Respiratory.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 #pragma once
5 #include "controller/System.h"
6 #include "system/physiology/SERespiratorySystem.h"
7 class SEPatient;
9 class SEGasCompartment;
13 class SEFluidCircuit;
14 class SEFluidCircuitNode;
15 class SEFluidCircuitPath;
17 class SEGasTransporter;
21 
33 class PULSE_DECL Respiratory : public SERespiratorySystem, public PulseRespiratorySystem, public PulseSystem
34 {
35  friend class PBPulsePhysiology;//friend the serialization class
36  friend class PulseController;
37  friend class PulseEngineTest;
38 protected:
39 
42 
43 public:
44  virtual ~Respiratory();
45 
46  void Clear();
47 
48 protected:
49  // Set members to a stable homeostatic state
50  void Initialize();
51  // Set pointers and other member varialbes common to both homeostatic initialization and loading a state
52  void SetUp();
53 
54  void AtSteadyState();
55  void PreProcess();
56  void Process();
57  void PostProcess();
58 
59  bool CalculatePulmonaryFunctionTest(SEPulmonaryFunctionTest& pft) const;
60 
61  //Tuning
62  void TuneCircuit();
63 
64  //Conditions
65  void COPD();
66  void ImpairedAlveolarExchange();
67  void LobarPneumonia();
68 
69  //PreProcess
70  void UpdatePleuralCompliance();
71  //Actions
72  void AirwayObstruction();
73  void BronchoConstriction();
74  void BronchoDilation();
75  void Intubation();
76  void Pneumothorax();
77  void ConsciousRespiration();
78  void ProcessConsciousRespiration(SEConsciousRespirationCommand& cmd);
79  void MechanicalVentilation();
80  void Apnea();
81  // Driver
82  void RespiratoryDriver();
83 
84  // Shared Utility Methods for Actions/Driver
85  // Asthma/COPD
86  void UpdateObstructiveResistance();
87  void UpdateIERatio();
88  // LobarPneumonia/COPD
89  void UpdateAlveoliCompliance(double dCompilanceScalingFactor, double dLeftLungFraction, double dRightLungFraction);
90  void UpdateGasDiffusionSurfaceArea(double dFractionalArea, double dLeftLungFraction, double dRightLungFraction);
91  // COPD
92  void UpdatePulmonaryCapillaryResistance(double dResistanceScalingFactor, double dLeftLungFraction, double dRightLungFraction);
93  // Pneumothorax
94  void DoLeftNeedleDecompression(double dFlowResistance);
95  void DoRightNeedleDecompression(double dFlowResistance);
96  // Aerosol Deposition and various Effects
97  void ProcessAerosolSubstances();
98  // Driver/Conscious Breath
99  double VolumeToDriverPressure(double TargetVolume);
100 
101  //Process
102  void CalculateVitalSigns();
103 
104  // Serializable member variables (Set in Initialize and in schema)
105  // Initial patient values
110  // CalculateVitalSigns()
126 
127  // Respiratory Driver
145  // Conscious Breathing
153 
154  // Stateless member variable (Set in SetUp())
155  double m_dt_s;
156  double m_dt_min;
157  // Configuration parameters
169  // State between functions (i.e. shared between methods in preprocess, set to a default value at the start of preprocess)
171 
172  // Patient
175  //Compartments
192  std::vector<SELiquidCompartment*> m_AerosolEffects;
195  //Circuits
197  //Nodes
208  //Paths
233 
237 };
double m_IEscaleFactor
Definition: Respiratory.h:136
SEGasCompartment * m_MechanicalVentilatorConnection
Definition: Respiratory.h:193
SEFluidCircuitPath * m_DriverPressurePath
Definition: Respiratory.h:215
double m_TopBreathPleuralPressure_cmH2O
Definition: Respiratory.h:116
double m_InitialExpiratoryReserveVolume_L
Definition: Respiratory.h:106
PulseController & m_data
Definition: Respiratory.h:41
SELiquidSubstanceQuantity * m_AortaO2
Definition: Respiratory.h:188
double m_TopBreathDeadSpaceVolume_L
Definition: Respiratory.h:115
The Respiratory System class handles the analysis and storage of data related the respiratory physiol...
Definition: Respiratory.h:33
bool m_BreathingCycle
Definition: Respiratory.h:111
SEFluidCircuitPath * m_MouthToCarina
Definition: Respiratory.h:217
SEFluidCircuitPath * m_CarinaToLeftAnatomicDeadSpace
Definition: Respiratory.h:209
double m_VentilationTidalVolumeIntercept
Definition: Respiratory.h:165
Definition: SEPatient.h:61
SEFluidCircuitPath * m_GroundToConnection
Definition: Respiratory.h:232
Definition: SEGasCompartment.h:12
SEPatient * m_Patient
Definition: Respiratory.h:173
SELiquidTransporter * m_AerosolTransporter
Definition: Respiratory.h:236
SEFluidCircuitCalculator * m_Calculator
Definition: Respiratory.h:234
SERunningAverage * m_BloodPHRunningAverage
Definition: Respiratory.h:125
SEPatientActionCollection * m_PatientActions
Definition: Respiratory.h:174
double m_InitialFunctionalResidualCapacity_L
Definition: Respiratory.h:107
double m_BottomBreathDeadSpaceVolume_L
Definition: Respiratory.h:123
double m_DriverPressureMin_cmH2O
Definition: Respiratory.h:134
SELiquidCompartment * m_MechanicalVentilatorAerosolConnection
Definition: Respiratory.h:194
Definition: SEPatientActionCollection.h:36
Manages and controls execution of all data/systems in Pulse.
Definition: Controller.h:50
Definition: SEFluidCircuitPath.h:8
double m_DefaultClosedResistance_cmH2O_s_Per_L
Definition: Respiratory.h:160
SEFluidCircuitNode * m_RightPleural
Definition: Respiratory.h:205
SEFluidCircuitPath * m_ConnectionToMouth
Definition: Respiratory.h:231
double m_VentilatoryOcclusionPressure_cmH2O
Definition: Respiratory.h:166
virtual void Clear()
Definition: SERespiratorySystem.cpp:43
double m_PreviousTargetAlveolarVentilation_L_Per_min
Definition: Respiratory.h:140
SELiquidCompartment * m_AerosolRightDeadSpace
Definition: Respiratory.h:181
SEFluidCircuitPath * m_LeftDriverPressurePath
Definition: Respiratory.h:216
double m_PleuralComplianceSensitivity_Per_L
Definition: Respiratory.h:162
SEFluidCircuitPath * m_LeftAlveoliLeakToLeftPleural
Definition: Respiratory.h:221
SEFluidCircuitPath * m_EnvironmentToLeftChestLeak
Definition: Respiratory.h:219
Definition: SERespiratorySystem.h:8
virtual void SetUp()=0
std::vector< SELiquidCompartment * > m_AerosolEffects
Definition: Respiratory.h:192
SEGasSubstanceQuantity * m_LeftAlveoliO2
Definition: Respiratory.h:190
Definition: SERunningAverage.h:7
SEFluidCircuitNode * m_Mouth
Definition: Respiratory.h:198
Definition: PulsePhysiologySystems.h:82
Definition: SELiquidSubstanceQuantity.h:11
SEFluidCircuitNode * m_LeftDeadSpace
Definition: Respiratory.h:200
SEFluidCircuitNode * m_RespiratoryMuscle
Definition: Respiratory.h:202
bool m_NotBreathing
Definition: Respiratory.h:112
double m_dt_s
Definition: Respiratory.h:155
double m_CentralControlGainConstant
Definition: Respiratory.h:158
double m_ArterialCO2PartialPressure_mmHg
Definition: Respiratory.h:129
SELiquidCompartment * m_AerosolMouth
Definition: Respiratory.h:177
double m_BreathingCycleTime_s
Definition: Respiratory.h:130
SEFluidCircuitPath * m_LeftAlveoliToLeftPleuralConnection
Definition: Respiratory.h:226
SEGasCompartment * m_Lungs
Definition: Respiratory.h:185
SEFluidCircuitPath * m_RightAnatomicDeadSpaceToRightPleuralConnection
Definition: Respiratory.h:227
SEFluidCircuitNode * m_Stomach
Definition: Respiratory.h:207
double m_VentilationFrequency_Per_min
Definition: Respiratory.h:141
SEFluidCircuitNode * m_RightDeadSpace
Definition: Respiratory.h:204
double m_InitialResidualVolume_L
Definition: Respiratory.h:109
double m_DriverPressure_cmH2O
Definition: Respiratory.h:133
Generic class for handling the Pulse stabilization methodology.
Definition: System.h:10
double m_PeripheralControlGainConstant
Definition: Respiratory.h:161
SEFluidCircuit * m_RespiratoryCircuit
Definition: Respiratory.h:196
SELiquidCompartment * m_RightLungExtravascular
Definition: Respiratory.h:184
double m_ConsciousEndPressure_cmH2O
Definition: Respiratory.h:152
Definition: PBPulsePhysiology.h:18
Definition: SELiquidCompartment.h:10
SEFluidCircuitPath * m_LeftPulmonaryCapillary
Definition: Respiratory.h:230
double m_TopBreathTotalVolume_L
Definition: Respiratory.h:113
SEFluidCircuitPath * m_LeftPleuralToEnvironment
Definition: Respiratory.h:223
SEFluidCircuitPath * m_LeftAnatomicDeadSpaceToLeftPleuralConnection
Definition: Respiratory.h:228
SEFluidCircuitPath * m_RightPulmonaryCapillary
Definition: Respiratory.h:229
virtual void Initialize()
Default system values to their homeostatic values
Definition: System.h:16
SEFluidCircuitPath * m_RightAlveoliLeakToRightPleural
Definition: Respiratory.h:222
Definition: SEFluidCircuitNode.h:7
SEFluidCircuitPath * m_RightPleuralToEnvironment
Definition: Respiratory.h:224
SEFluidCircuitPath * m_CarinaToRightAnatomicDeadSpace
Definition: Respiratory.h:210
SEFluidCircuitNode * m_LeftPleural
Definition: Respiratory.h:201
Definition: SEFluidCircuit.h:11
double m_DefaultOpenResistance_cmH2O_s_Per_L
Definition: Respiratory.h:159
double m_AverageLocalTissueBronchodilationEffects
Definition: Respiratory.h:170
double m_TopBreathElapsedTime_min
Definition: Respiratory.h:119
double m_dt_min
Definition: Respiratory.h:156
SEFluidCircuitPath * m_LeftPleuralToRespiratoryMuscle
Definition: Respiratory.h:214
virtual void AtSteadyState()
Notify systems that steady state has been achieved.
Definition: System.h:20
Definition: SEConsciousRespirationCommand.h:7
SEFluidCircuitPath * m_RightAnatomicDeadSpaceToRightAlveoli
Definition: Respiratory.h:212
SELiquidCompartment * m_LeftLungExtravascular
Definition: Respiratory.h:183
Definition: SESubstanceTransport.h:110
double m_DriverInspirationTime_s
Definition: Respiratory.h:132
double m_BottomBreathAlveoliVolume_L
Definition: Respiratory.h:122
SEFluidCircuitNode * m_RightAlveoli
Definition: Respiratory.h:203
SELiquidSubstanceQuantity * m_AortaCO2
Definition: Respiratory.h:189
SEGasCompartment * m_Environment
Definition: Respiratory.h:176
double m_ConsciousRespirationPeriod_s
Definition: Respiratory.h:147
SEFluidCircuitNode * m_LeftAlveoli
Definition: Respiratory.h:199
virtual void PostProcess()=0
double m_ConsciousStartPressure_cmH2O
Definition: Respiratory.h:151
double m_RespOpenResistance_cmH2O_s_Per_L
Definition: Respiratory.h:163
double m_BottomBreathPleuralPressure_cmH2O
Definition: Respiratory.h:124
double m_ExpiratoryReserveVolumeFraction
Definition: Respiratory.h:149
SEFluidCircuitPath * m_RightPleuralToRespiratoryMuscle
Definition: Respiratory.h:213
SEGasSubstanceQuantity * m_RightAlveoliO2
Definition: Respiratory.h:191
SELiquidCompartment * m_AerosolLeftAlveoli
Definition: Respiratory.h:180
SEGasSubstanceQuantity * m_CarinaO2
Definition: Respiratory.h:187
double m_VentilationToTidalVolumeSlope
Definition: Respiratory.h:142
SEGasTransporter * m_GasTransporter
Definition: Respiratory.h:235
double m_ArterialO2PartialPressure_mmHg
Definition: Respiratory.h:128
Definition: SESubstanceTransport.h:102
SELiquidCompartment * m_AerosolCarina
Definition: Respiratory.h:178
SEFluidCircuitNode * m_Ambient
Definition: Respiratory.h:206
bool m_ConsciousBreathing
Definition: Respiratory.h:146
SEFluidCircuitPath * m_RightAlveoliToRightPleuralConnection
Definition: Respiratory.h:225
double m_ElapsedBreathingCycleTime_min
Definition: Respiratory.h:135
SELiquidCompartment * m_AerosolRightAlveoli
Definition: Respiratory.h:182
virtual void Process()=0
double m_InspiratoryCapacityFraction
Definition: Respiratory.h:150
double m_InstantaneousFunctionalResidualCapacity_L
Definition: Respiratory.h:137
double m_BottomBreathTotalVolume_L
Definition: Respiratory.h:121
double m_TopCarinaO2
Definition: Respiratory.h:118
double m_DefaultDrivePressure_cmH2O
Definition: Respiratory.h:131
double m_MaxDriverPressure_cmH2O
Definition: Respiratory.h:138
SELiquidCompartment * m_AerosolLeftDeadSpace
Definition: Respiratory.h:179
SEFluidCircuitPath * m_EnvironmentToRightChestLeak
Definition: Respiratory.h:220
virtual void PreProcess()=0
Definition: SEFluidCircuitCalculator.h:9
Definition: SEGasSubstanceQuantity.h:9
double m_ConsciousRespirationRemainingPeriod_s
Definition: Respiratory.h:148
double m_PeakRespiratoryDrivePressure_cmH2O
Definition: Respiratory.h:139
SEFluidCircuitPath * m_LeftAnatomicDeadSpaceToLeftAlveoli
Definition: Respiratory.h:211
double m_TopBreathAlveoliVolume_L
Definition: Respiratory.h:114
SERunningAverage * m_ArterialO2RunningAverage_mmHg
Definition: Respiratory.h:143
Definition: SEPulmonaryFunctionTest.h:9
double m_RespClosedResistance_cmH2O_s_Per_L
Definition: Respiratory.h:164
double m_MinimumAllowableInpiratoryAndExpiratoryPeriod_s
Definition: Respiratory.h:168
double m_BottomBreathElapsedTime_min
Definition: Respiratory.h:120
SERunningAverage * m_ArterialCO2RunningAverage_mmHg
Definition: Respiratory.h:144
double m_MinimumAllowableTidalVolume_L
Definition: Respiratory.h:167
SEFluidCircuitPath * m_MouthToStomach
Definition: Respiratory.h:218
double m_InitialInspiratoryCapacity_L
Definition: Respiratory.h:108
double m_LastCardiacCycleBloodPH
Definition: Respiratory.h:117
SEGasCompartment * m_Carina
Definition: Respiratory.h:186