Type: Package
Title: Global Livestock Environmental Assessment Model (GLEAM-X)
Version: 0.8.0
Description: The official implementation of the Global Livestock Environmental Assessment Model (GLEAM) of the Food and Agriculture Organization of the United Nations (FAO) in R. GLEAM-X provides a modular, transparent framework for simulating livestock production systems and quantifying their environmental impacts. Methodological background: MacLeod et al. (2017) "Invited review: A position on the Global Livestock Environmental Assessment Model (GLEAM)" <doi:10.1017/S1751731117001847>. Further information: https://www.fao.org/gleam/en/.
License: AGPL-3
URL: https://github.com/un-fao/GLEAM/, https://www.fao.org/gleam/en/
BugReports: https://github.com/un-fao/GLEAM/issues
Encoding: UTF-8
RoxygenNote: 7.3.3
Imports: cli (≥ 3.0.0), data.table (≥ 1.16.0)
Suggests: knitr, rmarkdown, testthat (≥ 3.2.0)
VignetteBuilder: knitr
Config/testthat/edition: 3
Depends: R (≥ 4.4.0)
NeedsCompilation: no
Packaged: 2026-04-11 15:10:06 UTC; ahmed
Author: Ahmed Jou ORCID iD [aut, cre] (https://applitics.fr), Yassine Elaouni [aut] (https://applitics.fr), Dominik Wisser ORCID iD [aut] (GLEAM team lead, FAO), Lydia Lanzoni ORCID iD [aut] (Livestock and climate change specialist, FAO), Giuseppe Tempio ORCID iD [aut] (Livestock environmental impact analyst, FAO), Phyllis Ndungu' [ctb] (Livestock and climate change specialist, FAO), Yushan Li [ctb] (Livestock and sustainability specialist, FAO), Manling Xu [ctb] (Livestock data intern, FAO), Zixin Wang [ctb] (Livestock data intern, FAO), Narindra Rakotovao [ctb] (Livestock policy officer, FAO), Stewart Chikoloma [ctb] (Livestock data specialist, FAO), David OBrien ORCID iD [ctb] (https://applitics.fr), Food and Agriculture Organization of the United Nations FAO [cph] (Original GLEAM model framework), Federal Ministry of Agriculture, Food and Regional Identity of Germany BMELH [fnd] (Funding support)
Maintainer: Ahmed Jou <ahmed@applitics.fr>
Repository: CRAN
Date/Publication: 2026-04-16 18:30:08 UTC

gleam: Global Livestock Environmental Assessment Model (GLEAM-X)

Description

GLEAM-X is the official R implementation of FAO’s Global Livestock Environmental Assessment Model (GLEAM). The package provides a modular, transparent framework for simulating livestock production systems and quantifying their environmental impacts. Methodological background: MacLeod et al. (2017) "Invited review: A position on the Global Livestock Environmental Assessment Model (GLEAM)" doi:10.1017/S1751731117001847. Further information: https://www.fao.org/gleam/en/.

Author(s)

Maintainer: Ahmed Jou ahmed@applitics.fr (ORCID) (https://applitics.fr)

Authors:

Other contributors:

See Also

Useful links:


Assign allocation shares to emission variables by commodity

Description

Expands commodity-level allocation shares across emission sources and applies predefined allocation rules for excluded emission sources.

Usage

assign_allocation_shares(
  allocation_herd_long,
  emissions_vars,
  commodities,
  non_allocated_emission_sources,
  commodity_col,
  allocation_col
)

Arguments

allocation_herd_long

Long-format data.table containing herd-level emissions and allocation information. Each row represents an emission source–commodity combination or an unallocated emission source prior to allocation.

emissions_vars

Character. Names of emission variables to which allocation should be applied (e.g., "ch4_enteric","ch4_manure_pasture","ch4_manure_burned","ch4_manure_other", "n2o_manure_pasture_direct","n2o_manure_burned_direct","n2o_manure_other_direct", "n2o_manure_burned_indirect","n2o_manure_pasture_indirect","n2o_manure_other_indirect", "co2_ration_fertilizer", "co2_ration_pesticides", "co2_ration_crop_activities", "co2_ration_luc_nopeat", "co2_ration_luc_peat", "n2o_ration_fertilizer", "n2o_ration_manure_applied", "n2o_ration_crop_residues", "ch4_ration_rice").

commodities

Character. List of commodity categories to which emissions may be allocated. For example: c("None","Milk","Meat","Fibre","Work","Eggs").

non_allocated_emission_sources

Character. Emission variables that should not be allocated across commodities, even if they appear in emissions_vars (e.g., "ch4_manure_pasture", "ch4_manure_burned").

commodity_col

Character. Name of the column in allocation_herd_long identifying the commodity category.

allocation_col

Character. Name of the column in allocation_herd_long containing the allocation share to be applied.

Details

The function assigns commodity allocation shares to emission sources while also allowing for the implementation of specific allocation rules. Emission sources listed in non_allocated_emission_sources (e.g., emissions from manure burned as fuel or manure deposited on pasture) are treated as not attributable to livestock commodities under the chosen goal and scope. Consequently, these emissions are allocated entirely to the residual commodity category "None" and are not distributed across milk, meat, fibre, work, or egg outputs.

The following methodological rules apply to emission sources listed in non_allocated_emission_sources:

This function is part of the run_allocation_module().

Value

A data.table equal to allocation_herd_long expanded over all emissions_vars, with enforced allocation rules:

Non-allocated emission sources

allocation_col = 1 when commodity_col == "None", else 0.

Allocated emission sources

allocation_col = 0 when commodity_col == "None" (others unchanged).

References

IDF. (2022). The IDF Global Carbon Footprint Standard for the Dairy Sector. Bulletin of the IDF No. 520/2022. International Dairy Federation, Brussels.

FAO. (2016a). Environmental performance of large ruminant supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

FAO. (2016b). Greenhouse gas emissions and fossil energy use from small ruminant supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

FAO. (2016c). Greenhouse gas emissions and fossil energy use from poultry supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

See Also

run_allocation_module()


Calculate allocated greenhouse gas emissions (GHG)

Description

Calculates the greenhouse gas emissions (GHG) attributable to specific commodities by applying allocation shares to total herd-level emissions.

Usage

calc_allocated_emissions(value, allocation_share)

Arguments

value

Numeric. Total herd-level emissions by source before allocation to commodities (kg gas).

allocation_share

Numeric. Allocation share assigned to the commodity for the corresponding emission source (fraction).

Details

Allocation shares represent the fraction of total emissions assigned to each commodity (e.g., meat, milk, fibre). See run_allocation_module() for additional details.

Allocated emissions are calculated as:

value\_allocated = value \times allocation\_share

This function is part of the run_aggregation_module().

Value

Numeric. Allocated emissions for each commodity–emission combination (kg gas).

See Also

run_aggregation_module(), run_allocation_module()


Calculate allocation shares for livestock commodities

Description

Calculates biophysical allocation shares for commodities (meat, milk, fibre, work, eggs) based on their total energy requirements.

Usage

calc_allocation_shares(
  species_short,
  meat_allocation_energy,
  milk_allocation_energy,
  fibre_allocation_energy,
  work_allocation_energy,
  egg_allocation_energy
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

meat_allocation_energy

Numeric. Energy required by a given sex–age cohort for total meat output by cohort during the assessment period, equal to the energy needed to produce all live-weight gain to reach the target slaughter weight (MJ/cohort/assessment period).

milk_allocation_energy

Numeric. Energy required to produce total milk output by cohort (MJ/cohort/assessment period). Non-zero values are applicable only to milk-producing species and cohorts (species=CTL, BFL, CML, SHP, GTS; cohorts=FA). All other species–cohort combinations are assigned a value of 0.

fibre_allocation_energy

Numeric. Energy required to produce all fibre output by cohort (MJ/cohort/assessment period).

work_allocation_energy

Numeric vector. Energy required to provide all draught power (traction/work) by cohort (MJ/cohort/assessment period).

egg_allocation_energy

Numeric vector. Energy required to produce all eggs during the assessment period (MJ/cohort/assessment period).

Details

These fractions represent the proportions of total environmental burdens (e.g., GHG emissions) that will be allocated to each commodity in subsequent steps of the assessment.

This function is part of the run_allocation_module() of the Global Livestock Environmental Assessment Model (GLEAM), which incorporates a biophysical allocation approach, aligned with the IDF Global Carbon Footprint Standard for the Dairy Sector (IDF, 2022), and adapted from Thoma and Nemecek (2020), and is consistent with FAO LEAP livestock LCA guidelines (FAO, 2016a, 2016b, 2016c). This approach also aligns with ISO 14044:2006 (Section 4.3.4.2, Step 2) by using underlying physical (energy-based) relationships to assign shared inputs and outputs in multifunctional livestock production systems.

In accordance with ISO 14044:2006 (Section 4.3.4.2, Step 2), known processing or biophysical relationships may be used to assign shared inputs and outputs of a single production unit to individual products or sub-units. In livestock systems, this includes apportioning shared feed and energy use according to physiological energy requirements (e.g., net energy for lactation, growth..etc.). If the resulting process remains multifunctional, these energy terms may subsequently be used to derive allocation factors among co-products.

This function calculates biophysical allocation fractions for commodities (meat, milk, fibre, work, eggs) for all species. The allocation is based on commodity-specific energy requirements calculated using calc_meat_allocation_energy, calc_milk_allocation_energy, calc_fibre_allocation_energy, calc_work_allocation_energy, and calc_eggs_allocation_energy.

Pig species (PGS): allocation is not based on energy partitioning because pig production is treated as functionally single-output (edible meat). Consequently, 100% of the allocation is assigned to the meat commodity (meat share = 1; all other commodity shares = 0), independent of the energy inputs.

This function is part of the run_allocation_module().

Value

A named list of numeric vectors with same length as input, containing:

meat_share_allocation

Numeric. Allocation share assigned to meat (fraction).

milk_share_allocation

Numeric. Allocation share assigned to milk (fraction).

fibre_share_allocation

Numeric. Allocation share assigned to fibre (fraction).

work_share_allocation

Numeric. Allocation share assigned to work (fraction).

eggs_share_allocation

Numeric. Allocation share assigned to eggs (fraction).

References

ISO. (2006). Environmental management — Life cycle assessment — Requirements and guidelines (ISO 14044:2006). International Organization for Standardization, Geneva.

IDF. (2022). The IDF Global Carbon Footprint Standard for the Dairy Sector. Bulletin of the IDF No. 520/2022. International Dairy Federation, Brussels.

Thoma, G., and Nemecek, T. (2020). Allocation between milk and meat in dairy LCA: Critical discussion of the IDF’s standard methodology. In Proceedings of the 12th International Conference on Life Cycle Assessment of Food (LCAFood 2020) (pp. 83–89), 13–16 October, Berlin, Germany.

FAO. (2016a). Environmental performance of large ruminant supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

FAO. (2016b). Greenhouse gas emissions and fossil energy use from small ruminant supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

FAO. (2016c). Greenhouse gas emissions and fossil energy use from poultry supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

See Also

run_allocation_module, calc_meat_allocation_energy, calc_milk_allocation_energy, calc_fibre_allocation_energy, calc_work_allocation_energy, calc_eggs_allocation_energy


Calculate average and final live weights by cohort

Description

Calculates the average and final live weight for a given sex–age cohort based on initial weight, potential final weight, slaughter weight, and the offtake rate.

Usage

calc_avg_weights(
  live_weight_cohort_initial,
  live_weight_cohort_potential_final,
  live_weight_cohort_at_slaughter,
  offtake_rate
)

Arguments

live_weight_cohort_initial

Numeric. Live weight at the beginning of the cohort stage (kg).

live_weight_cohort_potential_final

Numeric. Potential final live weight attainable at the end of the cohort stage in the absence of offtake (kg). (For juveniles: equals weaning weight; For subadults: equals adult live weight; For adults: equals adult live weight)

live_weight_cohort_at_slaughter

Numeric. Live weight at slaughter for animals removed from the cohort (kg).

offtake_rate

Numeric. Annual proportion of animals removed from the herd for each sex-age cohort (fraction).

Details

The calculation of live_weight_cohort_average and live_weight_cohort_final is performed considering that a fraction of animals is removed (offtake) during the cohort stage, while the remaining animals reach the potential final live weight.

The final live weight is computed as:

live\_weight\_cohort_final = (1 - offtake\_rate) \times live\_weight\_cohort\_potential\_final + offtake\_rate \times live\_weight\_cohort\_at\_slaughter

The average live weight over the stage is approximated as:

live\_weight\_cohort\_average = (live\_weight\_cohort\_initial + live\_weight\_cohort\_final)/2

This function is part of the run_weights_module().

Value

A named list with:

live_weight_cohort_average

Numeric. Average live weight over the cohort stage. Computed by accounting for the share of offtaken animals within the cohort, using their slaughter weight, and the potential final weight of animals that remain in the cohort (kg).

live_weight_cohort_final

Numeric. Live weight at the end of the cohort stage, accounting for both surviving and offtaken animals. Computed as a weighted average of the potential final weight of surviving animals and the slaughter weight of offtaken animals, based on the offtake rate (kg).

See Also

run_weights_module


Calculate daily enteric methane emissions

Description

Calculates daily enteric methane emissions (kg CH4/head/day) based on gross energy intake, methane conversion factor (ym), and dry matter intake.

Usage

calc_ch4_enteric(
  species_short,
  ch4_conversion_factor_ym,
  ch4_mitigation_factor,
  ration_gross_energy,
  ration_intake
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

ch4_conversion_factor_ym

Numeric. Methane (CH4) conversion factor (ym), representing the percentage of gross energy of the feed ration that is converted to CH4 (percentage).

ch4_mitigation_factor

Numeric. Optional. Multiplicative mitigation factor applied to baseline enteric methane (CH4) emissions (dimensionless). If not provided, a default value of 1 (no mitigation) is used. Values lower than 1 represent proportional reductions (e.g., 0.90 = 10% reduction). This factor can represent mitigation measures with a direct effect on enteric methane emissions, such as the use of feed additives or methane inhibitors.

ration_gross_energy

Numeric. Average gross energy content of the diet (MJ/kg DM).

ration_intake

Numeric. Average daily dry matter intake of feed (kg DM/head/day).

Details

The formula used to estimate daily enteric methane emissions is:

CH_4 = \frac{ration\_gross\_energy \times ration\_intake \times ch4\_conversion\_factor\_ym}{55.65 \times 100}

where 55.65 MJ/kg is the energy content of methane.

ration_gross_energy and ration_intake can be calculated with calc_ration_gross_energy and calc_ration_intake ( see also run_ration_quality_module and run_metabolic_energy_req_module).

This function is part of the run_emissions_enteric_module().

Value

Numeric. Average daily enteric methane (CH4) emissions (kg CH4/head/day).

References

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories. Chapter 10: Emissions from Livestock and Manure Management, Equation 10.21.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories. Chapter 10: Emissions from Livestock and Manure Management, Equation 10.21.

See Also

run_emissions_enteric_module, calc_ration_gross_energy, calc_ration_intake, run_ration_quality_module run_metabolic_energy_req_module


Calculate methane (CH4) emissions from manure management systems

Description

Calculates daily methane emissions from manure management using IPCC-based parameters and separates emissions from manure deposited on pasture, manure burned for fuel, and all other manure management systems.

Usage

calc_ch4_manure(ratio_m3CH4_to_kgCH4 = 0.67, volatile_solids, ...)

Arguments

ratio_m3CH4_to_kgCH4

Numeric. Conversion factor used to convert methane (CH4) from volumetric unit (m3) to a mass unit (kg). This value represents the density of methane. It defaults to 0.67 kg/m3.

volatile_solids

Numeric. Total volatile solids (VS) excreted per animal per day, representing the organic material in livestock manure and consisting of both biodegradable and non-biodegradable fractions (kg VS/head/day).

...

A variable number of manure management system (MMS) arguments. Each MMS must be provided as a named numeric vector with exactly the following fields:

manure_management_system_fraction

Numeric. Fraction of total manure excreted by animals in a given herd and cohort that is handled in a specific manure management system. Values ranges from 0 to 1. The sum of all fractions for each herd_id must equal 1.

methane_conversion_factor_mcf

Numeric. Methane conversion factor represents the portion or degree of the maximum methane producing capacity (B_0) that is effectively achieved within a specific manure management system. It represents the extent to which the theoretical methane yield is realized based on management practices and environmental conditions, specifically the temperature of the system, the retention time of the organic material, and the degree of anaerobic conditions present. The value theoretically ranges from 0 to 100 percent. Default values can be selected from Table 10.17 of the IPCC guidelines (IPCC 2006, 2019).

ch4_max_producing_capacity_bo

Numeric. Maximum methane producing capacity (B_0) for all manure management systems (m3 CH4 / kg VS). The value is region- and species-specific, and represents the theoretical maximum methane yield per unit of volatile solids.. Default values may be selected from Table 10.16 (IPCC, 2019) or from Tables 10A-4 to 10A-9 (IPCC, 2006).

Two MMS names are treated explicitly when present:

mms_pasture

Manure deposited on pasture.

mms_burned

Manure burned for fuel.

All remaining MMS arguments are grouped and treated as other manure management systems.

Details

This calculation follows the structure of IPCC Equation 10.23 for methane (CH4) emission factors from manure management.

In the IPCC formulation, emissions are determined by combining:

Applying the IPCC conversion factor from m3 CH4 to kg CH4 (0.67), daily methane emissions are calculated as:

CH4 = volatile\_solids \times b0 \times 0.67 \times \sum \left( \frac{mcf}{100} \times manure\_management\_system\_fraction \right)

The summation is taken over all manure management systems included in the calculation. Results are expressed at daily resolution (kg CH4/head/day), consistent with Equation 10.23 after adapting the original annual formulation to a daily basis.

This function is part of the run_emissions_manure_module().

Value

A named list with the following elements:

ch4_manure_pasture

Numeric. Methane (CH4) emissions from manure deposited on pasture (kg CH4/head/day).

ch4_manure_burned

Numeric. Methane (CH4) emissions from manure burned for fuel (kg CH4/head/day).

ch4_manure_other

Numeric. Methane (CH4) emissions from manure management systems, excluding emissions from manure deposited on pasture and burned for fuel (kg CH4/head/day).

ch4_manure_all_noburn

Numeric. Methane (CH4) emissions from manure management systems, excluding manure burned for fuel (kg CH4/head/day).

References

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management. Equation 10.23.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management. Equation 10.23.

See Also

run_emissions_manure_module, calc_volatile_solids

run_emissions_manure_module, calc_volatile_solids

Examples

calc_ch4_manure(
  ratio_m3CH4_to_kgCH4 = 0.67,
  volatile_solids   = 2.024,
  mms_burned = c(
    manure_management_system_fraction = 0.020,
    methane_conversion_factor_mcf = 10,
    ch4_max_producing_capacity_bo = 0.13
  ),
  mms_drylot = c(
    manure_management_system_fraction = 0.264,
    methane_conversion_factor_mcf = 2,
    ch4_max_producing_capacity_bo = 0.13
  ),
  mms_pasture = c(
    manure_management_system_fraction = 0.310,
    methane_conversion_factor_mcf = 0.47,
    ch4_max_producing_capacity_bo = 0.19
  ),
  mms_solid = c(
    manure_management_system_fraction = 0.406,
    methane_conversion_factor_mcf = 5,
    ch4_max_producing_capacity_bo = 0.13
  )
)


Calculate a ration component's contribution to methane (CH4) emissions from rice cultivation

Description

Calculates the contribution of an individual feed component to methane (CH4) emissions from rice cultivation in feed production, using feed-specific emission factors weighted by the component's share in the ration.

Usage

calc_ch4_ration_rice(feed_ration_fraction, ch4_feed_rice)

Arguments

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration, expressed as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

ch4_feed_rice

Numeric. Methane (CH4) emission factor of a feed component, representing CH4 emissions from rice cultivation in feed production, expressed per kg of dry matter intake (g CH4/kg DM).

Details

The contribution is computed as:

diet\_ch4\_feed\_rice = feed\_ration\_fraction \times ch4\_feed\_rice

This function is part of the run_emissions_ration_module().

Value

Numeric. Contribution of an individual feed component to the diet-level average methane (CH4) emission factor from rice cultivation in feed production (g CH4/kg DM).

See Also

run_emissions_ration_module


Calculate a ration component's contribution to carbon dioxide (CO2) emissions from on-field agricultural activities

Description

Calculates the contribution of an individual feed component to carbon dioxide (CO2) emissions from on-field agricultural activities in feed production (e.g., energy use for tillage and machinery operations), using feed-specific emission factors weighted by the component's share in the ration.

Usage

calc_co2_ration_crop_activities(feed_ration_fraction, co2_feed_crop_activities)

Arguments

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration, expressed as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

co2_feed_crop_activities

Numeric. Carbon dioxide (CO2) emission factor of a feed component, representing CO2 emissions from on-field agricultural activities in feed production, expressed per kilogram of dry matter intake (kg CO2/kg DM).

Details

The contribution is computed as:

diet\_co2\_feed\_crop\_operations = feed\_ration\_fraction \times co2\_feed\_crop\_operations

This function is part of the run_emissions_ration_module().

Value

Numeric. Contribution of an individual feed component to the diet-level average carbon dioxide (CO2) emission factor from on-field agricultural activities in feed production (g CO2/kg DM).

See Also

run_emissions_ration_module


Calculate a ration component's contribution to carbon dioxide (CO2) emissions from fertilizer manufacture

Description

Calculates the contribution of an individual feed component to carbon dioxide (CO2) emissions from fertilizer manufacture in feed production, using feed-specific emission factors weighted by the component's share in the ration.

Usage

calc_co2_ration_fertilizer(feed_ration_fraction, co2_feed_fertilizer)

Arguments

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration,as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

co2_feed_fertilizer

Numeric. Carbon dioxide (CO2) emission factor of a feed component, representing CO2 emissions from fertilizer manufacture in feed production, expressed per kilogram of dry matter intake (g CO2/kg DM).

Details

The contribution is computed as:

diet\_co2\_feed\_fertilizer = feed\_ration\_fraction \times co2\_feed\_fertilizer

This function is part of the run_emissions_ration_module().

Value

Numeric. Contribution of an individual feed component to the diet-level average carbon dioxide (CO2) emission factor from fertilizer manufacture in feed production (g CO2/kg DM).

See Also

run_emissions_ration_module


Calculate a ration component's contribution to carbon dioxide (CO2) emissions from land-use change (excluding peatland drainage)

Description

Calculates the contribution of an individual feed component to carbon dioxide (CO2) emissions from land-use change in feed production (excluding peatland drainage), using feed-specific emission factors weighted by the component's share in the ration.

Usage

calc_co2_ration_luc_nopeat(feed_ration_fraction, co2_feed_luc_nopeat)

Arguments

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration, expressed as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

co2_feed_luc_nopeat

Numeric. Carbon dioxide (CO2) emission factor of a feed component, representing CO2 emissions from land-use change in feed production (excluding peatland drainage), expressed per kilogram of dry matter intake (g CO2/kg DM).

Details

The contribution is computed as:

diet\_co2\_feed\_luc\_nopeat = feed\_ration\_fraction \times co2\_feed\_luc\_nopeat

This function is part of the run_emissions_ration_module().

Value

Numeric. Contribution of an individual feed component to the diet-level average carbon dioxide (CO2) emission factor from land-use change (excluding peatland drainage) in feed production (g CO2/kg DM).

See Also

run_emissions_ration_module


Calculate a ration component's contribution to carbon dioxide (CO2) emissions from peatland drainage

Description

Calculates the contribution of an individual feed component to carbon dioxide (CO2) emissions from peatland drainage in feed production, using feed-specific emission factors weighted by the component's share in the ration.

Usage

calc_co2_ration_luc_peat(feed_ration_fraction, co2_feed_luc_peat)

Arguments

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration, expressed as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

co2_feed_luc_peat

Numeric. Carbon dioxide (CO2) emission factor of a feed component, representing CO2 emissions from peatland drainage in feed production, expressed per kilogram of dry matter intake (g CO2/kg DM).

Details

The contribution is computed as:

diet\_co2\_feed\_luc\_peat = feed\_ration\_fraction \times co2\_feed\_luc\_peat

This function is part of the run_emissions_ration_module().

Value

Numeric. Contribution of an individual feed component to the diet-level average carbon dioxide (CO2) emission factor from peatland drainage in feed production (g CO2/kg DM).

See Also

run_emissions_ration_module


Calculate a ration component's contribution to carbon dioxide (CO2) emissions from pesticide manufacture

Description

Calculates the contribution of an individual feed component to carbon dioxide (CO2) emissions from pesticide manufacture in feed production, using feed-specific emission factors weighted by the component's share in the ration.

Usage

calc_co2_ration_pesticides(feed_ration_fraction, co2_feed_pesticides)

Arguments

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration, expressed as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

co2_feed_pesticides

Numeric. Carbon dioxide (CO2) emission factor of a feed component, representing CO2 emissions from pesticide manufacture in feed production, expressed per kilogram of dry matter intake (g CO2/kg DM).

Details

The contribution is computed as:

diet\_co2\_feed\_pesticides = feed\_ration\_fraction \times co2\_feed\_pesticides

Value

Numeric. Contribution of an individual feed component to the diet-level average carbon dioxide (CO2) emission factor from pesticide manufacture in feed production (g CO2/kg DM).


Convert methane (CH4) and nitrous oxide (N2O) emissions to CO2-equivalents (CO2eq) using Global Warming Potentials (GWP) factors

Description

Calculates CO2-equivalent (CO2eq) emissions for CH4 and N2O based on 100-year Global Warming Potentials (GWP) reported in IPCC assessment reports.

Usage

calc_co2eq(gas, value_allocated, global_warming_potential_set)

Arguments

gas

Character. Gas type for each observation. Supported values:

  • "CH4": methane (CH4)

  • "N2O": nitrous oxide (N2O)

  • "CO2": carbon dioxide (CO2)

value_allocated

Numeric. Allocated emissions for each commodity–emission combination (kg gas).

global_warming_potential_set

Character. Settings for the 100-year Global Warming Potential (GWP-100) conversion factors used to express CH4 and N2O emissions as CO2eq. Must be one of:

  • "AR6": IPCC Sixth Assessment Report (IPCC, 2021) — CH4 = 27, N2O = 273

  • "AR5_excluding_carbon_feedback": IPCC Fifth Assessment Report (excluding climate–carbon feedbacks) (IPCC, 2013) — CH4 = 28, N2O = 265

  • "AR5_including_carbon_feedback": IPCC Fifth Assessment Report (including climate–carbon feedbacks) (IPCC, 2013) — CH4 = 34, N2O = 298

  • "AR4": IPCC Fourth Assessment Report (IPCC, 2007) — CH4 = 25, N2O = 298

Details

CO2-equivalent emissions are calculated as:

value\_co2eq = value\_allocated \times gwp

where gwp is the gas-specific 100-year Global Warming Potential factor from the selected IPCC assessment report.

This function is part of the run_aggregation_module().

Value

List with elements:

value_co2eq

Numeric vector. Emissions expressed as CO2-equivalents (kg CO2eq).

gwp

Numeric vector. Global Warming Potential factor applied to each observation (kg CO2eq/kg gas).

References

IPCC (2007). Climate Change 2007: The Physical Science Basis. Contribution of Working Group I to the Fourth Assessment Report of the Intergovernmental Panel on Climate Change.

IPCC (2013). Climate Change 2013: The Physical Science Basis. Contribution of Working Group I to the Fifth Assessment Report of the Intergovernmental Panel on Climate Change.

IPCC (2021). Climate Change 2021: The Physical Science Basis. Contribution of Working Group I to the Sixth Assessment Report of the Intergovernmental Panel on Climate Change.

See Also

run_aggregation_module(),


Aggregate cohort-level to herd-level data

Description

This function aggregates a dataset from cohort level to herd level by summing specified variables over the defined 'id' columns.

Usage

calc_cohort_to_herd_aggregation(
  data_cohort,
  id_cols,
  vars_to_sum,
  cohort_short
)

Arguments

data_cohort

Cohort-level dataset containing energy allocation variables and herd identifiers. Each row corresponds to a single sex–age cohort within a herd.

id_cols

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

vars_to_sum

Character vector. Names of numeric cohort-level variables to be summed across cohorts to produce herd-level totals (e.g., meat_allocation_energy, milk_allocation_energy, fibre_allocation_energy, work_allocation_energy, egg_allocation_energy)

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

Value

A data.table at herd scale, in which selected cohort-level variables have been summed across all cohorts belonging to the same herd, as defined by id_herd.

This function is part of the run_allocation_module() and run_aggregation_module().

See Also

run_allocation_module(), run_aggregation_module()


Calculate totals by cohort

Description

Calculates the total value for each variable at the cohort level over the full assessment period. Values are harmonized to a common unit (kg/cohort/assessment duration) by accounting for cohort stock size and simulation duration.

Usage

calc_cohort_totals(
  value,
  cohort_stock_size,
  ration_intake,
  feed_emissions_list,
  simulation_duration,
  variable_name,
  variable_type
)

Arguments

value

Numeric. Variable value expressed as (unit)/head/day for non-production variables and (unit)/cohort/assessment duration for production variables. Production variables can be explored from the list 'gleam_production_meta'.

cohort_stock_size

Numeric. Average population size in each of the 6 sex–age cohorts (# heads). (cohorts=FJ, FS, FA, MJ, MS, MA).

ration_intake

Numeric. Average daily dry matter intake of feed (kg DM/head/day).

feed_emissions_list

List of emission-source definitions for feed-related emissions. Each element is a list with two character fields:

emissions_source

List of variables = "co2_ration_fertilizer", "co2_ration_pesticides", "co2_ration_crop_activities", "co2_ration_luc_nopeat", "co2_ration_luc_peat", "n2o_ration_fertilizer", "n2o_ration_manure_applied", "n2o_ration_crop_residues", "ch4_ration_rice"

label

Human-readable output label.

simulation_duration

Numeric. Length of the assessment period (days).

variable_name

Character. Names of emission variables to which allocation should be applied (e.g., "ch4_enteric", "ch4_manure_pasture", "ch4_manure_burned", "ch4_manure_other", "n2o_manure_pasture_direct", "n2o_manure_burned_direct", "n2o_manure_other_direct", "n2o_manure_burned_indirect", "n2o_manure_pasture_indirect", "n2o_manure_other_indirect", "co2_ration_fertilizer", "co2_ration_pesticides", "co2_ration_crop_activities", "co2_ration_luc_nopeat", "co2_ration_luc_peat", "n2o_ration_fertilizer", "n2o_ration_manure_applied", "n2o_ration_crop_residues", "ch4_ration_rice")

variable_type

Character. Variable group classification. Supported values include:

  • "Production": variables already expressed at the cohort level for the full assessment duration

  • "Emissions": variables expressed per head per day

  • "Feed": variables expressed per head per day

  • "NitrogenBalance": variables expressed per head per day

Details

Production variables are already expressed at the cohort level for the entire assessment duration and are therefore returned unchanged. All other variables (emissions, feed, and nitrogen balance) are expressed per head per day and are scaled by cohort stock size and simulation duration to obtain cohort-level totals.

For production variables:

value\_total = value

For emissions (except emissions from feed), feed, and nitrogen balance variables:

value\_total = value \times cohort\_stock\_size \times simulation\_duration

For feed emissions variables:

value\_total = value \times ration\_intake \times cohort\_stock\_size \times simulation\_duration / 1000

This function is part of the run_aggregation_module().

Value

Numeric. Variable value expressed as (unit)/cohort/assessment duration for all variables.

See Also

run_aggregation_module()


Calculate live weights by cohort and life stage

Description

Determines the initial, potential final, and slaughter live weights for a given sex–age cohort based on species‑specific biological parameters. The function assigns weights according to the animal's life stage (juvenile, subadult, adult) and the sex of the cohort.

Usage

calc_cohort_weights(
  cohort_short,
  live_weight_female_adult = NA_real_,
  live_weight_male_adult = NA_real_,
  live_weight_at_birth = NA_real_,
  live_weight_female_at_slaughter = NA_real_,
  live_weight_male_at_slaughter = NA_real_,
  live_weight_at_weaning = NA_real_
)

Arguments

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

live_weight_female_adult

Numeric. Live weight of adult females (kg)

live_weight_male_adult

Numeric. Live weight of adult males (kg)

live_weight_at_birth

Numeric. Live weight of the animal at birth (kg).

live_weight_female_at_slaughter

Numeric. Slaughter weight of female sub-adult animals (kg).

live_weight_male_at_slaughter

Numeric. Slaughter weight of male sub-adult animals (kg).

live_weight_at_weaning

Numeric. Live weight of the animal at weaning (kg)

Details

The function attributes weights according to cohort and animal type:

This function is part of the run_weights_module().

Value

A named list with:

live_weight_cohort_initial

Numeric. Live weight at the beginning of the cohort stage (kg).

live_weight_cohort_potential_final

Numeric. Potential final live weight attainable at the end of the cohort stage in the absence of offtake (kg). (For juveniles: equals weaning weight; For subadults: equals adult live weight; For adults: equals adult live weight)

live_weight_cohort_at_slaughter

Numeric. Live weight at slaughter for animals removed from the cohort (kg).

live_weight_mature_stage

Numeric. Mature (adult) live weight that the animal can attain under given biological and management conditions (kg).

See Also

run_weights_module


Calculate methane conversion factor (ym)

Description

Calculates the methane conversion factor (ym, % of dietary gross energy in feed converted to methane) for a given species and cohort based on diet digestibility. Implements species- and cohort-specific rules consistent with IPCC Tier 2 approach.

Usage

calc_conversion_factor_ym(
  species_short,
  cohort_short,
  ration_digestibility_fraction
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

ration_digestibility_fraction

Numeric. Average digestibility of the feed ration, expressed as ratio of digestible (or metabolizable, for poultry) to gross energy content (fraction).

Details

ym is computed using species- and cohort-specific default relationships with diet digestibility (Opio et al., 2013).

ration_digestibility_fraction can be calculated with calc_ration_digestibility - see also run_ration_quality_module.

ym is returned as 0 for juvenile cohorts (FJ, MJ), assuming negligible enteric methane production before weaning/rumen development.

This function is part of the run_emissions_enteric_module().

Value

Numeric. Methane (CH4) conversion factor (ym), representing the percentage of gross energy of the feed ration that is converted to CH4 (percentage).

References

Opio, C., Gerber, P., Mottet, A., Falcucci, A., Tempio, G., MacLeod, M., Vellinga, T., Henderson, B. & Steinfeld, H. (2013). Greenhouse gas emissions from ruminant supply chains – A global life cycle assessment. Food and Agriculture Organization of the United Nations (FAO), Rome.

Jørgensen, H., Theil, P. K. & Knudsen, K. E. B. (2011). Enteric methane emission from pigs. In: Planet Earth 2011 – Global Warming Challenges and Opportunities for Policy and Practice (p. 610; Table 2). InTech.

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories. Chapter 10: Emissions from Livestock and Manure Management, Equation 10.21.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories. Chapter 10: Emissions from Livestock and Manure Management, Equation 10.21.

See Also

run_emissions_enteric_module, calc_ration_digestibility, run_ration_quality_module


Calculate daily weight gain by cohort

Description

Calculates average daily weight gain for a given sex–age cohort based on the difference between potential final and initial live weights.

Usage

calc_daily_weight_gain(
  live_weight_cohort_potential_final,
  live_weight_cohort_initial,
  cohort_duration_days
)

Arguments

live_weight_cohort_potential_final

Numeric. Potential final live weight attainable at the end of the cohort stage in the absence of offtake (kg). (For juveniles: equals weaning weight; For subadults: equals adult live weight; For adults: equals adult live weight)

live_weight_cohort_initial

Numeric. Live weight at the beginning of the cohort stage (kg).

cohort_duration_days

Numeric. Amount of time that each animal spends in a specific cohort (days).

Details

Daily live weight gain is calculated as the difference between the potential final live weight and the initial live weight, divided by the duration of the cohort stage:

daily\_weight\_gain = (live\_weight\_cohort\_potential\_final - live\_weight\_cohort\_initial) / cohort\_duration\_days

This function is part of the run_weights_module().

Value

Numeric. Average live weight gain of the cohort over the cohort stage (kg/head/day).

See Also

run_weights_module


Calculate daily fecundity rates

Description

Calculates the daily number of male and female offspring produced per adult female.

Usage

calc_fecundity_rates(parturition_rate, litter_size, birth_fraction_female)

Arguments

parturition_rate

Numeric. Average annual number of parturitions per female animal (# parturitions/adult female/year). A herd-level reproductive performance indicator calculated as the total number of parturitions (deliveries) occurring during a year divided by the number of adult females potentially able to give birth during that year.

litter_size

Numeric. Average number of offspring born per parturition (# offspring/parturition). This value can be calculated as the total number of offspring born divided by the total number of parturitions during the year.

birth_fraction_female

Numeric. Female birth fraction, defined as the probability that a newborn offspring is female (fraction). Can be calculated as the number of female offspring born divided by the total number of offspring born.

Value

A named list with two elements:

fecundity_female

Numeric. Daily number of female offspring per adult female (# offspring/day)

fecundity_male

Numeric. Daily number of male offspring per adult female (# offspring/day)

This function is part of the run_demographic_herd_module().

See Also

run_demographic_herd_module()

Examples

calc_fecundity_rates(parturition_rate = 0.8, litter_size = 2, birth_fraction_female = 0.5)


Calculate feed digestibility fraction

Description

Calculates species-specific feed digestibility fractions by feed component.

Usage

calc_feed_digestibility_fraction(
  feed_digestible_energy_ruminant,
  feed_digestible_energy_pigs,
  feed_gross_energy
)

Arguments

feed_digestible_energy_ruminant

Numeric. Digestible energy content of a feed component for ruminants, representing the energy absorbed by the animal after fecal losses (MJ/kg DM).

feed_digestible_energy_pigs

Numeric. Digestible energy content of a feed component for pigs, representing the energy absorbed by the animal after fecal losses (MJ/kg DM).

feed_gross_energy

Numeric. Gross energy content of a feed component, representing the total chemical energy released upon complete combustion of the feed (MJ/kg DM).

Details

Digestibility is computed as the ratio of usable energy to gross energy:

feed\_digestibility\_fraction = usable\_energy / feed\_gross\_energy

For ruminants and pigs, usable energy is represented by digestible_energy (DE), which accounts for fecal energy losses.

This function is part of the run_ration_quality_module().

Value

List with elements:

feed_digestibility_fraction_ruminant

Numeric. Digestibility of a feed component for ruminants, expressed as the ratio of digestible energy to gross energy content (fraction).

feed_digestibility_fraction_pigs

Numeric. Digestibility of a feed component for pigs, expressed as the ratio of digestible energy to gross energy content (fraction).

See Also

run_ration_quality_module


Calculate fibre energy requirements (for biophysical allocation)

Description

Calculates the energy required for fibre production over the assessment period (MJ/cohort/assessment period), based on the daily energy requirement for fibre production, cohort size, and assessment duration.

Usage

calc_fibre_allocation_energy(
  species_short,
  cohort_stock_size = NA_real_,
  metabolic_energy_req_fibre_production = NA_real_,
  ratio_me_to_ne = NA_real_,
  simulation_duration = NA_real_
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_stock_size

Numeric. Average population size in each of the 6 sex–age cohorts (# heads). (cohorts=FJ, FS, FA, MJ, MS, MA).

metabolic_energy_req_fibre_production

Numeric. Energy required for the synthesis of fibre for SHP, GTS and CML. Assumed to be 0 for other species. (MJ/head/day). Expressed as net energy for SHP and GTS and as metabolizable energy for CML.

ratio_me_to_ne

Numeric. Ratio of metabolizable energy converted to net energy (fraction). Used for species_short = CML.

simulation_duration

Numeric. Length of the assessment period (days).

Details

This function provides the fibre-related energy term used in a biophysical allocation framework to apportion emissions between milk and other co-products in multifunctional livestock production systems.

The approach implements the IDF (2022) standard, adapted from Thoma and Nemecek (2020), and is consistent with FAO LEAP livestock LCA guidelines (FAO, 2016a, 2016b, 2016c) and with ISO 14044:2006 (Section 4.3.4.2, Step 2).

In accordance with ISO 14044:2006 (Section 4.3.4.2, Step 2), known processing or biophysical relationships may be used to assign shared inputs and outputs of a single production unit to individual products or sub-units. In livestock systems, this includes apportioning shared feed and energy use according to physiological energy requirements (e.g., net energy for lactation, growth, etc.). If the resulting process remains multifunctional, these energy terms may subsequently be used to derive allocation factors among co-products.

Total fibre-related energy over the assessment period is computed for fibre-producing species (CML, SHP, GTS) and applicable cohorts ("FA", "FS", "MA", "MS").

The fibre_allocation_energy is calculated as follows:

energy\_allocation\_fibre = \frac{energy\_requirement\_fibre\_production}{ratio\_me\_to\_ne} \times simulation\_duration \times cohort\_stock\_size

for camels (CML), and:

energy\_allocation\_fibre = energy\_requirement\_fibre\_production \times simulation\_duration \times cohort\_stock\_size

for sheep (SHP) and goats (GTS).

where metabolic_energy_req_fibre_production can be computed using calc_metabolic_energy_req_fibre (see also run_metabolic_energy_req_module).

This function is part of the run_allocation_module().

Value

Numeric. Energy required to produce all fibre output by cohort (MJ/cohort/assessment period). Non-zero values are expected only for fibre-producing species (CML, SHP, GTS) and applicable cohorts ("FA", "FS", "MA", "MS").

References

ISO. (2006). Environmental management — Life cycle assessment — Requirements and guidelines (ISO 14044:2006). International Organization for Standardization, Geneva.

IDF. (2022). The IDF Global Carbon Footprint Standard for the Dairy Sector. Bulletin of the IDF No. 520/2022. International Dairy Federation, Brussels.

Thoma, G., and Nemecek, T. (2020). Allocation between milk and meat in dairy LCA: Critical discussion of the IDF’s standard methodology. In Proceedings of the 12th International Conference on Life Cycle Assessment of Food (LCAFood 2020) (pp. 83–89), 13–16 October, Berlin, Germany.

FAO. (2016a). Environmental performance of large ruminant supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

FAO. (2016b). Greenhouse gas emissions and fossil energy use from small ruminant supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

FAO. (2016c). Greenhouse gas emissions and fossil energy use from poultry supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

See Also

run_allocation_module, calc_metabolic_energy_req_fibre, run_metabolic_energy_req_module


Calculate fibre production

Description

Calculates fibre production for producing cohorts (FA, FS, MA, MS) of fibre-producing species (CML, SHP, GTS) over the assessment period (kg/cohort/assessment period).

Usage

calc_fibre_production(
  species_short,
  cohort_short,
  fibre_yield_year,
  simulation_duration,
  cohort_stock_size
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

fibre_yield_year

Numeric. Annual production yield of fibre, such as wool, cashmere, mohair (kg/head/year). Required only for species = CML, SHP, and GTS.

simulation_duration

Numeric. Length of the assessment period (days).

cohort_stock_size

Numeric. Average population size in each of the 6 sex–age cohorts (# heads). (cohorts=FJ, FS, FA, MJ, MS, MA).

Details

Fibre production outputs are computed as follows:

fibre\_production = \frac{fibre\_yield\_year}{365} \times simulation\_duration \times cohort\_stock\_size

Non-zero fibre outputs are only expected for producing cohorts (FA, FS, MA, MS) of fibre-producing species (CML, SHP, GTS).

This function is part of the run_production_module().

Value

Numeric. Total fibre produced over the assessment period by cohort (kg /cohort/assessment period).

See Also

run_production_module


Calculate meat energy requirements (for biophysical allocation)

Description

Calculates the energy required for meat production over the assessment period (MJ/cohort/assessment period), based on total live weight gained by the cohort from birth to slaughter.

Usage

calc_meat_allocation_energy(
  species_short,
  cohort_short,
  meat_production_live_weight_cohort,
  live_weight_cohort_at_slaughter = NA_real_,
  live_weight_at_birth = NA_real_,
  ratio_me_to_ne = NA_real_
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

meat_production_live_weight_cohort

Numeric. Total meat produced as live weight over the assessment period by cohort (kg/cohort/assessment period).

live_weight_cohort_at_slaughter

Numeric. Live weight at slaughter for animals removed from the cohort (kg).

live_weight_at_birth

Numeric. Live weight of the animal at birth (kg).

ratio_me_to_ne

Numeric. Ratio of metabolizable energy converted to net energy (fraction). Used for species_short = CML.

Details

This function provides the meat-related energy term used in a biophysical allocation framework to apportion emissions between milk and other co-products in multifunctional livestock production systems.

The approach implements the IDF (2022) standard, adapted from Thoma and Nemecek (2020), and is consistent with FAO LEAP livestock LCA guidelines (FAO, 2016a, 2016b, 2016c) and with ISO 14044:2006 (Section 4.3.4.2, Step 2).

In accordance with ISO 14044:2006, known biophysical relationships may be used to assign shared inputs and outputs of a production system to individual products or sub-units. In livestock systems, this includes apportioning shared feed and energy use according to physiological energy requirements such as growth, lactation, and maintenance. If the resulting process remains multifunctional, these energy terms may subsequently be used to derive allocation factors among co-products.

The meat_allocation_energy is calculated as follows:

energy\_allocation\_meat = specific\_energy\_meat \times meat\_production\_live\_weight\_cohort

where

Specific approaches by species:

This function is part of the run_allocation_module().

Value

Numeric. Energy required by a given sex–age cohort for total meat output by cohort during the assessment period, equal to the energy needed to produce all live-weight gain to reach the target slaughter weight (MJ/cohort/assessment period). For pigs (PGS), the function returns 0 by design.

References

ISO. (2006). Environmental management — Life cycle assessment — Requirements and guidelines (ISO 14044:2006). International Organization for Standardization, Geneva.

IDF. (2022). The IDF Global Carbon Footprint Standard for the Dairy Sector. Bulletin of the IDF No. 520/2022. International Dairy Federation, Brussels.

Thoma, G., and Nemecek, T. (2020). Allocation between milk and meat in dairy LCA: Critical discussion of the IDF’s standard methodology. In Proceedings of the 12th International Conference on Life Cycle Assessment of Food (LCAFood 2020) (pp. 83–89), 13–16 October, Berlin, Germany.

FAO. (2016a). Environmental performance of large ruminant supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

FAO. (2016b). Greenhouse gas emissions and fossil energy use from small ruminant supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

FAO. (2016c). Greenhouse gas emissions and fossil energy use from poultry supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

See Also

run_allocation_module, calc_meat_production, run_production_module, calc_allocation_shares


Calculate meat production

Description

Calculates cohort-level meat production outputs over the assessment period based on the number of animals removed from the herd (offtake). The function returns multiple production metrics expressed in live weight, carcass weight, bone-free meat, and meat protein (kg/cohort/assessment period).

Usage

calc_meat_production(
  offtake_heads_assessment,
  live_weight_cohort_at_slaughter,
  carcass_dressing_fraction,
  bone_free_meat_fraction,
  meat_protein_fraction
)

Arguments

offtake_heads_assessment

Numeric. Total number of animals removed via offtake over the assessment period, aggregated to 6 sex–age cohorts (heads/assessment period) (cohorts = FJ, FS, FA, MJ, MS, MA).

live_weight_cohort_at_slaughter

Numeric. Live weight at slaughter for animals removed from the cohort (kg).

carcass_dressing_fraction

Numeric. Ratio of a slaughtered animal's carcass weight to its live weight (fraction).

bone_free_meat_fraction

Numeric. Ratio of bone-free-meat to carcass weight (fraction).

meat_protein_fraction

Numeric. Protein content of bone-free-meat (kg protein/kg bone-free-meat).

Details

Meat production outputs are computed as follows:

This function is part of the run_production_module().

Value

A named list with:

meat_production_live_weight_cohort

Numeric . Total meat produced as live weight over the assessment period by cohort (kg/cohort/assessment period).

meat_production_carcass_weight_cohort

Numeric. Total meat as carcass weight (excluding organs, and other by-products after dressing) produced over the assessment period by cohort (kg/cohort/assessment period).

meat_production_bone_free_meat_cohort

Numeric. Total bone-free-meat (excluding bones, organs, and other by-products after dressing and bone removal) produced over the assessment period by cohort (kg/cohort/assessment period).

meat_production_protein_cohort

Numeric. Total meat protein (excluding bones, organs, and other by-products after dressing and bone removal) produced over the assessment period by cohort (kg protein/cohort/assessment period).

See Also

run_production_module, run_demographic_herd_module, run_weights_module


Calculate metabolic energy requirements for activity

Description

Calculates the energy requirement for activity by cohort (MJ/head/day), defined as the amount of energy needed to support animal movement and physical activity.

Usage

calc_metabolic_energy_req_activity(
  species_short,
  cohort_short,
  metabolic_energy_req_maintenance,
  live_weight_cohort_average,
  low_activity_fraction,
  high_activity_fraction
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

metabolic_energy_req_maintenance

Numeric. Energy required for maintenance, defined as the amount of energy needed to keep the animal at equilibrium such that body energy is neither gained nor lost. Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS (MJ/head/day).

live_weight_cohort_average

Numeric. Average live weight over the cohort stage. Computed by accounting for the share of offtaken animals within the cohort, using their slaughter weight, and the potential final weight of animals that remain in the cohort (kg).

low_activity_fraction

Numeric. Proportion of the assessment period during which the animal performs low-intensity movement typical of stall-feeding or near-field grazing, characterized by minimal walking distances and flat terrain (fraction).

high_activity_fraction

Numeric. Proportion of the assessment period during which the animal engages in sustained locomotion associated with herding or long-distance grazing, typically involving extended walking distances and/or uneven or hilly terrain (fraction).

Details

This approach follows the IPCC Tier 2 energy partitioning method and applies:

metabolic\_energy\_req\_activity = cact \times metabolic\_energy\_req\_maintenance

For SHP and GTS, activity energy is calculated as:

metabolic\_energy\_req\_activity = cact \times live\_weight\_cohort\_average

where

cact is an activity coefficient (dimensionless for CTL, BFL, PGS; MJ/day/kg for SHP, GTS) that reflects the animal’s feeding and management conditions. metabolic_energy_req_maintenance can be calculated using calc_metabolic_energy_req_maintenance().

For CTL, BFL, SHP and GTS, cact is computed as a weighted average of activity levels over the assessment period to account for variation in management and grazing intensity.

Specific coefficients by species and cohort:

CTL, BFL (NRC, 1996; AFRC, 1993):

CML (Wardeh, 2004):

GTS (AFRC, 1993):

SHP (AFRC, 1993):

PGS (NRC, 1998):

This function is part of the run_metabolic_energy_req_module().

Value

Numeric. Energy required for activity, defined as the amount of energy needed to support animal movement and physical activity (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

References

NRC (1998). Nutrient Requirements of Swine, 10th Revised Edition. National Academies Press, Washington, DC.

NRC (1996). Nutrient Requirements of Beef Cattle, 7th Revised Edition. National Academies Press, Washington, DC.

AFRC (1993). Energy and Protein Requirements of Ruminants. An Advisory Manual Prepared by the AFRC Technical Committee on Responses to Nutrients. CAB International, Wallingford, UK.

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management, Equation 10.4; Table 10.5.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management, Equation 10.4; Table 10.5.

Wardeh, M. F. (2004). The nutrient requirements of the dromedary camel. Journal of Camel Science, 1(1):37-45. The Camel Applied Research and Development Network (CARDN), Arab Center for the Studies of Arid Zones and Dry Lands (ACSAD).

See Also

run_metabolic_energy_req_module, calc_metabolic_energy_req_maintenance, calc_avg_weights


Calculate metabolic energy requirements for fibre production

Description

Calculates the energy requirement for fibre production (MJ/head/day), defined as the additional energy required for the synthesis of animal fibre (e.g. wool or hair).

Usage

calc_metabolic_energy_req_fibre(
  species_short,
  cohort_short,
  fibre_yield_year = NA_real_
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

fibre_yield_year

Numeric. Annual production yield of fibre, such as wool, cashmere, mohair (kg/head/year). Required only for species = CML, SHP, and GTS.

Details

This component follows the IPCC Tier 2 partitioning approach and is applied only to fibre-producing species and relevant cohorts, which are assumed to be FA, FS, MA, and MS.

Species-specific approach:

This function is part of the run_metabolic_energy_req_module().

Value

Numeric. Energy required for the synthesis of fibre for SHP, GTS and CML. Assumed to be 0 for other species. (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS (MJ/head/day).

References

AFRC (1998) The Nutrition of Goats. CAB International, Wallingford, UK.

AFRC (1993). Energy and Protein Requirements of Ruminants. An Advisory Manual Prepared by the AFRC Technical Committee on Responses to Nutrients. CAB International, Wallingford, UK.

Cannas, A., Atzori, A. S., Boe, F., & Teixeira, I. (2007). Energy and protein requirements of goats. In: Dairy sheep nutrition (pp. 31-49). CAB International, Wallingford, UK.

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories. Chapter 10: Emissions from Livestock and Manure Management, Equation 10.12.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories. Chapter 10: Emissions from Livestock and Manure Management, Equation 10.12.

See Also

run_metabolic_energy_req_module,


Calculate metabolic energy requirements for growth

Description

Calculates the energy requirement for growth by cohort (MJ/head/day), defined as the energy required for body tissue accretion, corresponding to the retained energy component of live weight gain.

Usage

calc_metabolic_energy_req_growth(
  species_short,
  cohort_short,
  live_weight_cohort_average = NA_real_,
  live_weight_cohort_final = NA_real_,
  live_weight_cohort_initial = NA_real_,
  live_weight_mature_stage = NA_real_,
  daily_weight_gain = NA_real_,
  offtake_rate = NA_real_,
  cohort_duration_days = NA_real_
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

live_weight_cohort_average

Numeric. Average live weight over the cohort stage. Computed by accounting for the share of offtaken animals within the cohort, using their slaughter weight, and the potential final weight of animals that remain in the cohort (kg).

live_weight_cohort_final

Numeric. Live weight at the end of the cohort stage, accounting for both surviving and offtaken animals. Computed as a weighted average of the potential final weight of surviving animals and the slaughter weight of offtaken animals, based on the offtake rate (kg).

live_weight_cohort_initial

Numeric. Live weight at the beginning of the cohort stage (kg).

live_weight_mature_stage

Numeric. Mature (adult) live weight that the animal can attain under given biological and management conditions (kg).

daily_weight_gain

Numeric. Average live weight gain of the cohort over the cohort stage (kg/head/day).

offtake_rate

Numeric. Annual proportion of animals removed from the herd for each sex-age cohort (fraction).

cohort_duration_days

Numeric. Amount of time that each animal spends in a specific cohort (days).

Details

This function follows the IPCC Tier 2 energy partitioning approach and applies species-specific equations for growth energy requirements.

In general, growth energy is computed only for growing cohorts (FJ, FS, MJ, MS); in this implementation, growth is set to 0 for adult cohorts (FA, MA).

Species-specific approach:

This function is part of the run_metabolic_energy_req_module().

Value

Numeric. Energy required for growth (i.e., weight gain) (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

References

Al-Jassim, R. (2019). Metabolisable energy and protein requirements of the Arabian camel (Camelus dromedarius). Journal of Camelid Science (12) 33-45

NRC (1998). Nutrient Requirements of Swine, 10th Revised Edition. National Academies Press, Washington, DC.

NRC (1996). Nutrient Requirements of Beef Cattle, 7th Revised Edition. National Academies Press, Washington, DC.

AFRC (1993). Energy and Protein Requirements of Ruminants. An Advisory Manual Prepared by the AFRC Technical Committee on Responses to Nutrients. CAB International, Wallingford, UK.

Gibbs, M.J., Conneely, D., Johnson, D., Lassey, K.R. and Ulyatt, M.J. (2002). CH4 emissions from enteric fermentation. In: Background Papers: IPCC Expert Meetings on Good Practice Guidance and Uncertainty Management in National Greenhouse Gas Inventories, p 297–320. IPCC-NGGIP, Institute for Global Environmental Strategies (IGES), Hayama, Kanagawa, Japan.

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management, Equation 10.6 and 10.7; Table 10.6.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management, Equation 10.6 and 10.7; Table 10.6.

See Also

run_metabolic_energy_req_module, calc_cohort_weights, calc_avg_weights, calc_daily_weight_gain


Calculate metabolic energy requirements for lactation

Description

Calculates the energy requirement for lactation by cohort (MJ/head/day), defined as the energy needed to support milk production by lactating females.

Usage

calc_metabolic_energy_req_lactation(
  species_short,
  cohort_short,
  lactating_females_fraction = NA_real_,
  milk_yield_day = NA_real_,
  milk_fat_fraction = NA_real_,
  non_productive_duration = NA_real_,
  pregnancy_duration = NA_real_,
  litter_size = NA_real_,
  death_rate_juvenile = NA_real_,
  live_weight_at_birth = NA_real_,
  live_weight_at_weaning = NA_real_,
  lactation_duration = NA_real_,
  parturition_rate = NA_real_
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

lactating_females_fraction

Numeric. Proportion of adult females that are lactating during the assessment period (fraction). Required only for species = CML, CTL, BFL, SHP, and GTS.

milk_yield_day

Numeric. Average milk yield per milk-producing animal during the assessment duration (kg/head/day). This value is calculated as the total quantity of milk produced for human consumption by milk-producing animals during the assessment period, divided by the number of milk-producing animals, and the length of the assessment period (days). Required only for species = CML, CTL, BFL, SHP, and GTS.

milk_fat_fraction

Numeric. Milk fat fraction (kg fat/kg milk). Required only for species = CML, CTL, BFL, SHP, and GTS.

non_productive_duration

Numeric. Period during which the animal is not performing any productive physiological function such as pregnancy or lactation (days). Required only for PGS.

pregnancy_duration

Numeric. Duration of pregnancy period (days).

litter_size

Numeric. Average number of offspring born per parturition (# offspring/parturition). This value can be calculated as the total number of offspring born divided by the total number of parturitions during the year.

death_rate_juvenile

Numeric. Fraction of deaths in a herd over a year for juvenile cohorts (i.e. FJ and MJ), (fraction).

live_weight_at_birth

Numeric. Live weight of the animal at birth (kg).

live_weight_at_weaning

Numeric. Live weight of the animal at weaning (kg).

lactation_duration

Numeric. Duration of the lactation period, defined as the number of days during which the animal is lactating (days). Required only for PGS.

parturition_rate

Numeric. Average annual number of parturitions per female animal (# parturitions/adult female/year). A herd-level reproductive performance indicator calculated as the total number of parturitions (deliveries) occurring during a year divided by the number of adult females potentially able to give birth during that year.

Details

This approach follows the IPCC Tier 2 partitioning method and applies species-specific equations for lactation energy requirements as a function of the quantity of milk produced and a species-specific energy cost per unit of milk.

Requirements are calculated only for cohort = FA (adult females) and are scaled by the proportion of lactating animals (lactating_females_fraction) or reproducing females (parturition_rate) within the cohort.

Species-specific approach:

CTL, BFL, CML, SHP and GTS:

Total milk production includes:

In general form, lactation energy is computed as:

metabolic\_energy\_req\_lactation = (milk\_yield \times lactating\_females\_fraction + milk\_for\_offspring) \times energy\_milk

where:

energy_milk is a species-specific coefficient representing the net energy cost of producing one kilogram of milk (MJ/kg milk).

Species-specific values of energy_milk are:

milk_for_offspring is the daily amount of milk required to rear offspring across the year (kg/day). It is calculated assuming that 5 kg of milk are required for each kilogram of live-weight gain up to weaning:

milk\_for\_offspring = \frac{parturition\_rate \times 5 \times (weaning\_weight - birth\_weight)}{365}

For SHP and GTS, milk_for_offspring is multiplied by litter_size to account for multiple offspring per birth.

PGS (NRC, 1998):

Lactation energy accounts only for the milk consumed directly by offspring (milk_for_offspring), adjusted by the fraction of the reproductive cycle spent in lactation (cadj):

\begin{aligned} metabolic\_energy\_req\_lactation &= litter\_size \times (1 - 0.5 \times death\_rate\_juvenile) \times \\ & \left( \frac{0.02059 \times (weaning\_weight - birth\_weight) \times 1000} {lactation\_duration} - \frac{0.3766}{0.67} \right) \times cadj \end{aligned}

where:

This function is part of the run_metabolic_energy_req_module().

Value

Numeric. Energy required for lactation (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

References

AFRC (1998) The Nutrition of Goats. CAB International, Wallingford, UK.

AFRC (1993). Energy and Protein Requirements of Ruminants. An Advisory Manual Prepared by the AFRC Technical Committee on Responses to Nutrients. CAB International, Wallingford, UK.

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management, Equation 10.8-10.10.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management, Equation 10.8-10.10.

NRC (1998). Nutrient Requirements of Swine, 10th Revised Edition. National Academies Press, Washington, DC.

NRC (1989) Nutrient Requirements of Dairy Cattle, 6th Ed. . Washington, D.C. U.S.A: National Academy Press.

Wardeh, M. F. (2004). The nutrient requirements of the dromedary camel. Journal of Camel Science, 1(1):37-45. The Camel Applied Research and Development Network (CARDN), Arab Center for the Studies of Arid Zones and Dry Lands (ACSAD).

See Also

run_metabolic_energy_req_module


Calculate metabolic energy requirements for maintenance

Description

Calculates the energy requirement for maintenance by cohort (MJ/head/day), defined as the energy required to maintain basal physiological functions at equilibrium, with no net gain or loss of body energy.

Usage

calc_metabolic_energy_req_maintenance(
  species_short,
  cohort_short,
  live_weight_cohort_average,
  lactating_females_fraction = NA_real_,
  offtake_rate = NA_real_,
  age_first_parturition = NA_real_
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

live_weight_cohort_average

Numeric. Average live weight over the cohort stage. Computed by accounting for the share of offtaken animals within the cohort, using their slaughter weight, and the potential final weight of animals that remain in the cohort (kg).

lactating_females_fraction

Numeric. Proportion of adult females that are lactating during the assessment period (fraction). Required only for species = CML, CTL, BFL, SHP, and GTS.

offtake_rate

Numeric. Annual proportion of animals removed from the herd for each sex-age cohort (fraction).

age_first_parturition

Numeric. Age at first parturition for female breeding animals (days)

Details

This approach follows the IPCC Tier 2 partitioning method and applies:

metabolic\_energy\_req\_maintenance = cmain \times average\_weight^{0.75}

where cmain is a category-specific coefficient (MJ/day/kg^{0.75}) that reflects basal metabolic requirements and varies by species, physiological status, and sex.

For selected cohorts, cmain is computed as a weighted average to account for:

Specific coefficients by species and cohort:

CTL and BFL (NRC, 1996; AFRC, 1993):

CML (Wardeh, 2004):

GTS (AFRC, 1993):

SHP (AFRC, 1993):

PGS (NRC, 1998):

This function is part of the run_metabolic_energy_req_module().

Value

Numeric. Energy required for maintenance, defined as the amount of energy needed to keep the animal at equilibrium such that body energy is neither gained nor lost. Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS (MJ/head/day).

References

NRC (1998). Nutrient Requirements of Swine, 10th Revised Edition. National Academies Press, Washington, DC.

NRC (1996). Nutrient Requirements of Beef Cattle, 7th Revised Edition. National Academies Press, Washington, DC.

AFRC (1993). Energy and Protein Requirements of Ruminants. An Advisory Manual Prepared by the AFRC Technical Committee on Responses to Nutrients. CAB International, Wallingford, UK.

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories. Chapter 10: Emissions from Livestock and Manure Management, Equation 10.3; Table 10.4.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories. Chapter 10: Emissions from Livestock and Manure Management, Equation 10.3; Table 10.4.

Wardeh, M. F. (2004). The nutrient requirements of the dromedary camel. Journal of Camel Science, 1(1):37-45. The Camel Applied Research and Development Network (CARDN), Arab Center for the Studies of Arid Zones and Dry Lands (ACSAD).

See Also

run_metabolic_energy_req_module, calc_avg_weights


Calculate metabolic energy requirements for pregnancy

Description

Calculates the energy requirement for pregnancy by cohort (MJ/head/day) for pregnant females, defined as the additional energy needed to support gestation.

Usage

calc_metabolic_energy_req_pregnancy(
  species_short,
  cohort_short,
  metabolic_energy_req_maintenance = NA_real_,
  parturition_rate = NA_real_,
  litter_size = NA_real_,
  pregnancy_duration = NA_real_,
  non_productive_duration = NA_real_,
  lactation_duration = NA_real_,
  cohort_duration_days = NA_real_,
  offtake_rate = NA_real_
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

metabolic_energy_req_maintenance

Numeric. Energy required for maintenance, defined as the amount of energy needed to keep the animal at equilibrium such that body energy is neither gained nor lost. Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS (MJ/head/day).

parturition_rate

Numeric. Average annual number of parturitions per female animal (# parturitions/adult female/year). A herd-level reproductive performance indicator calculated as the total number of parturitions (deliveries) occurring during a year divided by the number of adult females potentially able to give birth during that year.

litter_size

Numeric. Average number of offspring born per parturition (# offspring/parturition). This value can be calculated as the total number of offspring born divided by the total number of parturitions during the year.

pregnancy_duration

Numeric. Duration of pregnancy period (days).

non_productive_duration

Numeric. Period during which the animal is not performing any productive physiological function such as pregnancy or lactation (days). Required only for PGS.

lactation_duration

Numeric. Duration of the lactation period, defined as the number of days during which the animal is lactating (days). Required only for PGS.

cohort_duration_days

Numeric. Amount of time that each animal spends in a specific cohort (days).

offtake_rate

Numeric. Annual proportion of animals removed from the herd for each sex-age cohort (fraction).

Details

This component follows the IPCC Tier 2 partitioning framework and is applied only to female cohorts (FA and FS).

Pregnancy energy (metabolic_energy_req_pregnancy) represents the additional energy required to support gestation. Requirements are computed as a fraction of maintenance energy and are adjusted to reflect reproductive activity within the cohort:

General form

metabolic\_energy\_req\_pregnancy = metabolic\_energy\_req\_maintenance \times c_{preg} \times S

where

Specific coefficients by species and cohort:

This function is part of the run_metabolic_energy_req_module().

Value

Numeric. Energy required for pregnancy for pregnant females (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

References

NRC (1998). Nutrient Requirements of Swine, 10th Revised Edition. National Academies Press, Washington, DC.

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories. Chapter 10: Emissions from Livestock and Manure Management, Equation 10.13; Table 10.7.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories. Chapter 10: Emissions from Livestock and Manure Management, Equation 10.13; Table 10.7.

Wardeh, M. F. (2004). The nutrient requirements of the dromedary camel. Journal of Camel Science, 1(1):37-45. The Camel Applied Research and Development Network (CARDN), Arab Center for the Studies of Arid Zones and Dry Lands (ACSAD).

See Also

run_metabolic_energy_req_module, calc_metabolic_energy_req_maintenance


Calculate metabolic energy requirements for work

Description

Calculates the energy requirement for work (MJ/head/day), defined as the additional energy required to support draught power and work-related physical activity.

Usage

calc_metabolic_energy_req_work(
  species_short,
  cohort_short,
  metabolic_energy_req_maintenance = NA_real_,
  draught_work_hours_female = NA_real_,
  draught_work_hours_male = NA_real_,
  draught_fraction_female = NA_real_,
  draught_fraction_male = NA_real_
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

metabolic_energy_req_maintenance

Numeric. Energy required for maintenance, defined as the amount of energy needed to keep the animal at equilibrium such that body energy is neither gained nor lost. Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS (MJ/head/day).

draught_work_hours_female

Numeric. Average daily working time per adult female (hours/head/day). Required only for species = CML, CTL and BFL.

draught_work_hours_male

Numeric. Average daily working time per adult male (hours/head/day). Required only for species = CML, CTL and BFL.

draught_fraction_female

Numeric. Fraction of adult females involved in draught work (fraction). Required only for species = CML, CTL and BFL.

draught_fraction_male

Numeric. Fraction of adult males involved in draught work (fraction). Required only for species = CML, CTL and BFL.

Details

This approach follows the IPCC Tier 2 partitioning method and applies species-specific coefficients for draught work.

This energy component is calculated only for adult cohorts ( FA and MA) of draught-capable species (CTL, BFL, and CML). It is scaled by the fraction of adult animals involved in draught work (draught_fraction_female, draught_fraction_male) and their average daily working time (draught_work_hours_female, draught_work_hours_male).

Species-specific approach:

CTL and BFL - (Bamualim & Kartiarso, 1985; IPCC, 2006; IPCC 2019). Draught work energy is expressed as a proportion of net energy for maintenance:

metabolic\_energy\_req\_work = 0.1 \times metabolic\_energy\_req\_maintenance \times work\_hours \times draught\_fraction

where:

CML - (Wilson, 1989) Draught work energy is calculated using a fixed metabolizable energy cost per hour of work:

metabolic\_energy\_req\_work = 4 \times work\_hours \times draught\_fraction

where:

This function is part of the run_metabolic_energy_req_module().

Value

Numeric. Energy required for work, used to estimate the energy required for draught power for CTL, BFL and CML (MJ/head/day). Assumed to be 0 for other species. Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

References

Bamualim A., Kartiarso (1985). Nutrition of draught animals with special reference to Indonesia. In: Draught Animal Power for Production. Australian Centre for International agricultural Research (ACIAR), Proceedings Series No. 10, ed. JW Copland. Canberra, A.C.T., Australia: ACIAR.

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management, Equation 10.11.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management, Equation 10.11.

Wilson (1989). The nutritional requirements of camel. In: Tisserand J.-L. (ed.). Séminaire sur la digestion, la nutrition et l'alimentation du dromadaire. Zaragoza : CIHEAM. (1989). p. 171-179 (Options Méditerranéennes : Série A. Séminaires Méditerranéens; n. 2)

See Also

run_metabolic_energy_req_module, calc_metabolic_energy_req_maintenance


Calculate milk energy requirements (for biophysical allocation)

Description

Calculates the energy required for milk production over the assessment period (MJ/cohort/assessment period), based on total fat- and protein-corrected milk (FPCM) produced by the cohort.

Usage

calc_milk_allocation_energy(
  milk_production_fpcm_cohort,
  milk_protein_fraction_standard,
  milk_fat_fraction_standard,
  milk_lactose_fraction_standard
)

Arguments

milk_production_fpcm_cohort

Numeric. Total fat-protein-corrected milk (FPCM) produced over the assessment period (kg/cohort/assessment period). Suggested standard fat, protein and lactose contents are 0.04, 0.033, and 0.048 respectively.

milk_protein_fraction_standard

Numeric. Standard protein content of milk, used to calculate Fat-protein-corrected milk (FPCM), (kg protein/kg milk). Suggested value = 0.033.

milk_fat_fraction_standard

Numeric. Standard fat content of milk, used to calculate Fat-protein-corrected milk (FPCM), (kg fat/kg milk). Suggested value = 0.04.

milk_lactose_fraction_standard

Numeric. Standard lactose content of milk, used to calculate Fat-protein-corrected milk (FPCM) , (kg lactose/kg milk). Suggested value = 0.048.

Details

This function provides the milk-related energy term used in a biophysical allocation framework to apportion emissions between milk and other co-products in multifunctional livestock production systems.

The approach implements the IDF (2022) standard, adapted from Thoma and Nemecek (2020), and is consistent with FAO LEAP livestock LCA guidelines (FAO, 2016a, 2016b, 2016c) and with ISO 14044:2006 (Section 4.3.4.2, Step 2).

In accordance with ISO 14044:2006, known biophysical relationships may be used to assign shared inputs and outputs of a production system to individual products or sub-units. In livestock systems, this includes apportioning shared feed and energy use according to physiological energy requirements such as lactation, growth, and maintenance. If the resulting process remains multifunctional, these energy terms may subsequently be used to derive allocation factors among co-products.

The milk_allocation_energy is calculated as follows:

energy\_allocation\_milk = energy\_standard \times milk\_production\_fpcm\_cohort

where:

This function is part of the run_allocation_module().

Value

Numeric. Energy required to produce total milk output by cohort (MJ/cohort/assessment period). Non-zero values are applicable only to milk-producing species and cohorts (species = CTL, BFL, CML, SHP, GTS; cohorts=FA). All other species–cohort combinations are assigned a value of 0.

References

ISO. (2006). Environmental management — Life cycle assessment — Requirements and guidelines (ISO 14044:2006). International Organization for Standardization, Geneva.

IDF. (2022). The IDF Global Carbon Footprint Standard for the Dairy Sector. Bulletin of the IDF No. 520/2022. International Dairy Federation, Brussels.

Thoma, G., and Nemecek, T. (2020). Allocation between milk and meat in dairy LCA: Critical discussion of the IDF’s standard methodology. In Proceedings of the 12th International Conference on Life Cycle Assessment of Food (LCAFood 2020) (pp. 83–89), 13–16 October, Berlin, Germany.

FAO. (2016a). Environmental performance of large ruminant supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

FAO. (2016b). Greenhouse gas emissions and fossil energy use from small ruminant supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

FAO. (2016c). Greenhouse gas emissions and fossil energy use from poultry supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

See Also

run_allocation_module, calc_milk_production, run_production_module


Calculate milk production

Description

Calculates total milk production for the producing cohort (FA) of milk-producing species (CML, CTL, BFL, SHP, GTS) over the assessment period and returns multiple production metrics: total milk mass, milk protein, and fat-protein-corrected milk (FPCM) (kg/cohort/assessment period).

Usage

calc_milk_production(
  species_short,
  cohort_short,
  milk_yield_day,
  simulation_duration,
  cohort_stock_size,
  lactating_females_fraction,
  milk_protein_fraction,
  milk_fat_fraction,
  milk_lactose_fraction,
  milk_protein_fraction_standard,
  milk_fat_fraction_standard,
  milk_lactose_fraction_standard
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

milk_yield_day

Numeric. Average milk yield per milk-producing animal during the assessment duration (kg/head/day). This value is calculated as the total quantity of milk produced for human consumption by milk-producing animals during the assessment period, divided by the number of milk-producing animals, and the length of the assessment period (days). Required only for species = CML, CTL, BFL, SHP, and GTS.

simulation_duration

Numeric. Length of the assessment period (days).

cohort_stock_size

Numeric. Average population size in each of the 6 sex–age cohorts (# heads). (cohorts=FJ, FS, FA, MJ, MS, MA).

lactating_females_fraction

Numeric. Proportion of adult females that are lactating during the assessment period (fraction). Required only for species: CML, CTL, BFL, SHP, and GTS.

milk_protein_fraction

Numeric. Milk protein fraction (kg protein/kg milk). Required only for species = CML, CTL, BFL, SHP, and GTS.

milk_fat_fraction

Numeric. Milk fat fraction (kg fat/kg milk). Required only for species = CML, CTL, BFL, SHP, and GTS.

milk_lactose_fraction

Numeric. Milk lactose fraction (kg lactose/kg milk). Required only for species = CML, CTL, BFL, SHP, and GTS.

milk_protein_fraction_standard

Numeric. Standard protein content of milk, used to calculate Fat-protein-corrected milk (FPCM), (kg protein/kg milk). Suggested value = 0.033.

milk_fat_fraction_standard

Numeric. Standard fat content of milk, used to calculate Fat-protein-corrected milk (FPCM), (kg fat/kg milk). Suggested value = 0.04.

milk_lactose_fraction_standard

Numeric. Standard lactose content of milk, used to calculate Fat-protein-corrected milk (FPCM), (kg lactose/kg milk). Suggested value = 0.048.

Details

Milk production outputs are computed as follows:

Non-zero milk outputs are only expected for adult female cohorts of milk-producing species.

This function is part of the run_production_module().

Value

A named list with:

milk_production_mass_cohort

Numeric. Total milk production produced over the assessment period (kg/cohort/assessment period).

milk_production_protein_cohort

Numeric. Total milk protein production produced over the assessment period (kg protein/cohort/assessment period).

milk_production_fpcm_cohort

Numeric. Total fat-protein-corrected milk (FPCM) produced over the assessment period (kg/cohort/assessment period).

References

International Dairy Federation (IDF). 2022. The IDF Global Carbon Footprint Standard for the Dairy Sector. Bulletin of the IDF No. 520/2022. International Dairy Federation (ed.), Brussels, Belgium. Equation 10.

See Also

run_production_module


Calculate direct Nitrous Oxide (N2O) emissions from manure management systems

Description

Calculates daily direct nitrous oxide (N2O) emissions from manure management using IPCC-based parameters and separates emissions from manure deposited on pasture, manure burned for fuel, and all other manure management systems.

Usage

calc_n2o_manure_direct(ratio_N2ON_to_N2O = 44/28, nitrogen_excretion, ...)

Arguments

ratio_N2ON_to_N2O

Numeric. Conversion factor from kg N2O–N to kg N2O, based on molecular weights. Defaults to 44/28.

nitrogen_excretion

Numeric. Daily nitrogen excretion (kg N/head/day).

...

A variable number of manure management system (MMS) arguments. Each MMS must be provided as a named numeric vector with exactly the following fields:

manure_management_system_fraction

Numeric. Fraction of total manure excreted by animals in a given herd and cohort that is handled in a specific manure management system. Value ranges from 0 to 1. The sum of all fractions for each herd_id must equal 1.

n2o_ef3

Numeric. Emission factor for direct nitrous oxide (N2O) emissions for each manure management system, representing nitrous oxide emitted per unit of nitrogen from nitrification and denitrification processes occurring during manure storage and treatment (kg N2O–N per kg N). Default values may be selected from Table 10.21 and Table 11.1 (for manure deposited on pasture) in IPCC Guidelines (IPCC 2006, 2019).

Two MMS names are treated explicitly when present:

mms_pasture

Manure deposited on pasture.

mms_burned

Manure burned for fuel.

All remaining MMS arguments are grouped and treated as other manure management systems.

Details

This calculation follows the Tier 2 methodology for direct nitrous oxide (N2O) emissions from manure management as defined in the IPCC Guidelines (Equation 10.25).

In the IPCC formulation, annual direct emissions are:

N2O_{D(mm)} = \frac{44}{28} \sum_{S} \left( N \times AWMS_S \times EF3_S \right)

where:

N2O_D(mm)

Direct N2O emissions from Manure Management.

44/28

Conversion factor from N2O–N to N2O.

N

Nitrogen excreted (kg N).

AWMS_S

Fraction of excreted nitrogen managed in manure management system S.

EF3_S

Direct emission factor for system S (kg N2O–N per kg N managed).

In this implementation, calculations are performed at daily, per-head resolution using nitrogen_excretion (kg N/head/day) - see also calc_nitrogen_excretion.

Daily emissions are computed as:

\begin{aligned} N2O &= nitrogen\_excretion \times ratio\_N2ON\_to\_N2O \times \\ & \sum \left( manure\_management\_system\_fraction \times n2o\_ef3 \right) \end{aligned}

This function is part of the run_emissions_manure_module().

Value

A named list with the following elements:

n2o_manure_pasture_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure deposited on pasture (kg N2O/head/day).

n2o_manure_burned_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure burned for fuel (kg N2O/head/day).

n2o_manure_other_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure management systems, excluding emissions from manure deposited on pasture and burned for fuel (kg N2O/head/day).

n2o_manure_all_noburn_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure management systems, excluding manure burned for fuel (kg N2O/head/day).

References

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management. Equation 10.25.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management. Equation 10.25.

See Also

run_emissions_manure_module

Examples

calc_n2o_manure_direct(
  ratio_N2ON_to_N2O = 44 / 28,
  nitrogen_excretion = 0.9,
  mms_burned = c(
    manure_management_system_fraction = 0.020,
    n2o_ef3  = 0
  ),
  mms_drylot = c(
    manure_management_system_fraction = 0.264,
    n2o_ef3  = 0.02
  ),
  mms_pasture = c(
    manure_management_system_fraction = 0.310,
    n2o_ef3  = 0.02
  ),
  mms_solid = c(
    manure_management_system_fraction = 0.406,
    n2o_ef3  = 0.005
  )
)


Calculate indirect Nitrous Oxide (N2O) emissions from manure leaching and runoff

Description

Calculates daily indirect nitrous oxide (N2O) emissions resulting from nitrogen leaching and runoff from manure management systems and separates emissions from manure deposited on pasture, manure burned for fuel, and all other manure management systems.

Usage

calc_n2o_manure_leaching(ratio_N2ON_to_N2O = 44/28, nitrogen_excretion, ...)

Arguments

ratio_N2ON_to_N2O

Numeric. Conversion factor from kg N2O–N to kg N2O, based on molecular weights. Defaults to 44/28.

nitrogen_excretion

Numeric. Daily nitrogen excretion (kg N/head/day).

...

A variable number of manure management system (MMS) arguments. Each MMS must be provided as a named numeric vector with exactly the following fields:

manure_management_system_fraction

Numeric. Fraction of total manure excreted by animals in a given herd and cohort that is handled in a specific manure management system. Values ranges from 0 to 1. The sum of all fractions for each herd_id must equal 1.

n2o_ef5

Numeric. Emission factor for indirect nitrous oxide (N2O) emissions resulting from nitrogen leaching and runoff, expressed as kilograms of N2O–N per kilogram of nitrogen leached or lost through runoff (kg N2O–N / kg N). Default values can be selected from Table 11.3 in IPCC Guidelines (IPCC 2006, 2019).

nitrogen_fracleach

Numeric. Fraction of manure nitrogen excreted by a given livestock category that is lost through leaching and runoff from a specific manure management system. This parameter is highly uncertain and is used to estimate indirect N2O emissions from nitrogen that enters the surrounding environment of the storage facility. It is expressed as a dimensionless fraction (0–1). Default values are provided in Table 10.22 of IPCC Guidelines (IPCC 2006, 2019).

Two MMS names are treated explicitly when present:

mms_pasture

Manure deposited on pasture.

mms_burned

Manure burned for fuel.

All remaining MMS arguments are grouped and treated as other manure management systems.

Details

This calculation follows the Tier 2 methodology for indirect N2O emissions from manure management as defined in Equations 10.28 (IPCC, 2006), 10.27 (IPCC, 2019), and 10.29 (IPCC, 2006, 2019).

In the IPCC formulation, indirect emissions associated with nitrogen leaching and runoff are calculated as:

N2O_{L(mm)} = \frac{44}{28} \sum_{S} \left( N \times AWMS_S \times FracLeach_{S} \times EF5 \right)

where:

N2O_L(mm)

Indirect N2O emissions due to leaching and runoff from Manure Management.

44/28

Conversion factor from N2O–N to N2O.

N

Nitrogen excreted (kg N).

AWMS_S

Fraction of excreted nitrogen managed in manure management system S.

FracLeach_{S}

Fraction of nitrogen lost through leaching and runoff in manure management system S.

EF5

Emission factor for indirect N2O emissions from leaching and runoff (kg N2O–N per kg N leached or lost through runoff).

In this implementation, calculations are performed at daily, per-head resolution using nitrogen_excretion (kg N/head/day):

\begin{aligned} N_2O &= nitrogen\_excretion \times ratio\_N2ON\_to\_N2O \times \\ & \sum_{S} \left( manure\_management\_system\_fraction \times nitrogen\_fracleach \times n2o\_ef5 \right) \end{aligned}

This function is part of the run_emissions_manure_module().

Value

A named list with the following elements

n2o_manure_pasture_leach

Numeric. Indirect nitrous oxide (N2O) emissions resulting from leaching and runoff of manure nitrogen from manure deposited on pasture (kg N2O/head/day).

n2o_manure_burned_leach

Numeric. Indirect nitrous oxide (N2O) emissions resulting from leaching and runoff of manure nitrogen from manure burned for fuel (kg N2O/head/day).

n2o_manure_other_leach

Numeric. Indirect nitrous oxide (N2O) emissions resulting from leaching and runoff of manure nitrogen from manure management systems, excluding losses from manure deposited on pasture and manure burned for fuel (kg N2O/head/day).

n2o_manure_all_noburn_leach

Numeric. Indirect nitrous oxide (N2O) emissions resulting from leaching and runoff of manure nitrogen from manure management systems, excluding losses from manure burned for fuel (kg N2O/head/day).

References

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management. Equations 10.27; 10.29.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Volume 4, Chapter 10: Emissions from Livestock and Manure Management. Equations 10.28; 10.29.

See Also

run_emissions_manure_module

Examples

calc_n2o_manure_leaching(
  ratio_N2ON_to_N2O = 44 / 28,
  nitrogen_excretion = 0.9,
  mms_burned = c(
    manure_management_system_fraction = 0.020,
    n2o_ef5 = 0.011,
    nitrogen_fracleach = 0
  ),
  mms_drylot = c(
    manure_management_system_fraction = 0.264,
    n2o_ef5 = 0.011,
    nitrogen_fracleach = 0.035
  ),
  mms_pasture = c(
    manure_management_system_fraction = 0.310,
    n2o_ef5 = 0.011,
    nitrogen_fracleach = 0.24
  ),
  mms_solid = c(
    manure_management_system_fraction = 0.406,
    n2o_ef5 = 0.011,
    nitrogen_fracleach = 0.02
  )
)


Calculate total Nitrous Oxide (N2O) emissions from manure

Description

Aggregates direct and indirect nitrous oxide (N2O) emissions from manure, by manure management system group (deposited on pasture, burned for fuel, and all other systems). Indirect emissions include contributions from volatilization and from leaching and runoff.

Usage

calc_n2o_manure_total(
  n2o_manure_pasture_vol,
  n2o_manure_pasture_leach,
  n2o_manure_burned_vol,
  n2o_manure_burned_leach,
  n2o_manure_other_vol,
  n2o_manure_other_leach,
  n2o_manure_pasture_direct,
  n2o_manure_burned_direct,
  n2o_manure_other_direct
)

Arguments

n2o_manure_pasture_vol

Numeric. Indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3 and NOx) from manure deposited on pasture (kg N2O/head/day).

n2o_manure_pasture_leach

Numeric. Indirect nitrous oxide (N2O) emissions resulting from leaching and runoff of manure nitrogen from manure deposited on pasture (kg N2O/head/day).

n2o_manure_burned_vol

Numeric. Indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3 and NOx) from manure burned for fuel (kg N2O/head/day).

n2o_manure_burned_leach

Numeric. Indirect nitrous oxide (N2O) emissions resulting from leaching and runoff of manure nitrogen from manure burned for fuel (kg N2O/head/day).

n2o_manure_other_vol

Numeric. Indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3 and NOx) from manure management systems, excluding manure deposited on pasture and manure burned for fuel (kg N2O/head/day).

n2o_manure_other_leach

Numeric. Indirect nitrous oxide (N2O) emissions resulting from leaching and runoff of manure nitrogen from manure management systems, excluding losses from manure deposited on pasture and manure burned for fuel (kg N2O/head/day).

n2o_manure_pasture_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure deposited on pasture (kg N2O/head/day).

n2o_manure_burned_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure burned for fuel (kg N2O/head/day).

n2o_manure_other_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure management systems, excluding emissions from manure deposited on pasture and burned for fuel (kg N2O/head/day).

Details

The following aggregations are applied:

n2o\_manure\_pasture\_indirect = n2o\_vol\_manure\_pasture + n2o\_leach\_manure\_pasture

n2o\_manure\_burned\_indirect = n2o\_vol\_manure\_burned + n2o\_leach\_manure\_burned

n2o\_manure\_other\_indirect = n2o\_vol\_manure\_other + n2o\_leach\_manure\_other

n2o\_manure\_pasture\_total = n2o\_manure\_pasture\_indirect + n2o\_manure\_pasture\_direct

n2o\_manure\_burned\_total = n2o\_manure\_burned\_indirect + n2o\_manure\_burned\_direct

n2o\_manure\_other\_total = n2o\_manure\_other\_indirect + n2o\_manure\_other\_direct

Value

A named list with:

n2o_manure_pasture_indirect

Numeric. Total indirect nitrous oxide (N2O) emissions from manure deposited on pasture. Includes emissions from atmospheric deposition of volatilised nitrogen (NH3 and NOx) and from leaching and runoff of manure nitrogen (kg N2O/head/day).

n2o_manure_burned_indirect

Numeric. Total indirect nitrous oxide (N2O) emissions originating from manure burned for fuel. Includes emissions from atmospheric deposition of volatilised nitrogen (NH3 and NOx) and from leaching and runoff of manure nitrogen (kg N2O/head/day).

n2o_manure_other_indirect

Numeric. Total indirect nitrous oxide (N2O) emissions originating from manure management systems, excluding manure deposited on pasture and manure burned for fuel. Includes emissions from atmospheric deposition of volatilised nitrogen (NH3 and NOx) and from leaching and runoff of manure nitrogen (kg N2O/head/day).

n2o_manure_pasture_total

Numeric. Total nitrous oxide (N2O) emissions from manure deposited on pasture. Includes direct emissions and indirect emissions from volatilisation, leaching, and runoff (kg N2O/head/day).

n2o_manure_burned_total

Numeric. Total nitrous oxide (N2O) emissions from manure burned for fuel. Includes direct emissions and indirect emissions from volatilisation, leaching, and runoff (kg N2O/head/day).

n2o_manure_other_total

Numeric. Total nitrous oxide (N2O) emissions from manure management systems, excluding manure deposited on pasture and manure burned for fuel. Includes direct emissions and indirect emissions from volatilisation, leaching, and runoff (kg N2O/head/day).

This function is part of the run_emissions_manure_module().

See Also

run_emissions_manure_module

Examples

calc_n2o_manure_total(
  n2o_manure_pasture_vol = 0.0129,
  n2o_manure_pasture_leach = 0.0012,
  n2o_manure_burned_vol = 0,
  n2o_manure_burned_leach = 0,
  n2o_manure_other_vol = 0.052,
  n2o_manure_other_leach = 0.00027,
  n2o_manure_pasture_direct = 0.009,
  n2o_manure_burned_direct = 0,
  n2o_manure_other_direct = 0.01033
)


Calculate indirect Nitrous Oxide (N2O) emissions from manure volatilization

Description

Calculates daily indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3–N and NOx–N) from manure management systems and separates emissions from manure deposited on pasture, manure burned for fuel, and all other manure management systems.

Usage

calc_n2o_manure_volatilization(
  ratio_N2ON_to_N2O = 44/28,
  nitrogen_excretion,
  ...
)

Arguments

ratio_N2ON_to_N2O

Numeric. Conversion factor from kg N2O–N to kg N2O, based on molecular weights. Defaults to 44/28.

nitrogen_excretion

Numeric. Daily nitrogen excretion (kg N/head/day).

...

A variable number of manure management system (MMS) arguments. Each MMS must be provided as a named numeric vector with exactly the following fields:

manure_management_system_fraction

Numeric. Fraction of total manure excreted by animals in a given herd and cohort that is handled in a specific manure management system. Values ranges from 0 to 1. The sum of all fractions for each herd_id must equal 1.

n2o_ef4

Numeric. Emission factor for indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3–N and NOx–N) onto soils and water surfaces (kg N2O–N per kg NH3–N + NOx–N). Default values can be selected from Table 11.3 in IPCC Guidelines (IPCC 2006, 2019).

nitrogen_fracgas

Numeric. Fraction of manure nitrogen excreted by a given livestock category that is lost through volatilisation as ammonia (NH3) and nitrogen oxides (NOx) within a specific manure management system. This parameter represents the share of excreted nitrogen that is mineralised and released to the atmosphere during manure collection, storage, and treatment. It is expressed as a dimensionless fraction (0–1). Default values are provided in Table 10.22 of IPCC Guidelines (IPCC 2006, 2019).

Two MMS names are treated explicitly when present:

mms_pasture

Manure deposited on pasture.

mms_burned

Manure burned for fuel.

All remaining MMS arguments are grouped and treated as other manure management systems.

Details

This calculation follows the Tier 2 methodology for indirect N2O emissions from manure management as defined in the IPCC Guidelines in Equations 10.26 (IPCC, 2006, 2019), 10.27 (IPCC, 2006) and 10.28 (IPCC, 2019).

In the IPCC formulation, indirect emissions from atmospheric deposition of volatilised nitrogen are calculated as:

N2O_{G(mm)} = \frac{44}{28} \sum_{S} \left( N \times AWMS_S \times FracGas_{S} \times EF4 \right)

where:

N2O_G(mm)

Indirect N2O emissions due to volatilization of N from Manure Management.

44/28

Conversion factor from N2O-N to N2O.

N

Nitrogen excreted (kg N).

AWMS_S

Fraction of excreted nitrogen managed in manure management system S.

FracGas_{S}

Fraction of nitrogen volatilised as NH3–N and NOx–N in manure management system S.

EF4

Emission factor for indirect N2O emissions from atmospheric deposition (kg N2O-N per kg NH3–N + NOx–N).

In this implementation, calculations are performed at daily, per-head resolution using nitrogen_excretion (kg N/head/day):

\begin{aligned} N_2O &= nitrogen\_excretion \times ratio\_N2ON\_to\_N2O \times \\ & \sum_{S} \left( manure\_management\_system\_fraction \times nitrogen\_fracgas \times n2o\_ef4 \right) \end{aligned}

This function is part of the run_emissions_manure_module().

Value

A named list with the following elements:

n2o_manure_pasture_vol

Numeric. Indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3 and NOx) from manure deposited on pasture (kg N2O/head/day).

n2o_manure_burned_vol

Numeric. Indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3 and NOx) from manure burned for fuel (kg N2O/head/day).

n2o_manure_other_vol

Numeric. Indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3 and NOx) from manure management systems, excluding manure deposited on pasture and manure burned for fuel (kg N2O/head/day).

n2o_manure_all_noburn_vol

Numeric. Indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3 and NOx) from manure management systems, excluding losses from manure burned for fuel (kg N2O/head/day).

References

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management. Equation 10.26; 10.28.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management. Equation 10.26; 10.27.

See Also

run_emissions_manure_module

Examples

calc_n2o_manure_volatilization(
  ratio_N2ON_to_N2O = 44 / 28,
  nitrogen_excretion = 0.9,
  mms_burned = c(
    manure_management_system_fraction = 0.020,
    n2o_ef4 = 0.14,
    nitrogen_fracgas = 0
  ),
  mms_drylot = c(
    manure_management_system_fraction = 0.264,
    n2o_ef4 = 0.14,
    nitrogen_fracgas = 0.3
  ),
  mms_pasture = c(
    manure_management_system_fraction = 0.310,
    n2o_ef4 = 0.14,
    nitrogen_fracgas = 0.21
  ),
  mms_solid = c(
    manure_management_system_fraction = 0.406,
    n2o_ef4 = 0.14,
    nitrogen_fracgas = 0.45
  )
)


Calculate a ration component's contribution to nitrous oxide (N2O) emissions from crop residues decomposition

Description

Calculates the contribution of an individual feed component to nitrous oxide (N2O) emissions from crop residues decomposition in feed production, using feed-specific emission factors weighted by the component's share in the ration.

Usage

calc_n2o_ration_crop_residues(feed_ration_fraction, n2o_feed_crop_residues)

Arguments

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration, expressed as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

n2o_feed_crop_residues

Numeric. Nitrous oxide (N2O) emission factor of a feed component, representing N2O emissions from crop residues decomposition in feed production, expressed per kg of dry matter intake (g N2O/kg DM).

Details

The contribution is computed as:

diet\_n2o\_feed\_crop\_residues = feed\_ration\_fraction \times n2o\_feed\_crop\_residues

This function is part of the run_emissions_ration_module().

Value

Numeric. Contribution of an individual feed component to the diet-level average nitrous oxide (N2O) emission factor from crop residues decomposition in feed production (g N2O/kg DM).

See Also

run_emissions_ration_module


Calculate a ration component's contribution to nitrous oxide (N2O) emissions from fertilizer use

Description

Calculates the contribution of an individual feed component to nitrous oxide (N2O) emissions from synthetic fertilizer in feed production, using feed-specific emission factors weighted by the component's share in the ration.

Usage

calc_n2o_ration_fertilizer(feed_ration_fraction, n2o_feed_fertilizer)

Arguments

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration, expressed as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

n2o_feed_fertilizer

Numeric. Nitrous oxide (N2O) emission factor of a feed component, representing N2O emissions from fertilizer use in feed production, expressed per kg of dry matter intake (g N2O/kg DM).

Details

The contribution is computed as:

diet\_n2o\_feed\_fertilizer = feed\_ration\_fraction \times n2o\_feed\_fertilizer

This function is part of the run_emissions_ration_module().

Value

Numeric. Contribution of an individual feed component to the diet-level average nitrous oxide (N2O) emission factor from fertilizer use in feed production (g N2O/kg DM).

See Also

run_emissions_ration_module


Calculate a ration component's contribution to nitrous oxide (N2O) emissions from manure application and deposition

Description

Calculates the contribution of an individual feed component to nitrous oxide (N2O) emissions from manure application to or deposition on soil in feed production, using feed-specific emission factors weighted by the component's share in the ration.

Usage

calc_n2o_ration_manure(feed_ration_fraction, n2o_feed_manure_applied)

Arguments

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration, expressed as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

n2o_feed_manure_applied

Numeric. Nitrous oxide (N2O) emission factor of a feed component, representing N2O emissions from manure applied to or deposited on soil in feed production, expressed per kg of dry matter intake (g N2O/kg DM).

Details

The contribution is computed as:

diet\_n2o\_feed\_manure\_applied = feed\_ration\_fraction \times n2o\_feed\_manure\_applied

This function is part of the run_emissions_ration_module().

Value

Numeric. Contribution of an individual feed component to the diet-level average nitrous oxide (N2O) emission factor from manure applied to or deposited on soil in feed production (g N2O/kg DM).

See Also

run_emissions_ration_module


Calculate daily nitrogen excretion

Description

Calculates daily nitrogen excretion per animal (kg N/head/day) as the difference between nitrogen intake and nitrogen retention.

Usage

calc_nitrogen_excretion(species_short, nitrogen_intake, nitrogen_retention)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

nitrogen_intake

Numeric. Daily nitrogen intake (kg N/head/day).

nitrogen_retention

Numeric. Daily nitrogen retention in animal body tissues and products (e.g., growth, pregnancy, milk...) (kg N/head/day).

Details

Nitrogen excretion represents the fraction of consumed nitrogen that is not retained in animal tissues or products and is therefore excreted in urine and dung.

Nitrogen excretion is calculated as:

nitrogen\_excretion = nitrogen\_intake - nitrogen\_retention

where all quantities are expressed in kg N/head/day.

This quantity forms the basis for subsequent calculations of nitrous oxide (N2O) emissions from manure management under the IPCC Tier 2 methodology.

Value

Numeric. Daily nitrogen excretion (kg N/head/day).

References

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management. Equation 10.31A.

This function is part of the run_nitrogen_balance_module().

See Also

run_nitrogen_balance_module, calc_nitrogen_retention


Calculate daily nitrogen intake

Description

Calculates the daily nitrogen intake per head (kg N/head/day) as the product of feed dry matter intake (DMI) and diet nitrogen content.

Usage

calc_nitrogen_intake(ration_intake, ration_nitrogen)

Arguments

ration_intake

Numeric. Average daily dry matter intake of feed (kg DM/head/day).

ration_nitrogen

Numeric. Average nitrogen content of diet (kg N/kg DM).

Details

This approach follows the IPCC Tier 2 approach and estimates ration_intake as follows:

nitrogen\_intake = dry\_matter\_intake \times diet\_nitrogen

This function is part of the run_nitrogen_balance_module().

Value

Numeric. Daily nitrogen intake (kg N/head/day).

References

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management. Equation 10.32.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management. Equation 10.32.

See Also

run_nitrogen_balance_module, calc_ration_intake, run_metabolic_energy_req_module, calc_ration_nitrogen_content, run_ration_quality_module


Calculate daily nitrogen retention

Description

Calculates daily nitrogen retention per animal by species and cohort (kg N/head/day). Nitrogen retention represents the portion of consumed nitrogen that is incorporated into animal products or body tissues.

Usage

calc_nitrogen_retention(
  species_short,
  cohort_short,
  milk_protein_fraction = NA_real_,
  milk_yield_day = NA_real_,
  daily_weight_gain = NA_real_,
  fibre_yield_year = NA_real_,
  litter_size = NA_real_,
  parturition_rate = NA_real_,
  live_weight_at_weaning = NA_real_,
  live_weight_at_birth = NA_real_,
  pregnancy_duration = NA_real_,
  cohort_duration_days = NA_real_
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

milk_protein_fraction

Numeric. Milk protein fraction (kg protein / kg milk). Required only for species = CML, CTL, BFL, SHP, and GTS.

milk_yield_day

Numeric. Average milk yield per milk-producing animal during the assessment duration (kg/head/day). This value is calculated as the total quantity of milk produced for human consumption by milk-producing animals during the assessment period, divided by the number of milk-producing animals, and the length of the assessment period (days). Required only for species = CML, CTL, BFL, SHP, and GTS.

daily_weight_gain

Numeric. Average live weight gain of the cohort over the cohort stage (kg/head/day).

fibre_yield_year

Numeric. Annual production yield of fibre, such as wool, cashmere, mohair (kg/head/year). Required only for species = CML, SHP, and GTS.

litter_size

Numeric. Average number of offspring born per parturition (# offsprings/parturition). This value can be calculated as the total number of offspring born divided by the total number of parturitions during the year.

parturition_rate

Numeric. Average annual number of parturitions per female animal (# parturitions/adult female/year). A herd-level reproductive performance indicator calculated as the total number of parturitions (deliveries) occurring during a year divided by the number of adult females potentially able to give birth during that year.

live_weight_at_weaning

Numeric. Live weight of the animal at weaning (kg).

live_weight_at_birth

Numeric. Live weight of the animal at birth (kg).

pregnancy_duration

Numeric. Duration of pregnancy period (days).

cohort_duration_days

Numeric. Amount of time that each animal spends in a specific cohort (days).

Details

Species-specific nitrogen retention calculations are applied.

For CTL, BFL, SHP, GTS, and CML:

Nitrogen retained in products and tissues is computed consistent with the process described in the Technical paper from MPI (Ministry for Primary Industries (MPI), 2025), where nitrogen retention is calculated as the sum of:

Coefficients for nitrogen content of deposited tissue, fibre, and milk are derived from Chapter 5 (Nitrogen Excretion) of the MPI Technical paper.

The following constants are used:

For PGS

Nitrogen retention is calculated following the IPCC (2019) Tier 2 equations for swine (Equations 10.33A and 10.33B).

Nitrogen retention includes nitrogen retained in:

In this implementation:

This function is part of the run_nitrogen_balance_module().

Value

Numeric. Daily nitrogen retention in animal body tissues and products (e.g., growth, pregnancy, milk...) (kg N/head/day)

References

Ministry for Primary Industries (MPI). (2025). Detailed methodologies for agricultural greenhouse gas emission calculation: Methodology for calculation of New Zealand’s agricultural greenhouse gas emissions (Version 11). MPI Technical Paper, Wellington, New Zealand. Chapter 5.

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management. Equation 10.33A, 10.33B.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management. Equation 10.33.

See Also

run_nitrogen_balance_module


Calculate one year of steady-state population dynamics

Description

Calculates one year of population dynamics under steady-state assumptions using demographic parameters and returns population size statistics and offtake results. 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.

Usage

calc_projected_population_size(
  herd_size_total,
  fecundity_female,
  fecundity_male,
  probability_death,
  probability_offtake,
  probability_growth,
  growth_rate_herd,
  herd_structure,
  cohort_share
)

Arguments

herd_size_total

Numeric. Total population size at the start of the year, including all cohorts (# heads)

fecundity_female

Numeric. Daily number of female offspring per adult female (# offspring/day)

fecundity_male

Numeric. Daily number of male offspring per adult female (# offspring/day)

probability_death

Named numeric vector of length 10. Probability of animal dying within the model time interval for 10 cohorts (fraction) (cohorts= FB: Female Birth, FJ: Female Juvenile, FS: Female Sub-adult, FA: Female Adult, FC: Female Culling, MB: Male Birth, MJ: Male Juvenile, MS: Male Sub-adult, MA: Male Adult, MC: Male Culling).

probability_offtake

Named numeric vector of length 10. Probability that an animal will be removed from the herd within the model time interval for 10 cohorts (fraction). (cohorts= FB: Female Birth, FJ: Female Juvenile, FS: Female Sub-adult, FA: Female Adult, FC: Female Culling, MB: Male Birth, MJ: Male Juvenile, MS: Male Sub-adult, MA: Male Adult, MC: Male Culling).

probability_growth

Named numeric vector of length 10. Probability of growing into the next age class for 10 cohorts (fraction) (cohorts= FB: Female Birth, FJ: Female Juvenile, FS: Female Sub-adult, FA: Female Adult, FC: Female Culling, MB: Male Birth, MJ: Male Juvenile, MS: Male Sub-adult, MA: Male Adult, MC: Male Culling).

growth_rate_herd

Numeric. Annualized growth rate at which the herd reaches steady state (fraction)

herd_structure

Named numeric vector of length 8. Final steady-state share of each of 8 sex-age cohorts (FB, FJ, FS, FA, MB, MJ, MS, MA) (fraction). Shares should sum to 1.

cohort_share

Named numeric vector of length 6. Final steady-state share of 6 grouped sex-age cohorts (FJ, FS, FA, MJ, MS, MA, where FJ = FB + FJ and MJ = MB + MJ) (fraction). Shares should sum to 1.

Value

A named list with:

cohort_stock_start

Numeric vector of length 6. Population size in each of the 6 sex–age cohorts at the start of the year (# heads). (cohorts= FJ, FS, FA, MJ, MS, MA)

cohort_stock_end_projected

Numeric vector of length 6. Population size in each of the 6 sex–age cohorts at the end of the year, projected using the steady-state growth rate (# heads). (cohorts= FJ, FS, FA, MJ, MS, MA)

cohort_stock_end_exact_simulated

Numeric vector of length 10. Population size in each of 10 sex–age cohort at the end of the year, based on a demographic daily simulation over 365 days (# heads) (cohorts= FB: Female Birth, FJ: Female Juvenile, FS: Female Sub-adult, FA: Female Adult, FC: Female Culling, MB: Male Birth, MJ: Male Juvenile, MS: Male Sub-adult, MA: Male Adult, MC: Male Culling)

cohort_stock_average

Numeric vector of length 6. Average population size in each of the 6 sex–age cohorts over the year (# heads). Estimated from cohort_stock_start and cohort_stock_end_projected (cohorts= FJ, FS, FA, MJ, MS, MA)

cohort_offtake_heads

Numeric vector of length 10. Total number of animals removed from the herd over the year, by 10 sex–age cohorts (heads/year) (cohorts= FB: Female Birth, FJ: Female Juvenile, FS: Female Sub-adult, FA: Female Adult, FC: Female Culling, MB: Male Birth, MJ: Male Juvenile, MS: Male Sub-adult, MA: Male Adult, MC: Male Culling)

This function is part of the run_demographic_herd_module().

See Also

run_demographic_herd_module()


Calculate diet ash contribution for a ration component

Description

Calculates the contribution of a single feed component to diet ash content by weighting feed ash content by its ration composition share.

Usage

calc_ration_ash(feed_ration_fraction, feed_ash)

Arguments

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration, expressed as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

feed_ash

Numeric. Average ash content by feed component, expressed as a fraction of the dry matter intake (g ash/100g DM).

Details

The ash contribution is defined as:

ration\_ash = feed\_ration\_fraction \times feed\_ash / 100

Ash content is expressed as a percentage (g/100g DM); the result is a fraction.

This function is part of the run_ration_quality_module().

Value

Numeric. Contribution of the feed component to total diet ash content (kg ash/kg DM).

See Also

run_ration_quality_module


Calculate diet digestibility contribution for a ration component

Description

Applies species-specific digestibility parameters to a ration composition share to compute the contribution of a single feed component to total diet digestibility.

Usage

calc_ration_digestibility(
  species_short,
  feed_ration_fraction,
  feed_digestibility_fraction_ruminant = NA_real_,
  feed_digestibility_fraction_pigs = NA_real_
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration, expressed as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

feed_digestibility_fraction_ruminant

Numeric. Digestibility of a feed component for ruminants, expressed as the ratio of digestible energy to gross energy content (fraction).

feed_digestibility_fraction_pigs

Numeric. Digestibility of a feed component for pigs, expressed as the ratio of digestible energy to gross energy content (fraction).

Details

The digestibility contribution uses the animal-specific digestibility ratio:

This function is part of the run_ration_quality_module().

Value

Numeric. Contribution of the feed component to total diet digestibility (fraction).

See Also

run_ration_quality_module


Calculate diet gross energy contribution for a ration component

Description

Computes the contribution of a single feed component to diet gross energy content by weighting feed gross energy by its ration composition share.

Usage

calc_ration_gross_energy(feed_ration_fraction, feed_gross_energy)

Arguments

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration, expressed as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

feed_gross_energy

Numeric. Gross energy content of a feed component, representing the total chemical energy released upon complete combustion of the feed (MJ/kg DM).

Details

The gross energy contribution is defined as:

diet\_gross\_energy = feed\_ration\_fraction \times feed\_gross\_energy

This function is part of the run_ration_quality_module().

Value

Numeric. Contribution of the feed component to total diet gross energy content (MJ/kg DM).

See Also

run_ration_quality_module


Calculate daily ration intake in dry matter

Description

Calculates daily feed intake as dry matter intake (DMI) per animal (kg DM/head/day) from the animal's daily energy requirement and the diet energy density.

Usage

calc_ration_intake(
  species_short,
  metabolic_energy_req_total,
  ration_gross_energy,
  ration_metabolizable_energy
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

metabolic_energy_req_total

Numeric. Total daily energy requirement (MJ/head/day). For CTL, BFL, SHP and GTS this is expressed as gross energy intake requirement (GE). For CML and PGS the function returns the summed daily metabolizable energy requirement.

ration_gross_energy

Numeric. Average gross energy content of the diet (MJ/kg DM).

ration_metabolizable_energy

Numeric. Average metabolizable energy content of the diet (MJ/kg DM).

Details

This function follows the IPCC Tier 2 framework. DMI is computed by dividing the appropriate daily energy requirement by the corresponding diet energy content (MJ/kg DM).

This function is part of the run_metabolic_energy_req_module().

Value

Numeric. Average daily dry matter intake of feed (kg DM/head/day).

References

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Volume 4 (AFOLU), Chapter 10: Emissions from Livestock and Manure Management.

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Volume 4 (AFOLU), Chapter 10: Emissions from Livestock and Manure Management.

See Also

run_metabolic_energy_req_module, calc_total_metabolic_energy_req calc_ration_gross_energy calc_ration_metabolizable_energy


Calculate diet metabolizable energy contribution for a ration component

Description

Applies species-specific metabolizable energy parameters to a ration composition share to compute the contribution of a single feed component to total diet metabolizable energy content.

Usage

calc_ration_metabolizable_energy(
  species_short,
  feed_ration_fraction,
  feed_metabolizable_energy_ruminant = NA_real_,
  feed_metabolizable_energy_pigs = NA_real_
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration, expressed as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

feed_metabolizable_energy_ruminant

Numeric. Metabolizable energy content of a feed component for ruminants, representing digestible energy minus energy losses in urine and gaseous products of digestion (MJ/kg DM).

feed_metabolizable_energy_pigs

Numeric. Metabolizable energy content of a feed component for pigs, representing digestible energy minus energy losses in urine and gaseous products of digestion (MJ/kg DM).

Details

The metabolizable energy contribution uses the animal-specific parameter:

This function is part of the run_ration_quality_module().

Value

Numeric. Contribution of the feed component to total diet metabolizable energy content (MJ/kg DM).

See Also

run_ration_quality_module


Calculate diet nitrogen contribution for a ration component

Description

Calculates the contribution of a single feed component to diet nitrogen content by weighting feed nitrogen content by its ration composition share.

Usage

calc_ration_nitrogen_content(feed_ration_fraction, feed_nitrogen_content)

Arguments

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration, expressed as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

feed_nitrogen_content

Numeric. Nitrogen content of a feed component (kg N/kg DM).

Details

The nitrogen contribution is defined as:

diet\_nitrogen = feed\_ration\_fraction \times feed\_nitrogen\_content

Value

Numeric. Contribution of the feed component to total diet nitrogen content (kg N/kg DM).


Calculate urinary energy fraction contribution for a ration component

Description

Applies species-specific urinary energy fractions to a ration composition share to compute the contribution of a feed component to urinary energy losses.

Usage

calc_ration_urinary_energy_fraction(
  species_short,
  feed_ration_fraction,
  feed_urinary_energy_ruminant = NA_real_,
  feed_urinary_energy_pigs = NA_real_
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration, expressed as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

feed_urinary_energy_ruminant

Numeric. Fraction of feed's gross energy that is excreted in urine for ruminants (fraction).

feed_urinary_energy_pigs

Numeric. Fraction of feed's gross energy that is excreted in urine for pigs (fraction).

Details

The urinary energy fraction contribution uses the animal-specific parameter:

This function is part of the run_ration_quality_module().

Value

Numeric. Contribution of the feed component to the fraction of total diet gross energy that is excreted in urine (fraction).

See Also

run_ration_quality_module


Calculate the ratio of net energy available for growth in the diet (REG – Net Energy for Growth / Digestible Energy)

Description

Calculates the ratio of net energy available for growth to digestible energy consumed (fraction), which represents the efficiency with which digestible energy in the diet is converted into net energy retained as body tissue.

Usage

calc_reg_growth(species_short, ration_digestibility_fraction = NA_real_)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

ration_digestibility_fraction

Numeric. Average digestibility of the feed ration, expressed as ratio of digestible to gross energy content (fraction).

Details

This component follows the IPCC Tier 2 partitioning approach and returns REG for ruminants (CTL, BFL, SHP, GTS) as:

net\_energy\_growth\_digestible\_energy\_ratio = 1.164 - 0.005160 \times diet\_digestibility\_fraction \times 100 + 0.00001308 \times (diet\_digestibility\_fraction \times 100)^2 - \frac{37.4}{diet\_digestibility\_fraction \times 100}

For Other species REG is not applicable and the function returns NA_real_.

This function is part of the run_metabolic_energy_req_module().

Value

Numeric. Ratio of net energy available for growth in the diet to digestible energy consumed (fraction).

References

Gibbs M.J., Johnson D.E. (1993) Livestock Emissions. In: International Methane Emissions. Washington, D.C., U.S.A: US Environmental Protection Agency, Climate Change Division.

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management, Equation 10.15.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management, Equation 10.15.

See Also

run_metabolic_energy_req_module, calc_ration_digestibility calc_total_metabolic_energy_req calc_ration_intake


Calculate ratio of net energy available for maintenance in the diet (REM - Net Energy for Maintenance / Digestible Energy)

Description

Calculates the ratio of net energy available in the diet for maintenance to digestible energy.

Usage

calc_rem_maintenance(species_short, ration_digestibility_fraction = NA_real_)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

ration_digestibility_fraction

Numeric. Average digestibility of the feed ration, expressed as ratio of digestible to gross energy content (fraction).

Details

This component follows the IPCC Tier 2 partitioning approach and it returns the value for ruminants (CTL, BFL, SHP, GTS) calculated as follows:

net\_energy\_maintenance\_digestible\_energy\_ratio = 1.123 - 0.004092 \times (diet\_digestibility\_fraction \times 100) + 0.00001126 \times (diet\_digestibility\_fraction \times 100)^2 - \frac{25.4}{diet\_digestibility\_fraction \times 100}

For the Other species REM is not applicable and the function returns NA_real_.

This function is part of the run_metabolic_energy_req_module().

Value

Numeric. Ratio of net energy available for maintenance in the diet to digestible energy consumed (fraction).

References

Gibbs M.J., Johnson D.E. (1993) Livestock Emissions. In: International Methane Emissions. Washington, D.C., U.S.A: US Environmental Protection Agency, Climate Change Division.

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management, Equation 10.14.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management, Equation 10.14.

See Also

run_metabolic_energy_req_module, calc_ration_digestibility calc_total_metabolic_energy_req calc_ration_intake


Calculate steady-state population structure

Description

Calculates population dynamics over time until a steady state is reached. 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. Tracks sex–age cohort structure and population growth based on survival, offtake, and fecundity parameters.

Usage

calc_steady_state_structure(
  initial_herd_structure,
  max_simulation_years,
  min_lambda_change,
  fecundity_female,
  fecundity_male,
  probability_death,
  probability_offtake,
  probability_growth
)

Arguments

initial_herd_structure

Named numeric vector of length 6. Initial number of individuals in each of the 6 sex-age classes used to bootstrap the steady-state simulation (# heads). These values are used as starting points for the iterative simulation and do not affect the final steady-state results (only convergence speed). Must be named with: FJ, FS, FA, MJ, MS, MA.

max_simulation_years

Numeric. Maximum number of years to simulate (years).

min_lambda_change

Numeric. Convergence threshold for changes in cohort-specific growth rates of sex–age cohort proportions (lambda). Iterations of the herd simulation stop when the absolute change in lambda between successive iterations falls below this threshold.

fecundity_female

Numeric. Daily number of female offspring per adult female (# offspring/day)

fecundity_male

Numeric. Daily number of male offspring per adult female (# offspring/day)

probability_death

Named numeric vector of length 10. Probability of animal dying within the model time interval for 10 cohorts (fraction) (cohorts= FB: Female Birth, FJ: Female Juvenile, FS: Female Sub-adult, FA: Female Adult, FC: Female Culling, MB: Male Birth, MJ: Male Juvenile, MS: Male Sub-adult, MA: Male Adult, MC: Male Culling).

probability_offtake

Named numeric vector of length 10. Probability that an animal will be removed from the herd within the model time interval for 10 cohorts (fraction). (cohorts= FB: Female Birth, FJ: Female Juvenile, FS: Female Sub-adult, FA: Female Adult, FC: Female Culling, MB: Male Birth, MJ: Male Juvenile, MS: Male Sub-adult, MA: Male Adult, MC: Male Culling).

probability_growth

Named numeric vector of length 10. Probability of growing into the next age class for 10 cohorts (fraction) (cohorts= FB: Female Birth, FJ: Female Juvenile, FS: Female Sub-adult, FA: Female Adult, FC: Female Culling, MB: Male Birth, MJ: Male Juvenile, MS: Male Sub-adult, MA: Male Adult, MC: Male Culling).

Value

A named list with:

days_to_steady_state

Numeric. Number of days required for the herd population structure to converge to a steady state, defined as the point at which successive iterations produce negligible changes in cohort proportions (days)

herd_structure

Named numeric vector of length 8. Final steady-state share of each of 8 sex-age cohorts (FB, FJ, FS, FA, MB, MJ, MS, MA) (fraction). Shares should sum to 1.

cohort_share

Named numeric vector of length 6. Final steady-state share of 6 grouped sex-age cohorts (FJ, FS, FA, MJ, MS, MA, where FJ = FB + FJ and MJ = MB + MJ) (fraction). Shares should sum to 1.

growth_rate_herd

Numeric. Annualized growth rate at which the herd reaches steady state (fraction)

This function is part of the run_demographic_herd_module().

See Also

run_demographic_herd_module()


Summarise offtake and stock Variation for a steady-state year

Description

Calculates annual offtake quantities and rates, as well as stock variation and their combined values across 6 sex-age classes based on steady-state population projections. 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.

Usage

calc_summary_offtake(
  cohort_stock_start,
  cohort_stock_end_projected,
  cohort_stock_average,
  cohort_offtake_heads,
  simulation_duration
)

Arguments

cohort_stock_start

Numeric vector of length 6. Population size in each of the 6 sex–age cohorts at the start of the year (# heads). (cohorts= FJ, FS, FA, MJ, MS, MA)

cohort_stock_end_projected

Numeric vector of length 6. Population size in each of the 6 sex–age cohorts at the end of the year, projected using the steady-state growth rate (# heads). (cohorts= FJ, FS, FA, MJ, MS, MA)

cohort_stock_average

Numeric vector of length 6. Average population size in each of the 6 sex–age cohorts over the year (# heads). Estimated from cohort_stock_start and cohort_stock_end_projected (cohorts= FJ, FS, FA, MJ, MS, MA)

cohort_offtake_heads

Numeric vector of length 10. Total number of animals removed from the herd over the year, by 10 sex–age cohorts (heads/year) (cohorts= FB: Female Birth, FJ: Female Juvenile, FS: Female Sub-adult, FA: Female Adult, FC: Female Culling, MB: Male Birth, MJ: Male Juvenile, MS: Male Sub-adult, MA: Male Adult, MC: Male Culling)

simulation_duration

Numeric. Length of the assessment period (days)

Value

A named list with:

stock_variation_heads

Numeric vector of length 6. Change in population size between the start and end of the year for each sex–age cohort (# heads) (cohorts= FJ, FS, FA, MJ, MS, MA).

offtake_heads

Numeric vector of length 6. Total number of animals removed via offtake over the year, aggregated to 6 sex–age cohorts (heads/year) (cohorts= FJ, FS, FA, MJ, MS, MA)

offtake_heads_assessment

Numeric vector of length 6. Total number of animals removed via offtake over the assessment period, aggregated to 6 sex–age cohorts (heads/assessment period) (cohorts= FJ, FS, FA, MJ, MS, MA)

offtake_rate_to_stock_start

Numeric vector of length 6. Offtake rate relative to the starting population size in each sex–age cohort (fraction) (cohorts= FJ, FS, FA, MJ, MS, MA)

offtake_rate_to_stock_average

Numeric vector of length 6. Offtake rate relative to the average population size in each sex–age cohort (fraction) (cohorts= FJ, FS, FA, MJ, MS, MA)

offtake_stock_variation_heads

Numeric vector of length 6. Sum of offtake and stock variation for each sex–age cohort over the year (# heads) (cohorts= FJ, FS, FA, MJ, MS, MA)

offtake_stock_plus_variation_rate_to_stock_start

Numeric vector of length 6. Offtake plus stock-variation rate relative to starting population size (fraction) (cohorts= FJ, FS, FA, MJ, MS, MA)

offtake_stock_plus_variation_rate_to_stock_average

Numeric vector of length 6. Offtake plus stock-variation rate relative to average population size (fraction) (cohorts= FJ, FS, FA, MJ, MS, MA)

This function is part of the run_demographic_herd_module().

See Also

run_demographic_herd_module()


Calculate total metabolic energy requirements

Description

Calculates the total daily energy requirement (MJ/head/day) by summing relevant energy partitions (maintenance, activity, lactation, work, pregnancy, growth, fibre, egg deposition).

Usage

calc_total_metabolic_energy_req(
  species_short,
  metabolic_energy_req_maintenance,
  metabolic_energy_req_activity,
  metabolic_energy_req_lactation,
  metabolic_energy_req_work,
  metabolic_energy_req_pregnancy,
  net_energy_maintenance_digestible_energy_ratio,
  metabolic_energy_req_growth,
  metabolic_energy_req_fibre_production,
  metabolic_energy_req_egg_deposition,
  net_energy_growth_digestible_energy_ratio,
  ration_digestibility_fraction
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

metabolic_energy_req_maintenance

Numeric. Energy required for maintenance, defined as the amount of energy needed to keep the animal at equilibrium such that body energy is neither gained nor lost (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

metabolic_energy_req_activity

Numeric. Energy required for activity, defined as the amount of energy needed to support animal movement and physical activity (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

metabolic_energy_req_lactation

Numeric. Energy required for lactation (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

metabolic_energy_req_work

Numeric. Energy required for work, used to estimate the energy required for draught power for CTL, BFL and CML (MJ/head/day). Assumed to be 0 for other species. Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

metabolic_energy_req_pregnancy

Numeric. Energy required for pregnancy for pregnant females (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

net_energy_maintenance_digestible_energy_ratio

Ratio of net energy available for maintenance in the diet to digestible energy consumed (fraction).

metabolic_energy_req_growth

Numeric. Energy required for growth (i.e., weight gain) (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

metabolic_energy_req_fibre_production

Numeric. Energy required for the synthesis of fibre for SHP, GTS and CML. Assumed to be 0 for other species (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS (MJ/head/day).

metabolic_energy_req_egg_deposition

Numeric. Net energy for egg production (MJ/head/day).

net_energy_growth_digestible_energy_ratio

Numeric. Ratio of net energy available for growth in the diet to digestible energy consumed (fraction)

ration_digestibility_fraction

Numeric. Average digestibility of the feed ration, expressed as ratio of digestible to gross energy content (fraction).

Details

This component follows the IPCC Tier 2 partitioning approach and the calculation is computed differently depending on whether species energy requirements are expressed as net or metabolizable energy.

Species-specific approach:

This function is part of the run_metabolic_energy_req_module().

Value

Numeric. Total daily energy requirement (MJ/head/day). For CTL, BFL, SHP and GTS this is expressed as gross energy intake requirement (GE). For CML and PGS the function returns the summed daily metabolizable energy requirement.

References

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management, Equation 10.16.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management, Equation 10.16.

See Also

run_metabolic_energy_req_module, calc_metabolic_energy_req_maintenance calc_metabolic_energy_req_activity calc_metabolic_energy_req_growth calc_metabolic_energy_req_lactation calc_metabolic_energy_req_work calc_metabolic_energy_req_fibre calc_metabolic_energy_req_pregnancy calc_rem_maintenance calc_reg_growth calc_ration_intake


Calculate transition probabilities for sex-age classes

Description

Calculates hazard rates and daily transition probabilities (death, offtake, survival, and growth) across different sex-age cohorts. Converts annual inputs to daily hazards, then derives daily probabilities from those hazards.

Usage

calc_transition_probabilities(cohort_duration_days, offtake_rate, death_rate)

Arguments

cohort_duration_days

Numeric vector of length 6. Amount of time that each animal spends in a specific cohort (days).

offtake_rate

Numeric vector of length 6. Annual proportion of animals removed from the herd for each sex-age cohort (fraction).

death_rate

Numeric vector of length 6. Fraction of deaths in a herd over a year for each sex-age cohort (fraction)

Value

A named list with:

hazard_death

Numeric vector of length 6. Instantaneous mortality hazard rate for the 6 sex–age cohorts. Represents the risk of death per unit time (day) (cohorts= FJ, FS, FA, MJ, MS, MA)

hazard_offtake

Numeric vector of length 6. Instantaneous offtake hazard rate for the 6 sex-age cohorts. Represents the risk to leave the herd through planned removals per unit of time (day-1) (cohorts= FJ, FS, FA, MJ, MS, MA)

probability_death

Named numeric vector of length 10. Probability of animal dying within the model time interval for 10 cohorts (fraction). (cohorts= FB: Female Birth, FJ: Female Juvenile, FS: Female Sub-adult, FA: Female Adult, FC: Female Culling, MB: Male Birth, MJ: Male Juvenile, MS: Male Sub-adult, MA: Male Adult, MC: Male Culling)

probability_offtake

Named numeric vector of length 10. Probability that an animal will be removed from the herd within the model time interval for 10 cohorts (fraction). (cohorts= FB: Female Birth, FJ: Female Juvenile, FS: Female Sub-adult, FA: Female Adult, FC: Female Culling, MB: Male Birth, MJ: Male Juvenile, MS: Male Sub-adult, MA: Male Adult, MC: Male Culling)

probability_survival

Named numeric vector of length 10. Probability that an animal remains alive in the herd within the model time interval for 10 cohorts (fraction). (cohorts= FB: Female Birth, FJ: Female Juvenile, FS: Female Sub-adult, FA: Female Adult, FC: Female Culling, MB: Male Birth, MJ: Male Juvenile, MS: Male Sub-adult, MA: Male Adult, MC: Male Culling)

probability_growth

Named numeric vector of length 10. Probability of growing into the next age class for 10 cohorts (fraction) (cohorts= FB: Female Birth, FJ: Female Juvenile, FS: Female Sub-adult, FA: Female Adult, FC: Female Culling, MB: Male Birth, MJ: Male Juvenile, MS: Male Sub-adult, MA: Male Adult, MC: Male Culling)

This function is part of the run_demographic_herd_module().

See Also

run_demographic_herd_module()


Calculate Volatile Solids (VS)

Description

Calculates daily volatile solids (VS) excretion in manure (kg VS/head/day). VS represent the organic fraction of manure dry matter, including both biodegradable and non-biodegradable organic material. VS is a key intermediate variable required for estimating methane (CH4) emissions from manure management systems under IPCC methodologies.

Usage

calc_volatile_solids(
  ration_intake,
  ration_digestibility_fraction,
  ration_urinary_energy_fraction,
  ration_ash
)

Arguments

ration_intake

Numeric. Average daily dry matter intake of feed (kg DM/head/day).

ration_digestibility_fraction

Numeric. Average digestibility of the feed ration, expressed as ratio of digestible to gross energy content (fraction).

ration_urinary_energy_fraction

Numeric. Fraction of feed's gross energy that is excreted in urine (fraction).

ration_ash

Numeric. Average ash content of feed, calculated as a fraction of the dry matter intake (kg ash/kg DM).

Details

The IPCC recommends estimating volatile solids (VS) excretion from feed intake and digestibility when country-specific average daily VS excretion rates are not available. The core relationship is provided in IPCC Equation 10.24 (Volatile solids excretion rates), which estimates daily VS excretion as a function of:

The general structure of Eq. 10.24 partitions gross energy intake into digestible energy, urinary losses, and ash, and converts the remaining organic matter into volatile solids using the energy density of dry matter.

Implementation note. This function applies an algebraically simplified formulation from Equation 10.24 of IPCC.

In this implementation, the function takes ration_intake directly as an input. It can be calculated upstream with calc_ration_intake as a function of energy requirements and the energy content of the diet.

dry\_matter\_intake = \frac{gross\_energy\_intake}{diet\_gross\_energy}

This reflects the use of ration-specific energy content upstream and avoids assuming a fixed gross energy density of 18.45 MJ/kg DM, as in the IPCC default approach.

The volatile solids excretion is then calculated as:

volatile\_solids = dry\_matter\_intake \times (1 - diet\_digestibility\_fraction + urinary\_energy\_fraction) \times (1 - diet\_ash)

The resulting calculations are algebraically equivalent to the IPCC approach and fully consistent with Equation 10.24.

This function is part of the run_emissions_manure_module().

Value

Numeric. Total volatile solids (VS) excreted per animal per day, representing the organic material in livestock manure and consisting of both biodegradable and non-biodegradable fractions (kg VS/head/day).

References

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management. Equation 10.24.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Chapter 10: Emissions from Livestock and Manure Management. Equation 10.24.

See Also

run_emissions_manure_module

Examples

calc_volatile_solids <- calc_volatile_solids(
  ration_intake = 5,
  ration_digestibility_fraction = 0.6,
  ration_urinary_energy_fraction = 0.04,
  ration_ash = 0.08
)


Calculate work energy requirements (for biophysical allocation)

Description

Calculates the energy required for animal work over the assessment period (MJ/cohort/assessment period), based on the daily energy requirement for work, cohort size, and assessment duration.

Usage

calc_work_allocation_energy(
  species_short,
  cohort_stock_size,
  metabolic_energy_req_work,
  simulation_duration,
  ratio_me_to_ne = NA_real_
)

Arguments

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_stock_size

Numeric. Population size in the cohort at the start of the assessment period (heads).

metabolic_energy_req_work

Numeric. Energy required for work, used to estimate the energy required for draught power for CTL, BFL and CML. (MJ/head/day) Assumed to be 0 for other species. Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

simulation_duration

Numeric. Length of the assessment period (days).

ratio_me_to_ne

Numeric. Ratio of metabolizable energy converted to net energy (fraction).

Details

This function provides the work-related energy term used in a biophysical allocation framework to apportion emissions between milk and other co-products in multifunctional livestock production systems.

The approach implements the IDF (2022) standard, adapted from Thoma and Nemecek (2020), and is consistent with FAO LEAP livestock LCA guidelines (FAO, 2016a, 2016b, 2016c) and with ISO 14044:2006 (Section 4.3.4.2, Step 2).

In accordance with ISO 14044:2006 (Section 4.3.4.2, Step 2), known processing or biophysical relationships may be used to assign shared inputs and outputs of a single production unit to individual products or sub-units. In livestock systems, this includes apportioning shared feed and energy use according to physiological energy requirements (e.g., net energy for lactation, growth, etc.). If the resulting process remains multifunctional, these energy terms may subsequently be used to derive allocation factors among co-products.

Total work-related energy is computed for species (CTL, BFL, CML) and cohorts (, FA, MA) assumed to be potentially involved in draught power generation.

The work_allocation_energy is calculated as follows:

energy\_allocation\_work = energy\_requirement\_work \times simulation\_duration \times cohort\_stock\_size

for cattle (CTL) and buffalo (BFL), and:

energy\_allocation\_work = \frac{energy\_requirement\_work \times simulation\_duration \times cohort\_stock\_size} {ratio\_me\_to\_ne}

for camels (CML).

where metabolic_energy_req_work can be computed using calc_metabolic_energy_req_work (see also run_metabolic_energy_req_module).

This function is part of the run_allocation_module().

Value

Numeric. Energy required to provide all draught power (traction/work) by cohort (MJ/cohort/assessment period). Non-zero values are expected only for draught or work-producing species (CTL, BFL CML).

References

ISO. (2006). Environmental management — Life cycle assessment — Requirements and guidelines (ISO 14044:2006). International Organization for Standardization, Geneva.

IDF. (2022). The IDF Global Carbon Footprint Standard for the Dairy Sector. Bulletin of the IDF No. 520/2022. International Dairy Federation, Brussels.

Thoma, G., and Nemecek, T. (2020). Allocation between milk and meat in dairy LCA: Critical discussion of the IDF’s standard methodology. In Proceedings of the 12th International Conference on Life Cycle Assessment of Food (LCAFood 2020) (pp. 83–89), 13–16 October, Berlin, Germany.

FAO. (2016a). Environmental performance of large ruminant supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

FAO. (2016b). Greenhouse gas emissions and fossil energy use from small ruminant supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

FAO. (2016c). Greenhouse gas emissions and fossil energy use from poultry supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

See Also

run_allocation_module, calc_metabolic_energy_req_work, run_metabolic_energy_req_module


Valid cohort short codes

Description

All sex- and age-class cohort codes recognised by GLEAM. Derived from gleam_cohorts_names.

Usage

gleam_cohorts

Format

A character vector of length 6.


Female cohort codes (complement of male in gleam_cohorts)

Description

Female cohort codes (complement of male in gleam_cohorts)

Usage

gleam_cohorts_female

Format

A character vector of length 3.


Male cohort codes (M-prefix)

Description

Male cohort codes (M-prefix)

Usage

gleam_cohorts_male

Format

A character vector of length 3.


Cohort code -> full name mapping

Description

Maps each cohort short code to its descriptive name (sex and age class). gleam_cohorts is derived from this as the vector of codes.

Usage

gleam_cohorts_names

Format

A named character vector of length 6.


Emissions variable metadata

Description

All direct and indirect emission sources handled by the allocation and aggregation modules. Each element contains emissions_source (the column name in cohort-level data) and label (the string used in the aggregated long-form output).

Usage

gleam_emissions_meta

Format

An object of class list of length 19.

Details

The emissions_source values from this list are the canonical set passed to assign_allocation_shares() in the allocation module and used to pivot the aggregation output. Adding or renaming an emission source here automatically updates both modules.


Feed-related emission sources

Description

Emission variables expressed per kg dry matter intake (g/kg DM). Passed to calc_cohort_totals() to apply ration_intake scaling. All other emissions use cohort_stock_size * simulation_duration only.

Usage

gleam_feed_emissions_meta

Format

A list of lists with emissions_source and label.


Feed intake variable metadata

Description

One entry: dry-matter intake from the ration quality module.

Usage

gleam_feed_meta

Format

An object of class list of length 1.

Details

Each element contains:

feed_source

Column name in cohort-level data.

label

Human-readable label used in aggregated output.

unit

Physical unit of the variable.


Nitrogen balance variable metadata

Description

Intake, retention, and excretion from the nitrogen balance module.

Usage

gleam_nitrogen_balance_meta

Format

An object of class list of length 3.

Details

Each element contains nitrogen_balance_source, label, unit.


Emission sources excluded from commodity allocation

Description

These pasture and burn emission sources are not allocated to individual commodities (they remain as herd-level totals). Referenced by both run_allocation_module and any downstream reporting logic.

Usage

gleam_non_allocated_emissions

Format

An object of class character of length 6.


Production variable metadata

Description

Milk, meat, and fibre production outputs from the production module.

Usage

gleam_production_meta

Format

An object of class list of length 8.

Details

Each element contains production_source, label, unit, commodity_name, and commodity_type.


Valid species short codes

Description

All livestock species supported by GLEAM. Derived from gleam_species_names.

Usage

gleam_species

Format

A character vector of length 6.


Milk-producing species

Description

Species for which milk production, lactation energy requirements, and ruminant-style digestibility parameters apply. Includes ruminants plus Camels.

Usage

gleam_species_milk_producers

Format

A character vector of length 5.


Species code -> full name mapping

Description

Maps each species short code to its full common name. Used for display and documentation. gleam_species is derived from this as the vector of codes.

Usage

gleam_species_names

Format

A named character vector of length 6.


Species with non-zero enteric CH4 and N excretion

Description

All supported species. Used for enteric methane emission calculations and nitrogen excretion models. (Legacy alias; equivalent to gleam_species.)

Usage

gleam_species_non_poultry

Format

A character vector of length 6.


Ruminant species (four-stomach, NE-based energy system)

Description

Cattle, Buffalo, Sheep, Goats. Energy requirements are expressed as net energy (NE) and converted to gross energy (GE) via digestibility ratios. Camels use metabolizable energy (ME) instead.

Usage

gleam_species_ruminants

Format

A character vector of length 4.


Run Aggregation Module Pipeline

Description

This function generates final herd-level results by aggregating key cohort-level outputs, scaling variables over the assessment duration, allocating emissions to commodities, and converting methane (CH4) and nitrous oxide (N2O) emissions to CO2-equivalents (CO2eq) using selected 100-year Global Warming Potential (GWP-100) factors.

Usage

run_aggregation_module(
  cohort_level_data,
  allocation_herd_long,
  simulation_duration = 365,
  global_warming_potential_set = "AR6",
  show_indicator = TRUE
)

Arguments

cohort_level_data

data.table. Cohort-level input table with the following data requirement:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

species_short

Character. Livestock species code. Supported values include:

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

  • PGS: pigs

  • CML: camels

cohort_short

Character. Sex- and age-specific cohort code. Supported values include:

  • FA: adult females

  • FS: sub-adult females

  • FJ: juvenile females

  • MA: adult males

  • MS: sub-adult males

  • MJ: juvenile males

cohort_stock_size

Numeric. Average population size in each of the 6 sex-age cohorts (# heads). (cohorts=FJ, FS, FA, MJ, MS, MA).

Feed variables
ration_intake

Numeric. Average daily dry matter intake of feed (kg DM/head/day).

Nitrogen balance variables
nitrogen_intake

Numeric. Daily nitrogen intake (kg N/head/day)

nitrogen_retention

Numeric. Daily nitrogen retention in animal body tissues and products (e.g., growth, pregnancy, milk...) (kg N/head/day)

nitrogen_excretion

Numeric. Daily nitrogen excretion (kg N/head/day)

Production variables
milk_production_mass_cohort

Numeric. Total milk production produced over the assessment period (kg/cohort/assessment period).

milk_production_protein_cohort

Numeric. Total milk protein production produced over the assessment period (kg protein/cohort/assessment period).

milk_production_fpcm_cohort

Numeric. Total fat-protein-corrected milk (FPCM) produced over the assessment period (kg/cohort/assessment period).

meat_production_live_weight_cohort

Numeric . Total meat produced as live weight over the assessment period by cohort (kg/cohort/assessment period).

meat_production_carcass_weight_cohort

Numeric. Total meat as carcass weight (excluding organs, and other by-products after dressing) produced over the assessment period by cohort (kg/cohort/assessment period).

meat_production_bone_free_meat_cohort

Numeric. Total bone-free-meat (excluding bones, organs, and other by-products after dressing and bone removal) produced over the assessment period by cohort (kg/cohort/assessment period)

meat_production_protein_cohort

Numeric. Total meat protein (excluding bones, organs, and other by-products after dressing and bone removal) produced over the assessment period by cohort (kg protein/cohort/assessment period).

fibre_production_cohort

Numeric. Total fibre produced over the assessment period by cohort (kg/cohort/assessment period)

Emission variables
ch4_enteric

Numeric. Average daily enteric methane (CH4) emissions (kg CH4/head/day).

ch4_manure_pasture

Numeric. Methane (CH4) emissions from manure deposited on pasture (kg CH4/head/day)

ch4_manure_burned

Numeric. Methane (CH4) emissions from manure burned for fuel (kg CH4/head/day)

ch4_manure_other

Numeric. Methane (CH4) emissions from manure management systems, excluding emissions from manure deposited on pasture and burned for fuel (kg CH4/head/day)

n2o_manure_pasture_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure deposited on pasture (kg N2O/head/day)

n2o_manure_burned_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure burned for fuel (kg N2O/head/day)

n2o_manure_other_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure management systems, excluding emissions from manure deposited on pasture and burned for fuel (kg N2O/head/day)

n2o_manure_burned_indirect

Numeric. Total indirect nitrous oxide (N2O) emissions from manure deposited on pasture. Includes emissions from atmospheric deposition of volatilised nitrogen (NH3 and NOx) and from leaching and runoff of manure nitrogen (kg N2O/head/day).

n2o_manure_pasture_indirect

Numeric. Total indirect nitrous oxide (N2O) emissions originating from manure burned for fuel. Includes emissions from atmospheric deposition of volatilised nitrogen (NH3 and NOx) and from leaching and runoff of manure nitrogen (kg N2O/head/day).

n2o_manure_other_indirect

Numeric. Total indirect nitrous oxide (N2O) emissions originating from manure management systems, excluding manure deposited on pasture and burned for fuel. Includes emissions from atmospheric deposition of volatilised nitrogen (NH3 and NOx) and from leaching and runoff of manure nitrogen (kg N2O/head/day).

co2_ration_fertilizer

Numeric. Diet-level average carbon dioxide (CO2) emission factor from fertilizer manufacture in feed production (g CO2/kg DM).

co2_ration_pesticides

Numeric. Diet-level average carbon dioxide (CO2) emission factor from pesticide manufacture in feed production (g CO2/kg DM).

co2_ration_crop_activities

Numeric. Diet-level average carbon dioxide (CO2) emission factor from on-field agricultural activities in feed production (g CO2/kg DM).

co2_ration_luc_nopeat

Numeric. Diet-level average carbon dioxide (CO2) emission factor from land-use change (excluding peatland drainage) in feed production (g CO2/kg DM).

co2_ration_luc_peat

Numeric. Diet-level average carbon dioxide (CO2) emission factor from peatland drainage in feed production (g CO2/kg DM).

n2o_ration_fertilizer

Numeric. Diet-level average nitrous oxide (N2O) emission factor from fertilizer use in feed production (g N2O/kg DM).

n2o_ration_manure_applied

Numeric. Diet-level average nitrous oxide (N2O) emission factor from manure applied to or deposited on soil in feed production (g N2O/kg DM).

n2o_ration_crop_residues

Numeric. Diet-level average nitrous oxide (N2O) emission factor from crop residues decomposition in feed production (g N2O/kg DM).

ch4_ration_rice

Numeric. Diet-level average methane (CH4) emission factor from rice cultivation in feed production (g CH4/kg DM).

allocation_herd_long

data.table. Herd-level allocation table in long format, typically generated by run_allocation_module(), with the following data requirements:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

species_short

Character. Code identifying the livestock species. Supported values include PGS, CML, CTL, BFL, SHP, GTS

variable_name

Character. Names of emission variables to which allocation should be applied (e.g., "ch4_enteric", "ch4_manure_pasture", "ch4_manure_burned", "ch4_manure_other", "n2o_manure_pasture_direct", "n2o_manure_burned_direct", "n2o_manure_other_direct", "n2o_manure_burned_indirect", "n2o_manure_pasture_indirect", "n2o_manure_other_indirect", "co2_ration_fertilizer", "co2_ration_pesticides", "co2_ration_crop_activities", "co2_ration_luc_nopeat", "co2_ration_luc_peat", "n2o_ration_fertilizer", "n2o_ration_manure_applied", "n2o_ration_crop_residues", "ch4_ration_rice")

commodity_name

Character. List of commodity categories to which emissions may be allocated. List = c("None", "Milk", "Meat", "Fibre", "Work", "Eggs")

commodity_type

Character. Commodity (commodity_name) grouping, either "Edible" or "Non-Edible".

allocation_share

Numeric. Allocation share assigned to the commodity for the corresponding emission source (fraction).

simulation_duration

Numeric. Length of the assessment period (days).

global_warming_potential_set

Character. Settings for the 100-year Global Warming Potential (GWP-100) conversion factors used to express CH4 and N2O emissions as CO2eq. Must be one of:

  • "AR6": IPCC Sixth Assessment Report (IPCC, 2021) - CH4 = 27, N2O = 273

  • "AR5_excluding_carbon_feedback": IPCC Fifth Assessment Report (excluding climate-carbon feedbacks) (IPCC, 2013) - CH4 = 28, N2O = 265

  • "AR5_including_carbon_feedback": IPCC Fifth Assessment Report (including climate-carbon feedbacks) (IPCC, 2013) - CH4 = 34, N2O = 298

  • "AR4": IPCC Fourth Assessment Report (IPCC, 2007) - CH4 = 25, N2O = 298

show_indicator

Logical. Whether to display progress indicators during the pipeline run. Defaults to TRUE.

Details

This function represents the final step of the Global Livestock Environmental Assessment Model (GLEAM) computational pipeline run_gleam() and performs the following calculation sequence:

  1. Cohort-level variables are reshaped from wide to long format.

  2. Variables are classified into "Feed", "NitrogenBalance", "Production", and "Emissions".

  3. Cohort totals are calculated using calc_cohort_totals(). Production variables are retained as provided, whereas emissions, feed, and nitrogen balance variables are scaled using cohort stock size and simulation duration.

  4. Cohort totals are aggregated to herd level within each herd_id x species_short x variable_type x variable_name group.

  5. Herd-level emissions are merged with commodity allocation shares from allocation_herd_long.

  6. Emissions are allocated to commodities using calc_allocated_emissions().

  7. Gas type is identified from the emission variable name as "CH4", "N2O", or "CO2".

  8. Allocated CH4, N2O, and CO2 emissions are converted to CO2-equivalents (CO2eq) using calc_co2eq() and the selected GWP-100 option.

  9. Final output tables are produced summarizing herd-level results for emissions, feed, production, and nitrogen balance variables.

Value

A named list with the following elements:

results_emissions

A data.table containing herd-level emissions scaled to the assessment duration and allocated to commodities. Includes gas type, allocation shares, commodity metadata, GWP factors, and emissions expressed both as allocated gas mass (kg gas) and as CO2-equivalents (kg CO2eq).

results_feed

A data.table containing herd-level feed variables, aggregated at herd level and scaled to the assessment duration.

results_production

A data.table containing herd-level production variables aggregated from cohort-level values over the assessment duration.

results_nitrogen

A data.table containing herd-level nitrogen balance variables aggregated from cohort-level values and scaled to the assessment duration.

See Also

run_gleam(), calc_cohort_totals(), calc_cohort_to_herd_aggregation(), calc_allocated_emissions(), calc_co2eq(), run_allocation_module()

Examples


# Load cohort-level aggregation input
aggregation_chrt_dt <- data.table::fread(system.file(
  "extdata/run_modules_examples/aggregation_input_chrt_data.csv",
  package = "gleam"
))

# Load allocation shares (herd-level, long format)
allocation_long <- data.table::fread(system.file(
  "extdata/run_modules_examples/aggregation_allocation_input_data.csv",
  package = "gleam"
))

# Run aggregation
results <- run_aggregation_module(
  cohort_level_data = aggregation_chrt_dt,
  allocation_herd_long = allocation_long,
  simulation_duration = 365,
  global_warming_potential_set = "AR6"
)



Run Allocation Module Pipeline

Description

Calculates biophysical allocation shares for livestock commodities by computing cohort-level energy requirements for meat, milk, fibre, work, and eggs, aggregating these terms to herd level, and assigning allocation shares to emission sources.

Usage

run_allocation_module(
  cohort_level_data,
  herd_level_data,
  simulation_duration = 365,
  show_indicator = TRUE
)

Arguments

cohort_level_data

Cohort-level input table with the following data requirement:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

milk_production_fpcm_cohort

Numeric. Total fat-protein-corrected milk (FPCM) produced over the assessment period (kg/cohort/assessment period). Suggested standard fat, protein and lactose contents are 0.04, 0.033, and 0.048 respectively.

live_weight_cohort_at_slaughter

Numeric. Live weight at slaughter for animals removed from the cohort (kg).

meat_production_live_weight_cohort

Numeric. Total meat produced as live weight over the assessment period by cohort (kg/cohort/assessment period).

metabolic_energy_req_fibre_production

Numeric. Energy required for the synthesis of fibre for SHP, GTS and CML. Assumed to be 0 for other species. (MJ/head/day). Expressed as net energy for SHP and GTS and as metabolizable energy for CML.

cohort_stock_size

Numeric. Average population size in each of the 6 sex–age cohorts (# heads). (cohorts=FJ, FS, FA, MJ, MS, MA).

metabolic_energy_req_work

Numeric. Energy required for work, used to estimate the energy required for draught power for CTL, BFL and CML. (MJ/head/day) Assumed to be 0 for other species. Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML.

herd_level_data

data.table. Herd-level input table (one row per herd_id) with the following data requirement:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

live_weight_at_birth

Numeric. Live weight of the animal at birth (kg).

milk_protein_fraction_standard

Numeric. Standard protein content of milk, used to calculate Fat-protein-corrected milk (FPCM), (kg protein/kg milk). Suggested value = 0.033.

milk_fat_fraction_standard

Numeric. Standard fat content of milk, used to calculate Fat-protein-corrected milk (FPCM), (kg fat/kg milk). Suggested value = 0.04.

milk_lactose_fraction_standard

Numeric. Standard lactose content of milk, used to calculate Fat-protein-corrected milk (FPCM) , (kg lactose/kg milk). Suggested value = 0.048.

ratio_me_to_ne

Numeric. Ratio of metabolizable energy converted to net energy (fraction). Used for species_short = CML.

simulation_duration

Numeric. Length of the assessment period (days).

show_indicator

Logical. Whether to display progress indicators during simulation. Defaults to TRUE.

Details

This function implements the allocation pipeline used to derive biophysical allocation shares for livestock commodities in multifunctional production systems.

The approach follows the IDF standard for the dairy sector, adapted for livestock systems in which emissions are apportioned among multiple products according to their physiological energy requirements. In accordance with ISO 14044:2006, known biophysical relationships may be used to assign shared inputs and outputs of a production system to individual products or sub-units.

This function represents the intermediate allocation module of the Global Livestock Environmental Assessment Model (GLEAM) computational pipeline run_gleam() and performs the following calculation sequence:

  1. Calculation of cohort-level energy allocation terms for meat, milk, fibre, work, and eggs using calc_meat_allocation_energy, calc_milk_allocation_energy, calc_fibre_allocation_energy, calc_work_allocation_energy, and calc_eggs_allocation_energy.

  2. Aggregation of cohort-level energy terms to herd level using calc_cohort_to_herd_aggregation.

  3. Calculation of herd-level allocation shares for commodities using calc_allocation_shares.

  4. Reshaping of allocation shares to long format and assignment of shares to emission sources using assign_allocation_shares.

Commodity-specific allocation shares represent the fraction of total herd-level energy requirements attributable to each commodity. These shares are then used to assign emissions to meat, milk, fibre, work, eggs, or the residual category "None".

Emissions from manure burned for fuel and manure deposited on pasture are not allocated to livestock commodities. These flows are assigned fully to "None" in accordance with the rules implemented in assign_allocation_shares.

Value

A named list of two data.table objects:

cohort_allocation_inputs

A data.table with the original cohort-level input columns plus the following new variables:

milk_allocation_energy

Numeric. Energy required to produce total milk output by cohort (MJ/cohort/assessment period).

meat_allocation_energy

Numeric. Energy required by a given sex–age cohort for total meat output by cohort during the assessment period, equal to the energy needed to produce all live-weight gain to reach the target slaughter weight (MJ/cohort/assessment period).

fibre_allocation_energy

Numeric. Energy required to produce all fibre output by cohort (MJ/cohort/assessment period).

work_allocation_energy

Numeric. Energy required to provide all draught power (traction/work) by cohort (MJ/cohort/assessment period).

egg_allocation_energy

Numeric. Energy required for egg production over the assessment period (MJ/cohort/assessment period). Currently set to 0.

allocation_long

A herd-level data.table in long format with one row per herd, commodity, and emission source combination, containing the following columns:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

variable_name

Character. Names of emission variables to which allocation should be applied (e.g.,"ch4_enteric", "ch4_manure_pasture", "ch4_manure_burned","ch4_manure_other", "n2o_manure_pasture_direct", "n2o_manure_burned_direct","n2o_manure_other_direct", "n2o_manure_burned_indirect","n2o_manure_pasture_indirect", "n2o_manure_other_indirect", "co2_ration_fertilizer", "co2_ration_pesticides", "co2_ration_crop_activities", "co2_ration_luc_nopeat", "co2_ration_luc_peat", "n2o_ration_fertilizer", "n2o_ration_manure_applied", "n2o_ration_crop_residues", "ch4_ration_rice")

commodity_name

Character. List of commodity categories to which emissions may be allocated. List=c("None","Milk","Meat","Fibre","Work","Eggs")

commodity_type

Character. Commodity (commodity_name) grouping, either "Edible" or "Non-Edible".

allocation_share

Numeric. Allocation share assigned to the commodity for the corresponding emission source (fraction).

References

ISO. (2006). Environmental management — Life cycle assessment — Requirements and guidelines (ISO 14044:2006). International Organization for Standardization, Geneva.

IDF. (2022). The IDF Global Carbon Footprint Standard for the Dairy Sector. Bulletin of the IDF No. 520/2022. International Dairy Federation, Brussels.

Thoma, G., and Nemecek, T. (2020). Allocation between milk and meat in dairy LCA: Critical discussion of the IDF’s standard methodology. In Proceedings of the 12th International Conference on Life Cycle Assessment of Food (LCAFood 2020) (pp. 83–89), 13–16 October, Berlin, Germany.

FAO. (2016a). Environmental performance of large ruminant supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

FAO. (2016b). Greenhouse gas emissions and fossil energy use from small ruminant supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

FAO. (2016c). Greenhouse gas emissions and fossil energy use from poultry supply chains: Guidelines for assessment. Livestock Environmental Assessment and Performance (LEAP) Partnership. FAO, Rome, Italy.

See Also

run_gleam, calc_milk_production, calc_meat_production, run_production_module, calc_meat_allocation_energy, calc_milk_allocation_energy, calc_fibre_allocation_energy, calc_work_allocation_energy, calc_eggs_allocation_energy, calc_cohort_to_herd_aggregation, calc_allocation_shares, assign_allocation_shares

Examples


# Load allocation inputs (cohort and herd-level)
allocation_chrt_dt <- data.table::fread(system.file(
  "extdata/run_modules_examples/allocation_input_chrt_data.csv",
  package = "gleam"
))
allocation_hrd_dt <- data.table::fread(system.file(
  "extdata/run_modules_examples/allocation_input_hrd_data.csv",
  package = "gleam"
))
results <- run_allocation_module(
cohort_level_data = allocation_chrt_dt,
herd_level_data = allocation_hrd_dt
)
head(results$allocation_long)



Run Demographic Herd Module Pipeline

Description

This function takes herd- and cohort-level demographic inputs and estimates a steady-state sex–age herd structure compatible with downstream calculations in the Global Livestock Environmental Assessment Model (GLEAM) computational pipeline run_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.

Usage

run_demographic_herd_module(
  cohort_level_data,
  herd_level_data,
  initial_herd_structure = c(FJ = 100, FS = 50, FA = 30, MJ = 100, MS = 50, MA = 30),
  max_simulation_years = 100,
  min_lambda_change = 1e-09,
  show_indicator = TRUE,
  simulation_duration = 365
)

Arguments

cohort_level_data

A data.table with the one row per herd and cohort, and the following mandatory columns:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

cohort_duration_days

Numeric vector of length 6. Amount of time that each animal spends in a specific cohort (days).

offtake_rate

Numeric vector of length 6. Annual proportion of animals removed from the herd for each sex-age cohort (fraction).

death_rate

Numeric vector of length 6. Fraction of deaths in a herd over a year for each sex-age cohort (fraction).

herd_level_data

A data.table with one row per herd, and the following mandatory columns:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

parturition_rate

Numeric. Average annual number of parturitions per female animal (# parturitions/adult female/year). A herd-level reproductive performance indicator calculated as the total number of parturitions (deliveries) occurring during a year divided by the number of adult females potentially able to give birth during that year.

litter_size

Numeric. Average number of offspring born per parturition (# offspring/parturition). This value can be calculated as the total number of offspring born divided by the total number of parturitions during the year.

birth_fraction_female

Numeric. Female birth fraction, defined as the probability that a newborn offspring is female (fraction). Can be calculated as the number of female offspring born divided by the total number of offspring born.

herd_size_total

Numeric. Total population size at the start of the year, including all cohorts (# heads).

initial_herd_structure

Named numeric vector of length 6. Initial number of individuals in each of the 6 sex-age cohorts used to bootstrap the steady-state simulation (# heads).These values are used as starting points for the iterative simulation and do not affect the final steady-state results (only convergence speed). Default is c(FJ = 100, FS = 50, FA = 30, MJ = 100, MS = 50, MA = 30).

max_simulation_years

Numeric. Maximum number of years to simulate (years). Defaults to 100.

min_lambda_change

Numeric. Convergence threshold for changes in cohort-specific growth rates of sex–age cohort proportions (lambda). Iterations of the herd simulation stop when the absolute change in lambda between successive iterations falls below this threshold. Defaults to 1e-9.

show_indicator

Logical. Whether to display progress indicators during simulation. Defaults to TRUE.

simulation_duration

Numeric. Length of the assessment period (days).

Details

The function 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 within an R workflow and fully integrated into the GLEAM computational pipeline.

Model structure

The population is divided by sex (female/male) and age class (juvenile/subadult/adult), represented by six cohorts:

Only adult females (FA) contribute to reproduction. Births are distributed between females and males using birth_fraction_female. Reproduction is assumed to be distributed over time (no birth pulse). Daily fecundity rates are computed in calc_fecundity_rates.

Dynamics and parameters

Herd dynamics result from:

As in Dynmod, offtake_rate is interpreted as a net removal rate for the cohort (e.g. slaughter), while death_rate represents natural mortality excluding offtake.

Competing risks and conversion to daily probabilities

Mortality and offtake are treated as competing risks within each cohort: at any time an animal can survive, die, or be offtaken.Annual inputs are converted to daily hazards and then daily transition probabilities in calc_transition_probabilities.

Internally, the model:

  1. Converts annual mortality (death_rate) into a daily mortality hazard.

  2. Solves for the daily offtake hazard such that the implied offtake probability matches offtake_rate under competing risks.

  3. Computes daily probabilities of death, offtake, and survival from the hazards.

Steady state

Under constant parameters, the cohort structure converges to a stable composition and a stable population growth rate. This function seeks that steady state by iterating the demographic system (see calc_steady_state_structure) starting from initial_herd_structure until changes in cohort-specific growth rates of sex–age cohort proportions (\lambda) fall below min_lambda_change, or until max_simulation_years is reached.

Projection of population size

The steady-state solution obtained here provides:

These outputs are subsequently used to project one year of population dynamics (calc_projected_population_size) and to summarise annual offtake and stock variation (calc_summary_offtake).

Value

A named list with two elements:

cohort_level_results

A data.table with one row per herd and cohort containing all original cohort_level_data columns plus the following simulation results:

  • cohort_stock_size - Numeric vector of length 6. Average population size in each of the 6 sex–age cohorts (# heads) (cohorts = (FJ, FS, FA, MJ, MS, MA)). This corresponds to cohort_stock_start returned by calc_projected_population_size, as it reflects the size of the population by cohort while preserving the total population size (herd_size_total) provided in the inputs.

  • offtake_heads - Numeric vector of length 6. Total number of animals removed via offtake over the year, aggregated to 6 sex–age cohorts (heads/year) (cohorts = FJ, FS, FA, MJ, MS, MA).

  • offtake_heads_assessment - Numeric vector of length 6. Total number of animals removed via offtake over the assessment period, aggregated to 6 sex–age cohorts (heads/assessment period) (cohorts = FJ, FS, FA, MJ, MS, MA).

herd_level_results

A data.table with one row per herd containing all original herd_level_data columns plus the following herd-level simulation results:

  • growth_rate_herd - Numeric. Annualized growth rate at which the herd size reaches steady state (fraction).

References

Lesnoff, M. (2013). DYNMOD: A spreadsheet interface for demographic projections of tropical livestock populations, User's manual. CIRAD, Montpellier, France.

See Also

calc_fecundity_rates, calc_transition_probabilities, calc_steady_state_structure, calc_projected_population_size, calc_summary_offtake

Examples


# Load herd simulation inputs (cohort- and herd-level)
herd_simulation_chrt_dt <- data.table::fread(system.file(
  "extdata/run_modules_examples/herd_simulation_input_chrt_data.csv",
  package = "gleam"
))
herd_simulation_hrd_dt <- data.table::fread(system.file(
  "extdata/run_modules_examples/herd_simulation_input_hrd_data.csv",
  package = "gleam"
))

# Run herd simulation
results <- run_demographic_herd_module(
  cohort_level_data = herd_simulation_chrt_dt,
  herd_level_data = herd_simulation_hrd_dt,
  simulation_duration = 200
)

# Access results
print(results$cohort_level_results)
print(results$herd_level_results)



Run Enteric Methane (CH4) Emissions Module Pipeline

Description

Calculates daily enteric methane emissions by cohort (kg CH4/head/day) using a Tier 2 IPCC approach, by applying species-, cohort- and diet-specific methane conversion factors (ym).

Usage

run_emissions_enteric_module(cohort_level_data, show_indicator = TRUE)

Arguments

cohort_level_data

data.table. Cohort-level input table with the following data requirement:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

ration_digestibility_fraction

Numeric. Average digestibility of the feed ration, expressed as ratio of digestible (or metabolizable, for poultry) to gross energy content (fraction).

ration_gross_energy

Numeric. Average gross energy content of the diet (MJ/kg DM).

ration_intake

Numeric. Average daily dry matter intake of feed (kg DM/head/day).

ch4_mitigation_factor

Numeric. Optional. Multiplicative mitigation factor applied to baseline enteric methane (CH4) emissions (dimensionless). If not provided, a default value of 1 (no mitigation) is used. Values lower than 1 represent proportional reductions (e.g., 0.90 = 10% reduction). This factor can represent mitigation measures with a direct effect on enteric methane emissions, such as the use of feed additives or methane inhibitors.

show_indicator

Logical. Whether to display progress indicators during calculations. Defaults to TRUE.

Details

This function represents the intermediate module of the Global Livestock Environmental Assessment Model (GLEAM) computational pipeline run_gleam() to estimate enteric methane emissions and performs the following calculation sequence:

  1. If ch4_mitigation_factor is not provided in the input data, it is set to 1 (no mitigation).

  2. The methane conversion factor (ym) is computed using calc_conversion_factor_ym.

  3. Daily enteric methane emissions are computed using calc_ch4_enteric.

Value

A data.table with the original input columns plus the following new variables:

ch4_mitigation_factor

Added by the function if not provided as input.

ch4_conversion_factor_ym

Numeric. Methane (CH4) conversion factor (ym), representing the percentage of gross energy of the feed ration that is converted to CH4 (percentage).

ch4_enteric

Numeric. Average daily enteric methane (CH4) emissions (kg CH4/head/day).

References

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories. Chapter 10: Emissions from Livestock and Manure Management, Equation 10.21.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories. Chapter 10: Emissions from Livestock and Manure Management, Equation 10.21.

See Also

run_gleam, calc_conversion_factor_ym, calc_ch4_enteric

Examples


# Load example input (6 herd_ids, cohort-level; only required columns)
input_path <- system.file(
  "extdata/run_modules_examples/emissions_enteric_input_chrt_data.csv",
  package = "gleam"
)
emissions_enteric_input_chrt_data <- data.table::fread(input_path)
results <- run_emissions_enteric_module(
cohort_level_data = emissions_enteric_input_chrt_data
)



Run Emissions from Manure Module Pipeline

Description

Calculates methane (CH4) and nitrous oxide (N2O) emissions at cohort-level from manure management systems (MMS).

Usage

run_emissions_manure_module(
  cohort_level_data,
  manure_management_system_fraction,
  manure_management_system_factors,
  show_indicator = TRUE
)

Arguments

cohort_level_data

data.table. Cohort-level input table with the following minimum data requirement:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

ration_intake

Numeric. Average daily dry matter intake of feed (kg DM/head/day).

ration_digestibility_fraction

Numeric. Average digestibility of the feed ration, expressed as ratio of digestible to gross energy content (fraction).

ration_urinary_energy_fraction

Numeric. Fraction of feed's gross energy that is excreted in urine (fraction).

ration_ash

Numeric. Average ash content of feed, calculated as a fraction of the dry matter intake (kg ash/kg DM).

nitrogen_excretion

Numeric. Daily nitrogen excretion (kg N/head/day).

manure_management_system_fraction

data.table. Cohort-level MMS fractions with:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

manure_management_system

Character. Name identifying the manure management system. The identifiers mms_pasture and mms_burned are reserved for manure deposited on pasture and manure burned for fuel, respectively. No specific naming convention is required for other manure management systems, which are grouped and handled as “other” systems.

manure_management_system_fraction

Numeric. Fraction of total manure excreted by animals in a given herd and cohort that is handled in a specific manure management system. Values ranges from 0 to 1. The sum of all fractions for each herd_id must equal 1.

manure_management_system_factors

data.table. Herd-level MMS factors with:

manure_management_system

Character. Name identifying the manure management system. The identifiers mms_pasture and mms_burned are reserved for manure deposited on pasture and manure burned for fuel, respectively. No specific naming convention is required for other manure management systems, which are grouped and handled as “other” systems.

ratio_m3CH4_to_kgCH4

Numeric. Conversion factor used to convert methane (CH4) from volumetric unit (m3) to a mass unit (kg). This value represents the density of methane. It defaults to 0.67 kg/m3

methane_conversion_factor_mcf

Numeric. Methane (CH4) conversion factor represents the portion or degree of the maximum methane producing capacity (Bo) that is effectively achieved within a specific manure management system. It represents the extent to which the theoretical methane yield is realized based on management practices and environmental conditions, specifically the temperature of the system, the retention time of the organic material, and the degree of anaerobic conditions present. The value theoretically ranges from 0 to 100 percent. Default values can be selected from Table 10.17 of IPCC guidelines (IPCC 2006, 2019).

ch4_max_producing_capacity_bo

Numeric. Maximum methane (CH4) producing capacity (B0) for all systems (m3 CH4/kg VS). The value is region- and species-specific, and represents the theoretical maximum methane yield per unit of volatile solids. Default can be selected from Table 10.16 (IPCC, 2019) or from Tables 10A-4 to 10A-9 (IPCC, 2006).

n2o_ef3

Numeric. Emission factor for direct nitrous oxide (N2O) emissions for each manure management system, representing nitrous oxide emitted per unit of nitrogen from nitrification and denitrification processes occurring during manure storage and treatment (kg N2O–N per kg N). Default values can be selected from Table 10.21 and Table 11.1 (for manure deposited on pasture) in IPCC Guidelines (IPCC 2006, 2019).

n2o_ef4

Numeric. Emission factor for indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3–N and NOx–N) onto soils and water surfaces (kg N2O–N / (kg NH3–N + NOx–N)). Default values can be selected from Table 11.3 in IPCC Guidelines (IPCC 2006, 2019).

nitrogen_fracgas

Numeric. Fraction of manure nitrogen excreted by a given livestock category that is lost through volatilisation as ammonia (NH3) and nitrogen oxides (NOx) within a specific manure management system. This parameter represents the share of excreted nitrogen that is mineralised and released to the atmosphere during manure collection, storage, and treatment. It is expressed as a dimensionless fraction (0–1). Default values are provided in Table 10.22 of IPCC Guidelines (IPCC 2006, 2019).

n2o_ef5

Numeric. Emission factor for indirect nitrous oxide (N2O) emissions resulting from nitrogen leaching and runoff, expressed as kilograms of N2O–N per kilogram of nitrogen leached or lost through runoff (kg N2O–N/kg N). Default values can be selected from Table 11.3 in IPCC Guidelines (IPCC 2006, 2019).

nitrogen_fracleach

Numeric. Fraction of manure nitrogen excreted by a given livestock category that is lost through leaching and runoff from a specific manure management system. This parameter is highly uncertain and is used to estimate indirect N2O emissions from nitrogen that enters the surrounding environment of the storage facility. It is expressed as a dimensionless fraction (0–1). Default values are provided in Table 10.22 of IPCC Guidelines (IPCC 2006, 2019).

show_indicator

Logical. Whether to display progress indicators during the calculation. Defaults to TRUE.

Details

This function represents the intermediate module of the Global Livestock Environmental Assessment Model (GLEAM) computational pipeline run_gleam() to estimate emissions from manure management systems (MMS) and orchestrates a cohort-level implementation of the IPCC manure management methodology.

The following calculation sequence is applied:

  1. VS excretion is computed from nutritional parameters of the feed ration (digestibility, urinary energy, and ash) using a simplified formulation of Equation 10.24 (IPCC 2006, 2019) - calc_volatile_solids

  2. Methane (CH4) emissions from manure management are computed from VS and MMS-specific factors (MCF and B0) and reported by MMS group (pasture, burned, and other), consistently with Equation 10.23 (IPCC, 2006, 2019) - calc_ch4_manure

  3. Direct nitrous oxide (N2O) emissions from manure management are computed from nitrogen excretion and MMS-specific EF3 values, and reported by MMS group, consistently with Equation 10.25 (IPCC, 2006, 2019) - calc_n2o_manure_direct

  4. Indirect N2O emissions are computed as the sum of:

    • volatilisation-driven N2O using MMS-specific nitrogen losses (FracGas) and EF4, consistently with Equations 10.26 (IPCC, 2006, 2019), 10.27 (IPCC, 2006), and 10.28 (IPCC, 2019) - calc_n2o_manure_volatilization

    • leaching/runoff-driven N2O using MMS-specific nitrogen losses (FracLeach) and EF5, consistently with Equations 10.28 (IPCC, 2006), 10.27 (IPCC, 2019), and 10.29 (IPCC, 2006, 2019) - calc_n2o_manure_leaching

  5. Total N2O emissions are aggregated by MMS group (pasture, burned, other) - calc_n2o_manure_total

The approach corresponds to a Tier 2 implementation as:

Value

cohort_level_data data.table. Input cohort table with added manure emissions columns:

volatile_solids

Numeric. Total volatile solids (VS) excreted per animal per day, representing the organic material in livestock manure and consisting of both biodegradable and non-biodegradable fractions (kg VS/head/day).

ch4_manure_pasture

Numeric. Methane (CH4) emissions from manure deposited on pasture (kg CH4/head/day).

ch4_manure_burned

Numeric. Methane (CH4) emissions from manure burned for fuel (kg CH4/head/day).

ch4_manure_other

Numeric. Methane (CH4) emissions from manure management systems, excluding emissions from manure deposited on pasture and burned for fuel (kg CH4/head/day).

ch4_manure_all_noburn

Numeric. Methane (CH4) emissions from manure management systems, excluding manure burned for fuel (kg CH4/head/day).

n2o_manure_pasture_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure deposited on pasture (kg N2O/head/day).

n2o_manure_burned_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure burned for fuel (kg N2O/head/day).

n2o_manure_other_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure management systems, excluding emissions from manure deposited on pasture and burned for fuel (kg N2O/head/day).

n2o_manure_all_noburn_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure management systems, excluding emissions from manure burned for fuel (kg N2O/head/day).

n2o_manure_pasture_vol

Numeric. Indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3 and NOx) from manure deposited on pasture (kg N2O/head/day).

n2o_manure_burned_vol

Numeric. Indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3 and NOx) from manure burned for fuel (kg N2O/head/day).

n2o_manure_other_vol

Numeric. Indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3 and NOx) from manure management systems, excluding manure deposited on pasture and manure burned for fuel (kg N2O/head/day).

n2o_manure_all_noburn_vol

Numeric. Indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3 and NOx) from manure management systems, excluding losses from manure burned for fuel (kg N2O/head/day).

n2o_manure_pasture_leach

Numeric. Indirect nitrous oxide (N2O) emissions resulting from leaching and runoff of manure nitrogen from manure deposited on pasture (kg N2O/head/day).

n2o_manure_burned_leach

Numeric. Indirect nitrous oxide (N2O) emissions resulting from leaching and runoff of manure nitrogen from manure burned for fuel (kg N2O/head/day).

n2o_manure_other_leach

Numeric. Indirect nitrous oxide (N2O) emissions resulting from leaching and runoff of manure nitrogen from manure management systems, excluding losses from manure deposited on pasture and manure burned for fuel (kg N2O/head/day).

n2o_manure_all_noburn_leach

Numeric. Indirect nitrous oxide (N2O) emissions resulting from leaching and runoff of manure nitrogen from manure management systems, excluding losses from manure burned for fuel (kg N2O/head/day).

n2o_manure_pasture_indirect

Numeric. Total indirect nitrous oxide (N2O) emissions from manure deposited on pasture. Includes emissions from atmospheric deposition of volatilised nitrogen (NH3 and NOx) and from leaching and runoff of manure nitrogen (kg N2O/head/day).

n2o_manure_burned_indirect

Numeric. Total indirect nitrous oxide (N2O) emissions originating from manure burned for fuel. Includes emissions from atmospheric deposition of volatilised nitrogen (NH3 and NOx) and from leaching and runoff of manure nitrogen (kg N2O/head/day).

n2o_manure_other_indirect

Numeric. Total indirect nitrous oxide (N2O) emissions originating from manure management systems, excluding manure deposited on pasture and burned for fuel. Includes emissions from atmospheric deposition of volatilised nitrogen (NH3 and NOx) and from leaching and runoff of manure nitrogen.

n2o_manure_pasture_total

Numeric. Total nitrous oxide emissions from manure deposited on pasture. Includes direct emissions and indirect emissions from volatilisation, leaching, and runoff (kg N2O/head/day).

n2o_manure_burned_total

Numeric. Total nitrous oxide emissions (N2O) from manure burned for fuel. Includes direct emissions and indirect emissions from volatilisation, leaching, and runoff (kg N2O/head/day).

n2o_manure_other_total

Numeric. Total nitrous oxide (N2O) emissions from manure management systems, excluding manure deposited on pasture and manure burned for fuel. Includes direct emissions and indirect emissions from volatilisation, leaching, and runoff (kg N2O/head/day).

Manure management system (MMS) reference

A complete list of MMS names, definitions, and associated emission factors can be accessed in the GLEAM Data Explorer.

References

IPCC. (2019). 2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Volume 4, Chapter 10: Emissions from Livestock and Manure Management. Equations 10.23, 10.24, 10.25, 10.26, 10.27, 10.28, and 10.29.

IPCC. (2006). 2006 IPCC Guidelines for National Greenhouse Gas Inventories, Volume 4, Chapter 10: Emissions from Livestock and Manure Management. Equations 10.23, 10.24, 10.25, 10.26, 10.27, 10.28, and 10.29.

See Also

run_gleam, calc_volatile_solids, calc_ch4_manure, calc_n2o_manure_direct, calc_n2o_manure_volatilization, calc_n2o_manure_leaching, calc_n2o_manure_total

Examples


# Load emissions manure inputs (cohort-level and system lookups)
emissions_manure_input_chrt_data <- data.table::fread(system.file(
  "extdata/run_modules_examples/emissions_manure_input_chrt_data.csv",
  package = "gleam"
))
manure_management_system_factors <- data.table::fread(system.file(
  "extdata/run_modules_examples/manure_management_system_factors.csv",
  package = "gleam"
))
manure_management_system_fraction <- data.table::fread(system.file(
  "extdata/run_modules_examples/manure_management_system_fraction.csv",
  package = "gleam"
))

results <- run_emissions_manure_module(
  cohort_level_data = emissions_manure_input_chrt_data,
  manure_management_system_fraction = manure_management_system_fraction,
  manure_management_system_factors = manure_management_system_factors
)



Run Emissions from Feed Production Module Pipeline

Description

Computes cohort-level average greenhouse gas (GHG) emission factors from feed production by weighting emission factors of individual feed components by diet composition. Returns diet-level average GHG emission factors by gas and emission source for each cohort.

Usage

run_emissions_ration_module(
  rations_share,
  feed_emissions,
  show_indicator = TRUE
)

Arguments

rations_share

data.table. Cohort-level feed ration composition shares with the following minimum data requirement:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

feed_id

Character. Unique identifier for the feed component, used to join feed ration data with feed parameter tables.

feed_name

Character. Feed component name (optional, for readability and reporting). If provided, it should uniquely identify the same feed component as feed_id.

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration, expressed as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

feed_emissions

data.table. Emission factors of individual feed components with the following data requirement:

feed_id

Character. Unique identifier for the feed component, used to join feed ration data with feed parameter tables.

feed_name

Character. Feed component name (optional, for readability and reporting). If provided, it should uniquely identify the same feed component as feed_id.

co2_feed_fertilizer

Numeric. Carbon dioxide (CO2) emission factor of a feed component, representing CO2 emissions from fertilizer manufacture in feed production, expressed per kilogram of dry matter intake (g CO2/kg DM).

co2_feed_pesticides

Numeric. Carbon dioxide (CO2) emission factor of a feed component, representing CO2 emissions from pesticide manufacture in feed production, expressed per kilogram of dry matter intake (g CO2/kg DM).

co2_feed_crop_activities

Numeric. Carbon dioxide (CO2) emission factor of a feed component, representing CO2 emissions from on-field agricultural activities in feed production, expressed per kilogram of dry matter intake (kg CO2/kg DM).

co2_feed_luc_nopeat

Numeric. Carbon dioxide (CO2) emission factor of a feed component, representing CO2 emissions from land-use change in feed production (excluding peatland drainage), expressed per kilogram of dry matter intake (g CO2/kg DM).

co2_feed_luc_peat

Numeric. Carbon dioxide (CO2) emission factor of a feed component, representing CO2 emissions from peatland drainage in feed production, expressed per kilogram of dry matter intake (g CO2/kg DM).

n2o_feed_fertilizer

Numeric. Nitrous oxide (N2O) emission factor of a feed component, representing N2O emissions from fertilizer use in feed production, expressed per kg of dry matter intake (g N2O/kg DM).

n2o_feed_manure_applied

Numeric. Nitrous oxide (N2O) emission factor of a feed component, representing N2O emissions from manure applied to or deposited on soil in feed production, expressed per kg of dry matter intake (g N2O/kg DM).

n2o_feed_crop_residues

Numeric. Nitrous oxide (N2O) emission factor of a feed component, representing N2O emissions from crop residues decomposition in feed production, expressed per kg of dry matter intake (g N2O/kg DM).

ch4_feed_rice

Numeric. Methane (CH4) emission factor of a feed component, representing CH4 emissions from rice cultivation in feed production, expressed per kg of dry matter intake (g CH4/kg DM).

show_indicator

Logical. Whether to display progress indicators during calculations. Defaults to TRUE.

Details

This function represents the intermediate module of the Global Livestock Environmental Assessment Model (GLEAM) computational pipeline run_gleam() to estimate emissions from feed production used in the animal's ration. The function joins rations_share with feed_emissions by feed_id, uses species_short directly, and computes ration-weighted emission factors by cohort.

The following calculation sequence is applied:

  1. Merge ration shares with emission factors at the feed-component level using merge on feed_id (left join: all.x = TRUE).

  2. Compute feed-component contributions (row-wise) for each emission source by multiplying the ration share of each feed component (feed_ration_fraction) by the corresponding feed emission factor. Each contribution is computed using the specific helper below (called with by = .I):

  3. Aggregate to cohort-level diet emission factors by summing feed-component contributions across all feeds within each group (herd_id, species_short, cohort_short).

For each emission source, cohort-level dietary emission factors are computed as:

\mathrm{diet\_ef} = \sum_{i=1}^{n} \left( \mathrm{feed\_ration\_fraction}_{i} \times \mathrm{feed\_ef}_{i} \right)

Value

data.table. Cohort-level emission factors summarized by herd_id, species_short, and cohort_short with the following columns:

co2_ration_fertilizer

Numeric. Diet-level average carbon dioxide (CO2) emission factor from fertilizer manufacture in feed production (g CO2/kg DM).

co2_ration_pesticides

Numeric. Diet-level average carbon dioxide (CO2) emission factor from pesticide manufacture in feed production (g CO2/kg DM).

co2_ration_crop_activities

Numeric. Diet-level average carbon dioxide (CO2) emission factor from on-field agricultural activities in feed production (g CO2/kg DM).

co2_ration_luc_nopeat

Numeric. Diet-level average carbon dioxide (CO2) emission factor from land-use change (excluding peatland drainage) in feed production (g CO2/kg DM).

co2_ration_luc_peat

Numeric. Diet-level average carbon dioxide (CO2) emission factor from peatland drainage in feed production (g CO2/kg DM).

n2o_ration_fertilizer

Numeric. Diet-level average nitrous oxide (N2O) emission factor from fertilizer use in feed production (g N2O/kg DM).

n2o_ration_manure_applied

Numeric. Diet-level average nitrous oxide (N2O) emission factor from manure applied to or deposited on soil in feed production (g N2O/kg DM).

n2o_ration_crop_residues

Numeric. Diet-level average nitrous oxide (N2O) emission factor from crop residues decomposition in feed production (g N2O/kg DM).

ch4_ration_rice

Numeric. Diet-level average methane (CH4) emission factor from rice cultivation in feed production (g CH4/kg DM).

See Also

run_gleam, 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

Examples


# Load cleaned example input from the package and compute the calculation of feed emission factors

# Load table with ration shares
rations_share <- data.table::fread(system.file(
  "extdata/run_modules_examples/feed_rations_share_chrt.csv",
  package = "gleam"
))

# Load table with feed emission factors
feed_emissions <- data.table::fread(system.file(
  "extdata/run_modules_examples/feed_emission_factors.csv",
  package = "gleam"
))

# Run the code
result <- run_emissions_ration_module(
  rations_share = rations_share,
  feed_emissions = feed_emissions
)


Run the full Global Livestock Environmental Assessment Model (GLEAM) Pipeline

Description

Runs the full GLEAM pipeline from master herd and cohort inputs through all modules: herd (optional), weights, ration quality, energy requirements, manure emissions, enteric fermentation, nitrogren balance, feed emissions, allocation, and aggregation.

Common identifiers: Several input tables share the following identifier columns. Their supported values are listed once here and referenced throughout.

species_short — Character. Species code:

cohort_short — Character. Sex- and age-specific cohort code:

Usage

run_gleam(
  has_herd_structure = FALSE,
  cohort_level_data,
  herd_level_data,
  feed_rations,
  feed_params,
  feed_emissions,
  manure_management_system_fraction,
  manure_management_system_factors,
  simulation_duration = 365,
  global_warming_potential_set = "AR6",
  show_indicator = TRUE
)

Arguments

has_herd_structure

Logical. If TRUE, cohort_level_data is treated as an existing herd structure and the demographic herd simulation step is skipped. If FALSE, herd structure is first generated from cohort_level_data and herd_level_data using run_demographic_herd_module.

cohort_level_data

data.table. Cohort-level master input table. Required columns:

herd_id

Character. Unique herd identifier, repeated for each cohort within the same herd.

species_short

Character. Species code (see Common identifiers).

cohort_short

Character. Cohort code (see Common identifiers).

cohort_duration_days

Numeric. Time each animal spends in the cohort (days).

offtake_rate

Numeric. Annual proportion of animals removed from the herd per cohort (fraction).

low_activity_fraction

Numeric. Proportion of the assessment period with low-intensity movement, e.g. stall-feeding or near-field grazing (fraction).

high_activity_fraction

Numeric. Proportion of the assessment period with sustained locomotion, e.g. herding or long-distance grazing over uneven terrain (fraction).

Additional columns when has_herd_structure = FALSE:

death_rate

Numeric. Annual fraction of deaths per cohort (fraction).

Additional columns when has_herd_structure = TRUE:

cohort_stock_size

Numeric. Average population size in each cohort (heads).

offtake_heads_assessment

Numeric. Total animals removed via offtake over the assessment period per cohort (heads/assessment period).

Optional column (both cases):

ch4_mitigation_factor

Numeric. Multiplicative factor applied to baseline enteric CH4 emissions (dimensionless). Defaults to 1 (no mitigation). Values < 1 represent proportional reductions (e.g. 0.90 = 10 percent reduction). Can represent feed additives or methane inhibitors.

herd_level_data

data.table. Herd-level master input table (one row per herd_id). Required columns:

herd_id

Character. Unique herd identifier.

species_short

Character. Species code (see Common identifiers).

live_weight_female_adult

Numeric. Adult female live weight (kg).

live_weight_male_adult

Numeric. Adult male live weight (kg).

live_weight_at_birth

Numeric. Live weight at birth (kg).

live_weight_at_weaning

Numeric. Live weight at weaning (kg).

live_weight_female_at_slaughter

Numeric. Female sub-adult slaughter weight (kg).

live_weight_male_at_slaughter

Numeric. Male sub-adult slaughter weight (kg).

age_first_parturition

Numeric. Age at first parturition (days).

lactating_females_fraction

Numeric. Proportion of adult females lactating during the assessment period (fraction). Required for CTL, BFL, CML, SHP, GTS.

milk_yield_day

Numeric. Average daily milk yield per milk-producing animal (kg/head/day), calculated as total milk produced for human consumption divided by the number of milk-producing animals and the assessment period length. Required for CTL, BFL, CML, SHP, GTS.

milk_fat_fraction

Numeric. Milk fat content (kg fat/kg milk). Required for CTL, BFL, CML, SHP, GTS.

milk_protein_fraction

Numeric. Milk protein content (kg protein/kg milk). Required for CTL, BFL, CML, SHP, GTS.

milk_lactose_fraction

Numeric. Milk lactose content (kg lactose/kg milk). Required for CTL, BFL, CML, SHP, GTS.

milk_protein_fraction_standard

Numeric. Standard milk protein content for FPCM calculation (kg protein/kg milk). Suggested: 0.033.

milk_fat_fraction_standard

Numeric. Standard milk fat content for FPCM calculation (kg fat/kg milk). Suggested: 0.04.

milk_lactose_fraction_standard

Numeric. Standard milk lactose content for FPCM calculation (kg lactose/kg milk). Suggested: 0.048.

non_productive_duration

Numeric. Period without productive function (pregnancy/lactation) (days). Required for PGS.

pregnancy_duration

Numeric. Pregnancy duration (days).

death_rate_juvenile

Numeric. Annual death fraction for juvenile cohorts (FJ, MJ) (fraction).

lactation_duration

Numeric. Lactation period length (days). Required for PGS.

parturition_rate

Numeric. Average annual parturitions per adult female (parturitions/adult female/year).

litter_size

Numeric. Average offspring born per parturition (offspring/parturition).

draught_work_hours_female

Numeric. Average daily working time per adult female (hours/head/day). Required for CTL, BFL, CML.

draught_work_hours_male

Numeric. Average daily working time per adult male (hours/head/day). Required for CTL, BFL, CML.

draught_fraction_female

Numeric. Fraction of adult females doing draught work (fraction). Required for CTL, BFL, CML.

draught_fraction_male

Numeric. Fraction of adult males doing draught work (fraction). Required for CTL, BFL, CML.

fibre_yield_year

Numeric. Annual fibre production (wool, cashmere, mohair) (kg/head/year). Required for CML, SHP, GTS.

carcass_dressing_fraction

Numeric. Carcass weight to live weight ratio (fraction).

bone_free_meat_fraction

Numeric. Bone-free meat to carcass weight ratio (fraction).

meat_protein_fraction

Numeric. Protein content of bone-free meat (kg protein/kg bone-free meat).

ratio_me_to_ne

Numeric. Metabolizable-to-net energy ratio (fraction). Used for CML. Suggested: 0.43.

Additional columns when has_herd_structure = FALSE:

birth_fraction_female

Numeric. Probability that a newborn is female (fraction).

herd_size_total

Numeric. Total population at start of year, all cohorts (heads).

feed_rations

data.table. Cohort-level feed ration shares, also used by run_ration_quality_module and run_emissions_ration_module. Required columns:

herd_id

Character. Unique herd identifier.

species_short

Character. Species code (see Common identifiers).

cohort_short

Character. Cohort code (see Common identifiers).

feed_id

Character. Unique feed component identifier, used as join key with feed parameter tables.

feed_name

Character. Optional. Human-readable feed name; should match feed_id uniquely if provided.

feed_ration_fraction

Numeric. Proportion of this feed component in the total ration as a fraction of diet dry matter intake (fraction). Must sum to 1 within each herd_id \times cohort combination.

feed_params

data.table. Feed nutritional parameters. Required columns:

feed_id

Character. Unique feed component identifier.

feed_gross_energy

Numeric. Gross energy: total chemical energy upon complete combustion (MJ/kg DM).

feed_digestible_energy_ruminant

Numeric. Digestible energy for ruminants: energy absorbed after faecal losses (MJ/kg DM).

feed_digestible_energy_pigs

Numeric. Digestible energy for pigs (MJ/kg DM).

feed_metabolizable_energy_ruminant

Numeric. Metabolizable energy for ruminants: digestible energy minus urinary and gaseous losses (MJ/kg DM).

feed_metabolizable_energy_pigs

Numeric. Metabolizable energy for pigs (MJ/kg DM).

feed_metabolizable_energy_chicken

Numeric. Metabolizable energy for chickens: digestible energy minus uric acid and gaseous losses (MJ/kg DM).

feed_nitrogen_content

Numeric. Nitrogen content (kg N/kg DM).

feed_urinary_energy_ruminant

Numeric. Fraction of gross energy excreted in urine for ruminants (fraction).

feed_urinary_energy_pigs

Numeric. Fraction of gross energy excreted in urine for pigs (fraction).

feed_ash

Numeric. Ash content as a fraction of dry matter (g ash/100 g DM).

category

Character. Optional. Feed category; should be used consistently with feed_id.

feed_name

Character. Optional. Human-readable feed name; should match feed_id uniquely if provided.

feed_emissions

data.table. Emission factors per feed component. All emission factors are expressed per kg of feed dry matter intake. Required columns:

feed_id

Character. Unique feed component identifier.

feed_name

Character. Optional. Human-readable feed name.

co2_feed_fertilizer

Numeric. CO2 from fertilizer manufacture (g CO2/kg DM).

co2_feed_pesticides

Numeric. CO2 from pesticide manufacture (g CO2/kg DM).

co2_feed_crop_activities

Numeric. CO2 from on-field agricultural activities (g CO2/kg DM).

co2_feed_luc_nopeat

Numeric. CO2 from land-use change, excluding peatland drainage (g CO2/kg DM).

co2_feed_luc_peat

Numeric. CO2 from peatland drainage (g CO2/kg DM).

n2o_feed_fertilizer

Numeric. N2O from fertilizer use (g N2O/kg DM).

n2o_feed_manure_applied

Numeric. N2O from manure applied to or deposited on soil (g N2O/kg DM).

n2o_feed_crop_residues

Numeric. N2O from crop residue decomposition (g N2O/kg DM).

ch4_feed_rice

Numeric. CH4 from rice cultivation (g CH4/kg DM).

manure_management_system_fraction

data.table. Cohort-level manure management system fractions passed to run_emissions_manure_module. Required columns:

herd_id

Character. Unique herd identifier.

cohort_short

Character. Cohort code (see Common identifiers).

manure_management_system

Character. Manure management system name. mms_pasture and mms_burned are reserved for manure deposited on pasture and burned for fuel, respectively. All other systems are grouped as "other".

manure_management_system_fraction

Numeric. Fraction of total manure handled by this system for each herd \times cohort combination (0–1). Must sum to 1 per herd_id.

manure_management_system_factors

data.table. Emission factors and parameters per manure management system, passed to run_emissions_manure_module. Required columns:

manure_management_system

Character. System name (see manure_management_system_fraction).

ratio_m3CH4_to_kgCH4

Numeric. CH4 density conversion factor (kg/m3). Default: 0.67.

methane_conversion_factor_mcf

Numeric. Fraction of maximum CH4-producing capacity (Bo) realised under given management and environmental conditions (0–1). See IPCC Table 10.17 (2006, 2019).

ch4_max_producing_capacity_bo

Numeric. Maximum CH4-producing capacity per unit volatile solids (m3 CH4/kg VS). Region- and species-specific. See IPCC Table 10.16 (2019) or Tables 10A-4 to 10A-9 (2006).

n2o_ef3

Numeric. Direct N2O emission factor per manure management system (kg N2O-N/kg N). See IPCC Table 10.21 and Table 11.1 (2006, 2019).

n2o_ef4

Numeric. Indirect N2O emission factor from atmospheric deposition of volatilised N (kg N2O-N/(kg NH3-N + NOx-N)). See IPCC Table 11.3 (2006, 2019).

nitrogen_fracgas

Numeric. Fraction of excreted N volatilised as NH3 and NOx during collection, storage, and treatment (0–1). See IPCC Table 10.22 (2006, 2019).

n2o_ef5

Numeric. Indirect N2O emission factor from leaching and runoff (kg N2O-N/kg N). See IPCC Table 11.3 (2006, 2019).

nitrogen_fracleach

Numeric. Fraction of excreted N lost through leaching and runoff (0–1). See IPCC Table 10.22 (2006, 2019).

simulation_duration

Numeric. Assessment period length (days). Used by the demographic herd simulation (when has_herd_structure = FALSE) and by the production and aggregation steps. Default: 365.

global_warming_potential_set

Character. GWP-100 conversion factors for expressing CH4 and N2O as CO2-eq. One of:

  • "AR6": IPCC 6th Assessment (2021) — CH4 = 27, N2O = 273.

  • "AR5_excluding_carbon_feedback": IPCC 5th Assessment, excl. climate-carbon feedbacks (2013) — CH4 = 28, N2O = 265.

  • "AR5_including_carbon_feedback": IPCC 5th Assessment, incl. climate-carbon feedbacks (2013) — CH4 = 34, N2O = 298.

  • "AR4": IPCC 4th Assessment (2007) — CH4 = 25, N2O = 298.

show_indicator

Logical. Whether to display progress indicators during calculations. Defaults to TRUE.

Details

The GLEAM package implements the core computational engine of the Global Livestock Environmental Assessment Model (GLEAM), developed by the Food and Agriculture Organization of the United Nations (FAO). It provides a modular workflow for quantifying greenhouse gas emissions from livestock systems using a Life Cycle Assessment (LCA) approach based on the IPCC Tier 2 methodology.

The pipeline covers seven species (CTL, BFL, CML, SHP, GTS, PGS). Within each herd, animals are organised into six sex-age cohorts (FJ, FS, FA, MJ, MS, MA). These identifiers are used consistently across all modules.

The assessment period is specified in days via simulation_duration (typically 365). Intermediate per-head-per-day variables are carried through the cohort workflow and scaled to cohort and herd totals in the final aggregation step.

Pipeline sequence

  1. If has_herd_structure = FALSE, generate herd structure with run_demographic_herd_module; otherwise use supplied tables directly.

  2. Compute cohort weights (run_weights_module).

  3. Summarise ration quality (run_ration_quality_module) and merge into the cohort table.

  4. Compute energy requirements and dry matter intake (run_metabolic_energy_req_module).

  5. Compute enteric CH4 (run_emissions_enteric_module).

  6. Compute nitrogen balance (run_nitrogen_balance_module).

  7. Compute manure emissions (run_emissions_manure_module).

  8. Summarise feed production emissions (run_emissions_ration_module) and merge into the cohort table.

  9. Compute production outputs (run_production_module).

  10. Compute allocation (run_allocation_module).

  11. Aggregate to herd-level results and CO2-eq (run_aggregation_module).

All inputs containing herd_id must refer to the same herd set. Validation blocks variables that are expected to be produced internally.

Value

A named list with four elements:

cohort_level_results

A cohort-level data.table containing the original input columns plus all variables generated across the pipeline. Calculated variables are grouped below by module.

Demographic herd simulation

Computed when has_herd_structure = FALSE:

cohort_stock_size

Numeric. Average population size in each of the 6 sex-age cohorts (# heads). (cohorts = FJ, FS, FA, MJ, MS, MA).

offtake_heads

Numeric. Total number of animals removed via offtake over the year, aggregated to 6 sex-age cohorts (heads/year) (cohorts = FJ, FS, FA, MJ, MS, MA).

offtake_heads_assessment

Numeric. Total number of animals removed via offtake over the assessment period, aggregated to 6 sex-age cohorts (heads/assessment period) (cohorts = FJ, FS, FA, MJ, MS, MA).

Weight variables

live_weight_mature_stage

Numeric. Mature (adult) live weight that the animal can attain under given biological and management conditions (kg).

live_weight_cohort_initial

Numeric. Live weight at the beginning of the cohort stage (kg).

live_weight_cohort_potential_final

Numeric. Potential final live weight attainable at the end of the cohort stage in the absence of offtake (kg). (For juveniles: equals weaning weight; For subadults: equals adult live weight; For adults: equals adult live weight)

live_weight_cohort_at_slaughter

Numeric. Live weight at slaughter for animals removed from the cohort (kg).

live_weight_cohort_average

Numeric. Average live weight over the cohort stage. Computed by accounting for the share of offtaken animals within the cohort, using their slaughter weight, and the potential final weight of animals that remain in the cohort (kg).

live_weight_cohort_final

Numeric. Live weight at the end of the cohort stage, accounting for both surviving and offtaken animals. Computed as a weighted average of the potential final weight of surviving animals and the slaughter weight of offtaken animals, based on the offtake rate (kg).

daily_weight_gain

Numeric. Average live weight gain of the cohort over the cohort stage (kg/head/day).

Ration quality variables

ration_gross_energy

Numeric. Average gross energy content of the diet (MJ/kg DM).

ration_metabolizable_energy

Numeric. Average metabolizable energy content of the diet (MJ/kg DM).

ration_nitrogen

Numeric. Average nitrogen content of diet (kg N/kg DM).

ration_digestibility_fraction

Numeric. Average digestibility of the feed ration, expressed as ratio of digestible (or metabolizable, for poultry) to gross energy content (fraction).

ration_urinary_energy_fraction

Numeric. Fraction of feed's gross energy that is excreted in urine (fraction).

ration_ash

Numeric. Average ash content of feed, calculated as a fraction of the dry matter intake (kg ash/kg DM).

Energy requirement variables

Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS unless stated otherwise.

metabolic_energy_req_maintenance

Numeric. Energy required for maintenance, defined as the amount of energy needed to keep the animal at equilibrium such that body energy is neither gained nor lost (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

metabolic_energy_req_activity

Numeric. Energy required for activity, defined as the amount of energy needed to support animal movement and physical activity (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

metabolic_energy_req_growth

Numeric. Energy required for growth (i.e., weight gain) (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

metabolic_energy_req_lactation

Numeric. Energy required for lactation (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

metabolic_energy_req_work

Numeric. Energy required for work, used to estimate the energy required for draught power for CTL, BFL and CML (MJ/head/day). Assumed to be 0 for other species. Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

metabolic_energy_req_fibre_production

Numeric. Energy required for the synthesis of fibre for SHP, GTS and CML. Assumed to be 0 for other species. (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS (MJ/head/day).

metabolic_energy_req_pregnancy

Numeric. Energy required for pregnancy for pregnant females (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

net_energy_maintenance_digestible_energy_ratio

Numeric. Ratio of net energy available for maintenance in the diet to digestible energy consumed (fraction).

net_energy_growth_digestible_energy_ratio

Numeric. Ratio of net energy available for growth in the diet to digestible energy consumed (fraction).

metabolic_energy_req_total

Numeric. Total daily energy requirement (MJ/head/day). For CTL, BFL, SHP and GTS this is expressed as gross energy intake requirement (GE). For CML and PGS the function returns the summed daily metabolizable energy requirement.

ration_intake

Numeric. Average daily dry matter intake of feed (kg DM/head/day).

Enteric emission variables

ch4_mitigation_factor

Numeric. Multiplicative mitigation factor applied to baseline enteric methane (CH4) emissions (dimensionless). If not provided, a default value of 1 (no mitigation) is used.

ch4_conversion_factor_ym

Numeric. Methane (CH4) conversion factor (ym), representing the percentage of gross energy of the feed ration that is converted to CH4 (percentage).

ch4_enteric

Numeric. Average daily enteric methane (CH4) emissions (kg CH4/head/day).

Nitrogen balance variables

nitrogen_intake

Numeric. Daily nitrogen intake (kg N/head/day).

nitrogen_retention

Numeric. Daily nitrogen retention in animal body tissues and products (e.g., growth, pregnancy, milk...) (kg N/head/day).

nitrogen_excretion

Numeric. Daily nitrogen excretion (kg N/head/day).

Manure emission variables

volatile_solids

Numeric. Total volatile solids (VS) excreted per animal per day, representing the organic material in livestock manure and consisting of both biodegradable and non-biodegradable fractions (kg VS/head/day).

ch4_manure_pasture

Numeric. Methane (CH4) emissions from manure deposited on pasture (kg CH4/head/day).

ch4_manure_burned

Numeric. Methane (CH4) emissions from manure burned for fuel (kg CH4/head/day).

ch4_manure_other

Numeric. Methane (CH4) emissions from manure management systems, excluding emissions from manure deposited on pasture and burned for fuel (kg CH4/head/day).

ch4_manure_all_noburn

Numeric. Methane (CH4) emissions from manure management systems, excluding manure burned for fuel (kg CH4/head/day).

n2o_manure_pasture_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure deposited on pasture (kg N2O/head/day).

n2o_manure_burned_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure burned for fuel (kg N2O/head/day).

n2o_manure_other_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure management systems, excluding emissions from manure deposited on pasture and burned for fuel (kg N2O/head/day).

n2o_manure_all_noburn_direct

Numeric. Direct nitrous oxide (N2O) emissions from manure management systems, excluding emissions from manure burned for fuel (kg N2O/head/day).

n2o_manure_pasture_vol

Numeric. Indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3 and NOx) from manure deposited on pasture (kg N2O/head/day).

n2o_manure_burned_vol

Numeric. Indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3 and NOx) from manure burned for fuel (kg N2O/head/day).

n2o_manure_other_vol

Numeric. Indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3 and NOx) from manure management systems, excluding manure deposited on pasture and manure burned for fuel (kg N2O/head/day).

n2o_manure_all_noburn_vol

Numeric. Indirect nitrous oxide (N2O) emissions resulting from atmospheric deposition of volatilised nitrogen (NH3 and NOx) from manure management systems, excluding losses from manure burned for fuel (kg N2O/head/day).

n2o_manure_pasture_leach

Numeric. Indirect nitrous oxide (N2O) emissions resulting from leaching and runoff of manure nitrogen from manure deposited on pasture (kg N2O/head/day).

n2o_manure_burned_leach

Numeric. Indirect nitrous oxide (N2O) emissions resulting from leaching and runoff of manure nitrogen from manure burned for fuel (kg N2O/head/day).

n2o_manure_other_leach

Numeric. Indirect nitrous oxide (N2O) emissions resulting from leaching and runoff of manure nitrogen from manure management systems, excluding losses from manure deposited on pasture and manure burned for fuel (kg N2O/head/day).

n2o_manure_all_noburn_leach

Numeric. Indirect nitrous oxide (N2O) emissions resulting from leaching and runoff of manure nitrogen from manure management systems, excluding losses from manure burned for fuel (kg N2O/head/day).

n2o_manure_pasture_indirect

Numeric. Total indirect nitrous oxide (N2O) emissions from manure deposited on pasture. Includes emissions from atmospheric deposition of volatilised nitrogen (NH3 and NOx) and from leaching and runoff of manure nitrogen (kg N2O/head/day).

n2o_manure_burned_indirect

Numeric. Total indirect nitrous oxide (N2O) emissions originating from manure burned for fuel. Includes emissions from atmospheric deposition of volatilised nitrogen (NH3 and NOx) and from leaching and runoff of manure nitrogen (kg N2O/head/day).

n2o_manure_other_indirect

Numeric. Total indirect nitrous oxide (N2O) emissions originating from manure management systems, excluding manure deposited on pasture and burned for fuel. Includes emissions from atmospheric deposition of volatilised nitrogen (NH3 and NOx) and from leaching and runoff of manure nitrogen (kg N2O/head/day).

n2o_manure_pasture_total

Numeric. Total nitrous oxide emissions from manure deposited on pasture. Includes direct emissions and indirect emissions from volatilisation, leaching, and runoff (kg N2O/head/day).

n2o_manure_burned_total

Numeric. Total nitrous oxide emissions (N2O) from manure burned for fuel. Includes direct emissions and indirect emissions from volatilisation, leaching, and runoff (kg N2O/head/day).

n2o_manure_other_total

Numeric. Total nitrous oxide (N2O) emissions from manure management systems, excluding manure deposited on pasture and manure burned for fuel. Includes direct emissions and indirect emissions from volatilisation, leaching, and runoff (kg N2O/head/day).

Feed production emission variables

co2_ration_fertilizer

Numeric. Diet-level average carbon dioxide (CO2) emission factor from fertilizer manufacture in feed production (g CO2/kg DM).

co2_ration_pesticides

Numeric. Diet-level average carbon dioxide (CO2) emission factor from pesticide manufacture in feed production (g CO2/kg DM).

co2_ration_crop_activities

Numeric. Diet-level average carbon dioxide (CO2) emission factor from on-field agricultural activities in feed production (g CO2/kg DM).

co2_ration_luc_nopeat

Numeric. Diet-level average carbon dioxide (CO2) emission factor from land-use change (excluding peatland drainage) in feed production (g CO2/kg DM).

co2_ration_luc_peat

Numeric. Diet-level average carbon dioxide (CO2) emission factor from peatland drainage in feed production (g CO2/kg DM).

n2o_ration_fertilizer

Numeric. Diet-level average nitrous oxide (N2O) emission factor from fertilizer use in feed production (g N2O/kg DM).

n2o_ration_manure_applied

Numeric. Diet-level average nitrous oxide (N2O) emission factor from manure applied to or deposited on soil in feed production (g N2O/kg DM).

n2o_ration_crop_residues

Numeric. Diet-level average nitrous oxide (N2O) emission factor from crop residues decomposition in feed production (g N2O/kg DM).

ch4_ration_rice

Numeric. Diet-level average methane (CH4) emission factor from rice cultivation in feed production (g CH4/kg DM).

Production variables

milk_production_mass_cohort

Numeric. Total milk production produced over the assessment period (kg/cohort/assessment period).

milk_production_protein_cohort

Numeric. Total milk protein production produced over the assessment period (kg protein/cohort/assessment period).

milk_production_fpcm_cohort

Numeric. Total fat-protein-corrected milk (FPCM) produced over the assessment period (kg/cohort/assessment period).

fibre_production_cohort

Numeric. Total fibre produced over the assessment period by cohort (kg/cohort/assessment period).

meat_production_live_weight_cohort

Numeric. Total meat produced as live weight over the assessment period by cohort (kg/cohort/assessment period).

meat_production_carcass_weight_cohort

Numeric. Total meat as carcass weight (excluding organs, and other by-products after dressing) produced over the assessment period by cohort (kg/cohort/assessment period).

meat_production_bone_free_meat_cohort

Numeric. Total bone-free-meat (excluding bones, organs, and other by-products after dressing and bone removal) produced over the assessment period by cohort (kg/cohort/assessment period).

meat_production_protein_cohort

Numeric. Total meat protein (excluding bones, organs, and other by-products after dressing and bone removal) produced over the assessment period by cohort (kg protein/cohort/assessment period).

Allocation variables

milk_allocation_energy

Numeric. Energy required to produce total milk output by cohort (MJ/cohort/assessment period). Non-zero values are applicable only to milk-producing species and cohorts (species = CTL, BFL, CML, SHP, GTS; cohorts = FA). All other species-cohort combinations are assigned a value of 0.

meat_allocation_energy

Numeric. Energy required by a given sex-age cohort for total meat output by cohort during the assessment period, equal to the energy needed to produce all live-weight gain to reach the target slaughter weight (MJ/cohort/assessment period).

fibre_allocation_energy

Numeric. Energy required to produce all fibre output by cohort (MJ/cohort/assessment period).

work_allocation_energy

Numeric. Energy required to provide all draught power (traction/work) by cohort (MJ/cohort/assessment period).

egg_allocation_energy

Numeric. Energy required for egg production over the assessment period (MJ/cohort/assessment period). Currently set to 0.

herd_level_results

A herd-level data.table. When has_herd_structure = FALSE, the output from run_demographic_herd_module, including:

growth_rate_herd

Numeric. Annualized growth rate at which the herd reaches steady state (fraction).

When has_herd_structure = TRUE, the supplied herd_level_data is returned unchanged.

allocation_long

A herd-level data.table in long format with one row per herd \times commodity \times emission source:

herd_id

Character. Herd identifier.

species_short

Character. Species code.

variable_name

Character. Emission variable name (e.g. "ch4_enteric", "n2o_manure_pasture_direct").

commodity_name

Character. Commodity category: one of "None", "Milk", "Meat", "Fibre", "Work", "Eggs".

commodity_type

Character. "Edible" or "Non-Edible".

allocation_share

Numeric. Allocation share for this commodity-emission combination (fraction).

aggregation_results

A named list from run_aggregation_module with elements results_emissions, results_feed, results_production, and results_nitrogen. These tables summarise herd-level emissions, feed intake, production, and nitrogen balance, all scaled to the assessment duration.

See Also

run_demographic_herd_module, run_weights_module, run_ration_quality_module, run_metabolic_energy_req_module, run_emissions_enteric_module, run_nitrogen_balance_module, run_emissions_manure_module, run_emissions_ration_module, run_production_module, run_allocation_module, run_aggregation_module

Examples

# Example 1: You do NOT have herd structure — use cohort input for herd simulation.
# Pipeline runs herd simulation first, then the rest of the pipeline.

path_run_gleam_examples <- system.file("extdata/run_gleam_examples", package = "gleam")

master_chrt_lvl_no_structure_dt <- data.table::fread(file.path(
  path_run_gleam_examples, "master_chrt_lvl_no_structure_data.csv"
))
master_hrd_lvl_dt <- data.table::fread(
file.path(path_run_gleam_examples, "master_hrd_lvl_data.csv")
)
feed_rations_chrt_dt <- data.table::fread(
file.path(path_run_gleam_examples, "feed_rations_share_chrt.csv")
)
feed_params_dt <- data.table::fread(system.file(
  "extdata/run_gleam_examples/feed_quality.csv",
  package = "gleam"
))
feed_emissions_dt <- data.table::fread(system.file(
  "extdata/run_gleam_examples/feed_emission_factors.csv",
  package = "gleam"
))

manure_management_system_fraction_dt <- data.table::fread(
  file.path(path_run_gleam_examples, "manure_management_system_fraction.csv")
)
manure_management_system_factors_dt <- data.table::fread(
  file.path(path_run_gleam_examples, "manure_management_system_factors.csv")
)

results <- run_gleam(
  has_herd_structure = FALSE,
  cohort_level_data = master_chrt_lvl_no_structure_dt,
  herd_level_data = master_hrd_lvl_dt,
  feed_rations = feed_rations_chrt_dt,
  feed_params = feed_params_dt,
  feed_emissions = feed_emissions_dt,
  manure_management_system_fraction = manure_management_system_fraction_dt,
  manure_management_system_factors = manure_management_system_factors_dt,
  simulation_duration = 365
)
print(results$cohort_level_results)
print(results$allocation_long)


# Example 2: You already HAVE herd structure — use cohort table and skip herd simulation.
# Pipeline skips herd simulation and uses this as the starting cohort table.

path_run_gleam_examples <- system.file("extdata/run_gleam_examples", package = "gleam")

master_chrt_lvl_structure_dt <- data.table::fread(file.path(
  path_run_gleam_examples, "master_chrt_lvl_structure_data.csv"
))
master_hrd_lvl_dt <- data.table::fread(
file.path(path_run_gleam_examples, "master_hrd_lvl_data.csv")
)
feed_rations_chrt_dt <- data.table::fread(
file.path(path_run_gleam_examples, "feed_rations_share_chrt.csv")
)
feed_params_dt <- data.table::fread(system.file(
  "extdata/run_gleam_examples/feed_quality.csv",
  package = "gleam"
))
feed_emissions_dt <- data.table::fread(system.file(
  "extdata/run_gleam_examples/feed_emission_factors.csv",
  package = "gleam"
))

manure_management_system_fraction_dt <- data.table::fread(
  file.path(path_run_gleam_examples, "manure_management_system_fraction.csv")
)
manure_management_system_factors_dt <- data.table::fread(
  file.path(path_run_gleam_examples, "manure_management_system_factors.csv")
)

results <- run_gleam(
  has_herd_structure = TRUE,
  cohort_level_data = master_chrt_lvl_structure_dt,
  herd_level_data = master_hrd_lvl_dt,
  feed_rations = feed_rations_chrt_dt,
  feed_params = feed_params_dt,
  feed_emissions = feed_emissions_dt,
  manure_management_system_fraction = manure_management_system_fraction_dt,
  manure_management_system_factors = manure_management_system_factors_dt,
  simulation_duration = 365,
  global_warming_potential_set = "AR6"
)
print(results$cohort_level_results)
print(results$allocation_long)


Run Metabolic Energy Requirements and Dry Matter Intake Module Pipeline

Description

Calculates cohort-level daily energy requirements (MJ/head/day) and ration dry matter intake (kg DM/head/day) by applying the IPCC Tier 2 energy partitioning functions.

Usage

run_metabolic_energy_req_module(
  cohort_level_data,
  herd_level_data,
  show_indicator = TRUE
)

Arguments

cohort_level_data

data.table. Cohort-level input table with the following data requirement:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

live_weight_cohort_average

Numeric. Average live weight over the cohort stage. Computed by accounting for the share of offtaken animals within the cohort, using their slaughter weight, and the potential final weight of animals that remain in the cohort (kg).

offtake_rate

Numeric. Annual proportion of animals removed from the herd for each sex-age cohort (fraction).

low_activity_fraction

Numeric. Proportion of the assessment period during which the animal performs low-intensity movement typical of stall-feeding or near-field grazing, characterized by minimal walking distances and flat terrain (fraction).

high_activity_fraction

Numeric. Proportion of the assessment period during which the animal engages in sustained locomotion associated with herding or long-distance grazing, typically involving extended walking distances and/or uneven or hilly terrain (fraction).

live_weight_cohort_initial

Numeric. Live weight at the beginning of the cohort stage (kg).

live_weight_cohort_final

Numeric. Live weight at the end of the cohort stage, accounting for both surviving and offtaken animals. Computed as a weighted average of the potential final weight of surviving animals and the slaughter weight of offtaken animals, based on the offtake rate (kg).

live_weight_mature_stage

Numeric. Mature (adult) live weight that the animal can attain under given biological and management conditions (kg).

daily_weight_gain

Numeric. Average live weight gain of the cohort over the cohort stage (kg/head/day).

cohort_duration_days

Numeric. Amount of time that each animal spends in a specific cohort (days).

ration_digestibility_fraction

Numeric. Average digestibility of the feed ration, expressed as ratio of digestible to gross energy content (fraction).

ration_gross_energy

Numeric. Average gross energy content of the diet (MJ/kg DM).

ration_metabolizable_energy

Numeric. Average metabolizable energy content of the diet (MJ/kg DM).

herd_level_data

data.table. Herd-level input table (one row per herd_id) with the following data requirement:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

age_first_parturition

Numeric. Age at first parturition for female breeding animals (days).

lactating_females_fraction

Numeric. Proportion of adult females that are lactating during the assessment period (fraction). Required only for species = CML, CTL, BFL, SHP, and GTS.

milk_yield_day

Numeric. Average milk yield per milk-producing animal during the assessment duration (kg/head/day). This value is calculated as the total quantity of milk produced for human consumption by milk-producing animals during the assessment period, divided by the number of milk-producing animals, and the length of the assessment period (days). Required only for species = CML, CTL, BFL, SHP, and GTS.

milk_fat_fraction

Numeric. Milk fat fraction (kg fat / kg milk). Required only for species = CML, CTL, BFL, SHP, and GTS.

non_productive_duration

Numeric. Period during which the animal is not performing any productive physiological function such as pregnancy or lactation (days). Required only for PGS.

pregnancy_duration

Numeric. Duration of pregnancy period (days).

litter_size

Numeric. Average number of offspring born per parturition (# offsprings/parturition). This value can be calculated as the total number of offspring born divided by the total number of parturitions during the year.

death_rate_juvenile

Numeric. Fraction of deaths in a herd over a year for juvenile cohorts (i.e. FJ and MJ), (fraction).

live_weight_at_birth

Numeric. Live weight of the animal at birth (kg).

live_weight_at_weaning

Numeric. Live weight of the animal at weaning (kg).

lactation_duration

Numeric. Duration of the lactation period, defined as the number of days during which the animal is lactating (days). Required only for PGS.

parturition_rate

Numeric. Average annual number of parturitions per female animal (# parturitions/adult female/year). A herd-level reproductive performance indicator calculated as the total number of parturitions (deliveries) occurring during a year divided by the number of adult females potentially able to give birth during that year.

draught_work_hours_female

Numeric. Average daily working time per adult female (hours/head/day). Required only for species = CML, CTL, and BFL.

draught_work_hours_male

Numeric. Average daily working time per adult male (hours/head/day). Required only for species = CML, CTL, and BFL.

draught_fraction_female

Numeric. Fraction of adult females involved in draught work (fraction). Required only for species = CML, CTL, and BFL.

draught_fraction_male

Numeric. Fraction of adult males involved in draught work (fraction). Required only for species = CML, CTL, and BFL.

fibre_yield_year

Numeric. Annual production yield of fibre, such as wool, cashmere, mohair (kg/head/year). Required only for species = CML, SHP, and GTS.

show_indicator

Logical. Whether to display progress indicators during simulation. Defaults to TRUE.

Details

This function joins cohort_level_data with herd_level_data by herd_id, uses species_short directly for all species-specific energy calculations, and computes IPCC Tier 2 energy partition components and derived feed intake metrics by cohort.

Energy requirements are expressed as:

This function represents the intermediate module of the Global Livestock Environmental Assessment Model (GLEAM) computational pipeline run_gleam() to estimate animals' metabolic energy requirements and dry matter intake and performs the following calculation sequence:

  1. Maintenance energy is computed using calc_metabolic_energy_req_maintenance.

  2. Activity energy is computed using calc_metabolic_energy_req_activity.

  3. Growth energy is computed using calc_metabolic_energy_req_growth.

  4. Lactation energy is computed using calc_metabolic_energy_req_lactation.

  5. Work energy is computed using calc_metabolic_energy_req_work.

  6. Fibre production energy is computed using calc_metabolic_energy_req_fibre.

  7. Pregnancy energy is computed using calc_metabolic_energy_req_pregnancy.

  8. Diet net energy ratios are computed using calc_rem_maintenance and calc_reg_growth (ruminants only).

  9. Total daily energy requirement is computed using calc_total_metabolic_energy_req.

  10. Daily dry matter intake is computed using calc_ration_intake.

Value

A data.table with the original cohort-level input columns plus the following new variables:

metabolic_energy_req_maintenance

Numeric. Energy required for maintenance, defined as the amount of energy needed to keep the animal at equilibrium such that body energy is neither gained nor lost. Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS (MJ/head/day).

metabolic_energy_req_activity

Numeric. Energy required for activity, defined as the amount of energy needed to support animal movement and physical activity (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

metabolic_energy_req_growth

Numeric. Energy required for growth (i.e., weight gain) (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

metabolic_energy_req_lactation

Numeric. Energy required for lactation (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

metabolic_energy_req_work

Numeric. Energy required for work, used to estimate the energy required for draught power for CTL, BFL and CML (MJ/head/day). Assumed to be 0 for other species. Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

metabolic_energy_req_fibre_production

Numeric. Energy required for the synthesis of fibre for SHP, GTS and CML. Assumed to be 0 for other species. (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS (MJ/head/day).

metabolic_energy_req_pregnancy

Numeric. Energy required for pregnancy for pregnant females (MJ/head/day). Expressed as net energy for CTL, BFL, SHP, GTS and as metabolizable energy for CML and PGS.

net_energy_maintenance_digestible_energy_ratio

Numeric. Ratio of net energy available for maintenance in the diet to digestible energy consumed (fraction).

net_energy_growth_digestible_energy_ratio

Numeric. Ratio of net energy available for growth in the diet to digestible energy consumed (fraction).

metabolic_energy_req_total

Numeric. Total daily energy requirement (MJ/head/day). For CTL, BFL, SHP and GTS this is expressed as gross energy intake requirement (GE). For CML and PGS the function returns the summed daily metabolizable energy requirement.

ration_intake

Numeric. Average daily dry matter intake of feed (kg DM/head/day).

See Also

run_gleam, calc_metabolic_energy_req_maintenance, calc_metabolic_energy_req_activity, calc_metabolic_energy_req_growth, calc_metabolic_energy_req_lactation, calc_metabolic_energy_req_work, calc_metabolic_energy_req_fibre, calc_metabolic_energy_req_pregnancy, calc_rem_maintenance, calc_reg_growth, calc_total_metabolic_energy_req, calc_ration_intake

Examples


# Load metabolic energy requirements inputs (cohort and herd-level)
metabolic_energy_req_chrt_dt <- data.table::fread(system.file(
  "extdata/run_modules_examples/metabolic_energy_req_input_chrt_data.csv",
  package = "gleam"
))
metabolic_energy_req_hrd_dt <- data.table::fread(system.file(
  "extdata/run_modules_examples/metabolic_energy_req_input_hrd_data.csv",
  package = "gleam"
))

# Run metabolic energy requirement and rations calculations
results <- run_metabolic_energy_req_module(
  cohort_level_data = metabolic_energy_req_chrt_dt,
  herd_level_data = metabolic_energy_req_hrd_dt
)



Run Nitrogen Balance Module Pipeline

Description

Calculates cohort-level daily nitrogen intake, retention, and excretion (kg N/head/day) by applying IPCC Tier 2 approach.

Usage

run_nitrogen_balance_module(
  cohort_level_data,
  herd_level_data,
  show_indicator = TRUE
)

Arguments

cohort_level_data

data.table. Cohort-level input table with the following data requirement:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

ration_intake

Numeric. Average daily dry matter intake of feed (kg DM/head/day).

ration_nitrogen

Numeric. Average nitrogen content of diet (kg N/kg DM).

daily_weight_gain

Numeric. Average live weight gain of the cohort over the cohort stage (kg/head/day).

cohort_duration_days

Numeric. Amount of time that each animal spends in a specific cohort (days).

herd_level_data

data.table. Herd-level input table (one row per herd_id) with the following data requirement:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

milk_protein_fraction

Numeric. Milk protein fraction (kg protein / kg milk). Required only for species = CML, CTL, BFL, SHP, and GTS.

milk_yield_day

Numeric. Average milk yield per milk-producing animal during the assessment duration (kg/head/day). This value is calculated as the total quantity of milk produced for human consumption by milk-producing animals during the assessment period, divided by the number of milk-producing animals, and the length of the assessment period (days). Required only for species = CML, CTL, BFL, SHP, and GTS.

fibre_yield_year

Numeric. Annual production yield of fibre, such as wool, cashmere, mohair (kg/head/year). Required only for species = CML, SHP, and GTS.

litter_size

Numeric. Average number of offspring born per parturition (# offsprings/parturition). This value can be calculated as the total number of offspring born divided by the total number of parturitions during the year.

parturition_rate

Numeric. Average annual number of parturitions per female animal (# parturitions/adult female/year). A herd-level reproductive performance indicator calculated as the total number of parturitions (deliveries) occurring during a year divided by the number of adult females potentially able to give birth during that year.

live_weight_at_weaning

Numeric. Live weight of the animal at weaning (kg).

live_weight_at_birth

Numeric. Live weight of the animal at birth (kg).

pregnancy_duration

Numeric. Duration of pregnancy period (days).

show_indicator

Logical. Whether to display progress indicators during simulation. Defaults to TRUE.

Details

This function represents the intermediate module of the Global Livestock Environmental Assessment Model (GLEAM) computational pipeline run_gleam() to compute the nitrogen balance. The function joins cohort_level_data with herd_level_data by herd_id, uses species_short directly for all species-specific nitrogen balance calculations, and computes cohort-level nitrogen balance components following the IPCC Tier 2 structure.

The following calculation sequence is applied:

  1. Daily nitrogen intake is computed using calc_nitrogen_intake from ration_intake and ration_nitrogen.

  2. Daily nitrogen retention is computed using calc_nitrogen_retention from cohort-level and herd-level species parameters.

  3. Daily nitrogen excretion is computed using calc_nitrogen_excretion as intake minus retention (species-specific validation applied).

Value

A data.table with the original cohort-level input columns plus the following new variables:

nitrogen_intake

Numeric. Daily nitrogen intake (kg N/head/day).

nitrogen_retention

Numeric. Daily nitrogen retention in animal body tissues and products (e.g., growth, pregnancy, milk...) (kg N/head/day)

nitrogen_excretion

Numeric. Daily nitrogen excretion (kg N/head/day).

See Also

run_gleam, calc_nitrogen_intake, calc_nitrogen_retention, calc_nitrogen_excretion

Examples


# Load nitrogen balance inputs (cohort and herd-level)
nitrogen_balance_chrt_dt <- data.table::fread(system.file(
  "extdata/run_modules_examples/nitrogen_balance_input_chrt_data.csv",
  package = "gleam"
))
nitrogen_balance_hrd_dt <- data.table::fread(system.file(
  "extdata/run_modules_examples/nitrogen_balance_input_hrd_data.csv",
  package = "gleam"
))

# Run nitrogen balance calculations
results <- run_nitrogen_balance_module(
  cohort_level_data = nitrogen_balance_chrt_dt,
  herd_level_data = nitrogen_balance_hrd_dt
)



Run Production Module Pipeline

Description

Calculates cohort-level production outputs over the assessment period by combining cohort-level herd structure inputs with herd-level production parameters. The function returns milk, fibre, and meat outputs for each cohort.

Usage

run_production_module(
  cohort_level_data,
  herd_level_data,
  simulation_duration = 365,
  show_indicator = TRUE
)

Arguments

cohort_level_data

data.table. Cohort-level input table (one row per herd-cohort) with the following data requirement:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

cohort_stock_size

Numeric. Average population size in each of the 6 sex–age cohorts (# heads). (cohorts=FJ, FS, FA, MJ, MS, MA).

offtake_heads_assessment

Numeric. Total number of animals removed via offtake over the assessment period, aggregated to 6 sex–age cohorts (heads/assessment period) (cohorts = FJ, FS, FA, MJ, MS, MA).

live_weight_cohort_at_slaughter

Numeric. Live weight at slaughter for animals removed from the cohort (kg).

herd_level_data

data.table. Herd-level input table (one row per herd_id) with the following data requirement:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

milk_yield_day

Numeric. Average milk yield per milk-producing animal during the assessment duration (kg/head/day). This value is calculated as the total quantity of milk produced for human consumption by milk-producing animals during the assessment period, divided by the number of milk-producing animals, and the length of the assessment period (days). Required only for species = CML, CTL, BFL, SHP, and GTS.

lactating_females_fraction

Numeric. Proportion of adult females that are lactating during the assessment period (fraction). Required only for species: CML, CTL, BFL, SHP, and GTS.

milk_protein_fraction

Numeric. Milk protein fraction (kg protein/kg milk). Required only for species = CML, CTL, BFL, SHP, and GTS.

milk_fat_fraction

Numeric. Milk fat fraction (kg fat/kg milk). Required only for species = CML, CTL, BFL, SHP, and GTS.

milk_lactose_fraction

Numeric. Milk lactose fraction (kg lactose/kg milk). Required only for species = CML, CTL, BFL, SHP, and GTS.

milk_protein_fraction_standard

Numeric. Standard protein content of milk, used to calculate Fat-protein-corrected milk (FPCM), (kg protein/kg milk). Suggested value = 0.033.

milk_fat_fraction_standard

Numeric. Standard fat content of milk, used to calculate Fat-protein-corrected milk (FPCM), (kg fat/kg milk). Suggested value = 0.04.

milk_lactose_fraction_standard

Numeric. Standard lactose content of milk, used to calculate Fat-protein-corrected milk (FPCM), (kg lactose/kg milk). Suggested value = 0.048.

fibre_yield_year

Numeric. Annual production yield of fibre, such as wool, cashmere, mohair (kg/head/year). Required only for species = CML, SHP, and GTS.

carcass_dressing_fraction

Numeric. Ratio of a slaughtered animal's carcass weight to its live weight (fraction).

bone_free_meat_fraction

Numeric. Ratio of bone-free-meat to carcass weight (fraction).

meat_protein_fraction

Numeric. Protein content of bone-free-meat (kg protein/kg bone-free-meat).

simulation_duration

Numeric. Length of the assessment period (days).

show_indicator

Logical. Whether to display progress indicators during simulation. Defaults to TRUE.

Details

This function represents the intermediate module of the Global Livestock Environmental Assessment Model (GLEAM) computational pipeline run_gleam() to estimate meat, milk and fibre production outputs from livestock and performs the following calculation sequence:

  1. Milk outputs are computed using calc_milk_production

  2. Fibre outputs are computed using calc_fibre_production

  3. Meat outputs are computed using calc_meat_production

For species/cohorts where milk or fibre production is not applicable, outputs are returned as zero.

Value

A data.table with the original cohort-level input columns plus the following new variables:

milk_production_mass_cohort

Numeric. Total milk production produced over the assessment period (kg/cohort/assessment period).

milk_production_protein_cohort

Numeric. Total milk protein production produced over the assessment period (kg protein/cohort/assessment period).

milk_production_fpcm_cohort

Numeric. Total fat-protein-corrected milk (FPCM) produced over the assessment period (kg/cohort/assessment period).

fibre_production_cohort

Numeric. Total fibre produced over the assessment period by cohort (kg /cohort/assessment period).

meat_production_live_weight_cohort

Numeric . Total meat produced as live weight over the assessment period by cohort (kg/cohort/assessment period).

meat_production_carcass_weight_cohort

Numeric. Total meat as carcass weight (excluding organs, and other by-products after dressing) produced over the assessment period by cohort (kg/cohort/assessment period).

meat_production_bone_free_meat_cohort

Numeric. Total bone-free-meat (excluding bones, organs, and other by-products after dressing and bone removal) produced over the assessment period by cohort (kg/cohort/assessment period).

meat_production_protein_cohort

Numeric. Total meat protein (excluding bones, organs, and other by-products after dressing and bone removal) produced over the assessment period by cohort (kg protein/cohort/assessment period).

See Also

run_gleam, calc_milk_production, calc_fibre_production, calc_meat_production

Examples


# Load production inputs (cohort and herd-level)
production_chrt_dt <- data.table::fread(system.file(
  "extdata/run_modules_examples/production_input_chrt_data.csv",
  package = "gleam"
))
production_hrd_dt <- data.table::fread(system.file(
  "extdata/run_modules_examples/production_input_hrd_data.csv",
  package = "gleam"
))

# Run production calculations
results <- run_production_module(
  cohort_level_data = production_chrt_dt,
  herd_level_data = production_hrd_dt,
  simulation_duration = 365
)


Run Ration Quality Module Pipeline

Description

Calculates 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.

Usage

run_ration_quality_module(rations_share, feed_params, show_indicator = TRUE)

Arguments

rations_share

data.table. Cohort-level feed ration composition shares with the following minimum data requirement:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

species_short

Character. Code identifying the livestock species. Supported values include:

  • PGS: pigs

  • CML: camels

  • CTL: cattle

  • BFL: buffalo

  • SHP: sheep

  • GTS: goats

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

feed_id

Character. Unique identifier for the feed component, used to join feed ration data with feed parameter tables.

feed_name

Character. Feed component name (optional, for readability and reporting). If provided, it should uniquely identify the same feed component as feed_id.

feed_ration_fraction

Numeric. Proportion of a specific feed component in the total ration, expressed as its fraction of diet dry matter intake (fraction). Within each herd_id and cohort, proportions should sum to 1.

feed_params

data.table. Feed nutritional parameters with the following minimum data requirement:

feed_id

Character. Unique identifier for the feed component, used to join feed ration data with feed parameter tables.

feed_gross_energy

Numeric. Gross energy content of a feed component, representing the total chemical energy released upon complete combustion of the feed (MJ/kg DM).

feed_digestible_energy_ruminant

Numeric. Digestible energy content of a feed component for ruminants, representing the energy absorbed by the animal after fecal losses (MJ/kg DM).

feed_digestible_energy_pigs

Numeric. Digestible energy content of a feed component for pigs, representing the energy absorbed by the animal after fecal losses (MJ/kg DM).

feed_metabolizable_energy_ruminant

Numeric. Metabolizable energy content of a feed component for ruminants, representing digestible energy minus energy losses in urine and gaseous products of digestion (MJ/kg DM).

feed_metabolizable_energy_pigs

Numeric. Metabolizable energy content of a feed component for pigs, representing digestible energy minus energy losses in urine and gaseous products of digestion (MJ/kg DM).

feed_nitrogen_content

Numeric. Nitrogen content of a feed component (kg N/kg DM).

feed_urinary_energy_ruminant

Numeric. Fraction of feed's gross energy that is excreted in urine for ruminants (fraction).

feed_urinary_energy_pigs

Numeric. Fraction of feed's gross energy that is excreted in urine for pigs (fraction).

feed_ash

Numeric. Average ash content by feed component, calculated as a fraction of the dry matter intake (g ash/100g DM).

category

Character. Feed category (optional). If provided, it should be used consistently with feed_id, for a coherent result.

feed_name

Character. Feed component name (optional, for readability and reporting). If provided, it should uniquely identify the same feed component as feed_id.

show_indicator

Logical. Whether to display progress indicators during calculations. Defaults to TRUE.

Details

This function represents the intermediate module of the Global Livestock Environmental Assessment Model (GLEAM) computational pipeline run_gleam() to estimate the nutritional quality of the feed ration. This function joins rations_share with feed_params by feed_id, uses species_short directly, and computes ration-weighted nutritional metrics by cohort.

The following calculation sequence is applied:

  1. Species-specific digestibility ratios are computed from energy parameters and feed_gross_energy using calc_feed_digestibility_fraction.

  2. Contributions of each feed component are computed as ration-weighted values:

  3. Cohort-level nutritional metrics are obtained for the whole feed ration by summing contributions across feed components within each herd_id, species_short, and cohort_short.

Value

data.table. Cohort-level nutritional metrics summarized by herd_id, species_short, and cohort_short with the following columns:

ration_gross_energy

Numeric. Average gross energy content of the diet (MJ/kg DM).

ration_metabolizable_energy

Numeric. Average metabolizable energy content of the diet (MJ/kg DM).

ration_nitrogen

Numeric. Average nitrogen content of diet (kg N/kg DM).

ration_digestibility_fraction

Numeric. Average digestibility of the feed ration, expressed as ratio of digestible to gross energy content (fraction).

ration_urinary_energy_fraction

Numeric. Fraction of feed's gross energy that is excreted in urine (fraction).

ration_ash

Numeric. Average ash content of feed, calculated as a fraction of the dry matter intake (kg ash/kg DM).

See Also

run_gleam, 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

Examples


# Load feed rations inputs (cohort-level shares and feed parameters)
feed_rations_chrt_dt <- data.table::fread(system.file(
  "extdata/run_modules_examples/feed_rations_share_chrt.csv",
  package = "gleam"
))
feed_params_dt <- data.table::fread(system.file(
  "extdata/run_modules_examples/feed_quality.csv",
  package = "gleam"
))

result <- run_ration_quality_module(
  rations_share = feed_rations_chrt_dt,
  feed_params = feed_params_dt
)


Run Weights Module Pipeline

Description

Calculates cohort-level live weight metrics by combining cohort-level inputs with herd-level biological parameters. The function 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.

Usage

run_weights_module(cohort_level_data, herd_level_data, show_indicator = TRUE)

Arguments

cohort_level_data

A data.table in long format with one row per herd \times cohort. Must include:

herd_id

Character. Unique identifier for the herd, repeated for each cohort belonging to the same herd.

cohort_short

Character. Sex- and age-specific cohort code describing the production stage of the animals. Supported values include:

  • FA: adult females (from age at first parturition)

  • FS: sub-adult females (from weaning to age at first parturition)

  • FJ: juvenile females (from birth to weaning)

  • MA: adult males (from age at first breeding)

  • MS: sub-adult males (from weaning to age at first breeding)

  • MJ: juvenile males (from birth to weaning)

cohort_duration_days

Numeric. Amount of time that each animal spends in a specific cohort (days).

offtake_rate

Numeric. Annual proportion of animals removed from the herd for each sex-age cohort (fraction).

herd_level_data

A data.table with one row per herd. Must include:

  • live_weight_female_adult Numeric. Live weight of adult females (kg)

  • live_weight_male_adult Numeric. Live weight of adult males (kg)

  • live_weight_at_birth Numeric. Live weight of the animal at birth (kg).

  • live_weight_at_weaning Numeric. Live weight of the animal at weaning (kg)

  • live_weight_female_at_slaughter Numeric. Slaughter weight of female sub-adult animals (kg)

  • live_weight_male_at_slaughter Numeric. Slaughter weight of male sub-adult animals (kg)

show_indicator

Logical. Whether to display progress indicators during calculations. Defaults to TRUE.

Details

This function represents the intermediate module of the Global Livestock Environmental Assessment Model (GLEAM) computational pipeline run_gleam() to estimate animals' live weight and is composed of the following steps:

  1. Cohort-stage weight assignment using calc_cohort_weights. Herd-level biological parameters are matched to each cohort row by herd_id via data.table joins.

  2. Calculation of average and final live weights (accounting for offtake) using calc_avg_weights.

  3. Calculation of average daily live weight gain using calc_daily_weight_gain.

Value

A named list with two data.tables:

cohort_level_results

The input cohort_level_data with these additional columns:

live_weight_mature_stage

Numeric. Mature (adult) live weight that the animal can attain under given biological and management conditions (kg).

live_weight_cohort_initial

Numeric. Live weight at the beginning of the cohort stage (kg).

live_weight_cohort_potential_final

Numeric. Potential final live weight attainable at the end of the cohort stage in the absence of offtake (kg). (For juveniles: equals weaning weight; For subadults: equals adult live weight; For adults: equals adult live weight)

live_weight_cohort_at_slaughter

Numeric. Live weight at slaughter for animals removed from the cohort (kg).

live_weight_cohort_average

Numeric. Average live weight over the cohort stage. Computed by accounting for the share of offtaken animals within the cohort, using their slaughter weight, and the potential final weight of animals that remain in the cohort (kg).

live_weight_cohort_final

Numeric. Live weight at the end of the cohort stage, accounting for both surviving and offtaken animals. Computed as a weighted average of the potential final weight of surviving animals and the slaughter weight of offtaken animals, based on the offtake rate (kg).

daily_weight_gain

Numeric. Average live weight gain of the cohort over the cohort stage (kg/head/day).

herd_level_results

A copy of the input herd_level_data.

See Also

run_gleam, calc_cohort_weights, calc_avg_weights, calc_daily_weight_gain,

Examples


# Load weights inputs (cohort- and herd-level)
weights_chrt_dt <- data.table::fread(system.file(
  "extdata/run_modules_examples/weights_input_chrt_data.csv",
  package = "gleam"
))
weights_hrd_dt <- data.table::fread(system.file(
  "extdata/run_modules_examples/weights_input_hrd_data.csv",
  package = "gleam"
))

# Run weight calculations
results <- run_weights_module(
  cohort_level_data = weights_chrt_dt,
  herd_level_data = weights_hrd_dt
)

# Access results
print(results$cohort_level_results)
print(results$herd_level_results)