![](https://spaceanddefense.io/wp-content/uploads/2022/03/shutterstock_334772396.jpg)
An Experiment on a Mars Rover Paves the Way for Human Visitors
By Lisa Harvey, Editor at Mathworks.
For the NASA Perseverance rover, setting down on Mars after a dramatic descent involved a heat shield, a parachute, and a rocket-powered “sky crane” that lowered the rover on cables to the surface. One of the rover’s primary missions is to search for signs of previous life on the red planet. It also has a less-known mission: to test machinery that could support human life there.
A journey to Mars would require a lot of oxygen—some of it for the astronauts to breathe, but the majority as a liquid to burn fuel for the return trip. For a crew of four, 25 metric tons (55,000 pounds) would be required. Sending that mass from Earth would cost billions of dollars and involve complicated logistics, so NASA plans on in situ resource utilisation—using what they find on-site. Mining ice from the poles to retrieve oxygen would be an arduous process. Instead, they hope to extract it from the atmosphere by separating oxygen atoms from carbon dioxide, which makes up 95% of the atmosphere.
Sitting in the belly of Perseverance is a gold-coated box about the size of a car battery: the Mars Oxygen In-Situ Resource Utilisation Experiment, or MOXIE. Apart from the acronym, this device, designed at MIT, takes its name from moxie, meaning a courageous spirit—a word derived from the carbonated drink Moxie, invented in Massachusetts. As a miniature version of what’s to come for a human mission, it will run at least 10 times, testing the limits of its capabilities. “We’re looking to expedite the path that will send humans to Mars,” says Dr. Michael Hecht, who heads the project at MIT. “We’re looking to make that happen sooner, and with less risk, and with less cost.”
The device contains two main parts: a gas compressor and the Solid OXide Electrolyzer (SOXE), which splits CO2 using heat and electricity. Surrounding these components are pipes, valves, filters, sensors, a power supply, and a small computer. An engineering model “twin” of MOXIE at the Jet Propulsion Laboratory (JPL) in California is used for testing before mission control sends commands to the distant MOXIE. Another twin exists solely in software, which Hecht’s MIT team runs before trying the commands on the engineering model.
“If we break something on Mars, you can’t send anybody to go fix it, and you’re done,” says Eric Hinterman, a doctoral student in the AeroAstro department, the lab of Jeffrey Hoffman, the project’s deputy lead and a former astronaut. Hinterman designed the software simulation. “So, we have a bunch of steps so that we’re pretty confident, and the computer model, the digital twin, is one of those key steps.”
DOUBLE-CHECKING
“MATLAB changed my professional life when it came out,” Hecht says. “It was like a pocket calculator, enabling you to worry about other things instead of calculating things and graphing them by hand.” In the 1980s, if he found an issue, he would stop by the MathWorks office in Natick, Massachusetts. Around 1990 he began writing MATLAB® components himself. MATLAB was a natural fit for the MOXIE project.
Piyush Khopkar, a software engineer at MathWorks who’s on the MOXIE technical staff and operations team, said the decision to use Simulink®, the graphical environment for modelling and simulation, was easy. Simulink connects to MATLAB, which includes a library of mathematical and application-specific functions so “you don’t need to reinvent the wheel.”
The MOXIE Simulink model was handed down to Hinterman from former students, but he stripped it and rewrote it. It models electrical circuits, chemistry, fluid dynamics, controls, and sensors. “I was forced to learn a lot about electrochemistry,” he says, “and that’s been kind of fun.”
He models three control loops. The first maintains a set temperature in SOXE, accounting for how much heat the device generates—electrolysis happens at about 800 degrees Celsius (1,470 degrees Fahrenheit)—and how much escapes. The second controls the electrical voltage to keep the current constant. The third determines internal pressure by adjusting how fast the compressor blades spin. The loops also need to model fault detection and shut down a run when things go awry.
The model is “pretty complex,” Hinterman says. Tracking down errors isn’t easy, although the software helps. “Sometimes it’s a nested issue that takes quite a bit of time to debug.” Further, JPL would sometimes swap out components, and he’d have to adjust his model. “So just keeping up with the progress on the physical MOXIE was probably one of the biggest challenges.”
When the simulation doesn’t line up with the engineering model, “it’s something different every time,” Hinterman says. “Like the temperature doesn’t perfectly align. And then I might find out that there was a crack in the insulation.”
In development, when the model didn’t match reality, Hinterman would talk to JPL or pore over the data and change the formulas or constants. Now that the model has proven itself on Earth, he has to worry about how the trip to Mars may have changed the real MOXIE. Launch and re-entry may have shaken things up, or the gravity difference, dust, and cold could cause unexpected changes. He says he’s prepared to add “Mars factors” to the model to mimic reality on the red planet.
“I’ve had quite a bit of experience building things, and they rarely turn out exactly how you design them,” says Hinterman. Comparing the simulation with the engineering model, “it surprised me how close the model has come to predicting what happens.”
MATLAB provides Simulink with data, including the sizes of pieces of hardware, atmospheric conditions, chemical constants, control system setpoints like the desired SOXE temperature, and safety limits. Simulink then sends simulation outputs—sensor readings—back to MATLAB for analysis. MATLAB also receives data from the real MOXIE on Mars. But the real and virtual MOXIEs don’t tell you something as simple as how much oxygen they produce or the ratio of carbon dioxide to carbon monoxide. Instead, MATLAB calculates those values from temperature, pressure, and voltage sensor data. It also estimates more theoretical values like MOXIE’s limits and danger points, Hecht says. “There’s a thousand different little things that need to be calculated.”
To help MOXIE operators run the simulation and interpret the data, Khopkar designed user interfaces (UIs). One has virtual sliders that control Martian parameters, such as atmospheric conditions, and MOXIE parameters, such as current and temperature. Another UI displays the data from either the simulation or the actual experiment on Mars. Khopkar built them with a MATLAB environment called App Designer. As part of the operations team, he also gets to use these UIs.
PERFECT LANDING
Soon after Perseverance landed on Mars, MOXIE conducted a health check. It will make at least 10 runs lasting about an hour each, once every couple of months. They will get progressively more challenging, operating in different atmospheric conditions and seasons and at various times of day, then attempting different modes and operating conditions.
On April 20, 2021, MOXIE made its first run. MOXIE successfully generated 6 grams of oxygen per hour, well on its way toward the goal of 10 grams an hour. “It’s been a pretty wild ride. We’re all giddy. Then it’s time to settle down to the hard work of answering emails and talking to the media, but I want to look at data,” said Hecht at the time. MOXIE uses a few pieces of well-known technology, but much of it is new territory. “It did not start with anywhere near the heritage that most things going to Mars have.”
“The results surprised us only in the sense of how perfect it is,” Hecht says. “Things aren’t supposed to work that perfectly. An instrument was produced on the ground with behaviour that met all the requirements applied to it, and it got all the way to Mars, and it made oxygen. And that’s the part where you just hold your breath.”
He continued, “When we ran it on Tuesday, it had been two years since we had run it last and made oxygen. When you take your bicycle out of the closet after two years, you expect to have to oil up the chain and unseize a couple of bearings and replace the tires because they’re probably old and cracked. We packaged MOXIE in the rover, turned it upside down, put it through thermal cycles, and launched it. It sat in a vacuum and cruised for months. We plunked it down on Mars, with violent explosions as things deployed. Then we waited. When we ran it under these very harsh circumstances, it was as if none of that had happened.”
BIGGER AND BETTER
The work is far from done. “In general, the lack of smartness of the control system is the biggest challenge,” Hecht says. He’d like to make it more autonomous, perhaps by uploading new software from Earth. That will require testing in simulation first.
Hinterman is working on MOXIE’s successor, which NASA would deploy before sending humans to Mars. It will spend 14 months generating tons of oxygen. In some ways, that machine will face bigger challenges, and in other ways, smaller ones. It needs to run longer and produce more oxygen, but it will operate at a lower altitude with a smarter computer, better filtering, better sensors, and self-cleaning capabilities.
Those are new elements Hinterman will need to simulate. One big difference: the future machine will liquefy, store, and transfer the oxygen it makes, rather than release it into the Martian atmosphere. “I spent the past two months specifically modelling the liquefaction system,” he says.
Hinterman is using MATLAB optimisation algorithms to help design the hardware layout. He can tell the software to minimise the mass, and it will try different pumps or compressors, or a suite of operating conditions. “The real value is that it can see how all these different variables interplay with each other,” he says. “So, if you choose a cryogenic pump instead of a mechanical pump, maybe a lower temperature is better. Maybe a higher temperature is better for some reason, and it can see all those interactions, whereas humans have a tough time doing that.”
For the moment, Hecht isn’t putting too much thought into the next project. “I’m focused on running this one right now.”