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

#include <AnesthesiaMachine.h>

Inherits SEAnesthesiaMachine, PulseAnesthesiaMachine, and PulseSystem.

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 PreProcess ()
 Anesthesia machine preprocess function. More...
void Process ()
 Anesthesia machine process function. More...
void PostProcess ()
 Anesthesia machine postprocess function. More...
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 CalculateVentilator ()
 Calculates ventilator pressure. More...
void CalculateGasSource ()
 Updates the volume fractions for the gas inlet node. More...
void CalculateCyclePhase ()
 Calculates respiration cycle. More...
void CheckReliefValve ()
 Checks Relief Valve Pressure. More...
- Public Member Functions inherited from SEAnesthesiaMachine
 SEAnesthesiaMachine (SESubstanceManager &substances)
virtual ~SEAnesthesiaMachine ()
bool SerializeToString (std::string &output, SerializationFormat m) const
bool SerializeToFile (const std::string &filename, SerializationFormat m) const
bool SerializeFromString (const std::string &src, SerializationFormat m)
bool SerializeFromFile (const std::string &filename, SerializationFormat m)
virtual void ForwardEvents (SEEventHandler *handler)
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 HasVentilatorPressure () const
virtual SEScalarPressureGetVentilatorPressure ()
virtual double GetVentilatorPressure (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 ()
virtual const SEScalarGetScalar (const std::string &name)
virtual const std::map< eAnesthesiaMachine_Event, bool > & GetEventStates () const
virtual void SetEvent (eAnesthesiaMachine_Event state, bool active, const SEScalarTime &time)
virtual bool IsEventActive (eAnesthesiaMachine_Event state) const
virtual double GetEventDuration (eAnesthesiaMachine_Event type, const TimeUnit &unit) const
virtual void UpdateEvents (const SEScalarTime &timeStep)
- Public Member Functions inherited from SESystem
 SESystem (Logger *logger)
virtual ~SESystem ()
- Public Member Functions inherited from Loggable
 Loggable ()
 Loggable (Logger *log)
virtual ~Loggable ()
virtual LoggerGetLogger () const
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

Public Attributes

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

Protected Member Functions

 AnesthesiaMachine (PulseController &pc)
- Protected Member Functions inherited from SEAnesthesiaMachine
virtual void Merge (const SEAnesthesiaMachine &from)
virtual void ProcessConfiguration (const SEAnesthesiaMachineConfiguration &config)
- Protected Member Functions inherited from PulseSystem
virtual void AtSteadyState ()
 Notify systems that steady state has been achieved. More...

Protected Attributes

- Protected Attributes inherited from SEAnesthesiaMachine
friend SEAnesthesiaMachineConfiguration
std::map< eAnesthesiaMachine_Event, bool > m_EventState
std::map< eAnesthesiaMachine_Event, double > m_EventDuration_s
eAnesthesiaMachine_Connection m_Connection
eAnesthesiaMachine_OxygenSource m_OxygenSource
eAnesthesiaMachine_PrimaryGas m_PrimaryGas
- Protected Attributes inherited from SESystem
std::stringstream m_ss
- Protected Attributes inherited from Loggable


class PBPulseEquipment
class PulseController
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 ( PulseController pc)

◆ ~AnesthesiaMachine()

AnesthesiaMachine::~AnesthesiaMachine ( )

Member Function Documentation

◆ CalculateCyclePhase()

void AnesthesiaMachine::CalculateCyclePhase ( )

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 ( )

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.

Error: Invalid Airway Mode Encountered in Compute Equipment Leak function

◆ CalculateGasSource()

void AnesthesiaMachine::CalculateGasSource ( )

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.

: Do this stuff more generically by looping over all substances

◆ CalculateScrubber()

void AnesthesiaMachine::CalculateScrubber ( )

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 ( )

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.

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

◆ CalculateValveResistances()

void AnesthesiaMachine::CalculateValveResistances ( )

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

◆ CalculateVentilator()

void AnesthesiaMachine::CalculateVentilator ( )

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 ( )

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.

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

◆ Clear()

void AnesthesiaMachine::Clear ( )

Reimplemented from SEAnesthesiaMachine.

◆ Initialize()

void AnesthesiaMachine::Initialize ( )

Initializes system properties to valid homeostatic values.

Reimplemented from PulseSystem.

◆ InvalidateConnection()

void AnesthesiaMachine::InvalidateConnection ( )

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 ( )

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 ( )

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 ( )

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)

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

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 ( )

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 ( )

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 ( )

Reimplemented from SEAnesthesiaMachine.

Friends And Related Function Documentation

◆ PBPulseEquipment

friend class PBPulseEquipment

◆ PulseController

friend class PulseController

◆ PulseEngineTest

friend class PulseEngineTest

Member Data Documentation

◆ m_actions

SEAnesthesiaMachineActionCollection* AnesthesiaMachine::m_actions

◆ m_ambient

SEGasCompartment* AnesthesiaMachine::m_ambient

◆ m_ambientCO2

SEGasSubstanceQuantity* AnesthesiaMachine::m_ambientCO2

◆ m_ambientN2

SEGasSubstanceQuantity* AnesthesiaMachine::m_ambientN2

◆ m_ambientO2

SEGasSubstanceQuantity* AnesthesiaMachine::m_ambientO2

◆ m_currentbreathingCycleTime_s

double AnesthesiaMachine::m_currentbreathingCycleTime_s

◆ m_data

PulseController& AnesthesiaMachine::m_data

◆ m_dSwitchClosedResistance_cmH2O_s_Per_L

double AnesthesiaMachine::m_dSwitchClosedResistance_cmH2O_s_Per_L

◆ m_dSwitchOpenResistance_cmH2O_s_Per_L

double AnesthesiaMachine::m_dSwitchOpenResistance_cmH2O_s_Per_L

◆ m_dt_s

double AnesthesiaMachine::m_dt_s

◆ m_dValveClosedResistance_cmH2O_s_Per_L

double AnesthesiaMachine::m_dValveClosedResistance_cmH2O_s_Per_L

◆ m_dValveOpenResistance_cmH2O_s_Per_L

double AnesthesiaMachine::m_dValveOpenResistance_cmH2O_s_Per_L

◆ m_gasSource

SEGasCompartment* AnesthesiaMachine::m_gasSource

◆ m_gasSourceCO2

SEGasSubstanceQuantity* AnesthesiaMachine::m_gasSourceCO2

◆ m_gasSourceN2

SEGasSubstanceQuantity* AnesthesiaMachine::m_gasSourceN2

◆ m_gasSourceO2

SEGasSubstanceQuantity* AnesthesiaMachine::m_gasSourceO2

◆ m_inhaling

bool AnesthesiaMachine::m_inhaling

◆ m_inspirationTime_s

double AnesthesiaMachine::m_inspirationTime_s

◆ m_nVentilator

SEFluidCircuitNode* AnesthesiaMachine::m_nVentilator

◆ m_O2InletVolumeFraction

double AnesthesiaMachine::m_O2InletVolumeFraction

◆ m_pAnesthesiaConnectionToEnvironment

SEFluidCircuitPath* AnesthesiaMachine::m_pAnesthesiaConnectionToEnvironment

◆ m_pEnvironmentToReliefValve

SEFluidCircuitPath* AnesthesiaMachine::m_pEnvironmentToReliefValve

◆ m_pEnvironmentToVentilator

SEFluidCircuitPath* AnesthesiaMachine::m_pEnvironmentToVentilator

◆ m_pExpiratoryLimbToSelector

SEFluidCircuitPath* AnesthesiaMachine::m_pExpiratoryLimbToSelector

◆ m_pGasSourceToGasInlet

SEFluidCircuitPath* AnesthesiaMachine::m_pGasSourceToGasInlet

◆ m_pInspiratoryLimbToYPiece

SEFluidCircuitPath* AnesthesiaMachine::m_pInspiratoryLimbToYPiece

◆ m_pSelectorToEnvironment

SEFluidCircuitPath* AnesthesiaMachine::m_pSelectorToEnvironment

◆ m_pSelectorToReliefValve

SEFluidCircuitPath* AnesthesiaMachine::m_pSelectorToReliefValve

◆ m_pSelectorToScrubber

SEFluidCircuitPath* AnesthesiaMachine::m_pSelectorToScrubber

◆ m_pYPieceToExpiratoryLimb

SEFluidCircuitPath* AnesthesiaMachine::m_pYPieceToExpiratoryLimb

◆ m_scrubber

SEGasCompartment* AnesthesiaMachine::m_scrubber

◆ m_scrubberN2

SEGasSubstanceQuantity* AnesthesiaMachine::m_scrubberN2

◆ m_scubberCO2

SEGasSubstanceQuantity* AnesthesiaMachine::m_scubberCO2

◆ m_totalBreathingCycleTime_s

double AnesthesiaMachine::m_totalBreathingCycleTime_s