RUFAS.biophysical.manure.processor module#

class RUFAS.biophysical.manure.processor.Processor(name: str, is_housing_emissions_calculator: bool)#

Bases: ABC

Base class for all manure processors.

Parameters#

namestr

Unique identifier of the processor.

is_housing_emissions_calculatorbool

Indicates if a Processor calculates housing emissions.

Attributes#

namestr

Unique identifier of the processor used to label outputs.

is_housing_emissions_calculatorbool

If true, processor will only accept ManureStreams with non-None PenManureData, if false then vice versa.

_omOutputManager

Instance of the OutputManager.

_prefixstr

Prefix in a standardized format for reporting daily outputs from the Processor.

Methods#

receive_manure(manure: ManureStream) -> None

Entry point of manure into the processor.

process_manure(conditions: CurrentDayConditions, time: RufasTime) -> dict[str, ManureStream]

Handles the daily operations for the processor.

__init__(name: str, is_housing_emissions_calculator: bool) None#

Initializes a new Processor.

abstractmethod receive_manure(manure: ManureStream) None#

Takes in manure to be processed.

Parameters#

manureManureStream

The manure to be processed.

Raises#

ValueError

If the ManureStream is incompatible with the processor receiving it.

abstractmethod process_manure(conditions: CurrentDayConditions, time: RufasTime) dict[str, ManureStream]#

Executes the daily manure processing operations.

Parameters#

conditionsCurrentDayConditions

Current weather and environmental conditions that manure is being processed in.

timeRufasTime

RufasTime instance containing the simulations temporal information.

Returns#

dict[str, ManureStream]

Mapping between classification of manure coming out of this processor to the ManureStream containing the manure information. If the processor is a separator, the classifications are “solid” and “liquid”. Otherwise the only classification is “manure”.

_report_manure_stream(manure_stream: ManureStream | dict[str, float | None], stream_name: str, simulation_day: int) None#

Reports the manure stream data to Output Manager.

Parameters#

manure_streamManureStream | dict[str, float]

The manure stream to report. If a ManureStream instance is passed, it will be converted to a dictionary.

stream_namestr

The name of the manure stream being reported.

simulation_dayint

The current simulation day.

check_manure_stream_compatibility(manure_stream: ManureStream) bool#

Checks if a ManureStream is capable of being processed.

Parameters#

manure_streamManureStream

The ManureStream instance being checked for compatibility.

Returns#

bool

True if the ManureStream can be processed by the Processor, otherwise false.

static _calculate_ammonia_emissions(total_ammoniacal_nitrogen: float, mass: float, density: float, temperature: float, ammonia_resistance: float, surface_area: float, pH: float) float#

Calculate housing and liquid storage ammonia nitrogen emissions.

Parameters#

total_ammoniacal_nitrogenfloat

Total ammoniacal nitrogen in manure (kg).

massfloat

Total mass of the manure produced by the animals in the storage area (m^3).

densityfloat

Density of the manure (kg / m^3).

temperaturefloat

Temperature of the manure (degrees C).

ammonia_resistancefloat

Resistance of ammonia transport to the atmosphere (siemens / meter).

surface_areafloat

Total surface area of the manure storage (m^2).

pHfloat

pH value of the manure (unitless).

Returns#

float

Ammonia nitrogen emission from manure (kg).

Raises#

ValueError

If total_ammoniacal_nitrogen < 0.0. If volume < 0.0. If density < 0.0. If surface area of storage < 0.0.0

static _calculate_ammonia_equilibrium_coefficient(temperature: float, pH: float) float#

Calculates the equilibrium coefficient for the ammonia gas in the air for a given concentration of total ammoniacal nitrogen in the solution.

Parameters#

temperaturefloat

Manure solution temperature in Kelvin (K).

pHfloat

Manure solution pH (unitless).

Returns#

float

Equilibrium coefficient for the ammonia gas in the air (unitless).

static _calculate_henry_law_coefficient_of_ammonia(temperature: float) float#

Calculate Henry’s Law coefficient of ammonia.

Parameters#

temperaturefloat

Temperature in Kelvin (K).

Returns#

float

Henry’s law coefficient of ammonia (unitless).

static _calculate_dissociation_coefficient_of_ammonium(temperature: float, pH: float) float#

Calculate dissociation coefficient of ammonium.

Parameters#

temperaturefloat

Temperature in Kelvin (K).

pHfloat

Manure solution acidity (unitless).

Returns#

float

Dissociation coefficient of ammonium (unitless).

static _determine_outdoor_storage_temperature(air_temperature: float) float#

Determines the temperature of the manure in outdoor liquid and slurry storages.

Parameters#

air_temperaturefloat

The current day’s ambient air temperature (°C).

Returns#

float

The estimated temperature of the manure storage (°C).

References#

The temperature bounds of this method were based on personal communication and recommendations from A. Leytem (april.leytem@usda.gov) and A. VanderZaag (andrew.vanderzaag@AGR.GC.CA). These bounds are also support by work from Genedy and Ogejo, 2021 (https://doi.org/10.1016/j.compag.2021.106234) who observed similar minimum and maximum liquid manure temperatures in outdoor clay pit and concrete tank manure storages.

Notes#

This function clamps stored manure temperature to between 0 and 35 °C. Between 0 and 35 °C, outdoor stored liquid manure temperature is assumed to be equal to ambient air temperature.

static _determine_barn_temperature(air_temperature: float) float#

Calculates the barn temperature.

Parameters#

air_temperaturefloat

Air temperature (c).

Returns#

float

Adjusted barn temperature (c).

References#

Between 5 and 30 C, barn temperature is assumed to be equal to outdoor air temperature. This function assumes that barn temperature does not drop below 5 C or increase above 30 C. These bounds were suggested by manure SMEs and are supported by barn temperature ranges reported in Bucklin et al. (FL, upper limit; https://doi.org/10.13031/2013.28851). The lower bound (5 C) suggested by SMEs was based on general industry standards/conditions.

_report_processor_output(variable_name: str, variable_value: float, data_origin_function: str, units: MeasurementUnits, simulation_day: int) None#

Reports an output variable to the OutputManager.

Parameters#

variable_namestr

The name of the reported variable.

variable_valuestr

The value of the reported variable value.

data_origin_functionstr

The name of the function that reported the variable value.

unitsMeasurementUnits

The units for the reported variable value.

simulation_dayint

The current simulation day.

_abc_impl = <_abc._abc_data object>#