RUFAS.biophysical.animal.milk.milk_production module#

class RUFAS.biophysical.animal.milk.milk_production.MilkProduction#

Bases: object

Handles updating the milk-production related animal attributes.

Attributes#

FAT_PERCENTfloat

Class constant which stores the user-defined fat percentage of milk (by weight).

TRUE_PROTEIN_PERCENTfloat

Class constant which stores the user-defined true protein percentage of milk (by weight).

Notes#

The class constants for fat and true protein percentages in milk are intended to be stores. The actual fat and true protein percentages of an individual animal will be stored in the MilkProductionProperties instance associated with that animal.

crude_protein_percent: float#
true_protein_percent: float#
fat_percent: float#
lactose_percent: float#
wood_l: float#
wood_m: float#
wood_n: float#
__init__() None#
crude_protein_content: float#
true_protein_content: float#
fat_content: float#
lactose_content: float#
milk_production_reduction: float#
current_lactation_305_day_milk_produced: float#
milk_production_history: list[MilkProductionRecord]#
property daily_milk_produced: float#
classmethod set_milk_quality(fat_percent: float, true_protein_percent: float, lactose_percent: float) None#

Sets user-defined milk qualities.

set_wood_parameters(wood_l: float, wood_m: float, wood_n: float) None#
perform_daily_milking_update(milk_production_inputs: MilkProductionInputs, time: RufasTime) MilkProductionOutputs#

Handles an animal’s daily milking update.

Parameters#

milking_propertiesMilkProductionProperties

Animal properties only used to determine milk production.

general_propertiesGeneralProperties

Animal properties that are general or are used to determine many animal outcomes.

timeRufasTime

RufasTime instance containing the current time of the simulation.

Returns#

tuple[MilkingProperties, GeneralProperties]

Milking and general properties of the animal after milk production-related updates for the current day.

perform_daily_milking_update_without_history(milk_production_inputs: MilkProductionInputs) MilkProductionOutputs#

Handles an animal’s daily milking update, without updating the milk history attributes. This method is intended to be utilized only prior to the first ration formulation.

Parameters#

milk_production_inputsMilkProductionProperties

Animal properties only used to determine milk production.

Returns#

MilkProductionOutputs

Milking properties of the animal after milk production-related updates for the current day.

static calculate_daily_milk_production(days_in_milk: int, l_param: float, m_param: float, n_param: float) float#

Calculates the milk yield on the given day using Wood’s lactation curve.

Notes#

[AN.MLK.9]

Parameters#

days_in_milkint

Days into milk of the cow.

l_param: float

Wood’s lactation curve parameter l.

m_param: float

Wood’s lactation curve parameter m.

n_param: float

Wood’s lactation curve parameter n.

Returns#

numpy.float64

Milk yield on the provided day (kg).

References#

Li, M., et al. “Investigating the effect of temporal, geographic, and management factors on US Holstein lactation curve parameters.” Journal of Dairy Science 105.9 (2022): 7525-7538.

static calc_305_day_milk_yield(l_param: float, m_param: float, n_param: float) float#

Calculates the total milk yield from day 1 to day 305 of the lactation.

Notes#

[AN.MLK.10]

Parameters#

l_param: float

Wood’s lactation curve parameter l.

m_param: float

Wood’s lactation curve parameter m.

n_param: float

Wood’s lactation curve parameter n.

Returns#

float

305 day milk yield for a cow with the given lactation curve (kg).

_get_milk_production_adjustment() float#

Randomly adjusts the milk production on a specific day.

Parameters#

milking_propertiesMilkProductionProperties

Animal properties only used to determine milk production.

general_propertiesGeneralProperties

Animal properties that are general or are used to determine many animal outcomes.

Returns#

general_propertiesGeneralProperties

Animal properties with the daily_milk_produced attribute updated.

_calculate_nutrient_content(milk: float, nutrient_percentage: float) float#

Calculates the amount of a given nutrient in milk.

Parameters#

milkfloat

Amount of milk produced (kg).

nutrient_percentagefloat

Percentage of nutrient in the milk.

Returns#

float

Amount of nutrient contained in the milk (kg).

_update_milking_history(days_in_milk: int, daily_milk_produced: float, days_born: int, time: RufasTime) None#

Updates the milking history kept in a MilkProductionProperties instance.