RUFAS.data_structures.crop_soil_to_feed_storage_connection module#

class RUFAS.data_structures.crop_soil_to_feed_storage_connection.CropCategory(*values)#

Bases: Enum

Enum for Crop Categories.

Attributes#

SMALL_GRAINstr

Represents small grain crops.

CORNstr

Represents corn crops.

SOYstr

Represents soy crops.

GRASSstr

Represents grass crops.

ALFALFAstr

Represents alfalfa crops.

SMALL_GRAIN = 'Small grain'#
CORN = 'Corn'#
SOY = 'Soy'#
GRASS = 'Grass'#
ALFALFA = 'Alfalfa'#
class RUFAS.data_structures.crop_soil_to_feed_storage_connection.CropType(*values)#

Bases: Enum

Enum for subdivisions of Crop Categories.

Attributes#

WHEATstr

Represents a type of Small Grain.

RYEstr

Represents a type of Small Grain.

OATstr

Represents a type of Small Grain.

RICEstr

Represents a type of Small Grain.

HIGH_MOISTUREstr

Represents a type of Corn.

SILAGEstr

Represents a type of Corn.

WHOLE_PLANTstr

Represents a type of Corn.

GRAINstr

Represents a type of Corn or Soy.

FORAGEstr

Represents a type of Soy.

ALFALFAstr

Represents a type of Alfalfa.

RYEGRASSstr

Represents a type of Grass.

ORCHARDGRASSstr

Represents a type of Grass.

FINE_FESCUEstr

Represents a type of Grass.

TALL_FESCUEstr

Represents a type of Grass.

MEADOW_FESCUEstr

Represents a type of Grass.

WHEAT = 'Wheat'#
RYE = 'Rye'#
OAT = 'Oat'#
RICE = 'Rice'#
HIGH_MOISTURE = 'High-moisture'#
SILAGE = 'Silage'#
WHOLE_PLANT = 'Whole-plant'#
GRAIN = 'Grain'#
FORAGE = 'Forage'#
ALFALFA = 'Alfalfa'#
RYEGRASS = 'Ryegrass'#
ORCHARDGRASS = 'Orchardgrass'#
FINE_FESCUE = 'Fine Fescue'#
TALL_FESCUE = 'Tall Fescue'#
MEADOW_FESCUE = 'Meadow Fescue'#
class RUFAS.data_structures.crop_soil_to_feed_storage_connection.StorageType(*values)#

Bases: Enum

Maps each storage type to its respective class.

PROTECTED_INDOORS = 'Protected Indoors'#
PROTECTED_WRAPPED = 'Protected Wrapped'#
PROTECTED_TARPED = 'Protected Tarped'#
UNPROTECTED = 'Unprotected'#
BALEAGE = 'Baleage'#
DRY = 'Dry'#
HIGH_MOISTURE = 'High Moisture'#
BUNKER = 'Bunker'#
PILE = 'Pile'#
BAG = 'Bag'#
class RUFAS.data_structures.crop_soil_to_feed_storage_connection.HarvestedCrop(category: CropCategory, type: CropType, config_name: str, rufas_ids: list[int], harvest_time: date, storage_time: 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)#

Bases: object

A class to represent a harvested crop with its attributes.

Attributes#

categoryCropCategory

The category of the crop (enum).

typeCropType

The type of the crop (enum), a subdivision of crop category.

config_namestr

Name of the crop configuration that produced this harvested crop.

rufas_idslist[RUFAS_ID]

List of RUFAS_IDs that this Harvested Crop may be fed as (unitless).

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.

dry_matter_mass

Methods#

__post_init__():

Validates the category and type relationship.

category: CropCategory#
type: CropType#
config_name: str#
rufas_ids: list[int]#
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#
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.

remove_dry_matter_mass(mass_to_remove: float) None#

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

_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__(category: CropCategory, type: CropType, config_name: str, rufas_ids: list[int], harvest_time: date, storage_time: 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) None#
class RUFAS.data_structures.crop_soil_to_feed_storage_connection.HarvestedCropStorageType(harvested_crop: HarvestedCrop, storage_type: StorageType)#

Bases: NamedTuple

Used to couple a yield collected in the Crop and Soil module with the storage type it will be put in.

harvested_crop: HarvestedCrop#

Alias for field number 0

storage_type: StorageType#

Alias for field number 1

_asdict()#

Return a new dict which maps field names to their values.

_field_defaults = {}#
_fields = ('harvested_crop', 'storage_type')#
classmethod _make(iterable)#

Make a new HarvestedCropStorageType object from a sequence or iterable

_replace(**kwds)#

Return a new HarvestedCropStorageType object replacing specified fields with new values