Skip to content

Latest commit

 

History

1,614 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

♡ MarsHSim ♡

MarsHSim Banner

major subsystem rewrite in progress

I'm building a Mars habitat simulation where a closed system keeps a crew of 30 alive with no resupply, one subsystem at a time.

♡♡♡

MarsHSim models a self-sustaining Environmental Control and Life Support System (ECLSS) for a crew of 30 inside a closed 2400 m³ habitat on Mars in Arcadia Planitia (47° North, 184° East)

♡ The focus is on reliability, realistic subsystem behavior, reusability, and future machine learning integration.

Overview:

MarsHSim simulates a habitat in Arcadia Planitia running on Mars time (sols and LMST).

The system updates continuously using a timestep based simulation, modeling how a closed life support system maintains stability over time.

Notice: MarsHSim is currently undergoing a major subsystem rewrite. The simulator runs, but some systems are still being reconnected and calibrated, so certain outputs and alerts may not yet reflect the intended behavior.

♡♡♡

My goal is to build something that feels real, structured, autonomous and potentially slightly interactive on a UI I designed.

Dashboard

MarsHSim includes an early browser-based monitoring dashboard.

The current dashboard is a visual prototype designed to display the simulator's state in a more immersive way than the terminal output. It reads simulation data exported to JSON and shows the important habitat systems and information.

Note: dashboard development is currently on hold while I focus on the major subsystem rewrite.

Systems:

Atmospheric gases:

♡ oxygen (O₂)

♡ carbon dioxide (CO₂)

♡ nitrogen (N₂)

♡ argon (Ar)

Core life support:

♡ amine swing beds

♡ oxygen generation assembly (OGA)

♡ water electrolysis

♡ Sabatier reaction system

♡ major constituent analyzer (MCA)

♡ buffer gas management

Environmental systems:

♡ habitat temperature control

♡ radiator cooling

♡ heater systems

♡ humidity control

♡ day/night thermal behavior

♡ Mars solar cycles

Resource systems:

♡ power generation and battery storage

♡ water storage and recovery

♡ hydrogen byproduct storage

♡ atmospheric pressure stabilization

♡ hydroponic greenhouse

♡ water In-Situ Resource Utilization (ISRU)

♡ deployable subsurface extraction systems

♡ atmospheric intake and compression

♡ sorbent bed gas separation

♡ atmospheric gas storage

Crew and Habitat:

♡ crew metabolism

♡ oxygen consumption & CO₂ production

♡ crew heat generation

♡ day and night behavior

Planned Features:

♡ environmental monitoring

♡ emergency scenarios

♡ pressure leaks

♡ crew illness

♡ plant disease

♡ dust storms

♡ extreme temperature shifts

♡ interactive monitoring and control interface

Current Focus:

♡ reconnecting and testing subsystem interactions during the current rewrite

♡ refining system balancing, constants, and resource flow

♡ improving terminal output

♡ expanding closed loop habitat resource management

♡ laying groundwork for future AI habitat oversight

This project is in active development.

Project Structure:

♡ docs /

- dev_log.md = active development log and my thought process

- todo.md = planned systems, ideas, fixes and future tasks

- v1_scope.md = project info and notes

- v1_state_variables.md = reference of all tracked variables

♡ docs / notes - atmosphere.md = future atmosphere design notes

- hab_water.md = overall habitat water design notes

- isru.md = future ISRU atmosphere and water notes

- layout.md = future habitat structure and layout notes

- lights.md = habitat lighting design notes

- power.md = habitat power system design and simulation notes

- sabatier.md = sabatier design notes

- solar_field.md = solar field design, operation and power generation notes

- template.md = my own template I'm using for note structure

- water_process.md = UPA, BPA and WPA design notes

♡ docs / notes / greenhouse /

- crops.md = crew nutrition targets and crop planning

- gases.md = greenhouse photosynthesis, respiration, CO₂/O₂ exchange rates and zone gas calculations

- hydroponics.md = greenhouse operation and management notes

- layout.md = Hive-8 Arcadia structure, dimensions, zones and physical layout

- lighting.md = greenhouse natural and artificial lighting plan

- power.md = greenhouse power requirements and energy planning

- water.md = greenhouse water use, recovery and hydroponic water planning

- zone_overview.md = raw zone values and overview (in progress)

♡ src /sim /

- alerts.py = simulation alerts and warning systems (very incomplete, not a main focus right now)

- buffer_gas.py = nitrogen and argon pressure balancing

- co2_scrub.py = amine swing bed CO₂ scrubbing

- crew.py = crew metabolism and environmental impact

- dust.py = dust accumulation and environmental dust effects

- engine.py = main simulation loop and subsystem coordination

- greenhouse.py = hydroponic greenhouse systems

- isru_atm.py = atmospheric intake, sorbent bed CO₂ capture, and N₂/Ar extraction

- isru_water.py = water ISRU extraction and raw water storage

- mars_time.py = Mars sols, LMST, and day/night cycles

- oxygen.py = oxygen generation assembly (OGA) and electrolysis

- power.py = solar, batteries, power distribution and power consumption

- print.py = terminal display and simulation output formatting

- run.py = simulation entry point and testing environment

- sabatier.py = CO₂ conversion and methane production systems

- state.py = habitat state and tracked simulation variables

- temp.py = habitat thermal control and heat modeling

- ui_export.py = writes the latest simulation state and subsystem outputs to the latest.json

- water.py = water storage, recovery, and usage tracking

♡ .gitignore = ignored files

♡ README.md = project overview

♡ requirements.txt = project dependencies

♡ ui /

- index.html = dashboard page structure

- dashboard.css = dashboard layout, panel styling, and visual design

- dashboard.js = loads simulation JSON data and updates dashboard panels

♡ ui / data /

- latest.json = most recent simulation state for the dashboard

- history.json = saved simulation history over time

Running the Simulation

My simulator includes a browser-based dashboard, but can also be run as a terminal based simulation.

1. Make sure Python is installed, then run:

py -m src.sim.run

-this will run the terminal based simulation-

2. Run:

python -m http.server 8000

3. Open dashboard:

Notice: MarsHSim is currently undergoing a major subsystem rewrite, so dashboard development is currently on hold.

Open a new tab in your browser and go to:

http://localhost:8000/ui/

The dashboard displays the latest simulation output from ui/data/latest.json.

-automatic dashboard refreshing is still being implemented-

Why this project:

I wanted to build something that feels real, and something I was genuinely interested in and excited about.

MarsHSim started as a way to explore how a closed life support system actually behaves over time, not just as isolated calculations but as a connected system where everything affects everything else.

Instead of solving problems individually, this project focuses on how systems interact, drift, stabilize, learn, and fail.

My long term goal is to move toward a simulation that can support autonomous decision making and eventually integrate machine learning for prediction and control, while keeping it structured, autonomous, and slightly interactive to make it more engaging.

For a more detailed breakdown of how this is being built step by step, see my raw development log that I update as I work on it:

docs/dev_log.md

-Adore2113 ♡

♡♡♡

About

I'm building a Mars habitat simulation where a closed system keeps a crew of 30 alive with no resupply.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages