# Energy and matter accounting Locked: explicit biological costs and conservation. Ledger structure is recommended; coefficients/solvers are experiments, not claims of biochemical accuracy. M0 particles do not implement this model. | Quantity | Convention | |---|---| | Usable/source/work/heat energy | J inventories; W reported rates; explicit fixed-point quantum if adopted | | Material | kg or scaled mass; validated element composition | | Elements/nutrients | kg of specified element; mol requires explicit identity and conversion | | Temperature | K; intensive state, not conserved inventory | | Population | Nonnegative integer individuals or separately typed expected count | Material and its element composition are two views of the same matter, not additive inventories. Conserve an explicit 'other' component if the chemical basis is simplified. Reserve and structural chemical energy must not double count ingestible energy. Work may immediately become heat in a simplified model; it then cannot also remain available as mechanical energy. For each closed accounting interval: `E_end = E_start + external_input - exported_energy - unmodeled_heat_loss`. If heat is modeled, include its reservoir in E_end instead of that loss term. For every element k: `M_end[k] = M_start[k] + imported[k] - exported[k]`. Totals include environment, organisms, eggs/spores/cohorts, corpses, transfer escrow and suspended organisms. Death/reproduction/conversion are transfers. Atmospheric release is a transfer when atmosphere is modeled, otherwise an explicit boundary export. Light/geothermal flux is finite per area/interval; chemosynthesis consumes finite potential or recorded geological replenishment. `reserve_next = reserve + assimilation + capture - maintenance - locomotion - construction - reproduction - exported_reserve`. Every term has a counterpart. Unmet costs trigger the defined starvation policy, never a negative reserve or implicit loan. Overflow/excess follows named outputs. ```mermaid sequenceDiagram participant B as Biology participant L as Tick ledger participant R as Inventory owners B->>L: Propose(action ID, debits, credits, costs) L->>L: Validate dimensions, composition, bounds and phase L->>R: Reserve balances in stable order alt Sufficient resources L->>R: Commit balanced transfer exactly once L-->>B: Outcome and phenotype/lifecycle changes else Insufficient or stale L-->>B: Reject or explicitly quantified partial consumption end ``` The ledger is an in-process deterministic buffer, not a remote service or database write per transfer. Initial canonical entity/action allocation order introduces priority bias: measure against fair-share alternatives before tuning. Randomized fairness requires a purpose-specific recorded stream. Costs and outputs commit together; retries cannot double-spend. Partial ingestion is a declared quantity, not partially published offspring. Checked integer arithmetic carries division residuals. Floating-point solvers require finite checks, fixed reduction order and declared absolute/relative error budgets. Never conceal failed conservation by clamping balances. A density field is a view of owned finite inventory; consumers contend for that inventory. | Process | Debit → credit / limitation | |---|---| | Capture | finite flux + substrate → reserve/production + loss; area/efficiency bound | | Feeding | prey/resource matter + reserve → assimilation + waste + heat; ingestion bound | | Maintenance/movement | reserve → work/heat; phenotype demand and fixed interval | | Growth | material + reserve → structure + heat; developmental plan | | Reproduction | funded parent/environment inventory → offspring investment + heat | | Death | live compartments → corpse/detritus exactly once | | Decomposition | detritus + reactants → nutrients/chemical outputs/heat; rate/reactant bound | M2 uses explicitly synthetic founder fixtures, not unrelated wildlife in a persistent world. A simplified decomposition basis must balance completely; scalar biomass-to-nutrients is not full elemental chemistry. Expose source inputs, inventory/sink totals, unmet maintenance, failed transfers and per-element residuals. Distinguish cumulative quantities/rates; IDs are not metric labels. Tests: closed-box conservation, finite-source exhaustion, predation with waste, starvation nonnegativity, reproduction rollback, exactly-once death/decomposition, competing consumers, long-run rounding, overflow/NaN rejection, cross-tier escrow and independently recomputed seeded totals. Baseline metabolism, efficiencies, light attenuation, stoichiometry, heat fidelity and starvation rules remain open. Conservation alone does not guarantee a stable or enjoyable ecosystem.