The Respiratory System class handles the analysis and storage of data related the respiratory physiology and pathology. More...
#include <Respiratory.h>

Static Public Member Functions | |
static size_t | TypeHash () |
static constexpr char const *const | TypeTag () |
![]() | |
static size_t | TypeHash () |
static constexpr char const *const | TypeTag () |
![]() | |
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 () |
![]() | |
void | Unload (CDM::RespiratorySystemData &data) const |
![]() | |
void | Unload (CDM::SystemData &data) const |
![]() | |
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 |
![]() | |
virtual void | LoadState () |
Static Protected Member Functions | |
static auto | make_unique (BioGears &bg) -> std::unique_ptr< Respiratory > |
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... | |
Friends | |
class | BioGears |
class | BioGearsEngineTest |
Additional Inherited Members | |
![]() | |
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
|
protected |
|
overridevirtual |
Member Function Documentation
|
private |
|
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.
|
private |
Apply apnea action.
- Parameters
-
None
- Returns
- void
This reduces the respiratory driver pressure source amplitude by the percentage defined by the action severity.
|
overridevirtual |
Respiratory system at steady state.
Initializes respiratory conditions if any are present.
- COPD
- Lobar Pneumonia
- ImpairedAlveolarExchange
Reimplemented from biogears::BioGearsSystem.
|
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.
|
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
-
pft pft data
- Returns
- success true, if everything worked out
- Todo:
- Insert more PFT calculations here
SEScalar & biogears::Respiratory::CalculateRespirationSOFA | ( | ) |
|
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
- Event:
- Patient: Acute Respiratory Distress: Carrico Index is below 200 mmHg
- Event:
- Patient: Acute Lung Injury: Carrico Index is below 300 mmHg
- 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.
- 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.
|
inlineoverridevirtual |
Reimplemented from biogears::SERespiratorySystem.
|
overridevirtual |
Reimplemented from biogears::SERespiratorySystem.
|
private |
Conscious respiration.
- Parameters
-
None
- Returns
- void
This method determines when to process a conscious respiration command and removes the command from the stack.
|
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.
|
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
|
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
|
inlineoverridevirtual |
Reimplemented from biogears::SERespiratorySystem.
|
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.
|
overridevirtual |
Initializes system properties to valid homeostatic values.
Reimplemented from biogears::BioGearsSystem.
|
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
|
virtual |
|
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.
|
staticprotected |
|
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.
|
protected |
|
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
|
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.
|
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.
|
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.
|
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.
|
private |
Process conscious respiration.
- Parameters
-
cmd - Conscious respiration command
Processes conscious respiration commands.
|
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.
|
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.
|
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--------------------------------------------------------------------------—
|
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.
|
private |
Run the circuit standalone for a little to get it into a good starting state.
- keep volume fractions constant
|
inlinestatic |
|
inlinestatic |
|
overridevirtual |
Reimplemented from biogears::SERespiratorySystem.
|
protectedvirtual |
|
private |
Update Alveoli Compliance.
- Parameters
-
dScalingFactor Multiplier based on the severity of the condition (lobar pneumonia, COPD, etc) dLeftLungFraction Fraction of left lung affected by change in surface area (0 to 1) dRightLungFraction Fraction 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
|
private |
Update Gas Diffusion Surface Area.
- Parameters
-
dFractionArea Fractional change in gas diffusion surface area (0 to 1) dLeftLungFraction Fraction of left lung affected by change in surface area (0 to 1) dRightLungFraction Fraction 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.
|
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.
|
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.
|
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.
|
private |
Update Pulmonary Capillary Resistance.
- Parameters
-
dResistanceScalingFactor Pulmonary capillary resistance multiplier dLeftLungFraction Fraction of left lung affected by change in surface area (0 to 1) dRightLungFraction Fraction 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 |
|
friend |
Member Data Documentation
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
protected |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |