RUFAS.biophysical.animal.ration.ration_manager module#

class RUFAS.biophysical.animal.ration.ration_manager.RationManager#

Bases: object

Handles the initialization and management of user-defined animal rations.

Each ration formulation is represented as a dictionary, where the key is the RuFaS ID of a feed and the value is the percentage it contributes to the ration.

Attributes#

user_defined_rationsdict[AnimalCombination, dict[RUFAS_ID, float]]

A mapping of animal groupings to their respective ration formulations.

ration_feedsdict[AnimalCombination, list[RUFAS_ID]]

A mapping of animal groupings to the list of RuFaS feed IDs available to formulate their ration.

tolerancefloat

Fraction +/- of target user defined ration value (as a fraction of dry matter intake estimate) allowable in ration formulation.

maximum_ration_reformulation_attemptsint

Maximum number of attempts to formulate a ration in a single ration interval for a single pen.

CALF_DRY_MATTER_INTAKE = 3#
_om = <RUFAS.output_manager.OutputManager object>#
ration_feeds: dict[AnimalCombination, list[int]] | None#
user_defined_rations: dict[AnimalCombination, dict[int, float]] | None#
tolerance: float | None = 0.0#
maximum_ration_reformulation_attempts: int#
classmethod set_ration_feeds(ration_config: dict[str, list[int]]) None#

Maps the input feeds available for each ration to Animal combinations.

Parameters#

ration_configdict[str, list[int]]

Collection of animal requirements and feed supply information for ration formulation.

classmethod get_ration_feeds(animal_combination: AnimalCombination) list[int]#

Generate a list of feed RuFaS IDs for the given animal combination that user defined to be used as the ration.

Parameters#

animal_combinationAnimalCombination

The combination of animals in the pen.

Returns#

list[RUFAS_ID]

A list of feed RuFaS IDs that user defined to be used as the feed for the given animal combination.

classmethod set_user_defined_ration_tolerance(ration_config: dict[str, dict[str, list[dict[str, int | float]] | float]]) None#

Collects the tolerance value for user defined rations.

Parameters#

ration_configdict[str, dict[str, list[dict[str, int | float]] | float]]

Collection of animal requirements and feed supply information for ration formulation.

classmethod set_user_defined_rations(ration_config: dict[str, dict[str, list[dict[str, int | float]] | float]]) None#

Maps the input user-defined rations to Animal combinations.

Parameters#

ration_configdict[str, dict[str, list[dict[str, int | float]] | float]]

Collection of animal requirements and feed supply information for ration formulation.

classmethod get_user_defined_ration(animal_combination: AnimalCombination, requirements: NutritionRequirements) dict[int, float]#

Generate a ration for the given animal type scaled to the estimated dry matter intake requirement.

Parameters#

animal_combinationAnimalCombination

The combination of animals in the pen.

requirementsNutritionRequirements

The nutrition requirements of an animal or average of a group of animals.

Returns#

dict[RUFAS_ID, float]

A mapping of feed RuFaS IDs to the amount of feed required in the ration (kg dry matter).

classmethod get_user_defined_ration_feeds(animal_combination: AnimalCombination) list[int]#

Generate a list of feed RuFaS IDs for the given animal combination that user defined to be used as the ration.

Parameters#

animal_combinationAnimalCombination

The combination of animals in the pen.

Returns#

list[RUFAS_ID]

A list of feed RuFaS IDs that user defined to be used as the feed for the given animal combination.