1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
4 #pragma once
5 struct error_functor;
6 class SESubstance;
15 class PULSE_DECL SaturationCalculator : public Loggable
16 {
17 protected:
18  friend error_functor;
20  friend class PulseEngineTest;
24 public:
25  virtual ~SaturationCalculator();
27  void Initialize(SESubstanceManager& substances);
29  void SetBodyState(const SEScalarMassPerVolume& AlbuminConcentration, const SEScalar0To1& Hematocrit, const SEScalarTemperature& Temperature, const SEScalarAmountPerVolume& StrongIonDifference, const SEScalarAmountPerVolume& Phosphate);
30  void CalculateBloodGasDistribution(SELiquidCompartment& cmpt);
31  void CalculateCarbonMonoxideSpeciesDistribution(SELiquidCompartment& cmpt);
33 protected:// Stewart Model + Dash-Bassingthwaighte Model + Henderson-Hasselbach Model
34  void CalculateHemoglobinSaturations(double O2PartialPressureGuess_mmHg, double CO2PartialPressureGuess_mmHg, double pH, double temperature_C, double hematocrit, double& OxygenSaturation, double& CarbonDioxideSaturation, double CO2_scaling_factor);
35  bool DistributeHemoglobinBySaturation();
37  // All properties are stateless and are set by either the Initialize method or SetBodyState method
47  // Used for conversions
55  // This is the current compartment and the quantities we are balancing
66  // The current state of the body to balance to
68  double m_hematocrit;
70  // Here is the stuff that will need to go into the CDM
71  double m_StrongIonDifference_mmol_Per_L; // BloodChemistrySystemData mmol/L
72  double m_Phosphate_mmol_Per_L; //BloodChemistryData mmol/L
73 };
Definition: SESubstanceManager.h:8
SELiquidSubstanceQuantity * m_subCO2Q
Definition: Saturation.h:58
double m_hematocrit
Definition: Saturation.h:68
SELiquidSubstanceQuantity * m_subHbCOQ
Definition: Saturation.h:60
SESubstance * m_HbCO2
Definition: Saturation.h:46
Definition: SEScalarMassPerVolume.h:32
Manages and controls execution of all data/systems in Pulse.
Definition: Controller.h:50
SESubstance * m_HCO3
Definition: Saturation.h:45
SESubstance * m_HbO2
Definition: Saturation.h:40
friend error_functor
Definition: Saturation.h:18
SESubstance * m_O2
Definition: Saturation.h:38
PulseController & m_data
Definition: Saturation.h:23
Definition: SELiquidSubstanceQuantity.h:11
SELiquidSubstanceQuantity * m_subO2Q
Definition: Saturation.h:57
SELiquidSubstanceQuantity * m_subHbO2Q
Definition: Saturation.h:63
Definition: Logger.h:11
SELiquidSubstanceQuantity * m_subHbCO2Q
Definition: Saturation.h:64
Definition: SEScalarTemperature.h:22
Definition: SELiquidCompartment.h:10
double m_albumin_g_per_L
Definition: Saturation.h:67
The SaturationCalculator class holds the blood gas distribution model.
Definition: Saturation.h:15
SELiquidCompartment * m_cmpt
Definition: Saturation.h:56
SELiquidSubstanceQuantity * m_subHbO2CO2Q
Definition: Saturation.h:65
SESubstance * m_CO
Definition: Saturation.h:43
SESubstance * m_CO2
Definition: Saturation.h:42
double m_HbO2_g_Per_mol
Definition: Saturation.h:52
double m_O2_g_Per_mol
Definition: Saturation.h:48
double m_HbO2CO2_g_Per_mol
Definition: Saturation.h:54
double m_Hb_g_Per_mol
Definition: Saturation.h:51
Definition: SEScalarAmountPerVolume.h:24
double m_HbCO2_g_Per_mol
Definition: Saturation.h:53
friend PulseController
Definition: Saturation.h:19
double m_Phosphate_mmol_Per_L
Definition: Saturation.h:72
SELiquidSubstanceQuantity * m_subHCO3Q
Definition: Saturation.h:61
Definition: Saturation.cpp:46
SESubstance * m_HbO2CO2
Definition: Saturation.h:41
SESubstance * m_HbCO
Definition: Saturation.h:44
SELiquidSubstanceQuantity * m_subCOQ
Definition: Saturation.h:59
double m_StrongIonDifference_mmol_Per_L
Definition: Saturation.h:71
double m_temperature_C
Definition: Saturation.h:69
Definition: SESubstance.h:14
SESubstance * m_Hb
Definition: Saturation.h:39
double m_HCO3_g_Per_mol
Definition: Saturation.h:50
SELiquidSubstanceQuantity * m_subHbQ
Definition: Saturation.h:62
Definition: SEScalar0To1.h:7
double m_CO2_g_Per_mol
Definition: Saturation.h:49