Science Sector¶
Purpose: The ScienceSector orchestrates all scientific research activities within the simulation. Its primary function is to manage a fleet of ScienceRover agents to generate a cumulative science score, which can unlock new technologies or fulfill mission objectives. It also runs a receding-horizon growth policy that orders new rovers from the manufacturing/logistics pipeline to keep pace with a target science growth rate.
Core Components:
ScienceRover: The primary agent within the sector. Each rover is an independent entity with its own battery (battery_capacity_kWh,current_battery_kWh), power consumption rate (power_usage_kWh_per_step), and science generation rate (science_generation). Its behavior is governed by its internal state, primarily its battery level, and itsstatus(IDLE,OPERATIONAL,CHARGING,LOW_BATTERY,THROTTLED).ScienceSectorConfig: Scalar configuration and runtime counters for the sector, including growth-policy parameters (growth_duration_sp,lead_time_L,planning_horizon_H,safety_margin_beta,max_pipeline_capacity,expected_losses) and tracked state (current_growth_rate,S_0,rovers_in_pipeline,total_rovers,operational_rovers,p_eff).
Operational Cycle & Key Algorithms¶
A. Throttling (step)
A system-wide throttle_factor is applied before any power math. For each rover, a random draw against throttle_factor decides whether it is marked THROTTLED and excluded from this step’s power allocation and operation entirely. This is a key mechanism for policies (like the Dust Coverage Policy) to influence the sector’s activity level via set_throttle_factor. Deciding throttling first, and filtering throttled rovers out before any power distribution, ensures a throttled rover never ties up a power share it won’t use.
B. Fair-Share Power Distribution (_fair_share)
Only un-throttled rovers that actually need to charge (current_battery_kWh < power_usage_kWh_per_step) are considered demanders; each rover’s demand is the energy needed to reach full capacity (battery_capacity_kWh - current_battery_kWh). _fair_share performs a max-min fair split across just those rovers: available power is divided evenly among all current demanders, any rover whose remaining demand is covered by that even share is fully satisfied and removed, and its unused share is rolled back into the pool and re-split among the rovers still waiting, repeating until all demand is met or power runs out. A rover with a full battery is excluded from the split up front, so its unused share is never withheld from rovers that need to charge.
C. Rover Operation (ScienceRover.step)
Each un-throttled rover then executes its own step logic with the power allocated to it:
If it has enough battery, it operates, consuming
power_usage_kWh_per_stepand generatingscience_generationscience, and its status becomesOPERATIONAL.If it lacks power to operate, it attempts to charge from its allocation, becoming
CHARGING(orLOW_BATTERYif still under the operating threshold afterward).
D. Metric & Growth Aggregation (step)
The sector aggregates step_science_generated and total power consumed by all rovers during the step, adds the science to total_science_cumulative, appends (step, step_science_generated) to science_history, and recalculates the current growth rate.
E. Growth-Rate Measurement (_calculate_growth_rate)
Using a sliding window of the last growth_duration_sp entries in science_history, the sector fits the observed science-production rate to an exponential model S(t) = S_0 * 2^(r*t) and solves for r = log2(S_current / S_0) / t_elapsed, updating current_growth_rate and S_0 (the production rate at the start of the window). Degenerate cases (fewer than two history samples, non-positive rates, or zero elapsed time) fall back to current_growth_rate = 0.0.
F. Receding-Horizon Growth Algorithm (_apply_growth_algorithm, triggered by control_science_growth_rate)
Algorithm from science_policies.md:
Calculate effective productivity
p_eff = p * a * u, wherea(availability_factor_a) is the fraction of rovers currentlyOPERATIONALandu(utilization_factor_u) is1 - throttle_factor.Compute the future target science rate at the planning horizon,
S_target(t+H), fromS_0and the configuredgrowth_rate_sp.Determine required rovers
R_req = ceil(S_target / p_eff).Forecast available rovers
R_fore = total_rovers - expected_losses + rovers_in_pipeline.Compute the order quantity
q(t) = max(0, ceil((1+safety_margin_beta) * R_req) - R_fore).Cap the order at the remaining pipeline capacity (
max_pipeline_capacity - rovers_in_pipeline), logging a warning if the request is capped.If the capped order is non-zero, increment
rovers_in_pipelineand publish oneCONSTRUCTION_REQUESTevent per ordered rover (module_id="comp_science_rover") so each unit is tracked individually through the pipeline.
G. Fleet Growth (handle_module_completed, _create_rover)
The sector subscribes to module_completed events on the event bus. When a comp_science_rover module completes for this sector, _create_rover instantiates a new ScienceRover and decrements rovers_in_pipeline (if positive). Each new rover’s unique_id is derived from len(self.science_rovers) (the fleet size before the new rover is appended), which stays unique even when rovers are created outside the normal increment path (see state restoration below), since it depends on the actual list length rather than a counter that _apply_latest_state may not advance.
H. State Restoration (_apply_latest_state)
On construction, if a latest_state snapshot is supplied, the sector restores its counters (total_science_cumulative, total_rovers, operational_rovers, rovers_in_pipeline, current_growth_rate, S_0, p_eff) and, if the saved total_rovers exceeds the number of agents actually spawned, tops up the fleet by calling _create_rover(..., increment_total=False) for each missing rover so the restored count isn’t double-applied.
Interaction with the World System:
Metric Contribution: The sector reports its contributions via
get_metrics, includingIND-DUST-COV: the number of operational rovers contributes to overall dust coverage, simulating the environmental impact of their activity (_create_metric_map, driven by each rover config’smetric_contributions).Policy Interface:
set_throttle_factoris a direct interface for thePolicyEngineto raise or lower the sector’s operational tempo.Dynamic Growth: The sector listens for
module_completedevents, allowing it to dynamically add new rovers as they are constructed, and itself drives that construction by publishingCONSTRUCTION_REQUESTevents via the growth algorithm.
Equations¶
Science Metric as Technology Unlock Driver:
Unlock condition:
Explanation:
\(S_t\): cumulative science score.
\(\eta_{\mathrm{SCI}}\): science efficiency per rover-hour/mission.
\(r_{\mathrm{SCI}}(t)\): science rate at time (t).
\(\delta_{\mathrm{SCI}}\): knowledge decay rate.
Crossing \(S_{\mathrm{fusion}}\) unlocks helium-3 fusion tech.
Growth-Rate Fit:
Receding-Horizon Rover Ordering:
Configuration Options¶
The sector is configured in the world_system JSON file, defining its rover fleet and growth-policy parameters.
"science": {
"sector_name": "science",
"growth_duration_sp": 6,
"lead_time_L": 2,
"planning_horizon_H": 60,
"safety_margin_beta": 0.1,
"max_pipeline_capacity": 10,
"expected_losses": 0,
"science_rovers": [
{
"quantity": 4,
"config": {
"power_usage_kWh": 0.2,
"science_generation": 0.5,
"battery_capacity_kWh": 20
},
"metric_contributions": [
{
"metric_id": "IND-DUST-COV",
"contribution_type": "predefined",
"contribution_value": 0.01
}
]
}
]
}
TODO: Potential Improvements¶
[ ] Losses Modeling:
expected_lossesis currently a static config value; it is never updated to reflect actual rover attrition over time.[ ] Per-Rover Capability: Unlike the manufacturing sector’s per-robot
isru_modes, all science rovers are treated as interchangeable; there is no mechanism for specialized rover types or capability matching.