Construction Sector¶
Purpose: The ConstructionSector is the primary engine of growth for the lunar base. It manages the entire construction pipeline, from producing basic structural components to assembling complex, functional modules. It acts as a “make-to-order” factory, responding to construction_request events from other sectors to expand their capabilities.
Core Components:
PrintingRobot: An autonomous agent that consumes raw regolith and power to 3D print structural “shells,” the basic building blocks for all modules.AssemblyRobot: A more advanced agent that takes a pre-printed shell and combines it with a specific piece of equipment (e.g., a science instrument, a life support unit) to create a final, operational module.ConstructionRequest: A data object that represents a single construction project, tracking its requirements (shells, equipment), its status (queued, in-progress), and the robot assigned to it.Module-to-equipment mapping: Shared construction equipment requirements are defined centrally in
world_system_defs.pythroughMODULE_TO_EQUIPMENT_MAP.
Operational Cycle & Key Algorithms¶
The sector operates a two-stage production line: first producing shells into a local inventory, then using those shells to fulfill construction orders.
flowchart TD
RequestingSector["Requesting Sector"] -->|construction_request| Intake["Construction Intake"]
Intake --> Queue["Construction Queue"]
Regolith["Regolith Supply"] --> Printing["Shell Production<br/>Printing Robots"]
Printing --> ShellStock["Shell Stock<br/>limited by shell_storage_capacity"]
Queue --> Planning["Project Planning<br/>limited by max_concurrent_projects"]
Planning --> ResourceGate{"Shells and equipment<br/>available?"}
ResourceGate -->|Missing equipment| EquipmentRequest["Equipment Request"]
EquipmentRequest -->|equipment_request| EquipmentManufacturing["Equipment Manufacturing Sector"]
EquipmentManufacturing -->|equipment_allocated| EquipmentStock["Construction Equipment Stock"]
ShellStock --> ResourceGate
EquipmentStock --> ResourceGate
ResourceGate -->|Ready| Assembly["Module Assembly<br/>Assembly Robots"]
Assembly --> CompletedModule["Completed Module"]
CompletedModule -->|module_completed| RequestingSector
Assembly --> Metrics["Construction Metrics<br/>queue, shells, robots, completions"]
Printing --> Metrics
A. Shell Production (_manage_printing_operations)
The sector employs a “make-to-stock” strategy for shells.
Proactive Printing: Idle
PrintingRobots automatically start printing a new shell whenever the sector’s shell count (_state.shells) is below the configuredshell_storage_capacity.Resource Consumption: Each completed shell consumes a fixed amount of regolith (
regolith_usage_kg) and takes a fixed number of simulation steps (processing_time_steps, derived from the configuredprocessing_time_hand the model’stime_scale).Power Gating: Robots are stepped in fleet order, each drawing from whatever power remains after earlier robots in the same step. A robot whose demand exceeds the power left over is
throttledfor that step (counted inrobots_throttled_this_step) and makes no progress; it is not a partial/scaled-down step.
B. Request Intake (handle_construction_request)
Another sector publishes a
construction_requestfor a new module (e.g., a new science rover for theScienceSector), naming amodule_idand the number of shells needed.The equipment the module requires is looked up via
get_equipment_type_for_module(backed byMODULE_TO_EQUIPMENT_MAP); modules with no mapped equipment type need none.The
ConstructionSectorcreates aConstructionRequestand appends it toconstruction_queuein aQUEUEDstate.
C. Resource Check & Acquisition (_start_construction_project)
For a
QUEUEDrequest, the sector checks resources in this order:Equipment: Does it have the required specialized equipment (e.g.,
Science_Rover_EQ) in its localequipment_stock?Shells: Are there enough shells in local storage?
If equipment is missing: the sector publishes a one-time
equipment_requestto the equipment manufacturing sector (guarded by the request’sequipment_requestedflag so it isn’t re-sent every step) and the request staysQUEUED.If only shells are missing: the request stays
QUEUEDand the sector simply waits forPrintingRobots to produce more; no event is published.If all resources are available: both are deducted from inventory and the project proceeds to assembly.
D. Assembly (_start_construction_project & _advance_construction_project)
An idle
AssemblyRobotis assigned to the request, which transitions toIN_PROGRESS; the robot works for a fixed number of steps (assembly_time_steps, derived from the configuredassembly_time_h)._process_construction_queueadvances allIN_PROGRESSrequests before starting new ones, and only starts as many new projects asmax_concurrent_projectsallows and idle assembly robots permit.Assembly robots are power-gated the same way as printing robots: a request’s assigned robot is throttled (no progress that step) if the remaining power after earlier robots can’t cover its demand.
If an assigned robot fails to start (
start_assemblyreturnsFalse), the reserved shells and equipment are returned to inventory and the request staysQUEUED.
E. Completion (_advance_construction_project)
Once the assembly timer reaches zero, the robot returns to
IDLEand is unassigned from the request.The request is marked
COMPLETED(and removed fromconstruction_queueon the next pass through_process_construction_queue).The sector publishes a
module_completedevent carryingrequesting_sphereandmodule_id, signaling to the original requesting sector that its new module is ready.
Configuration Options¶
The sector’s capabilities are defined in the world_system JSON file, specifying the number of robots and their operational parameters. Each robot entry’s tunables live under a nested config object; unset fields fall back to defaults in PrintingRobot/AssemblyRobot (e.g. max_power_usage_kWh: 65/50, processing_time_h: 80, assembly_time_h: 60, regolith_usage_kg: 200, efficiency: 0.9).
"construction": {
"sector_name": "construction",
"max_concurrent_projects": 3,
"shell_storage_capacity": 10,
"printing_robots": [
{
"quantity": 2,
"config": {
"max_power_usage_kWh": 65,
"processing_time_h": 80,
"regolith_usage_kg": 200
}
}
],
"assembly_robots": [
{
"quantity": 2,
"config": {
"max_power_usage_kWh": 50,
"assembly_time_h": 60
}
}
]
}
TODO: Potential Improvements¶
[ ] Implement Dynamic Fleet Growth: The sector should listen for
module_completedevents forPrinting_Robot_EQandAssembly_Robot_EQto dynamically add new robots to its fleet as they are constructed, rather than only instantiating robots from the initialworld_systemconfig.