RUFAS.data_structures.crop_soil_to_feed_storage_connection module#

class RUFAS.data_structures.crop_soil_to_feed_storage_connection.HarvestedCrop(config_name: str, field_name: str, harvest_time: ~datetime.date, storage_time: ~datetime.date, fresh_mass: float, dry_matter_percentage: float, dry_matter_digestibility: float, crude_protein_percent: float, non_protein_nitrogen: float, starch: float, adf: float, ndf: float, lignin: float, sugar: float, ash: float, recorded_days: set[int] = <factory>)#

Bases: object

A class to represent a harvested crop with its attributes.

Attributes#

config_namestr

Name of the crop configuration that produced this harvested crop.

field_namestr

Name of the field from which this crop was harvested.

harvest_timedate

The time at which the crop was harvested.

storage_timedate

The time at which the crop was stored.

last_time_degradeddate

The last time at which the quality and mass of the crop was recalculated. This value is initially set to the storage time of the crop.

fresh_massfloat

The fresh mass of the crop in kg.

dry_matter_percentagefloat

Percent of mass that is not water.

initial_dry_matter_percentagefloat

Percent of mass that is not water at the time this crop is stored.

initial_dry_matter_massfloat

Mass of dry matter initially stored (kg). Note that this value is only used if this crop is stored in a Hay instance (or one of its child classes), and is only calculated at the time of storage.

dry_matter_digestibilityfloat

Percent of mass that is digestible.

crude_protein_percentfloat

Percent of mass that is dietary crude protein.

non_protein_nitrogenfloat

Percent of mass that is non-protein nitrogen.

starchfloat

Percent of mass that is starch.

adffloat

Percent of mass that is acid detergent fiber.

ndffloat

Percent of mass that is neutral detergent fiber.

ligninfloat

Percent of mass that is lignin.

sugarfloat

Percent of mass that is labile carbohydrate.

ashfloat

Percent of mass that is ash.

estimated_maximum_effluentfloat

Total amount of mass that will be lost from this crop as effluent in kg. Note that this value is only used if this crop is stored in a Silage instance (or one of its child classes), and is calculated only once, when it is stored.

bale_densityfloat

Density of this crop if it is hayed in kg per cubic meter. Note that this value is only used if this crop is stored in a Hay instance (or one of its child classes), and is only calculated at the time of storage.

total_sensible_heat_generatedfloat

Heat generated by this crop if it is hayed in kJ per kg. Note that this value is only used if this crop is stored in a Hay instance (or one of its child classes), and is only calculated at the time of storage.

recorded_daysset[int]

A set of simulation days on which this crop was recorded.

dry_matter_mass

The mass of dry matter in the crop in kg. This is calculated from the fresh mass and dry matter percentage.

Methods#

__post_init__():

Validates the category and type relationship.

config_name: str#
field_name: str#
harvest_time: date#
storage_time: date#
last_time_degraded: date#
fresh_mass: float#
dry_matter_percentage: float#
initial_dry_matter_percentage: float#
initial_dry_matter_mass: float#
dry_matter_digestibility: float#
crude_protein_percent: float#
non_protein_nitrogen: float#
starch: float#
adf: float#
ndf: float#
lignin: float#
sugar: float#
ash: float#
recorded_days: set[int]#
estimated_maximum_effluent: float#
bale_density: float#
total_sensible_heat_generated: float#
property dry_matter_mass: float#

Calculates the dry matter mass of this crop in kg.

property is_alfalfa: bool#

Checks if the crop is alfalfa based on its configuration name.

Returns#

bool

True if the crop is alfalfa, False otherwise.

remove_dry_matter_mass(mass_to_remove: float) None#

Removes the specified amount of dry matter mass from the crop.

remove_feed_mass(dm_to_remove: float) None#

Removes the specified dry matter mass of feed from the crop and keeps the dry matter percentage unchanged.

Parameters#

dm_to_removefloat

Dry-matter to remove. (kg).

estimate_maximum_effluent() float#

Calculates the total amount of effluent loss this crop will experience if it is ensiled.

Returns#

float

Estimated maximum amount of mass that will flow out of this crop in kg.

References#

_calculate_bale_density() float#

Calculates the bale density of hayed crop.

Returns#

float

Bale density of this crop (kg / cubic meter).

References#

_calculate_total_sensible_heat_generated() float#

Calculates the total sensible heat generated by a hayed crop.

Returns#

float

Total sensible heat generated by this crop (kJ per kilogram).

References#

__init__(config_name: str, field_name: str, harvest_time: ~datetime.date, storage_time: ~datetime.date, fresh_mass: float, dry_matter_percentage: float, dry_matter_digestibility: float, crude_protein_percent: float, non_protein_nitrogen: float, starch: float, adf: float, ndf: float, lignin: float, sugar: float, ash: float, recorded_days: set[int] = <factory>) None#