The Respiratory System class handles the analysis and storage of data related the respiratory physiology and pathology. More...

#include <Respiratory.h>

Inheritance diagram for biogears::Respiratory:

Public Member Functions

virtual ~Respiratory () 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::BioGearsRespiratorySystemData &in)
 
virtual CDM::BioGearsRespiratorySystemData * Unload () const override
 
void AtSteadyState () override
 Respiratory system at steady state. More...
 
void PreProcess () override
 Respiratory system preprocess function. More...
 
void Process () override
 Respiratory system process function. More...
 
void PostProcess () override
 Respiratory system postprocess function. More...
 
bool CalculatePulmonaryFunctionTest (SEPulmonaryFunctionTest &pft)
 Populate the Pulmonary Function Test Assessment. More...
 
SEScalar & CalculateRespirationSOFA ()
 
- Public Member Functions inherited from biogears::SERespiratorySystem
 SERespiratorySystem (Logger *logger)
 
 ~SERespiratorySystem () override
 
const SEScalar * GetScalar (const char *name) override
 
const SEScalar * GetScalar (const std::string &name) override
 
bool Load (const CDM::RespiratorySystemData &in)
 
Tree< const char * > GetPhysiologyRequestGraph () const override
 
bool HasAlveolarArterialGradient () const
 
SEScalarPressure & GetAlveolarArterialGradient ()
 
double GetAlveolarArterialGradient (const PressureUnit &unit) const
 
bool HasCarricoIndex () const
 
SEScalarPressure & GetCarricoIndex ()
 
double GetCarricoIndex (const PressureUnit &unit) const
 
bool HasEndTidalCarbonDioxideFraction () const
 
SEScalarFraction & GetEndTidalCarbonDioxideFraction ()
 
double GetEndTidalCarbonDioxideFraction () const
 
bool HasEndTidalCarbonDioxidePressure () const
 
SEScalarPressure & GetEndTidalCarbonDioxidePressure ()
 
double GetEndTidalCarbonDioxidePressure (const PressureUnit &unit) const
 
bool HasExpiratoryFlow () const
 
SEScalarVolumePerTime & GetExpiratoryFlow ()
 
double GetExpiratoryFlow (const VolumePerTimeUnit &unit) const
 
bool HasInspiratoryExpiratoryRatio () const
 
SEScalar & GetInspiratoryExpiratoryRatio ()
 
double GetInspiratoryExpiratoryRatio () const
 
bool HasInspiratoryFlow () const
 
SEScalarVolumePerTime & GetInspiratoryFlow ()
 
double GetInspiratoryFlow (const VolumePerTimeUnit &unit) const
 
bool HasMeanPleuralPressure () const
 
SEScalarPressure & GetMeanPleuralPressure ()
 
double GetMeanPleuralPressure (const PressureUnit &unit) const
 
bool HasPulmonaryCompliance () const
 
SEScalarFlowCompliance & GetPulmonaryCompliance ()
 
double GetPulmonaryCompliance (const FlowComplianceUnit &unit) const
 
bool HasPulmonaryResistance () const
 
SEScalarFlowResistance & GetPulmonaryResistance ()
 
double GetPulmonaryResistance (const FlowResistanceUnit &unit) const
 
bool HasRespirationDriverFrequency () const
 
SEScalarFrequency & GetRespirationDriverFrequency ()
 
double GetRespirationDriverFrequency (const FrequencyUnit &unit) const
 
bool HasRespirationDriverPressure () const
 
SEScalarPressure & GetRespirationDriverPressure ()
 
double GetRespirationDriverPressure (const PressureUnit &unit) const
 
bool HasRespirationMusclePressure () const
 
SEScalarPressure & GetRespirationMusclePressure ()
 
double GetRespirationMusclePressure (const PressureUnit &unit) const
 
bool HasRespirationRate () const
 
SEScalarFrequency & GetRespirationRate ()
 
double GetRespirationRate (const FrequencyUnit &unit) const
 
bool HasSpecificVentilation () const
 
SEScalar & GetSpecificVentilation ()
 
double GetSpecificVentilation () const
 
bool HasTargetPulmonaryVentilation () const
 
SEScalarVolumePerTime & GetTargetPulmonaryVentilation ()
 
double GetTargetPulmonaryVentilation (const VolumePerTimeUnit &unit) const
 
bool HasTidalVolume () const
 
SEScalarVolume & GetTidalVolume ()
 
double GetTidalVolume (const VolumeUnit &unit) const
 
bool HasTotalAlveolarVentilation () const
 
SEScalarVolumePerTime & GetTotalAlveolarVentilation ()
 
double GetTotalAlveolarVentilation (const VolumePerTimeUnit &unit) const
 
bool HasTotalDeadSpaceVentilation () const
 
SEScalarVolumePerTime & GetTotalDeadSpaceVentilation ()
 
double GetTotalDeadSpaceVentilation (const VolumePerTimeUnit &unit) const
 
bool HasTotalPulmonaryVentilation () const
 
SEScalarVolumePerTime & GetTotalPulmonaryVentilation ()
 
double GetTotalPulmonaryVentilation (const VolumePerTimeUnit &unit) const
 
bool HasTotalLungVolume () const
 
SEScalarVolume & GetTotalLungVolume ()
 
double GetTotalLungVolume (const VolumeUnit &unit) const
 
bool HasTranspulmonaryPressure () const
 
SEScalarPressure & GetTranspulmonaryPressure ()
 
double GetTranspulmonaryPressure (const PressureUnit &unit) 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::SERespiratorySystem
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

 Respiratory (BioGears &bg)
 
virtual void Unload (CDM::BioGearsRespiratorySystemData &data) const
 
void SetUp () override
 Initializes parameters for Respiratory Class. More...
 
void ProcessOverride ()
 determine override requirements from user defined inputs More...
 
void OverrideControlLoop ()
 
- Protected Member Functions inherited from biogears::SERespiratorySystem
void Unload (CDM::RespiratorySystemData &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< Respiratory >
 

Protected Attributes

BioGears & m_data
 
- Protected Attributes inherited from biogears::SERespiratorySystem
SEScalarPressure * m_AlveolarArterialGradient
 
SEScalarPressure * m_CarricoIndex
 
SEScalarFraction * m_EndTidalCarbonDioxideFraction
 
SEScalarPressure * m_EndTidalCarbonDioxidePressure
 
SEScalarVolumePerTime * m_ExpiratoryFlow
 
SEScalar * m_InspiratoryExpiratoryRatio
 
SEScalarVolumePerTime * m_InspiratoryFlow
 
SEScalarPressure * m_MeanPleuralPressure
 
SEScalarFlowCompliance * m_PulmonaryCompliance
 
SEScalarFlowResistance * m_PulmonaryResistance
 
SEScalarFrequency * m_RespirationDriverFrequency
 
SEScalarPressure * m_RespirationDriverPressure
 
SEScalarPressure * m_RespirationMusclePressure
 
SEScalarFrequency * m_RespirationRate
 
SEScalar * m_SpecificVentilation
 
SEScalarVolumePerTime * m_TargetPulmonaryVentilation
 
SEScalarVolume * m_TidalVolume
 
SEScalarVolumePerTime * m_TotalAlveolarVentilation
 
SEScalarVolumePerTime * m_TotalDeadSpaceVentilation
 
SEScalarVolume * m_TotalLungVolume
 
SEScalarVolumePerTime * m_TotalPulmonaryVentilation
 
SEScalarPressure * m_TranspulmonaryPressure
 
- Protected Attributes inherited from biogears::SESystem
std::stringstream m_ss
 
- Protected Attributes inherited from biogears::Loggable
Logger * m_Logger
 

Private Member Functions

void TuneCircuit ()
 Run the circuit standalone for a little to get it into a good starting state. More...
 
void COPD ()
 Chronic Obstructive Pulmonary Disease (COPD) More...
 
void ImpairedAlveolarExchange ()
 Impaired Alveolar Exchange. More...
 
void LobarPneumonia ()
 Lobar Pneumonia. More...
 
void UpdatePleuralCompliance ()
 Chest wall compliance modifier. More...
 
void AcuteRespiratoryDistress ()
 
void AirwayObstruction ()
 Airway obstruction. More...
 
void BronchoConstriction ()
 Bronchoconstriction. More...
 
void BronchoDilation ()
 Bronchodilation PD effects. More...
 
void Intubation ()
 Esophageal Intubation. More...
 
void Pneumothorax ()
 Tension pneumothorax. More...
 
void ConsciousRespiration ()
 Conscious respiration. More...
 
void ProcessConsciousRespiration (SEConsciousRespirationCommand &cmd)
 Process conscious respiration. More...
 
void MechanicalVentilation ()
 Modifies the pressure and/or flow at the mouth. More...
 
void Apnea ()
 Apply apnea action. More...
 
void RespiratoryDriver ()
 Respiratory driver pressure source. More...
 
void ProcessDriverActions ()
 Process actions that affect respiratory driver. More...
 
void UpdateObstructiveResistance ()
 Update obstructive (airway) resistance. More...
 
void UpdateIERatio ()
 Update the inspiratory-expiratory ratio. More...
 
void UpdateAlveoliCompliance (double dCompilanceScalingFactor, double dLeftLungFraction, double dRightLungFraction)
 Update Alveoli Compliance. More...
 
void UpdateGasDiffusionSurfaceArea (double dFractionalArea, double dLeftLungFraction, double dRightLungFraction)
 Update Gas Diffusion Surface Area. More...
 
void UpdatePulmonaryCapillaryResistance (double dResistanceScalingFactor, double dLeftLungFraction, double dRightLungFraction)
 Update Pulmonary Capillary Resistance. More...
 
void DoLeftNeedleDecompression (double dFlowResistance)
 Left Side Needle Decompression. More...
 
void DoRightNeedleDecompression (double dFlowResistance)
 Right Side Needle Decompression. More...
 
void ProcessAerosolSubstances ()
 Compute deposited mass, update localized PD effects. More...
 
void CalculateVitalSigns ()
 Calculates key respiratory physiological parameters. More...
 

Private Attributes

std::string m_TuningFile
 
double m_InitialExpiratoryReserveVolume_L
 
double m_InitialFunctionalResidualCapacity_L
 
double m_InitialInspiratoryCapacity_L
 
double m_InitialResidualVolume_L
 
double m_OverrideRRBaseline_Per_min
 
bool m_bNotBreathing
 
double m_TopBreathTotalVolume_L
 
double m_TopBreathAlveoliVolume_L
 
double m_TopBreathDeadSpaceVolume_L
 
double m_TopBreathPleuralPressure_cmH2O
 
double m_LastCardiacCycleBloodPH
 
double m_PreviousTotalLungVolume_L
 
RunningAverage m_BloodPHRunningAverage
 
bool m_BreathingCycle
 
double m_ArterialO2PartialPressure_mmHg
 
double m_ArterialCO2PartialPressure_mmHg
 
RunningAverage m_ArterialO2Average_mmHg
 
RunningAverage m_ArterialCO2Average_mmHg
 
double m_BreathingCycleTime_s
 
double m_BreathTimeExhale_min
 
double m_DefaultDrivePressure_cmH2O
 
double m_DriverPressure_cmH2O
 
double m_DriverPressureMin_cmH2O
 
double m_ElapsedBreathingCycleTime_min
 
double m_IEscaleFactor
 
double m_InstantaneousFunctionalResidualCapacity_L
 
double m_MaxDriverPressure_cmH2O
 
double m_PeakRespiratoryDrivePressure_cmH2O
 
double m_VentilationFrequency_Per_min
 
double m_VentilationToTidalVolumeSlope
 
bool m_ConsciousBreathing
 
double m_ConsciousRespirationPeriod_s
 
double m_ConsciousRespirationRemainingPeriod_s
 
double m_ExpiratoryReserveVolumeFraction
 
double m_InspiratoryCapacityFraction
 
double m_ConsciousStartPressure_cmH2O
 
double m_ConsciousEndPressure_cmH2O
 
bool m_HadAirwayObstruction
 
bool m_HadBronchoconstriction
 
double m_dt_s
 
double m_dt_min
 
bool m_hadApnea
 
double m_dDefaultOpenResistance_cmH2O_s_Per_L
 
double m_dDefaultClosedResistance_cmH2O_s_Per_L
 
double m_PleuralComplianceSensitivity_Per_L
 
double m_dRespOpenResistance_cmH2O_s_Per_L
 
double m_dRespClosedResistance_cmH2O_s_Per_L
 
double m_VentilatoryOcclusionPressure_cmH2O
 
double m_AverageLocalTissueBronchodilationEffects
 
double m_arterialPHBaseline
 
SEPatient * m_Patient
 
SEPatientActionCollection * m_PatientActions
 
SEGasCompartment * m_Environment
 
SELiquidCompartment * m_AerosolMouth
 
SELiquidCompartment * m_AerosolTrachea
 
SELiquidCompartment * m_AerosolLeftBronchi
 
SELiquidCompartment * m_AerosolLeftAlveoli
 
SELiquidCompartment * m_AerosolRightBronchi
 
SELiquidCompartment * m_AerosolRightAlveoli
 
SELiquidCompartment * m_LeftLungExtravascular
 
SELiquidCompartment * m_RightLungExtravascular
 
SEGasCompartment * m_Lungs
 
SEGasCompartment * m_Trachea
 
SEGasSubstanceQuantity * m_TracheaO2
 
SEGasSubstanceQuantity * m_TracheaCO2
 
SELiquidSubstanceQuantity * m_AortaO2
 
SELiquidSubstanceQuantity * m_AortaCO2
 
SEGasSubstanceQuantity * m_LeftAlveoliO2
 
SEGasSubstanceQuantity * m_RightAlveoliO2
 
SEGasSubstanceQuantity * m_LeftAlveoliCO2
 
SEGasSubstanceQuantity * m_RightAlveoliCO2
 
std::vector< SELiquidCompartment * > m_AerosolEffects
 
SEGasCompartment * m_MechanicalVentilatorConnection
 
SEFluidCircuit * m_RespiratoryCircuit
 
SEFluidCircuitNode * m_LeftAlveoli
 
SEFluidCircuitNode * m_LeftBronchi
 
SEFluidCircuitNode * m_LeftPleuralCavity
 
SEFluidCircuitNode * m_RespiratoryMuscle
 
SEFluidCircuitNode * m_RightAlveoli
 
SEFluidCircuitNode * m_RightBronchi
 
SEFluidCircuitNode * m_RightPleuralCavity
 
SEFluidCircuitNode * m_Ambient
 
SEFluidCircuitNode * m_Stomach
 
SEFluidCircuitPath * m_TracheaToLeftBronchi
 
SEFluidCircuitPath * m_TracheaToRightBronchi
 
SEFluidCircuitPath * m_LeftBronchiToLeftAlveoli
 
SEFluidCircuitPath * m_RightBronchiToRightAlveoli
 
SEFluidCircuitPath * m_RightPleuralCavityToRespiratoryMuscle
 
SEFluidCircuitPath * m_LeftPleuralCavityToRespiratoryMuscle
 
SEFluidCircuitPath * m_DriverPressurePath
 
SEFluidCircuitPath * m_LeftDriverPressurePath
 
SEFluidCircuitPath * m_MouthToTrachea
 
SEFluidCircuitPath * m_MouthToStomach
 
SEFluidCircuitPath * m_EnvironmentToLeftChestLeak
 
SEFluidCircuitPath * m_EnvironmentToRightChestLeak
 
SEFluidCircuitPath * m_LeftAlveoliLeakToLeftPleuralCavity
 
SEFluidCircuitPath * m_RightAlveoliLeakToRightPleuralCavity
 
SEFluidCircuitPath * m_LeftPleuralCavityToEnvironment
 
SEFluidCircuitPath * m_RightPleuralCavityToEnvironment
 
SEFluidCircuitPath * m_RightAlveoliToRightPleuralConnection
 
SEFluidCircuitPath * m_LeftAlveoliToLeftPleuralConnection
 
SEFluidCircuitPath * m_RightBronchiToRightPleuralConnection
 
SEFluidCircuitPath * m_LeftBronchiToLeftPleuralConnection
 
SEFluidCircuitPath * m_RightPulmonaryCapillary
 
SEFluidCircuitPath * m_LeftPulmonaryCapillary
 
SEFluidCircuitPath * m_ConnectionToMouth
 
SEFluidCircuitPath * m_GroundToConnection
 
SEFluidCircuitCalculator m_Calculator
 
SEGasTransporter m_GasTransporter
 
SELiquidTransporter m_AerosolTransporter
 

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

The Respiratory System class handles the analysis and storage of data related the respiratory physiology and pathology.

The goal of the Respiratory System class is to handle the analysis and storage of data representing the ventilation and gas exchange of the human respiratory system. The class handles the analysis of changes in the lungs volume and pressure data during the flow and transfer of gases between the lungs, the blood and the outside environment. The class updates the volume and volume fractions of gases in the lungs, and ensures the integration and flow of data between the respiratory system and the anesthesia machine during mechanical ventilation.

Constructor & Destructor Documentation

biogears::Respiratory::Respiratory ( BioGears &  bg)
protected
biogears::Respiratory::~Respiratory ( )
overridevirtual

Member Function Documentation

void biogears::Respiratory::AcuteRespiratoryDistress ( )
private
void biogears::Respiratory::AirwayObstruction ( )
private

Airway obstruction.

Various factors can trigger upper airway obstruction. The Biogears engine handles airway obstruction that arise from the partial or complete obstruction of the upper airways by foreign objects. The model accounts for such obstruction by setting the flow resistance of the trachea compartment in proportion to the severity of the obstruction. The function updates the tracheal flow resistance by modifying the resistance across the airway to Trachea node path.

void biogears::Respiratory::Apnea ( )
private

Apply apnea action.

Parameters
None
Returns
void

This reduces the respiratory driver pressure source amplitude by the percentage defined by the action severity.

void biogears::Respiratory::AtSteadyState ( )
overridevirtual

Respiratory system at steady state.

Initializes respiratory conditions if any are present.

  • COPD
  • Lobar Pneumonia
  • ImpairedAlveolarExchange

Reimplemented from biogears::BioGearsSystem.

void biogears::Respiratory::BronchoConstriction ( )
private

Bronchoconstriction.

Bronchoconstriction involves the tightening of smooth muscles surrounding bronchi. The effect of such airway constriction is the reduction of air flow or increase of flow resistance of the lower airways. The Biogears model handles bronchoconstriction by increasing the flow resistances of the bronchi compartments. The function updates the bronchial resistances in proportion to the severity of the bronchoconstriction.

void biogears::Respiratory::BronchoDilation ( )
private

Bronchodilation PD effects.

This reduces the bronchi resitances based on drug PD effects (i.e., plasma concentrations).

bool biogears::Respiratory::CalculatePulmonaryFunctionTest ( SEPulmonaryFunctionTest &  pft)

Populate the Pulmonary Function Test Assessment.

Parameters
pftpft data
Returns
success true, if everything worked out
Todo:
Insert more PFT calculations here
SEScalar & biogears::Respiratory::CalculateRespirationSOFA ( )
void biogears::Respiratory::CalculateVitalSigns ( )
private

Calculates key respiratory physiological parameters.

Calculates the respiration rate and tidal volume. For each breathing cycle, the tidal volume is calculated by identifying the peaks in the total lung volume. The tidal volume of a particular breathing cycle is then calculated by taking the difference between the maximum and minimum values of the total lung volume. The respiration rate is calculated by measuring the duration for one complete breathing cycle and then converting the duration to the number of breaths per minute.

Event:
Patient: Start of exhale/inhale
Event:
Patient: Severe ARDS: Carrico Index is below 100 mmHg

[273]

[273]

Event:
Patient: Acute Respiratory Distress: Carrico Index is below 200 mmHg

[273]

Event:
Patient: Acute Lung Injury: Carrico Index is below 300 mmHg

[273]

Event:
Patient: End ARDS: Carrico Index is above 305 mmHg
Todo:
Move to blood chemistry
Event:
Patient: Bradypnea: Respiration rate is below 10 breaths per minute The patient has bradypnea.

[252]

Event:
Patient: End Bradypnea Event. The respiration rate has risen above 10. The patient is no longer considered to have bradypnea.
Event:
Patient: Tachypnea: Respiration rate is above 20 breaths per minute. The patient has tachypnea.
Event:
Patient: End Tachypnea Event. The respiration rate has fallen below 19.5. The patient is no longer considered to have tachypnea.
Event:
Patient: Respiratory Acidosis: event is triggered when blood pH is below 7.36 The patient has respiratory acidosis.
Event:
Patient: arterial blood ph has dropped below 6.5.
Irreversible:
Extreme respiratory Acidosis: blood pH below 6.5.
Event:
Patient: End Respiratory Acidosis Event. The pH value has risen above 7.38. The patient is no longer considered to have respiratory acidosis.
Event:
Patient: Respiratory Alkalosis: event is triggered when blood pH is above 7.45 The patient has respiratory alkalosis.
Event:
Patient: arterial blood ph has gotten above 8.5.
Irreversible:
Extreme respiratory Alkalosis: blood pH above 8.5.
Event:
Patient: End Respiratory Alkalosis Event. The pH value has has fallen below 7.45. The patient is no longer considered to have respiratory alkalosis.
const char* biogears::Respiratory::classname ( ) const
inlineoverridevirtual

Reimplemented from biogears::SERespiratorySystem.

void biogears::Respiratory::Clear ( )
overridevirtual

Reimplemented from biogears::SERespiratorySystem.

void biogears::Respiratory::ConsciousRespiration ( )
private

Conscious respiration.

Parameters
None
Returns
void

This method determines when to process a conscious respiration command and removes the command from the stack.

void biogears::Respiratory::COPD ( )
private

Chronic Obstructive Pulmonary Disease (COPD)

Parameters
None
Returns
void

This method handles the COPD condition. It determines if the patient has COPD, and if so, calculates a set of multipliers to model the various symptoms. This method should only run once per simulation. Note that the bronchitis symptom (airway obstruction) is handled by another method that is called every time-step in pre-process.

void biogears::Respiratory::DoLeftNeedleDecompression ( double  dFlowResistance)
private

Left Side Needle Decompression.

Parameters
dFlowResistance- Resistance value for air flow through the needle

Used for left side needle decompression. this is an intervention (action) used to treat left side tension pneumothorax

void biogears::Respiratory::DoRightNeedleDecompression ( double  dFlowResistance)
private

Right Side Needle Decompression.

Parameters
dFlowResistance- Resistance value for air flow through the needle

Used for right side needle decompression. this is an intervention (action) used to treat right side tension pneumothorax

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

Reimplemented from biogears::SERespiratorySystem.

void biogears::Respiratory::ImpairedAlveolarExchange ( )
private

Impaired Alveolar Exchange.

Parameters
None
Returns
void

This method handles the Impaired Alveolar Exchange condition.

Error:
Fatal: The Impaired Alveolar Exchange action must include either a surface area of fraction.
Error:
Error: The Impaired Alveolar Exchange action cannot have both an impaired surface area and impaired fraction defined. Defaulting to the surface area value.
void biogears::Respiratory::Initialize ( )
overridevirtual

Initializes system properties to valid homeostatic values.

Reimplemented from biogears::BioGearsSystem.

void biogears::Respiratory::Intubation ( )
private

Esophageal Intubation.

During mechanical ventilation, one of the clinical complications of endotracheal intubation is esophageal intubation. This involves the misplacement of the tube down the esophagus. Such event prohibits air flow into or out of the lungs. The Biogers circuit handles this respiratory distress by manipulating the tracheal resistance. When esophageal intubation incidence is triggered, significantly large resistance is assigned to the trachea compartment. Otherwise, the esophageal compartment resistance is set to be significantly large value under normal condition.

Todo:
Make this a modifier (i.e. multiplier), instead of setting it directly
bool biogears::Respiratory::Load ( const CDM::BioGearsRespiratorySystemData &  in)
virtual
void biogears::Respiratory::LobarPneumonia ( )
private

Lobar Pneumonia.

Parameters
None
Returns
void

This method handles the lobar pneumonia condition. It determines if the patient has lobar pneumonia and calculates a set of multipliers to model the various symptoms. This method should only run once per simulation.

auto biogears::Respiratory::make_unique ( BioGears &  bg) -> std::unique_ptr<Respiratory>
staticprotected
void biogears::Respiratory::MechanicalVentilation ( )
private

Modifies the pressure and/or flow at the mouth.

Handles the mechanical ventilation action that adds a flow and pressure source to instantaneously set the respiratory connection (mouth) to user specified values.

void biogears::Respiratory::OverrideControlLoop ( )
protected
void biogears::Respiratory::Pneumothorax ( )
private

Tension pneumothorax.

Pneumothorax is an abnormal accumulation of air in the pleural cavity. Tension pneumothorax occurs when air escapes into the pleural space on inspiration, but cannot return on expiration. Different types of pneumothorces are known. The Biogears engine models open (sucking chest wound) and closed (intact thoracic cage) pnumothoraces whereas occlusive dressing and needle decompression are modeled as interventions. The function models pneumothorax and needle decompression by opening respiratory circuits that allow air flows into and out of the pleural cavity. Under normal condition, the path between the lung node or the outside environment and the intrapleural cavity is blocked via significantly high resistances that serve as open switches. When open or closed pneumothorax is triggered, these resistances are reduced in proportion to the severity of the pneumothorax. This reduction permits air flow into the pleural cavity a and cause respiratory and cardiovascular distress. The function allows the selection of tension pneumothorax and/or needle decompression events on the left or right lung side. The effects on the cardiovascular system parameters is accounted through modifiers that scale in proportion to the accumulated gas.

Error:
Patient: Cannot perform an intervention if Tension Pneumothorax is not present on that side.
Error:
Patient: Cannot perform an intervention if Tension Pneumothorax is not present on that side.
Error:
Patient: can't process needle decompression if no pneumothorax is present
Error:
Patient: can't process a chest occlusive dressing if no pneumothorax is present
void biogears::Respiratory::PostProcess ( )
overridevirtual

Respiratory system postprocess function.

Updates the current values of the gas volume fraction and gas volumes for the nodes in the respiratory circuit or the nodes in the combined (respiratory + anesthesia machine) circuit when the anesthesia machine is turned on.

Implements biogears::BioGearsSystem.

void biogears::Respiratory::PreProcess ( )
overridevirtual

Respiratory system preprocess function.

Calculates the muscle pressure source that drives the respiratory system. Updates airway resistance to account for changes arising from factors like drugs and respiratory insults and interventions. Updates the chest wall variable compliance. Handles all respiratory insults and actions.

Implements biogears::BioGearsSystem.

void biogears::Respiratory::Process ( )
overridevirtual

Respiratory system process function.

Ensures the selection of the respiratory system with or without the anesthesia machine. Handles the integration of the anesthesia machine to the respiratory system when the anesthesia machine is turned on. The integration of the anesthesia machine to the respiratory system is handled at run time by constructing a combined circuit of the respiratory and anesthesia machine. Handles lung volume changes during alveolar gas transfer. Calculates physiological parameters such as respiration rate, tidal volume and others that belonging to the respiratory system.

Implements biogears::BioGearsSystem.

void biogears::Respiratory::ProcessAerosolSubstances ( )
private

Compute deposited mass, update localized PD effects.

For each aerosol get the SIDE coefficient to determine deposited mass in each respiratory compartment. Adjust the resistances between compartments as a function of deposited mass to reach validated data. Liquid and solid aerosols are handled here.

void biogears::Respiratory::ProcessConsciousRespiration ( SEConsciousRespirationCommand &  cmd)
private

Process conscious respiration.

Parameters
cmd- Conscious respiration command

Processes conscious respiration commands.

void biogears::Respiratory::ProcessDriverActions ( )
private

Process actions that affect respiratory driver.

The tidal volume calculated from the target ventilation returned by the Chemoreceptor feedback can attenuated by many factors. Currently, we have a cardiac arrest effect, drug effects in the form of neuromuscular blockers and sedatives, sepsis effects, and pain effects. Process these actions here instead of in the RespiratoryDriver to clean up the code and have a dedicated place for future actions that change driver output.

void biogears::Respiratory::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::Respiratory::RespiratoryDriver ( )
private

Respiratory driver pressure source.

Calculates the muscle pressure source pressure by using the chemical stimuli as feedback control mechanism. The method reads the arterial O2 and CO2 partial pressures. Using these partial pressures, the method calculates the alveolar ventilation from which the method calculates the target breathing frequency. The target breathing frequency is used in the equation for muscle pressure source. The muscle pressure source is used as a driver for ventilation. This method also calculates the drug modifiers that adjusts the depth and frequency of respiration.

: Running averages were mostly used for chemoreceptors that have been moved to Nervous. ToDo: However, they are still used in some calculations in CalculateVitals. Should we move/consolidate these?

@cite Albanese2015Integrated--------------------------------------------------------------------------—

void biogears::Respiratory::SetUp ( )
overrideprotectedvirtual

Initializes parameters for Respiratory Class.

Initializes member variables and system level values on the common data model.

Todo:
figure out how to modify these resistances without getting the cv circuit - maybe add a parameter, like baroreceptors does

Implements biogears::BioGearsSystem.

void biogears::Respiratory::TuneCircuit ( )
private

Run the circuit standalone for a little to get it into a good starting state.

  • keep volume fractions constant
static size_t biogears::Respiratory::TypeHash ( )
inlinestatic
static constexpr char const* const biogears::Respiratory::TypeTag ( )
inlinestatic
CDM::BioGearsRespiratorySystemData * biogears::Respiratory::Unload ( ) const
overridevirtual

Reimplemented from biogears::SERespiratorySystem.

void biogears::Respiratory::Unload ( CDM::BioGearsRespiratorySystemData &  data) const
protectedvirtual
void biogears::Respiratory::UpdateAlveoliCompliance ( double  dScalingFactor,
double  dLeftLungFraction,
double  dRightLungFraction 
)
private

Update Alveoli Compliance.

Parameters
dScalingFactorMultiplier based on the severity of the condition (lobar pneumonia, COPD, etc)
dLeftLungFractionFraction of left lung affected by change in surface area (0 to 1)
dRightLungFractionFraction of right lung affected by change in surface area (0 to 1)
Returns
void

This method takes a scaling factor and lung percentages (left and right) as input variables The scaling factor and lung percentages are combined to produce a measure of deviation from compliance baseline. The Alveoli to Pleural compliances are updated to model alveolus membrane damage orchanges to alveolus fluid content

void biogears::Respiratory::UpdateGasDiffusionSurfaceArea ( double  dFractionArea,
double  dLeftLungFraction,
double  dRightLungFraction 
)
private

Update Gas Diffusion Surface Area.

Parameters
dFractionAreaFractional change in gas diffusion surface area (0 to 1)
dLeftLungFractionFraction of left lung affected by change in surface area (0 to 1)
dRightLungFractionFraction of right lung affected by change in surface area (0 to 1)
Returns
void

This method takes a percent valve and lung percentages (left and right) as input variables. It updates the gas diffusion surface area in the lungs in order to model the destruction of alveoli membranes and/or lung consolidation.

void biogears::Respiratory::UpdateIERatio ( )
private

Update the inspiratory-expiratory ratio.

Returns
void

The inspiratory-expiratory ratio is modified based on certain actions and conditions, as well as local bronchodilation effects from aerosols.

void biogears::Respiratory::UpdateObstructiveResistance ( )
private

Update obstructive (airway) resistance.

Returns
void

This method takes a resistance scaling factor and lung percentages (left and right) as input variables. It updates the Trachea to Dead Space path resistances in order to model airflow blockage through the bronchi and bronchioles.

void biogears::Respiratory::UpdatePleuralCompliance ( )
private

Chest wall compliance modifier.

Adjusts the chest wall compliance based on the pleural volume. The variable compliance allows some level of tolerance to mechanical stresses that may arise from events like airway obstruction. Currently, a linear relation with an upper bound has been used.

void biogears::Respiratory::UpdatePulmonaryCapillaryResistance ( double  dResistanceScalingFactor,
double  dLeftLungPercent,
double  dRightLungPercent 
)
private

Update Pulmonary Capillary Resistance.

Parameters
dResistanceScalingFactorPulmonary capillary resistance multiplier
dLeftLungFractionFraction of left lung affected by change in surface area (0 to 1)
dRightLungFractionFraction of right lung affected by change in surface area (0 to 1)
Returns
void

This method takes a resistance scaling factor and lung fractions (left and right) as input variables. It updates the pulmonary capillary to pulmonary vein resistance in order to model the destruction of capillaries in the alveolus membrane.

Friends And Related Function Documentation

friend class BioGears
friend
friend class BioGearsEngineTest
friend

Member Data Documentation

std::vector<SELiquidCompartment*> biogears::Respiratory::m_AerosolEffects
private
SELiquidCompartment* biogears::Respiratory::m_AerosolLeftAlveoli
private
SELiquidCompartment* biogears::Respiratory::m_AerosolLeftBronchi
private
SELiquidCompartment* biogears::Respiratory::m_AerosolMouth
private
SELiquidCompartment* biogears::Respiratory::m_AerosolRightAlveoli
private
SELiquidCompartment* biogears::Respiratory::m_AerosolRightBronchi
private
SELiquidCompartment* biogears::Respiratory::m_AerosolTrachea
private
SELiquidTransporter biogears::Respiratory::m_AerosolTransporter
private
SEFluidCircuitNode* biogears::Respiratory::m_Ambient
private
SELiquidSubstanceQuantity* biogears::Respiratory::m_AortaCO2
private
SELiquidSubstanceQuantity* biogears::Respiratory::m_AortaO2
private
RunningAverage biogears::Respiratory::m_ArterialCO2Average_mmHg
private
double biogears::Respiratory::m_ArterialCO2PartialPressure_mmHg
private
RunningAverage biogears::Respiratory::m_ArterialO2Average_mmHg
private
double biogears::Respiratory::m_ArterialO2PartialPressure_mmHg
private
double biogears::Respiratory::m_arterialPHBaseline
private
double biogears::Respiratory::m_AverageLocalTissueBronchodilationEffects
private
RunningAverage biogears::Respiratory::m_BloodPHRunningAverage
private
bool biogears::Respiratory::m_bNotBreathing
private
bool biogears::Respiratory::m_BreathingCycle
private
double biogears::Respiratory::m_BreathingCycleTime_s
private
double biogears::Respiratory::m_BreathTimeExhale_min
private
SEFluidCircuitCalculator biogears::Respiratory::m_Calculator
private
SEFluidCircuitPath* biogears::Respiratory::m_ConnectionToMouth
private
bool biogears::Respiratory::m_ConsciousBreathing
private
double biogears::Respiratory::m_ConsciousEndPressure_cmH2O
private
double biogears::Respiratory::m_ConsciousRespirationPeriod_s
private
double biogears::Respiratory::m_ConsciousRespirationRemainingPeriod_s
private
double biogears::Respiratory::m_ConsciousStartPressure_cmH2O
private
BioGears& biogears::Respiratory::m_data
protected
double biogears::Respiratory::m_dDefaultClosedResistance_cmH2O_s_Per_L
private
double biogears::Respiratory::m_dDefaultOpenResistance_cmH2O_s_Per_L
private
double biogears::Respiratory::m_DefaultDrivePressure_cmH2O
private
double biogears::Respiratory::m_dRespClosedResistance_cmH2O_s_Per_L
private
double biogears::Respiratory::m_dRespOpenResistance_cmH2O_s_Per_L
private
double biogears::Respiratory::m_DriverPressure_cmH2O
private
double biogears::Respiratory::m_DriverPressureMin_cmH2O
private
SEFluidCircuitPath* biogears::Respiratory::m_DriverPressurePath
private
double biogears::Respiratory::m_dt_min
private
double biogears::Respiratory::m_dt_s
private
double biogears::Respiratory::m_ElapsedBreathingCycleTime_min
private
SEGasCompartment* biogears::Respiratory::m_Environment
private
SEFluidCircuitPath* biogears::Respiratory::m_EnvironmentToLeftChestLeak
private
SEFluidCircuitPath* biogears::Respiratory::m_EnvironmentToRightChestLeak
private
double biogears::Respiratory::m_ExpiratoryReserveVolumeFraction
private
SEGasTransporter biogears::Respiratory::m_GasTransporter
private
SEFluidCircuitPath* biogears::Respiratory::m_GroundToConnection
private
bool biogears::Respiratory::m_HadAirwayObstruction
private
bool biogears::Respiratory::m_hadApnea
private
bool biogears::Respiratory::m_HadBronchoconstriction
private
double biogears::Respiratory::m_IEscaleFactor
private
double biogears::Respiratory::m_InitialExpiratoryReserveVolume_L
private
double biogears::Respiratory::m_InitialFunctionalResidualCapacity_L
private
double biogears::Respiratory::m_InitialInspiratoryCapacity_L
private
double biogears::Respiratory::m_InitialResidualVolume_L
private
double biogears::Respiratory::m_InspiratoryCapacityFraction
private
double biogears::Respiratory::m_InstantaneousFunctionalResidualCapacity_L
private
double biogears::Respiratory::m_LastCardiacCycleBloodPH
private
SEFluidCircuitNode* biogears::Respiratory::m_LeftAlveoli
private
SEGasSubstanceQuantity* biogears::Respiratory::m_LeftAlveoliCO2
private
SEFluidCircuitPath* biogears::Respiratory::m_LeftAlveoliLeakToLeftPleuralCavity
private
SEGasSubstanceQuantity* biogears::Respiratory::m_LeftAlveoliO2
private
SEFluidCircuitPath* biogears::Respiratory::m_LeftAlveoliToLeftPleuralConnection
private
SEFluidCircuitNode* biogears::Respiratory::m_LeftBronchi
private
SEFluidCircuitPath* biogears::Respiratory::m_LeftBronchiToLeftAlveoli
private
SEFluidCircuitPath* biogears::Respiratory::m_LeftBronchiToLeftPleuralConnection
private
SEFluidCircuitPath* biogears::Respiratory::m_LeftDriverPressurePath
private
SELiquidCompartment* biogears::Respiratory::m_LeftLungExtravascular
private
SEFluidCircuitNode* biogears::Respiratory::m_LeftPleuralCavity
private
SEFluidCircuitPath* biogears::Respiratory::m_LeftPleuralCavityToEnvironment
private
SEFluidCircuitPath* biogears::Respiratory::m_LeftPleuralCavityToRespiratoryMuscle
private
SEFluidCircuitPath* biogears::Respiratory::m_LeftPulmonaryCapillary
private
SEGasCompartment* biogears::Respiratory::m_Lungs
private
double biogears::Respiratory::m_MaxDriverPressure_cmH2O
private
SEGasCompartment* biogears::Respiratory::m_MechanicalVentilatorConnection
private
SEFluidCircuitPath* biogears::Respiratory::m_MouthToStomach
private
SEFluidCircuitPath* biogears::Respiratory::m_MouthToTrachea
private
double biogears::Respiratory::m_OverrideRRBaseline_Per_min
private
SEPatient* biogears::Respiratory::m_Patient
private
SEPatientActionCollection* biogears::Respiratory::m_PatientActions
private
double biogears::Respiratory::m_PeakRespiratoryDrivePressure_cmH2O
private
double biogears::Respiratory::m_PleuralComplianceSensitivity_Per_L
private
double biogears::Respiratory::m_PreviousTotalLungVolume_L
private
SEFluidCircuit* biogears::Respiratory::m_RespiratoryCircuit
private
SEFluidCircuitNode* biogears::Respiratory::m_RespiratoryMuscle
private
SEFluidCircuitNode* biogears::Respiratory::m_RightAlveoli
private
SEGasSubstanceQuantity* biogears::Respiratory::m_RightAlveoliCO2
private
SEFluidCircuitPath* biogears::Respiratory::m_RightAlveoliLeakToRightPleuralCavity
private
SEGasSubstanceQuantity* biogears::Respiratory::m_RightAlveoliO2
private
SEFluidCircuitPath* biogears::Respiratory::m_RightAlveoliToRightPleuralConnection
private
SEFluidCircuitNode* biogears::Respiratory::m_RightBronchi
private
SEFluidCircuitPath* biogears::Respiratory::m_RightBronchiToRightAlveoli
private
SEFluidCircuitPath* biogears::Respiratory::m_RightBronchiToRightPleuralConnection
private
SELiquidCompartment* biogears::Respiratory::m_RightLungExtravascular
private
SEFluidCircuitNode* biogears::Respiratory::m_RightPleuralCavity
private
SEFluidCircuitPath* biogears::Respiratory::m_RightPleuralCavityToEnvironment
private
SEFluidCircuitPath* biogears::Respiratory::m_RightPleuralCavityToRespiratoryMuscle
private
SEFluidCircuitPath* biogears::Respiratory::m_RightPulmonaryCapillary
private
SEFluidCircuitNode* biogears::Respiratory::m_Stomach
private
double biogears::Respiratory::m_TopBreathAlveoliVolume_L
private
double biogears::Respiratory::m_TopBreathDeadSpaceVolume_L
private
double biogears::Respiratory::m_TopBreathPleuralPressure_cmH2O
private
double biogears::Respiratory::m_TopBreathTotalVolume_L
private
SEGasCompartment* biogears::Respiratory::m_Trachea
private
SEGasSubstanceQuantity* biogears::Respiratory::m_TracheaCO2
private
SEGasSubstanceQuantity* biogears::Respiratory::m_TracheaO2
private
SEFluidCircuitPath* biogears::Respiratory::m_TracheaToLeftBronchi
private
SEFluidCircuitPath* biogears::Respiratory::m_TracheaToRightBronchi
private
std::string biogears::Respiratory::m_TuningFile
private
double biogears::Respiratory::m_VentilationFrequency_Per_min
private
double biogears::Respiratory::m_VentilationToTidalVolumeSlope
private
double biogears::Respiratory::m_VentilatoryOcclusionPressure_cmH2O
private