AnesthesiaMachineModel.h
1/* Distributed under the Apache License, Version 2.0.
2 See accompanying NOTICE file for details.*/
3
4#pragma once
5
6#include "engine/common/system/Model.h"
7#include "engine/common/system/Systems.h"
8
14
15namespace pulse
16{
17 class PBEquipment;
18 class EngineTest;
23 class PULSE_DECL AnesthesiaMachineModel : public AnesthesiaMachineSystem, public Model
24 {
25 friend PBEquipment;//friend the serialization class
26 friend EngineTest;
27 public:
28 AnesthesiaMachineModel(Data& pc);
29 virtual ~AnesthesiaMachineModel();
30
31 void Clear() override;
32
33 // Set members to a stable homeostatic state
34 void Initialize() override;
35 // Set pointers and other member varialbes common to both homeostatic initialization and loading a state
36 void SetUp() override;
37
38 void StateChange() override;
39
40 void AtSteadyState() override {}
41 void PreProcess() override;
42 void Process(bool solve_and_transport = true) override;
43 void PostProcess(bool solve_and_transport = true) override;
44
45 protected:
46 void ComputeExposedModelParameters() override;
47
48 void CalculateScrubber();
49
50 void UpdateAirwayMode();
51
52 void CalculateSourceStatus();
53 void CalculateEquipmentLeak();
54 void CalculateValveResistances();
55 void CalculateVentilatorPressure();
56 void CalculateGasSourceSubstances();
57 void CalculateGasSourceResistance();
58 void CalculateCyclePhase();
59 void CheckReliefValve();
60
61 // Serializable member variables (Set in Initialize and in schema)
62 bool m_inhaling;
63 double m_inspirationTime_s;
64 double m_O2InletVolumeFraction;
65 double m_currentbreathingCycleTime_s;
66 double m_totalBreathingCycleTime_s;
67
68 // Stateless member variable (Set in SetUp())
69 double m_dValveOpenResistance_cmH2O_s_Per_L;
70 double m_dValveClosedResistance_cmH2O_s_Per_L;
71 double m_dSwitchOpenResistance_cmH2O_s_Per_L;
72 double m_dSwitchClosedResistance_cmH2O_s_Per_L;
74 SEGasCompartment* m_ambient;
75 SEGasSubstanceQuantity* m_ambientCO2;
76 SEGasSubstanceQuantity* m_ambientN2;
77 SEGasSubstanceQuantity* m_ambientO2;
78 SEGasCompartment* m_gasSource;
79 SEGasSubstanceQuantity* m_gasSourceCO2;
80 SEGasSubstanceQuantity* m_gasSourceN2;
81 SEGasSubstanceQuantity* m_gasSourceO2;
82 SEGasCompartment* m_scrubber;
83 SEGasSubstanceQuantity* m_scubberCO2;
84 SEGasSubstanceQuantity* m_scrubberN2;
85 SEFluidCircuitNode* m_nVentilator;
86 SEFluidCircuitPath* m_pAnesthesiaConnectionToEnvironment;
87 SEFluidCircuitPath* m_pYPieceToExpiratoryLimb;
88 SEFluidCircuitPath* m_pGasSourceToGasInlet;
89 SEFluidCircuitPath* m_pInspiratoryLimbToYPiece;
90 SEFluidCircuitPath* m_pSelectorToReliefValve;
91 SEFluidCircuitPath* m_pEnvironmentToReliefValve;
92 SEFluidCircuitPath* m_pEnvironmentToVentilator;
93 SEFluidCircuitPath* m_pExpiratoryLimbToSelector;
94 SEFluidCircuitPath* m_pSelectorToScrubber;
95 SEFluidCircuitPath* m_pEnvironmentToGasSource;
96 };
97END_NAMESPACE
Definition: SEEquipmentActionCollection.h:47
Definition: SEFluidCircuitNode.h:10
Definition: SEFluidCircuitPath.h:9
Definition: SEGasCompartment.h:14
Definition: SEGasSubstanceQuantity.h:10
Definition: Logger.h:14

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.