More...

#include <Energy.h>

Inheritance diagram for biogears::Energy:

Public Member Functions

 ~Energy (void) override
 
const char * classname () const override
 
size_t hash_code () const override
 
void Clear () override
 
void Initialize () override
 Initializes system properties to valid homeostatic values. More...
 
virtual bool Load (const CDM::BioGearsEnergySystemData &in)
 
virtual CDM::BioGearsEnergySystemData * Unload () const override
 
void AtSteadyState () override
 Notify systems that steady state has been achieved. More...
 
void PreProcess () override
 Prepares the energy system for the circuit solver. More...
 
void Process () override
 Processes the temperature circuit and calculates extravascular transport. More...
 
void PostProcess () override
 Updates the parameters for the temperature circuit. More...
 
- Public Member Functions inherited from biogears::SEEnergySystem
 SEEnergySystem (Logger *logger)
 
 ~SEEnergySystem () override
 
const SEScalar * GetScalar (const char *name) override
 
const SEScalar * GetScalar (const std::string &name) override
 
bool Load (const CDM::EnergySystemData &in)
 
Tree< const char * > GetPhysiologyRequestGraph () const override
 
bool HasAchievedExerciseLevel () const
 
SEScalarFraction & GetAchievedExerciseLevel ()
 
double GetAchievedExerciseLevel () const
 
bool HasChlorideLostToSweat () const
 
SEScalarMass & GetChlorideLostToSweat ()
 
double GetChlorideLostToSweat (const MassUnit &unit) const
 
bool HasCoreTemperature () const
 
SEScalarTemperature & GetCoreTemperature ()
 
double GetCoreTemperature (const TemperatureUnit &unit) const
 
bool HasCreatinineProductionRate () const
 
SEScalarAmountPerTime & GetCreatinineProductionRate ()
 
double GetCreatinineProductionRate (const AmountPerTimeUnit &unit) const
 
bool HasEnergyDeficit () const
 
SEScalarPower & GetEnergyDeficit ()
 
double GetEnergyDeficit (const PowerUnit &unit) const
 
bool HasExerciseEnergyDemand () const
 
SEScalarPower & GetExerciseEnergyDemand ()
 
double GetExerciseEnergyDemand (const PowerUnit &unit) const
 
bool HasExerciseMeanArterialPressureDelta () const
 
SEScalarPressure & GetExerciseMeanArterialPressureDelta ()
 
double GetExerciseMeanArterialPressureDelta (const PressureUnit &unit) const
 
bool HasFatigueLevel () const
 
SEScalarFraction & GetFatigueLevel ()
 
double GetFatigueLevel () const
 
bool HasLactateProductionRate () const
 
SEScalarAmountPerTime & GetLactateProductionRate ()
 
double GetLactateProductionRate (const AmountPerTimeUnit &unit) const
 
bool HasPotassiumLostToSweat () const
 
SEScalarMass & GetPotassiumLostToSweat ()
 
double GetPotassiumLostToSweat (const MassUnit &unit) const
 
bool HasSkinTemperature () const
 
SEScalarTemperature & GetSkinTemperature ()
 
double GetSkinTemperature (const TemperatureUnit &unit) const
 
bool HasSodiumLostToSweat () const
 
SEScalarMass & GetSodiumLostToSweat ()
 
double GetSodiumLostToSweat (const MassUnit &unit) const
 
bool HasSweatRate () const
 
SEScalarMassPerTime & GetSweatRate ()
 
double GetSweatRate (const MassPerTimeUnit &unit) const
 
bool HasTotalMetabolicRate () const
 
SEScalarPower & GetTotalMetabolicRate ()
 
double GetTotalMetabolicRate (const PowerUnit &unit) const
 
bool HasTotalWorkRateLevel () const
 
SEScalarFraction & GetTotalWorkRateLevel ()
 
double GetTotalWorkRateLevel () const
 
- Public Member Functions inherited from biogears::SESystem
 SESystem (Logger *logger)
 
virtual ~SESystem ()
 
bool Load (const CDM::SystemData &in)
 
- Public Member Functions inherited from biogears::Loggable
 Loggable ()
 
 Loggable (Logger *log)
 
virtual ~Loggable ()
 
virtual Logger * GetLogger () const
 

Static Public Member Functions

static size_t TypeHash ()
 
static constexpr char const *const TypeTag ()
 
- Static Public Member Functions inherited from biogears::SEEnergySystem
static size_t TypeHash ()
 
static constexpr char const *const TypeTag ()
 
- Static Public Member Functions inherited from biogears::SESystem
static const SEScalar * GetScalar (const char *name, std::vector< SESystem * > *systems)
 
static const SEScalar * GetScalar (const std::string &name, std::vector< SESystem * > *systems)
 

Protected Member Functions

 Energy (BioGears &bg)
 
virtual void Unload (CDM::BioGearsEnergySystemData &data) const
 
void SetUp () override
 Initializes the energy specific quantities. More...
 
void ManageEnergyDeficit ()
 Tracks gap in energy supply / demand due to pathophysiological states. More...
 
void ProcessOverride ()
 determine override requirements from user defined inputs More...
 
void OverrideControlLoop ()
 
- Protected Member Functions inherited from biogears::SEEnergySystem
void Unload (CDM::EnergySystemData &data) const
 
- Protected Member Functions inherited from biogears::SESystem
void Unload (CDM::SystemData &data) const
 
- Protected Member Functions inherited from biogears::Loggable
virtual void Debug (const char *msg, const char *origin="") const
 
virtual void Debug (const std::string &msg, const std::string &origin=empty) const
 
virtual void Debug (std::ostream &msg, const std::string &origin=empty) const
 
virtual void Info (const char *msg, const char *origin="") const
 
virtual void Info (const std::string &msg, const std::string &origin=empty) const
 
virtual void Info (std::ostream &msg, const std::string &origin=empty) const
 
virtual void Warning (const char *msg, const char *origin="") const
 
virtual void Warning (const std::string &msg, const std::string &origin=empty) const
 
virtual void Warning (std::ostream &msg, const std::string &origin=empty) const
 
virtual void Error (const char *msg, const char *origin="") const
 
virtual void Error (const std::string msg, const std::string origin=empty) const
 
virtual void Error (std::ostream &msg, const std::string &origin=empty) const
 
virtual void Fatal (const char *msg, const char *origin="") const
 
virtual void Fatal (const std::string &msg, const std::string &origin=empty) const
 
virtual void Fatal (std::ostream &msg, const std::string &origin=empty) const
 
- Protected Member Functions inherited from biogears::BioGearsSystem
virtual void LoadState ()
 

Static Protected Member Functions

static auto make_unique (BioGears &bg) -> std::unique_ptr< Energy >
 

Protected Attributes

BioGears & m_data
 
- Protected Attributes inherited from biogears::SEEnergySystem
SEScalarFraction * m_AchievedExerciseLevel
 
SEScalarMass * m_ChlorideLostToSweat
 
SEScalarTemperature * m_CoreTemperature
 
SEScalarAmountPerTime * m_CreatinineProductionRate
 
SEScalarPower * m_EnergyDeficit
 
SEScalarPower * m_ExerciseEnergyDemand
 
SEScalarPressure * m_ExerciseMeanArterialPressureDelta
 
SEScalarFraction * m_FatigueLevel
 
SEScalarAmountPerTime * m_LactateProductionRate
 
SEScalarMass * m_PotassiumLostToSweat
 
SEScalarTemperature * m_SkinTemperature
 
SEScalarMass * m_SodiumLostToSweat
 
SEScalarMassPerTime * m_SweatRate
 
SEScalarPower * m_TotalMetabolicRate
 
SEScalarFraction * m_TotalWorkRateLevel
 
- Protected Attributes inherited from biogears::SESystem
std::stringstream m_ss
 
- Protected Attributes inherited from biogears::Loggable
Logger * m_Logger
 

Private Member Functions

void CalculateMetabolicHeatGeneration ()
 Calculates the metabolic rate, depending on the current state of the patient. More...
 
void CalculateSweatRate ()
 Calculates the sweat rate if the core temperature is too high. More...
 
void UpdateHeatResistance ()
 Updates the variable core to skin heat transfer resistance. More...
 
void Exercise ()
 The exercise function updates the patient's metabolic rate if the exercise action is present. More...
 
void CalculateBasalMetabolicRate ()
 Calculates the basal metabolic rate from the Harris-Benedict formula. More...
 
void CalculateVitalSigns ()
 Checks the patient's thermal and metabolic state. More...
 

Private Attributes

RunningAverage m_BloodpH
 
RunningAverage m_BicarbonateMolarity_mmol_Per_L
 
bool m_packOn
 
double m_previousWeightPack_kg
 
double m_dT_s
 
SEPatient * m_Patient
 
SEPatientActionCollection * m_PatientActions
 
SELiquidSubstanceQuantity * m_AortaHCO3
 
SELiquidSubstanceQuantity * m_SkinSodium
 
SELiquidSubstanceQuantity * m_SkinChloride
 
SELiquidSubstanceQuantity * m_SkinPotassium
 
SEThermalCircuitNode * m_coreNode
 
SEThermalCircuitNode * m_skinNode
 
SEThermalCircuitPath * m_temperatureGroundToCorePath
 
SEThermalCircuitPath * m_coreToSkinPath
 
SEFluidCircuitPath * m_skinExtravascularToSweatingGroundPath
 
SEThermalCircuit * m_InternalTemperatureCircuit
 
SEThermalCircuit * m_TemperatureCircuit
 
SEThermalCircuitCalculator m_circuitCalculator
 

Friends

class BioGears
 
class BioGearsEngineTest
 

Additional Inherited Members

- Static Public Attributes inherited from biogears::Loggable
static const std::string empty
 
static const char * empty_cStr
 

Detailed Description

Constructor & Destructor Documentation

biogears::Energy::Energy ( BioGears &  bg)
protected
biogears::Energy::~Energy ( void  )
override

Member Function Documentation

void biogears::Energy::AtSteadyState ( )
overridevirtual

Notify systems that steady state has been achieved.

Reimplemented from biogears::BioGearsSystem.

void biogears::Energy::CalculateBasalMetabolicRate ( )
private

Calculates the basal metabolic rate from the Harris-Benedict formula.

The Harris-Benedict formula uses the patient height, weight age and sex to determine the basal metabolic requirements.

[300]

void biogears::Energy::CalculateMetabolicHeatGeneration ( )
private

Calculates the metabolic rate, depending on the current state of the patient.

The metabolic rate is dictated by the current state of the core temperature. This function includes states of increased metabolic rate due to shivering or severe hyperthermia. Additionally, an extreme drop in core temperature leads to decreasing metabolic rate. If the core temperature does not meet any of the criteria for increases/decreases, the metabolic rate will be calculated as the basal metabolic rate.

[herman2008physics]

[201]

[196]

void biogears::Energy::CalculateSweatRate ( )
private

Calculates the sweat rate if the core temperature is too high.

The sweat rate is calculated from a core temperature control function. The mass lost due to sweating is accounted for and a flow source from the skin extravascular to ground path is updated to ensure fluid loss

Determine the maximum evaporative capacity to limit the amount of cooling due to sweat on the patient [265]

[321]

[321]

[321]

Todo:
Convert to sweat density once specific gravity calculation is in

[herman2008physics]

[320]

void biogears::Energy::CalculateVitalSigns ( )
private

Checks the patient's thermal and metabolic state.

The core and skin temperatures are recorded in this function. In addition, the current metabolic state of the patient may trigger the following events: hypothermia, hyperthermia, and metabolic acidosis/alkalosis. These events are only triggered if the current state falls within the criteria of the specific event

[Stocks2004HumanPhysiologicalResponseCold]

[mallet2001hypothermia]

Event:
Patient: Core temperature has fallen below 35 degrees Celsius. Patient is hypothermic.
Irreversible:
State: Core temperature has fallen below 20 degrees Celsius.
Event:
Patient: Core temperature has exceeded 38.8 degrees Celsius. Patient is hyperthermic.
Todo:
Move to blood chemistry
Event:
The patient is in a state of metabolic acidosis
Irreversible:
State: arterial blood pH has dropped below 6.5.
Event:
The patient has exited the state state of metabolic acidosis
Event:
The patient is in a state of metabolic alkalosis
Irreversible:
State: arterial blood pH has increased above 8.5.
Event:
The patient has exited the state of metabolic alkalosis
const char* biogears::Energy::classname ( ) const
inlineoverridevirtual

Reimplemented from biogears::SEEnergySystem.

void biogears::Energy::Clear ( )
overridevirtual

Reimplemented from biogears::SEEnergySystem.

void biogears::Energy::Exercise ( )
private

The exercise function updates the patient's metabolic rate if the exercise action is present.

The exercise function adds to the body's basal metabolic rate a value that is specified by the exercise action. The actual metabolic rate is ramped up to this value. The body's actual work rate is determined by the nutrients and oxygen available. Exercise-related outputs are set in Tissue::CalculateMetabolicConsumptionAndProduction().

size_t biogears::Energy::hash_code ( ) const
inlineoverridevirtual

Reimplemented from biogears::SEEnergySystem.

void biogears::Energy::Initialize ( )
overridevirtual

Initializes system properties to valid homeostatic values.

[herman2008physics]

[263]

[134]

Reimplemented from biogears::BioGearsSystem.

bool biogears::Energy::Load ( const CDM::BioGearsEnergySystemData &  in)
virtual
auto biogears::Energy::make_unique ( BioGears &  bg) -> std::unique_ptr<Energy>
staticprotected
void biogears::Energy::ManageEnergyDeficit ( )
protected

Tracks gap in energy supply / demand due to pathophysiological states.

Pathophysiology such as hypoperfusion secondary to hemorrhage or sepsis cause the tissues to extract more oxygen from the bloodstream to make up for mitochondrial dysfunction and increased capillary diffusion distance. Since we do not currently model this mechanistically, we track a pathophysiological energy debt that we use to force the tissue to consume more O2 and pull it from the vascular space, giving symptoms such as decreased pH and O2 saturation. Currently, only triggered by hemorrhage. Will add sepsis, burn wound.

void biogears::Energy::OverrideControlLoop ( )
protected
void biogears::Energy::PostProcess ( )
overridevirtual

Updates the parameters for the temperature circuit.

Updates the resulting heat transfer rates, temperatures and nodal heat values; effectively moving the next values to the current ones before time can be advanced.

Implements biogears::BioGearsSystem.

void biogears::Energy::PreProcess ( )
overridevirtual

Prepares the energy system for the circuit solver.

The PreProcess function performs function in preparation to update the thermal circuit. It also processes energy-related actions (exercise) and computes a sweat rate.

Implements biogears::BioGearsSystem.

void biogears::Energy::Process ( )
overridevirtual

Processes the temperature circuit and calculates extravascular transport.

The Process function solves the temperature circuit for all path heat transfer rates and nodal temperatures. Additionally, the process function also initiates the flow transport of the metabolic substance quantities from the vascular to extravascular space. After this is complete, the vital signs of the patient are updated with regards to the new state.

Implements biogears::BioGearsSystem.

void biogears::Energy::ProcessOverride ( )
protected

determine override requirements from user defined inputs

User specified override outputs that are specific to the cardiovascular system are implemented here. If overrides aren't present for this system then this function will not be called during preprocess.

void biogears::Energy::SetUp ( )
overrideprotectedvirtual

Initializes the energy specific quantities.

The energy local member variables, system level quantities, and metabolic-specific substance quantities are initialized here. These variables are used in the numerous metabolic and thermal regulation functions contained in the energy system. Encompassing them in this function allows for easy initialization either at the beginning of a simulation or after a system crash

Implements biogears::BioGearsSystem.

static size_t biogears::Energy::TypeHash ( )
inlinestatic
static constexpr char const* const biogears::Energy::TypeTag ( )
inlinestatic
CDM::BioGearsEnergySystemData * biogears::Energy::Unload ( ) const
overridevirtual

Reimplemented from biogears::SEEnergySystem.

void biogears::Energy::Unload ( CDM::BioGearsEnergySystemData &  data) const
protectedvirtual
void biogears::Energy::UpdateHeatResistance ( )
private

Updates the variable core to skin heat transfer resistance.

The variable core to skin heat transfer resistance is updated here according to the inverse of the skin blood flow.

Friends And Related Function Documentation

friend class BioGears
friend
friend class BioGearsEngineTest
friend

Member Data Documentation

SELiquidSubstanceQuantity* biogears::Energy::m_AortaHCO3
private
RunningAverage biogears::Energy::m_BicarbonateMolarity_mmol_Per_L
private
RunningAverage biogears::Energy::m_BloodpH
private
SEThermalCircuitCalculator biogears::Energy::m_circuitCalculator
private
SEThermalCircuitNode* biogears::Energy::m_coreNode
private
SEThermalCircuitPath* biogears::Energy::m_coreToSkinPath
private
BioGears& biogears::Energy::m_data
protected
double biogears::Energy::m_dT_s
private
SEThermalCircuit* biogears::Energy::m_InternalTemperatureCircuit
private
bool biogears::Energy::m_packOn
private
SEPatient* biogears::Energy::m_Patient
private
SEPatientActionCollection* biogears::Energy::m_PatientActions
private
double biogears::Energy::m_previousWeightPack_kg
private
SELiquidSubstanceQuantity* biogears::Energy::m_SkinChloride
private
SEFluidCircuitPath* biogears::Energy::m_skinExtravascularToSweatingGroundPath
private
SEThermalCircuitNode* biogears::Energy::m_skinNode
private
SELiquidSubstanceQuantity* biogears::Energy::m_SkinPotassium
private
SELiquidSubstanceQuantity* biogears::Energy::m_SkinSodium
private
SEThermalCircuit* biogears::Energy::m_TemperatureCircuit
private
SEThermalCircuitPath* biogears::Energy::m_temperatureGroundToCorePath
private