The industrial manufacturing giant Siemens is planning for the reality of supplying and maintaining energy for a civilization on the Red Planet.

SpaceX and Tesla CEO Elon Musk wants to put a million people on Mars in the next century. They’ll be ferried to the Red Planet on a fleet of spaceships that can each carry 100 or more people, and make their living in an environment bereft of oxygen and full of danger.

While you can’t breathe the air on Mars, with some creative thinking you could bring in many of the comforts of home. Mars has great potential for energy generation. While its atmosphere is dusty, the sun’s light reaches down to the surface, allowing for solar panels. And the wind that provides the driving force of erosion on Mars could be harnessed for wind farms.

The industrial manufacturing giant Siemens is trying to plan for this reality.

“Mars will be the ultimate microgrid,” the company says on its website. “With no centralized power sources, communities will one day rely on decentralized energy systems.”

Their first major test case: an indigenous reservation about 5.5 hours north of San Francisco. The Blue Lake Rancheria is home to the Aboriginal Wiyot, encompassing members of the Wiyot, Yurok, Tolowa, and Cherokee tribes. It’s a 91-acre area, with 53 members living among coastal mountains and large redwood trees.

While the area is rich in natural resources — unlike Mars — the Wiyot have endured regular interruptions with the Pacific Gas & Electric power grid in recent years. That’s where Siemens stepped in.

“They got the idea that they wanted to do something about it, and their No. 1 objective was improve reliability, and… to reduce the carbon footprint,” said Clark Wiedetz, director of microgrid and renewable integration at Siemens Energy Management.

The result is a microgrid, completed in April, that is expected to save the community more than $200,000 a year. It includes a 500-kilowatt array of solar panels that were designed and built by REC Solar, a Tesla battery storage system, and contributions from other partners. Siemens maintains the microgrid through a computer-operated management system that decides where best to allocate power resources.

“They have the ability to replace what power they take from the grid, when that makes sense or when it’s down,” Wiedetz said.

The Siemens system makes decisions about where to put the power, basing its analysis on historical data. If a storm were to knock out the power, for example, the microgrid would predict how much power is needed for the Red Cross shelter on site, and allocate resources accordingly.

“A colony on Mars may one day be powered by the types of on-site systems that are already hard at work on Earth,” the company says.

Though a similar system could be the answer to sustaining power on Mars, it’s hard to know right now what a Martian equivalent would need.

“We don’t know what variables to work in the equation,” Wiedetz explained. But he said the microgrid system does have some advantages. One big one is that it doesn’t rely on cloud computing, which would likely not be in place on Mars. The Wiyot residents can also take on maintenance themselves, with remote assistance — just as astronauts would be expected to do so in deep space.

The microgrid system is adapted from previous software used for utility companies for energy management. It’s a new use for the 20-year-old technology, and Wiedetz said Siemens is looking at other ways to implement it, but they’re not yet ready to reveal where they plan to do so.

Tesla, which has positioned itself as a major player in battery development, has worked on other microgrids before. In 2016, the company announced that it and its subsidiary SolarCity helped the entire island of Ta’u in American Samoa. Thanks to a newly installed microgrid with solar panels and Tesla batteries, the island (which used to burn 100,000 gallons of fuel a year) could have full power for three days — even when it’s cloudy.