Pulse adds COVID-19 Simulation Support
×

Generic anesthesia machine for positive pressure ventilation. More...

#include <AnesthesiaMachine.h>

Inherits PulseAnesthesiaMachine.

Public Member Functions

virtual ~AnesthesiaMachine ()
 
void Clear ()
 
void Initialize ()
 Initializes system properties to valid homeostatic values. More...
 
void SetUp ()
 Initializes parameters for the anesthesia machine class. More...
 
void StateChange ()
 
void AtSteadyState ()
 Notify systems that steady state has been achieved. More...
 
void PreProcess ()
 Anesthesia machine preprocess function. More...
 
void Process (bool solve_and_transport=true)
 Anesthesia machine process function. More...
 
void PostProcess (bool solve_and_transport=true)
 Anesthesia machine postprocess function. More...
 
- Public Member Functions inherited from PulseAnesthesiaMachine
 PulseAnesthesiaMachine (Logger *logger)
 
virtual ~PulseAnesthesiaMachine ()=default
 
virtual const SEScalarGetScalar (const std::string &name) override
 
- Public Member Functions inherited from SEAnesthesiaMachine
 SEAnesthesiaMachine (Logger *logger)
 
virtual ~SEAnesthesiaMachine ()
 
bool SerializeToString (std::string &output, SerializationFormat m) const
 
bool SerializeToFile (const std::string &filename) const
 
bool SerializeFromString (const std::string &src, SerializationFormat m, const SESubstanceManager &subMgr)
 
bool SerializeFromFile (const std::string &filename, const SESubstanceManager &subMgr)
 
virtual eAnesthesiaMachine_Connection GetConnection () const
 
virtual bool HasInletFlow () const
 
virtual SEScalarVolumePerTimeGetInletFlow ()
 
virtual double GetInletFlow (const VolumePerTimeUnit &unit) const
 
virtual bool HasInspiratoryExpiratoryRatio () const
 
virtual SEScalarGetInspiratoryExpiratoryRatio ()
 
virtual double GetInspiratoryExpiratoryRatio () const
 
virtual bool HasOxygenFraction () const
 
virtual SEScalar0To1GetOxygenFraction ()
 
virtual double GetOxygenFraction () const
 
virtual eAnesthesiaMachine_OxygenSource GetOxygenSource () const
 
virtual void SetOxygenSource (eAnesthesiaMachine_OxygenSource name)
 
virtual bool HasPositiveEndExpiredPressure () const
 
virtual SEScalarPressureGetPositiveEndExpiredPressure ()
 
virtual double GetPositiveEndExpiredPressure (const PressureUnit &unit) const
 
virtual eAnesthesiaMachine_PrimaryGas GetPrimaryGas () const
 
virtual void SetPrimaryGas (eAnesthesiaMachine_PrimaryGas name)
 
virtual bool HasRespiratoryRate () const
 
virtual SEScalarFrequencyGetRespiratoryRate ()
 
virtual double GetRespiratoryRate (const FrequencyUnit &unit) const
 
virtual bool HasReliefValvePressure () const
 
virtual SEScalarPressureGetReliefValvePressure ()
 
virtual double GetReliefValvePressure (const PressureUnit &unit) const
 
virtual bool HasPeakInspiratoryPressure () const
 
virtual SEScalarPressureGetPeakInspiratoryPressure ()
 
virtual double GetPeakInspiratoryPressure (const PressureUnit &unit) const
 
virtual bool HasLeftChamber () const
 
virtual SEAnesthesiaMachineChamberGetLeftChamber ()
 
virtual const SEAnesthesiaMachineChamberGetLeftChamber () const
 
virtual void RemoveLeftChamber ()
 
virtual bool HasRightChamber () const
 
virtual SEAnesthesiaMachineChamberGetRightChamber ()
 
virtual const SEAnesthesiaMachineChamberGetRightChamber () const
 
virtual void RemoveRightChamber ()
 
virtual bool HasOxygenBottleOne () const
 
virtual SEAnesthesiaMachineOxygenBottleGetOxygenBottleOne ()
 
virtual const SEAnesthesiaMachineOxygenBottleGetOxygenBottleOne () const
 
virtual void RemoveOxygenBottleOne ()
 
virtual bool HasOxygenBottleTwo () const
 
virtual SEAnesthesiaMachineOxygenBottleGetOxygenBottleTwo ()
 
virtual const SEAnesthesiaMachineOxygenBottleGetOxygenBottleTwo () const
 
virtual void RemoveOxygenBottleTwo ()
 
- Public Member Functions inherited from SEEquipment
 SEEquipment (Logger *logger)
 
virtual ~SEEquipment ()
 
- Public Member Functions inherited from SESystem
 SESystem (Logger *logger)
 
virtual ~SESystem ()
 
- Public Member Functions inherited from Loggable
 Loggable (Logger *logger=nullptr)
 
 Loggable (std::string const &logfile)
 
virtual ~Loggable ()
 
virtual LoggerGetLogger () const
 
virtual void SetLogger (Logger &logger)
 
virtual void Debug (std::string const &msg, std::string const &origin=empty) const
 
virtual void Debug (std::stringstream &msg, std::string const &origin=empty) const
 
virtual void Debug (std::ostream &msg, std::string const &origin=empty) const
 
virtual void Info (std::string const &msg, std::string const &origin=empty) const
 
virtual void Info (std::stringstream &msg, std::string const &origin=empty) const
 
virtual void Info (const std::stringstream &msg, std::string const &origin=empty) const
 
virtual void Info (std::ostream &msg, std::string const &origin=empty) const
 
virtual void Warning (std::string const &msg, std::string const &origin=empty) const
 
virtual void Warning (std::stringstream &msg, std::string const &origin=empty) const
 
virtual void Warning (std::ostream &msg, std::string const &origin=empty) const
 
virtual void Error (std::string const &msg, std::string const &origin=empty) const
 
virtual void Error (std::stringstream &msg, std::string const &origin=empty) const
 
virtual void Error (std::ostream &msg, std::string const &origin=empty) const
 
virtual void Fatal (std::string const &msg, std::string const &origin=empty) const
 
virtual void Fatal (std::stringstream &msg, std::string const &origin=empty) const
 
virtual void Fatal (std::ostream &msg, std::string const &origin=empty) const
 
std::string to_string (int i)
 
std::string to_string (unsigned int i)
 
std::string to_string (size_t t)
 
std::string to_string (float f)
 
std::string to_string (double d)
 

Protected Member Functions

 AnesthesiaMachine (PulseData &pc)
 
void ComputeExposedModelParameters () override
 
void CalculateScrubber ()
 Calculates the carbon dioxide removed by the scrubber. More...
 
virtual void SetConnection (eAnesthesiaMachine_Connection c)
 Connect to the patient via the ventilator mask, an endotracheal tube, or no connection. More...
 
virtual void InvalidateConnection ()
 Removes the connection to the patient. More...
 
void CalculateSourceStatus ()
 Checks the status of the oxygen source. More...
 
void CalculateEquipmentLeak ()
 Scales the resistance of anesthesia machine equipment in the presence of a leak. More...
 
void SetConnection ()
 Initializes gas volumes and volume fractions supplied by the anesthesia machine depending on the airway mode. More...
 
void CalculateValveResistances ()
 Valve resistance calculation. More...
 
void CalculateVentilatorPressure ()
 Calculates ventilator pressure. More...
 
void CalculateGasSourceSubstances ()
 Updates the volume fractions for the gas inlet node. More...
 
void CalculateGasSourceResistance ()
 Updates the circuit to supply gas at the flow setting. More...
 
void CalculateCyclePhase ()
 Calculates respiration cycle. More...
 
void CheckReliefValve ()
 Checks Relief Valve Pressure. More...
 
- Protected Member Functions inherited from SEAnesthesiaMachine
virtual void Merge (const SEAnesthesiaMachine &from, SESubstanceManager &subMgr)
 
virtual void ProcessConfiguration (SEAnesthesiaMachineConfiguration &config, SESubstanceManager &subMgr)
 

Protected Attributes

PulseDatam_data
 
bool m_inhaling
 
double m_inspirationTime_s
 
double m_O2InletVolumeFraction
 
double m_currentbreathingCycleTime_s
 
double m_totalBreathingCycleTime_s
 
double m_dt_s
 
double m_dValveOpenResistance_cmH2O_s_Per_L
 
double m_dValveClosedResistance_cmH2O_s_Per_L
 
double m_dSwitchOpenResistance_cmH2O_s_Per_L
 
double m_dSwitchClosedResistance_cmH2O_s_Per_L
 
SEEquipmentActionCollectionm_actions
 
SEGasCompartmentm_ambient
 
SEGasSubstanceQuantitym_ambientCO2
 
SEGasSubstanceQuantitym_ambientN2
 
SEGasSubstanceQuantitym_ambientO2
 
SEGasCompartmentm_gasSource
 
SEGasSubstanceQuantitym_gasSourceCO2
 
SEGasSubstanceQuantitym_gasSourceN2
 
SEGasSubstanceQuantitym_gasSourceO2
 
SEGasCompartmentm_scrubber
 
SEGasSubstanceQuantitym_scubberCO2
 
SEGasSubstanceQuantitym_scrubberN2
 
SEFluidCircuitNodem_nVentilator
 
SEFluidCircuitPathm_pAnesthesiaConnectionToEnvironment
 
SEFluidCircuitPathm_pYPieceToExpiratoryLimb
 
SEFluidCircuitPathm_pGasSourceToGasInlet
 
SEFluidCircuitPathm_pInspiratoryLimbToYPiece
 
SEFluidCircuitPathm_pSelectorToReliefValve
 
SEFluidCircuitPathm_pEnvironmentToReliefValve
 
SEFluidCircuitPathm_pEnvironmentToVentilator
 
SEFluidCircuitPathm_pExpiratoryLimbToSelector
 
SEFluidCircuitPathm_pSelectorToScrubber
 
SEFluidCircuitPathm_pEnvironmentToGasSource
 
SEFluidCircuitPathm_pVentilatorToSelector
 
- Protected Attributes inherited from SEAnesthesiaMachine
friend SEAnesthesiaMachineConfiguration
 
eAnesthesiaMachine_Connection m_Connection
 
SEScalarVolumePerTimem_InletFlow
 
SEScalarm_InspiratoryExpiratoryRatio
 
SEScalar0To1m_OxygenFraction
 
eAnesthesiaMachine_OxygenSource m_OxygenSource
 
SEScalarPressurem_PositiveEndExpiredPressure
 
eAnesthesiaMachine_PrimaryGas m_PrimaryGas
 
SEScalarFrequencym_RespiratoryRate
 
SEScalarPressurem_ReliefValvePressure
 
SEScalarPressurem_PeakInspiratoryPressure
 
SEAnesthesiaMachineChamberm_LeftChamber
 
SEAnesthesiaMachineChamberm_RightChamber
 
SEAnesthesiaMachineOxygenBottlem_OxygenBottleOne
 
SEAnesthesiaMachineOxygenBottlem_OxygenBottleTwo
 
- Protected Attributes inherited from SESystem
std::stringstream m_ss
 
- Protected Attributes inherited from Loggable
bool myLogger
 
Loggerm_Logger
 

Friends

class PulseData
 
class PBPulseEquipment
 
class PulseEngineTest
 

Additional Inherited Members

- Static Public Member Functions inherited from SESystem
static const SEScalarGetScalar (const std::string &name, std::vector< SESystem *> *systems)
 
- Static Public Attributes inherited from Loggable
static const std::string empty
 

Detailed Description

Generic anesthesia machine for positive pressure ventilation.

Constructor & Destructor Documentation

◆ AnesthesiaMachine()

AnesthesiaMachine::AnesthesiaMachine ( PulseData pc)
protected

◆ ~AnesthesiaMachine()

AnesthesiaMachine::~AnesthesiaMachine ( )
virtual

Member Function Documentation

◆ AtSteadyState()

void AnesthesiaMachine::AtSteadyState ( )
inlinevirtual

Notify systems that steady state has been achieved.

Implements PulseSystem.

◆ CalculateCyclePhase()

void AnesthesiaMachine::CalculateCyclePhase ( )
protected

Calculates respiration cycle.

The inspiratory and expiratory phase times are calculated based on a pre-set respiration rate and inspiration-expiration ratio parameters. These parameters are selected as input parameters for the anesthesia machine configurations.

◆ CalculateEquipmentLeak()

void AnesthesiaMachine::CalculateEquipmentLeak ( )
protected

Scales the resistance of anesthesia machine equipment in the presence of a leak.

The resistance of the mask, tube, and y piece are scaled based on the presence and severity of a leak. This will influence the circuit analyis and will effect the flow and gas mixture provided by the anesthesia machine. This occurs during preprocess.

◆ CalculateGasSourceResistance()

void AnesthesiaMachine::CalculateGasSourceResistance ( )
protected

Updates the circuit to supply gas at the flow setting.

Calculates a resistance to mimic the flow knob based on the constant, large pressure and flow setting.

◆ CalculateGasSourceSubstances()

void AnesthesiaMachine::CalculateGasSourceSubstances ( )
protected

Updates the volume fractions for the gas inlet node.

The final step of the anesthesia machine preprocess is to update the volume fractions for the gas inlet node. The gas mixture is determined based on the right and left chamber activity and specified substances and the oxygen percent setting on the anesthesia machine. The oxygen source (bottle and wall) are checked to ensure no equipment failures exist. The volume fractions are adjusted according to gas composition, the sources, and any failures present.

Todo:
: Do this stuff more generically by looping over all substances

◆ CalculateScrubber()

void AnesthesiaMachine::CalculateScrubber ( )
protected

Calculates the carbon dioxide removed by the scrubber.

Calculates the amount of carbon dioxide removed from the anesthesia machine by the scrubber. If a soda lime failure is present, the full amount of carbon dioxide is not removed. The amount removed is dependent on the severity of the failure. The substance volume in the scrubber node is decremented based on the amount of carbon dioxide removed. This function occurs during anesthesia machine preprocess.

◆ CalculateSourceStatus()

void AnesthesiaMachine::CalculateSourceStatus ( )
protected

Checks the status of the oxygen source.

Checks the status of the oxygen source. If an oxygen bottle is in use, ensures that the bottle still has oxygen. If the oxygen bottle no longer has oxygen, then an event is sent to the log notifying the user.

Event:
AnesthesiaMachine: Oxygen bottle 1 is exhausted. There is no longer any oxygen to provide via the anesthesia machine.
Event:
AnesthesiaMachine: Oxygen bottle 2 is exhausted. There is no longer any oxygen to provide via the anesthesia machine.

◆ CalculateValveResistances()

void AnesthesiaMachine::CalculateValveResistances ( )
protected

Valve resistance calculation.

The method checks for the breathing cycle and sets the inspiratory or expiratory valves as open or closed by adjusting the corresponding valve resistances. The method also changes valve resistances to simulate equipment failures that correspond to valve leak and obstructions

◆ CalculateVentilatorPressure()

void AnesthesiaMachine::CalculateVentilatorPressure ( )
protected

Calculates ventilator pressure.

The Anesthesia machine employs pressure-control ventilation mode. This method calculates the control ventilator pressure that drives the gas flow in the breathing circle. During inspiration, the ventilator pressure is set to pre-defined constant value to serve as an input pressure source. This causes gas to flow into the inspiratory limb path. The pressure is dropped to much low pressure during the expiration phase to allow gas return to the ventilator.

◆ CheckReliefValve()

void AnesthesiaMachine::CheckReliefValve ( )
protected

Checks Relief Valve Pressure.

Assigns relief valve pressure as a pressure source based on the pressure setting and checks if the status of the relief valve is open or closed.

Event:
AnesthesiaMachine: Relief Valve is active. The pressure setting has been exceeded.

◆ Clear()

void AnesthesiaMachine::Clear ( )
virtual

Reimplemented from SEAnesthesiaMachine.

◆ ComputeExposedModelParameters()

void AnesthesiaMachine::ComputeExposedModelParameters ( )
overrideprotectedvirtual

◆ Initialize()

void AnesthesiaMachine::Initialize ( )
virtual

Initializes system properties to valid homeostatic values.

Reimplemented from PulseSystem.

◆ InvalidateConnection()

void AnesthesiaMachine::InvalidateConnection ( )
protectedvirtual

Removes the connection to the patient.

If the mask is on or the tube is connected, it is removed and the airway mode is set to free. The action is then removed from the action manager.

◆ PostProcess()

void AnesthesiaMachine::PostProcess ( bool  solve_and_transport = true)
virtual

Anesthesia machine postprocess function.

The substance volumes and the volume fractions are updated for all of the nodes in the anesthesia machine circuit during post process. The ventilator volumes are updated based on the previously calculated nodal analysis.

Implements PulseSystem.

◆ PreProcess()

void AnesthesiaMachine::PreProcess ( )
virtual

Anesthesia machine preprocess function.

Checks the anesthesia machine settings to ensure all are within the acceptable ranges. Processes all equipment failures. Verifies the oxygen source. Processes any failures with the oxygen source. Calculates the gas inlet volume fractions based on equipment failures and gas sources.

Implements PulseSystem.

◆ Process()

void AnesthesiaMachine::Process ( bool  solve_and_transport = true)
virtual

Anesthesia machine process function.

The current Pulse implementation has no specific process functionality for the anesthesia machine. Anesthesia machine processing is currently done in the Respiratory System with the combined circuit methodology.

Implements PulseSystem.

◆ SetConnection() [1/2]

void AnesthesiaMachine::SetConnection ( eAnesthesiaMachine_Connection  c)
protectedvirtual

Connect to the patient via the ventilator mask, an endotracheal tube, or no connection.

Parameters
enumAnesthesiaMachineConnectionConnectoin type : Mask, tube, or off

If the enum is set to mask, then the mask is applied to the face If the enum is set to tube, then the machine is connected to the tube If the enum is set to off, the airway mode is set to free.

Reimplemented from SEAnesthesiaMachine.

◆ SetConnection() [2/2]

void AnesthesiaMachine::SetConnection ( )
protected

Initializes gas volumes and volume fractions supplied by the anesthesia machine depending on the airway mode.

The gas volumes and volume fractions are initialized and updated based on the airway mode (mask, free, or tube) and the volume associated with each airway mode.

◆ SetUp()

void AnesthesiaMachine::SetUp ( )
virtual

Initializes parameters for the anesthesia machine class.

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

Implements PulseSystem.

◆ StateChange()

void AnesthesiaMachine::StateChange ( )
virtual

Reimplemented from SEAnesthesiaMachine.

Friends And Related Function Documentation

◆ PBPulseEquipment

friend class PBPulseEquipment
friend

◆ PulseData

friend class PulseData
friend

◆ PulseEngineTest

friend class PulseEngineTest
friend

Member Data Documentation

◆ m_actions

SEEquipmentActionCollection* AnesthesiaMachine::m_actions
protected

◆ m_ambient

SEGasCompartment* AnesthesiaMachine::m_ambient
protected

◆ m_ambientCO2

SEGasSubstanceQuantity* AnesthesiaMachine::m_ambientCO2
protected

◆ m_ambientN2

SEGasSubstanceQuantity* AnesthesiaMachine::m_ambientN2
protected

◆ m_ambientO2

SEGasSubstanceQuantity* AnesthesiaMachine::m_ambientO2
protected

◆ m_currentbreathingCycleTime_s

double AnesthesiaMachine::m_currentbreathingCycleTime_s
protected

◆ m_data

PulseData& AnesthesiaMachine::m_data
protected

◆ m_dSwitchClosedResistance_cmH2O_s_Per_L

double AnesthesiaMachine::m_dSwitchClosedResistance_cmH2O_s_Per_L
protected

◆ m_dSwitchOpenResistance_cmH2O_s_Per_L

double AnesthesiaMachine::m_dSwitchOpenResistance_cmH2O_s_Per_L
protected

◆ m_dt_s

double AnesthesiaMachine::m_dt_s
protected

◆ m_dValveClosedResistance_cmH2O_s_Per_L

double AnesthesiaMachine::m_dValveClosedResistance_cmH2O_s_Per_L
protected

◆ m_dValveOpenResistance_cmH2O_s_Per_L

double AnesthesiaMachine::m_dValveOpenResistance_cmH2O_s_Per_L
protected

◆ m_gasSource

SEGasCompartment* AnesthesiaMachine::m_gasSource
protected

◆ m_gasSourceCO2

SEGasSubstanceQuantity* AnesthesiaMachine::m_gasSourceCO2
protected

◆ m_gasSourceN2

SEGasSubstanceQuantity* AnesthesiaMachine::m_gasSourceN2
protected

◆ m_gasSourceO2

SEGasSubstanceQuantity* AnesthesiaMachine::m_gasSourceO2
protected

◆ m_inhaling

bool AnesthesiaMachine::m_inhaling
protected

◆ m_inspirationTime_s

double AnesthesiaMachine::m_inspirationTime_s
protected

◆ m_nVentilator

SEFluidCircuitNode* AnesthesiaMachine::m_nVentilator
protected

◆ m_O2InletVolumeFraction

double AnesthesiaMachine::m_O2InletVolumeFraction
protected

◆ m_pAnesthesiaConnectionToEnvironment

SEFluidCircuitPath* AnesthesiaMachine::m_pAnesthesiaConnectionToEnvironment
protected

◆ m_pEnvironmentToGasSource

SEFluidCircuitPath* AnesthesiaMachine::m_pEnvironmentToGasSource
protected

◆ m_pEnvironmentToReliefValve

SEFluidCircuitPath* AnesthesiaMachine::m_pEnvironmentToReliefValve
protected

◆ m_pEnvironmentToVentilator

SEFluidCircuitPath* AnesthesiaMachine::m_pEnvironmentToVentilator
protected

◆ m_pExpiratoryLimbToSelector

SEFluidCircuitPath* AnesthesiaMachine::m_pExpiratoryLimbToSelector
protected

◆ m_pGasSourceToGasInlet

SEFluidCircuitPath* AnesthesiaMachine::m_pGasSourceToGasInlet
protected

◆ m_pInspiratoryLimbToYPiece

SEFluidCircuitPath* AnesthesiaMachine::m_pInspiratoryLimbToYPiece
protected

◆ m_pSelectorToReliefValve

SEFluidCircuitPath* AnesthesiaMachine::m_pSelectorToReliefValve
protected

◆ m_pSelectorToScrubber

SEFluidCircuitPath* AnesthesiaMachine::m_pSelectorToScrubber
protected

◆ m_pVentilatorToSelector

SEFluidCircuitPath* AnesthesiaMachine::m_pVentilatorToSelector
protected

◆ m_pYPieceToExpiratoryLimb

SEFluidCircuitPath* AnesthesiaMachine::m_pYPieceToExpiratoryLimb
protected

◆ m_scrubber

SEGasCompartment* AnesthesiaMachine::m_scrubber
protected

◆ m_scrubberN2

SEGasSubstanceQuantity* AnesthesiaMachine::m_scrubberN2
protected

◆ m_scubberCO2

SEGasSubstanceQuantity* AnesthesiaMachine::m_scubberCO2
protected

◆ m_totalBreathingCycleTime_s

double AnesthesiaMachine::m_totalBreathingCycleTime_s
protected

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.