This vignette provides a high-level overview of all GLEAM modules, the sequence of their functions, and their input and output datasets. An overview of the full pipeline is provided in the GLEAM Overview. Full documentation for each module is available via the module reference pages linked in each section below.
See run_demographic_herd_module()
for full documentation.
This module takes herd- and cohort-level demographic inputs and estimates a steady-state sex–age herd structure compatible with downstream calculations in GLEAM. In addition to cohort population sizes, it derives population growth rates and offtake numbers. The steady state is defined as a constant sex–age cohort structure over time, with population size potentially growing or declining at a constant rate.
The module operates under a steady-state assumption: demographic parameters are constant over time, so the population converges to a stable cohort composition and a constant annual growth rate. Once this regime is reached, the model computes cohort population sizes (start/end/average), cohort shares, and offtake totals.
A key feature of this implementation is that it applies demography at a daily resolution. Annual mortality and offtake inputs are converted into daily hazards and daily transition probabilities under competing risks (death vs. offtake vs. survival). Conceptually, this corresponds to the steady-state demographic approach implemented in Dynmod STEADY1 (Lesnoff, 2013), adapted here to a daily time-step formulation.
The population is divided by sex (female/male) and age class
(juvenile/subadult/adult), represented by six cohorts: FJ,
FS, FA (female juvenile, subadult, adult) and
MJ, MS, MA (male juvenile,
subadult, adult).
See run_weights_module()
for full documentation.
Computes cohort-level live weight metrics by combining cohort-level inputs with herd-level biological parameters. The module appends cohort weights (initial, potential final, slaughter), then derives average and final live weights accounting for offtake, and finally computes average daily live weight gain over each cohort stage.
The calculation pipeline consists of the following steps:
herd_id and weights are assigned per life stage using calc_cohort_weights().calc_avg_weights().calc_daily_weight_gain().See run_ration_quality_module()
for full documentation.
Computes cohort-level diet nutritional metrics — gross and metabolizable energy content, digestibility, nitrogen content, urinary energy losses, and ash content — from cohort-level feed ration composition shares and feed component nutrient parameters.
The module joins ration shares with feed parameters by
feed_id, uses species_short for
species-specific lookups, and computes ration-weighted nutritional
metrics by cohort through the following steps:
calc_feed_digestibility_fraction().calc_ration_gross_energy()calc_ration_nitrogen_content()calc_ration_digestibility()calc_ration_metabolizable_energy()calc_ration_urinary_energy_fraction()calc_ration_ash()calc_ration_intake().See run_metabolic_energy_req_module()
for full documentation.
Computes cohort-level daily energy requirements (MJ/head/day) and feed dry matter intake (kg DM/head/day) by applying the IPCC Tier 2 energy partitioning functions.
Energy requirements are expressed as net energy (NE) for CTL, BFL, SHP, and GTS, and as metabolizable energy (ME) for CML, PGS, and CHK. The module computes the following energy partitions:
calc_metabolic_energy_req_maintenance()calc_metabolic_energy_req_activity()calc_metabolic_energy_req_growth()calc_metabolic_energy_req_lactation()calc_metabolic_energy_req_pregnancy()calc_metabolic_energy_req_work()calc_metabolic_energy_req_fibre()Total energy requirements are then aggregated using calc_total_metabolic_energy_req(),
and dry matter intake is derived using calc_ration_intake()
by dividing the total energy requirement by the diet energy density.
See run_emissions_enteric_module()
for full documentation.
The calculation pipeline consists of the following steps:
ch4_mitigation_factor is not provided in the input
data, it is set to 1 (no mitigation).calc_conversion_factor_ym().calc_ch4_enteric().See run_nitrogen_balance_module()
for full documentation.
Computes cohort-level daily nitrogen intake, retention, and excretion (kg N/head/day) following the IPCC Tier 2 approach.
The following calculation sequence is applied:
ration_intake
and ration_nitrogen using calc_nitrogen_intake().calc_nitrogen_retention().calc_nitrogen_excretion().See run_emissions_manure_module()
for full documentation.
Computes cohort-level greenhouse gas emissions from manure management systems (MMS) following the IPCC Tier 2 methodology, using volatile solids (VS), MMS allocation fractions, and MMS-specific emission factors.
For each herd_id, the set of MMS identifiers must be
consistent between the manure_management_system_fraction
and manure_management_system_factors tables. The following
calculation sequence is applied:
[`calc_volatile_solids()`](../reference/calc_volatile_solids.html)
(IPCC 2006/2019, Eq. 10.24).
calc_ch4_manure()
(IPCC 2006/2019, Eq. 10.23).calc_n2o_manure_direct()
(IPCC 2006/2019, Eq. 10.25).calc_n2o_manure_volatilization()
(IPCC 2006/2019, Eq. 10.26–10.28).calc_n2o_manure_leaching()
(IPCC 2006/2019, Eq. 10.27–10.29).calc_n2o_manure_total().See run_emissions_ration_module()
for full documentation.
Computes cohort-level average greenhouse gas emission factors from feed production by weighting the emission factors of individual feed components by diet composition. Returns diet-level average GHG emission factors by gas and emission source for each cohort.
The module joins ration shares with feed emission factors by
feed_id and applies the following calculation sequence:
feed_ration_fraction) by the corresponding
emission factor:
calc_co2_ration_fertilizer()calc_co2_ration_pesticides()calc_co2_ration_crop_activities()calc_co2_ration_luc_nopeat()calc_co2_ration_luc_peat()calc_n2o_ration_fertilizer()calc_n2o_ration_manure()calc_n2o_ration_crop_residues()calc_ch4_ration_rice()See run_production_module()
for full documentation.
Computes cohort-level production outputs over the assessment period by combining cohort-level herd structure inputs with herd-level production parameters. The module returns milk, fibre, and meat outputs for each cohort.
The following calculation sequence is applied:
calc_milk_production().calc_fibre_production().calc_meat_production().See run_allocation_module()
for full documentation.
The pipeline consists of the following steps:
calc_meat_allocation_energy()calc_milk_allocation_energy()calc_fibre_allocation_energy()calc_work_allocation_energy()calc_cohort_to_herd_aggregation().calc_allocation_shares().assign_allocation_shares().See run_aggregation_module()
for full documentation.
This is the final step of the GLEAM pipeline. It generates final herd-level results by aggregating key cohort-level outputs, scaling variables over the assessment duration, allocating emissions to commodities, and converting CH₄ and N₂O emissions to CO₂-equivalents (CO₂eq) using selected 100-year Global Warming Potential (GWP-100) factors.
The following calculation sequence is applied:
"Feed",
"NitrogenBalance", "Production", and
"Emissions".calc_cohort_totals().
Production variables are retained as provided; emissions, feed, and
nitrogen balance variables are scaled using cohort stock size and
simulation duration.calc_cohort_to_herd_aggregation().calc_allocated_emissions().calc_co2eq() and
the selected GWP-100 option (AR4, AR5, or AR6).