RUFAS.biophysical.animal.animal_module_reporter module#

class RUFAS.biophysical.animal.animal_module_reporter.AnimalModuleReporter#

Bases: object

classmethod data_padder(reference_variable: str, full_variable_to_add: str, thing_to_add: Any, simulation_day: int, info_map: dict[str, Any], units: dict[str, MeasurementUnits] | MeasurementUnits) None#

Pads a variable in OutputManager for entries that it “missed” relative to another variable.

This is meant to be used prior to the addition of a variable to OutputManager, only in the cases where there may be a mismatch in variable lengths. A common case would be when a variable is stored in OutputManager by pen, and additional pens are created during the simulation.

This method checks the length of a reference variable (in the previous example, Pen 0) in OutputManager and the variable of interest (in the previous example, a newly created Pen 15), and if there is a mismatch greater than one, it makes the number of calls to OutputManager necessary to ensure the length of the variable to add is one less than the reference variable using “blank” data.

Parameters#

reference_variablestr

The “reference” variable name as found in om.variables_pool. In the case of a pen, this should be pen 0 (as it will always be instantiated at the start of the simulation).

full_variable_to_add: str

The variable name as found in om.variables_pool.

thing_to_addAny

The variable data to pad the om.variables_pool with.

simulation_day: int

The day of the simulation.

info_map: Dict[str, Any]

The info_map to use when padding.

units: Dict[str, str] | str

Units for the variable being added, in the format provided in the main call to add_variable, (e.g., the one following the call of data_padder).

classmethod report_daily_animal_population(herd_statistics: HerdStatistics, simulation_day: int) None#

Adds daily totals for animal types to OutputManager.

Parameters#

herd_statisticsHerdStatistics

The HerdStatistics object containing the statistics for the animals in the herd.

simulation_dayint

The current simulation day.

classmethod report_milk(milk_reports: list[MilkProductionStatistics], simulation_day: int) None#

Adds milk information for all cows in pen to output manager.

Parameters#

milk_reportslist[MilkProductionStatistics]

A list of MilkProductionStatistics for each lactating cow in the herd.

simulation_dayint

Day of simulation.

classmethod report_ration_per_animal(pen_base_name: str, ration_per_animal: dict[int, float], total_dry_matter: float, num_animals: int, simulation_day: int) None#

Reports the ration consumption per animal along with additional simulation details.

Parameters#

pen_base_namestr

The base name of the pen for which the ration report is created.

ration_per_animaldict[RUFAS_ID, float]

A dictionary mapping animal identifiers (RUFAS_ID) to the amount of ration consumption per animal in kilograms.

total_dry_matterfloat

The total dry matter intake for all animals in the pen.

num_animalsint

The number of animals present in the pen during the simulation.

simulation_dayint

The current simulation day when the ration report is generated.

classmethod report_nutrient_amounts(pen_base_name: str, average_nutrition_supply: NutritionSupply, num_animals: int, simulation_day: int) None#

Reports the amounts of nutrients in the ration.

classmethod report_average_nutrient_requirements(pen_base_name: str, average_nutrition_requirements: NutritionRequirements, average_body_weight: float, average_milk_production_reduction: float, num_animals: int, simulation_day: int) None#

Reports the average nutrient requirements for a pen of animals over a simulation period.

Parameters#

pen_base_namestr

The identifier for the pen in which the group of animals resides.

average_nutrition_requirementsNutritionRequirements

The average nutrient requirements for the pen, encapsulated in a NutritionRequirements object.

average_body_weightfloat

The average body weight of the animals in the pen.

average_milk_production_reductionfloat

The average milk production reduction for these animals.

num_animalsint

The number of animals present in the pen.

simulation_dayint

The current day in the simulation for which data is being reported.

classmethod report_average_nutrient_evaluation_results(pen_base_name: str, average_nutrition_evaluation: NutritionEvaluationResults, simulation_day: int) None#

Reports the average nutritional evaluation results for a specific pen and simulation day.

Parameters#

pen_base_namestr

The base name of the pen for which the nutrient evaluation data is reported.

average_nutrition_evaluationNutritionEvaluationResults

Contains the average values of nutrient evaluation differences for various metrics such as energy, protein, and minerals.

simulation_dayint

Represents the simulation day for which the nutrient evaluation report is generated.

classmethod report_me_diet(pen_base_name: str, metabolizable_energy: float, num_animals: int, simulation_day: int) None#

Reports the metabolizable energy of the diet for a specified pen.

Parameters#

pen_base_namestr

The base name of the pen for which the metabolizable energy is reported.

metabolizable_energyfloat

The value of the metabolizable energy in the given units.

num_animalsint

The number of animals present in the pen.

simulation_dayint

The specific day in the simulation when this data is captured.

classmethod report_daily_herd_total_ration(herd_total_ration: dict[str, float], simulation_day: int) None#

Adds the daily total ration of the herd to the OutputManager.

Parameters#

herd_total_rationdict[str, float]

The total ration of the herd.

simulation_dayint

The day of simulation.

classmethod report_daily_ration_per_pen(pen_id: str, pen_animal_name: str, pen_ration: dict[str, float], simulation_day: int) None#

Calculates and reports the total amounts of feed fed to animals in a pen in a given day.

Parameters#

pen_idstr

ID of the pen.

pen_animal_namestr

Name of the animal combination in the pen.

pen_rationdict[str, float]

Dictionary of feed types and total amounts fed to animals in the pen.

simulation_dayint

Day of simulation.

classmethod report_enteric_methane_emission(enteric_methane_emission_by_pen: dict[str, float]) None#

Reports the amount of daily emission by pen.

classmethod report_manure_streams(manure_streams: dict[str, ManureStream], simulation_day: int) None#

Report Animal Module manure stream data to Output Manager.

Parameters#

manure_streamsdict[str, ManureStream]

A dictionary of manure stream data, where the key is the formatted stream name and the value is the ManureStream object.

simulation_dayint

The simulation day.

classmethod report_manure_excretions(manure_excretions: dict[str, AnimalManureExcretions], simulation_day: int) None#

Report pen AnimalManureExcretions to Output Manager.

Parameters#

manure_excretionsdict[str, AnimalManureExcretions]

A dictionary of manure excretion data, where the key is the formatted base name and the value is the AnimalManureExcretions object.

simulation_dayint

The simulation day.

classmethod report_herd_statistics_data(herd_statistics: HerdStatistics, simulation_day: int) None#

Adds daily herd statistics data to OutputManager.

Parameters#

herd_statisticsHerdStatistics

The HerdStatistics object containing the daily herd statistics data.

simulation_dayint

Day of simulation.

classmethod report_daily_pen_total(pen_id: str, pen_animal_name: str, number_of_animals_in_pen: int, simulation_day: int) None#

Reports the pen total animal numbers.

Parameters#

pen_idstr

The pen ID.

pen_animal_namestr

The pen animal name.

number_of_animals_in_penint

The number of animals in the pen.

simulation_dayint

The current simulation day.

classmethod report_sold_animal_information(herd_statistics: HerdStatistics) None#

Adds a dictionary of sold animal information to the output manager.

Parameters#

herd_statisticsHerdStatistics

The HerdStatistics object containing sold animal information.

classmethod report_stillborn_calves_information(stillborn_calves: list[StillbornCalfTypedDict] | list[dict[str, int]], report_name: str, total_days: int) None#

Adds a dictionary of sold animal information to the output manager on daily basis.

Parameters#

stillborn_calveslist[StillbornCalfTypedDict]

List of stillborn calves.

report_namestr

The string to be appended to the variable being reported to the OM.

total_daysint

The total number of days in the simulation

classmethod report_sold_animal_information_sort_by_sell_day(sold_animals: list[SoldAnimalTypedDict], report_name: str, total_days: int) None#

Adds a dictionary of sold animal information to the output manager on daily basis.

Parameters#

sold_animalslist[object]

List of sold animals.

report_namestr

The string to be appended to the variable being reported to the OM.

total_daysint

The total number of days in the simulation

classmethod report_305d_milk(average_herd_305_days_milk_production: float) None#

Adds herd mean of latest_milk_production_305days to the output manager, though only for lactating cows with nonzero values.

Parameters#

average_herd_305_days_milk_productionfloat

The herd average total past 305-day milk production.

classmethod report_end_of_simulation(herd_statistics: HerdStatistics, herd_reproduction_statistics: HerdReproductionStatistics, time: RufasTime, heiferII_events_by_id: dict[str, str], cow_events_by_id: dict[str, str]) None#

Calls all reporter methods that should happen at the end of the simulation.

Parameters#

herd_statisticsHerdStatistics

Instance of HerdStatistics class.

herd_reproduction_statisticsHerdReproductionStatistics

Instance of HerdReproductionStatistics class.

timeRufasTime

The RufasTime object with the current time information.

heiferII_events_by_iddict[str, str]

The dictionary of HeiferII events.

cow_events_by_iddict[str, str]

The dictionary of Cow events.

classmethod _record_animal_events(animal_events_by_id: dict[str, str], simulation_day: int) None#

Record the events of the animals.

Parameters#

animal_events_by_iddict[str, str]

A dictionary of animal events, where the key is a string containing the animal id and the animal type, and the value is the string representation of the events of the animal.

simulation_dayint

The current simulation day.

classmethod _record_heiferIIs_conception_rate(herd_reproduction_statistics: HerdReproductionStatistics) None#

Record the conception rate of heiferIIs.

classmethod _record_cows_conception_rate(herd_reproduction_statistics: HerdReproductionStatistics) None#

Record the conception rate of cows.

classmethod report_animal_population_statistics(prefix: str, herd_summary: AnimalPopulationStatistics) None#

Reports the herd summary statistics for the starting animal population.

classmethod report_total_disease_days() None#

Adds total animal-days of disease to Output Manager.

classmethod report_disease_incidence() None#

Adds disease-incidence data to Output Manager.

classmethod report_lost_milk_production() None#

Reports lost milk production due to disease to Output Manager.

classmethod report_feed_efficiency_decreases() None#

Reports feed efficiency decreases due to disease to Output Manager.

classmethod report_milk_co2_increases() None#

Reports increases in milk kgCO2/kgMilk due to disease to Output Manager.

classmethod report_income_losses() None#

Reports losses in income due to disease to Output Manager.