Modular Megafauna Model 1.1.5
A physiological, dynamic herbivore simulator in C++.
Loading...
Searching...
No Matches
Fauna::FatmassEnergyBudget Class Reference

A herbivore’s energy budget with fat reserves. More...

#include <fatmass_energy_budget.h>

Public Member Functions

 FatmassEnergyBudget (const double initial_fatmass, const double maximum_fatmass, const double anabolism_coefficient, const double catabolism_coefficient)
 Constructor. More...
 
void add_energy_needs (const double energy)
 Increase energy needs. More...
 
void catabolize_fat ()
 Burn fat reserves and reduce unmet energy needs. More...
 
void force_body_condition (const double body_condition)
 Set the proportional fat reserves. More...
 
double get_energy_needs () const
 Current energy needs [MJ/ind]. More...
 
double get_fatmass () const
 Current fat mass [kg/ind]. More...
 
double get_max_anabolism_per_day () const
 Get the maximum energy [MJ/ind/day] that could be anabolized in a day. More...
 
double get_max_fatmass () const
 Maximum fat mass [kg/ind]. More...
 
void merge (const FatmassEnergyBudget &other, const double this_weight, const double other_weight)
 Merge this object with another one by building weighted averages. More...
 
void metabolize_energy (double energy)
 Update budget and fat mass by receiving energy (through feeding) More...
 
void set_max_fatmass (const double max_fatmass, const double max_gain)
 Set the maximum allowed fat mass [kg/ind] and fat gain [kg/ind/day]. More...
 

Private Attributes

double anabolism_coefficient
 
double catabolism_coefficient
 
double energy_needs = 0.0
 
double fatmass
 
double max_fatmass
 
double max_fatmass_gain = 0.0
 

Detailed Description

A herbivore’s energy budget with fat reserves.

Terminology:

  • Anabolism = build up fat mass
  • Catabolism = burn fat mass
  • Metabolism = burn food energy directly and use surplus for anabolism

Constructor & Destructor Documentation

◆ FatmassEnergyBudget()

FatmassEnergyBudget::FatmassEnergyBudget ( const double  initial_fatmass,
const double  maximum_fatmass,
const double  anabolism_coefficient,
const double  catabolism_coefficient 
)

Constructor.

Parameters
initial_fatmassInitial fat mass [kg/ind]
maximum_fatmassMaximum fat mass [kg/ind]
anabolism_coefficientConversion factor from net forage energy to fat mass [MJ/kg]. See Section Energy Content of Forage for how this value can be derived.
catabolism_coefficientConversion factor from fat mass to net energy [MJ/kg]. This is basically gross (combustion) energy of fat mass multiplied by conversion efficiency.
Exceptions
std::invalid_argumentIf one parameter is <=0.0
std::logic_errorinitial_fatmass > maximum_fatmass

Member Function Documentation

◆ add_energy_needs()

void FatmassEnergyBudget::add_energy_needs ( const double  energy)

Increase energy needs.

Parameters
energyAdditional energy needs [MJ/ind]
Exceptions
std::invalid_argumentif energy<0.0

◆ catabolize_fat()

void FatmassEnergyBudget::catabolize_fat ( )

Burn fat reserves and reduce unmet energy needs.

Fat mass never drops below zero.

◆ force_body_condition()

void FatmassEnergyBudget::force_body_condition ( const double  body_condition)

Set the proportional fat reserves.

Parameters
body_conditionCurrent fat mass divided by potential maximum fat mass.
Exceptions
std::invalid_argumentIf body_condition not in interval [0,1]

◆ get_energy_needs()

double Fauna::FatmassEnergyBudget::get_energy_needs ( ) const
inline

Current energy needs [MJ/ind].

◆ get_fatmass()

double Fauna::FatmassEnergyBudget::get_fatmass ( ) const
inline

Current fat mass [kg/ind].

◆ get_max_anabolism_per_day()

double FatmassEnergyBudget::get_max_anabolism_per_day ( ) const

Get the maximum energy [MJ/ind/day] that could be anabolized in a day.

◆ get_max_fatmass()

double Fauna::FatmassEnergyBudget::get_max_fatmass ( ) const
inline

Maximum fat mass [kg/ind].

◆ merge()

void FatmassEnergyBudget::merge ( const FatmassEnergyBudget other,
const double  this_weight,
const double  other_weight 
)

Merge this object with another one by building weighted averages.

Parameters
otherThe other object.
this_weightWeight for this object.
other_weightWeight for the other object.

◆ metabolize_energy()

void FatmassEnergyBudget::metabolize_energy ( double  energy)

Update budget and fat mass by receiving energy (through feeding)

If energy exceeds current energy needs, the surplus is stored as fat (anabolism).

Parameters
energyInput energy [MJ/ind].
Exceptions
std::invalid_argumentIf energy<0.0.
std::logic_errorif energy exceeds current energy needs and maximum anabolism.

◆ set_max_fatmass()

void FatmassEnergyBudget::set_max_fatmass ( const double  max_fatmass,
const double  max_gain 
)

Set the maximum allowed fat mass [kg/ind] and fat gain [kg/ind/day].

Parameters
max_fatmassCurrent maximum fat mass [kg/ind].
max_gainMaximum fat mass gain [kg/ind/day]. A value of zero indicates no limit.
Exceptions
std::logic_errorif max_fatmass is smaller than current fat mass
std::invalid_argumentIf max_fatmass<=0.0 or if max_gain < 0.

Member Data Documentation

◆ anabolism_coefficient

double Fauna::FatmassEnergyBudget::anabolism_coefficient
private

◆ catabolism_coefficient

double Fauna::FatmassEnergyBudget::catabolism_coefficient
private

◆ energy_needs

double Fauna::FatmassEnergyBudget::energy_needs = 0.0
private

◆ fatmass

double Fauna::FatmassEnergyBudget::fatmass
private

◆ max_fatmass

double Fauna::FatmassEnergyBudget::max_fatmass
private

◆ max_fatmass_gain

double Fauna::FatmassEnergyBudget::max_fatmass_gain = 0.0
private

The documentation for this class was generated from the following files: