Transportation Sector¶
Purpose: The TransportationSector is the logistics backbone of the simulation, managing the entire lifecycle of interplanetary transport. It orchestrates a fleet of reusable rockets, handles the production of rocket fuel from local resources (Helium-3), and processes transport requests to move equipment and materials between Earth and the Moon.
Core Components:
Rocket: A reusable agent capable of round-trip missions. Each rocket has a specific payload capacity and fuel efficiency. Its internal state machine manages its availability and mission progress (outbound flight, loading on the Moon, inbound flight).FuelGenerator: An agent that converts Helium-3 (He3_kg) into rocket propellant. The He-3 thermal energy determines propellant output; the generator’s grid demand is configured separately.TransportRequest: A data object representing a single logistics mission, detailing the payload, origin, destination, and requesting sector.
Operational Cycle & Key Algorithms¶
The sector’s operation is a continuous loop of fuel production, request processing, and mission management.
1. Fuel Production Pipeline The sector aims to be self-sufficient by producing its own fuel.
A. Proactive He-3 Request (
_request_resources_for_fuel): If the sector’s internal stock of rocket fuel and He-3 fall below configured minimums, it automatically publishes aresource_requestto the event bus to acquire more He-3. This ensures a steady supply of raw material for fuel generation.B. Fuel Generation (
_generate_fuel): In every step, the sector tasks itsFuelGenerators to convert available He-3 into rocket fuel, which is added to itsrocket_fuel_kgstock. Each generator’s output is gated by the grid power it’s actually allocated for the step (see Power-Gated Operation below).
1.1 Power-Gated Operation
FuelGenerators don’t get to consume power for free — like every other power-consuming sector, TransportationSector reports a power demand each step and only produces fuel with whatever power the EnergySector actually allocates back to it.
A. Demand Reporting (
get_power_demand): Before allocation, the sector walks its generators in order, giving each a share of the sector’s current He-3 stock (depleted sequentially as each generator’she3_kg_per_stepis subtracted) and summinggenerator.get_power_demand()for that share. A generator’s own demand is its configuredpower_demand_kWh_per_step, scaled down if the He-3 remaining for it is less than itshe3_kg_per_stepcapacity.B. Allocation:
WorldSystem.step()collects demand from every power-consuming sector, andEnergySector.allocate_power()returns each sector’s share for the step. This may be less than what was demanded if power is scarce.C. Throttled Generation (
_generate_fuel→FuelGenerator.step): The sector hands itsallocated_powerto its generators one at a time, in order, each drawing from whatever power remains:A generator’s usable power is
min(allocated_power_remaining, its own power_demand).If usable power is less than its demand, the generator is
is_throttledand scales down He-3 consumption and propellant output by the same fraction (power_fraction = usable_power / power_demand).If usable power is
0, the generator produces nothing this step (is_operational = False).Remaining power after each generator feeds into the next, so a shortfall only throttles generators once earlier ones have taken their share.
D. Metrics: The sector tracks
power_demand_step,power_consumed_step, andfuel_generators_throttled_this_stepeach step for visibility into how much of its demand was actually met.
flowchart LR
A["Report power demand<br/>(get_power_demand)"] --> B["EnergySector allocates power<br/>(allocate_power)"]
B --> C["Generators consume allocated power<br/>(_generate_fuel)"]
C --> D["Fuel produced, throttled if<br/>power fell short of demand"]
2. Launch Processing (_process_transport_queue)
The sector processes pending transport requests in a Last-In-First-Out (LIFO) order.
A. Find Available Rocket: It scans its fleet for a
Rocketthat is currentlyis_available.B. Pre-Launch Calculation (
_attempt_launch): For an available rocket and a pending request, it performs a critical check:It calculates the total propellant required for a round trip based on the payload mass. The request’s
payloadis treated as the trip’sreturn_payload_kg;outbound_payload_kgis currently always0(the sector does not yet model cargo carried on the outbound leg), so fuel is computed from whichever single leg actually carries the requested payload.It compares the required fuel against its current
rocket_fuel_kgstock.
C. Launch or Defer:
If fuel is sufficient: The rocket is launched. The required fuel is deducted from the sector’s stock, and the rocket’s
commit_round_tripmethod is called. The rocket becomes unavailable, and its internal mission timer begins.If fuel is insufficient: The launch is deferred. The request remains in the queue, and the sector will attempt to launch it again in a future step once more fuel has been generated.
3. Mission Progression (_step_all_rockets)
In every simulation step, the sector calls the step() method on every rocket in its fleet.
This advances the internal state machine of any rocket currently on a mission.
When a rocket arrives at its destination (either the Moon or Earth), it publishes a
payload_deliveredevent, notifying the relevant sector that its requested equipment or resources have arrived.Upon returning to its origin, the rocket’s mission is cleared, and it becomes
is_availablefor a new task.
Equations¶
Fuel Generation: The amount of propellant generated \(P_{\text{gen}}\) from a given amount of Helium-3 \(He3_{\text{proc}}\) is calculated as:
Where:
\(\text{GWh}_{\text{thermal}}\) is the thermal energy per kg of He-3.
\(\eta_{\text{efficiency}}\) is the generator’s conversion efficiency.
\(\text{kWh}_{\text{per\_kg\_prop}}\) is the energy needed to create 1 kg of propellant.
Fuel Generator Grid Demand:
The generator’s grid energy demand is not derived from He-3 thermal energy. A full generator step uses the configured power_demand_kWh_per_step; if less He-3 is available, demand scales with the fraction of the step that can run.
Usable Power & Throttling: Each generator draws from whatever power remains after earlier generators have taken their share. Its usable power is capped by both what’s left and its own demand:
The fraction of demand actually met determines how much the generator’s He-3 consumption and propellant output are scaled down:
A generator is is_throttled whenever \(f_{\text{power}} < 1\), and produces nothing (\(f_{\text{power}} = 0\)) when no power remains.
Rocket Fuel Calculation:
The propellant needed for a round trip \(P_{\text{total}}\) is the sum of the outbound and return legs.
In the current implementation, _attempt_launch always passes 0 for Payload_outbound_kg, so \(P_{\text{outbound}} = 0\) and \(P_{\text{total}} = P_{\text{return}}\) for every launch.
Configuration Options¶
The sector is configured in the world_system JSON file, defining its fleet, fuel generators, and operational parameters. If flight_distance is omitted, the sector uses the shared FLIGHT_DISTANCE_KM lookup table in world_system_defs.py.
"transportation": {
"sector_name": "transportation",
"flight_distance": 384400,
"loading_time_steps": 24,
"he3_request_threshold_kg": 1.0,
"minimum_fuel_k_sp": 5000,
"rockets": [
{
"template_id": "comp_rocket",
"quantity": 3,
"config": {
"prop_usage_kg_per_payload_kg": 21.4,
"carrying_capacity_equipment": 22800
},
"metric_contributions": [
{
"metric_id": "IND-DUST-COV",
"contribution_type": "predefined",
"contribution_value": 0.1
}
]
}
],
"fuel_generators": [
{
"template_id": "comp_fuel_gen_rocket",
"quantity": 1,
"config": {
"efficiency": 0.5,
"thermal_GWh_per_kg": 163.9,
"kwh_per_kg_prop": 22.8,
"power_demand_kWh_per_step": 65,
"he3_kg_per_hour": 5
}
}
]
}
TODO: Potential Improvements¶
[ ] Implement Queue Prioritization: The transport queue is processed Last-In-First-Out (LIFO). A more robust system would allow for request prioritization based on urgency or the importance of the payload.
[ ] Model Outbound Cargo:
_attempt_launchalways treatsoutbound_payload_kgas0; there’s no mechanism yet for a request to carry cargo on the Earth-to-Moon leg, only on whichever single legrequest.payloadapplies to.[ ] Add Dynamic Fleet Expansion: The sector should listen for
module_completedevents to dynamically add new rockets and fuel generators to its fleet as they are constructed.