projects/biogears/src/engine/Systems/BloodChemistry.cpp
void BloodChemistry::SetUp()
{
  const BioGearsConfiguration& ConfigData = m_data.GetConfiguration();
  m_redBloodCellVolume_mL = ConfigData.GetMeanCorpuscularVolume(VolumeUnit::mL);
  m_HbPerRedBloodCell_ug_Per_ct = ConfigData.GetMeanCorpuscularHemoglobin(MassPerAmountUnit::ug_Per_ct);

  //Substance
  SESubstance* albumin = &m_data.GetSubstances().GetAlbumin();
  SESubstance* aminoAcids = &m_data.GetSubstances().GetAminoAcids();
  SESubstance* bicarbonate = &m_data.GetSubstances().GetBicarbonate();
  SESubstance* calcium = &m_data.GetSubstances().GetCalcium();
  SESubstance* chloride = &m_data.GetSubstances().GetChloride();
  SESubstance* creatinine = &m_data.GetSubstances().GetCreatinine();
  SESubstance* epinephrine = &m_data.GetSubstances().GetEpi();
  SESubstance* glucagon = &m_data.GetSubstances().GetGlucagon();
  SESubstance* glucose = &m_data.GetSubstances().GetGlucose();
  SESubstance* insulin = &m_data.GetSubstances().GetInsulin();
  SESubstance* ketones = &m_data.GetSubstances().GetKetones();
  SESubstance* lactate = &m_data.GetSubstances().GetLactate();
  SESubstance* potassium = &m_data.GetSubstances().GetPotassium();
  SESubstance* sodium = &m_data.GetSubstances().GetSodium();
  SESubstance* triaclyglycerol = &m_data.GetSubstances().GetTriacylglycerol();
  SESubstance* urea = &m_data.GetSubstances().GetUrea();

  m_aorta = m_data.GetCompartments().GetLiquidCompartment(BGE::VascularCompartment::Aorta);
  m_aortaO2 = m_aorta->GetSubstanceQuantity(m_data.GetSubstances().GetO2());
  m_aortaCO2 = m_aorta->GetSubstanceQuantity(m_data.GetSubstances().GetCO2());
  m_aortaBicarbonate = m_aorta->GetSubstanceQuantity(m_data.GetSubstances().GetHCO3());

  m_brainO2 = m_data.GetCompartments().GetLiquidCompartment(BGE::VascularCompartment::Brain)->GetSubstanceQuantity(m_data.GetSubstances().GetO2());
  m_myocardiumO2 = m_data.GetCompartments().GetLiquidCompartment(BGE::VascularCompartment::Myocardium)->GetSubstanceQuantity(m_data.GetSubstances().GetO2());

  m_venaCava = m_data.GetCompartments().GetLiquidCompartment(BGE::VascularCompartment::VenaCava);
  m_venaCavaO2 = m_venaCava->GetSubstanceQuantity(m_data.GetSubstances().GetO2());
  m_venaCavaCO2 = m_venaCava->GetSubstanceQuantity(m_data.GetSubstances().GetCO2());
  m_venaCavaAlbumin = m_venaCava->GetSubstanceQuantity(*albumin);
  m_venaCavaAminoAcids = m_venaCava->GetSubstanceQuantity(*aminoAcids);
  m_venaCavaBicarbonate = m_venaCava->GetSubstanceQuantity(*bicarbonate);
  m_venaCavaCalcium = m_venaCava->GetSubstanceQuantity(*calcium);
  m_venaCavaChloride = m_venaCava->GetSubstanceQuantity(*chloride);
  m_venaCavaCreatinine = m_venaCava->GetSubstanceQuantity(*creatinine);
  m_venaCavaEpinephrine = m_venaCava->GetSubstanceQuantity(*epinephrine);
  m_venaCavaGlucagon = m_venaCava->GetSubstanceQuantity(*glucagon);
  m_venaCavaGlucose = m_venaCava->GetSubstanceQuantity(*glucose);
  m_venaCavaInsulin = m_venaCava->GetSubstanceQuantity(*insulin);
  m_venaCavaKetones = m_venaCava->GetSubstanceQuantity(*ketones);
  m_venaCavaLactate = m_venaCava->GetSubstanceQuantity(*lactate);
  m_venaCavaPotassium = m_venaCava->GetSubstanceQuantity(*potassium);
  m_venaCavaSodium = m_venaCava->GetSubstanceQuantity(*sodium);
  m_venaCavaTriacylglycerol = m_venaCava->GetSubstanceQuantity(*triaclyglycerol);
  m_venaCavaUrea = m_venaCava->GetSubstanceQuantity(*urea);

  SELiquidCompartment* pulmonaryArteries = m_data.GetCompartments().GetLiquidCompartment(BGE::VascularCompartment::PulmonaryArteries);
  m_pulmonaryArteriesO2 = pulmonaryArteries->GetSubstanceQuantity(m_data.GetSubstances().GetO2());
  m_pulmonaryArteriesCO2 = pulmonaryArteries->GetSubstanceQuantity(m_data.GetSubstances().GetCO2());

  SELiquidCompartment* pulmonaryVeins = m_data.GetCompartments().GetLiquidCompartment(BGE::VascularCompartment::PulmonaryVeins);
  m_pulmonaryVeinsO2 = pulmonaryVeins->GetSubstanceQuantity(m_data.GetSubstances().GetO2());
  m_pulmonaryVeinsCO2 = pulmonaryVeins->GetSubstanceQuantity(m_data.GetSubstances().GetCO2());

  double dT_s = m_data.GetTimeStep().GetValue(TimeUnit::s);
  m_PatientActions = &m_data.GetActions().GetPatientActions();
}
//--------------------------------------------------------------------------------------------------
/// \brief
/// Initializes parameters for BloodChemistry Class
///
///  \details
///  Initializes member variables and system level values on the common data model.
//--------------------------------------------------------------------------------------------------
\brief
Initializes parameters for BloodChemistry Class

\details
Initializes member variables and system level values on the common data model.
\ brief Initializes parameters for BloodChemistry Class \ details Initializes member variables and system level values on the common data model .
void BloodChemistry::SetUp()
{
  const BioGearsConfiguration& ConfigData = m_data.GetConfiguration();
  m_redBloodCellVolume_mL = ConfigData.GetMeanCorpuscularVolume(VolumeUnit::mL);
  m_HbPerRedBloodCell_ug_Per_ct = ConfigData.GetMeanCorpuscularHemoglobin(MassPerAmountUnit::ug_Per_ct);
  SESubstance* albumin = &m_data.GetSubstances().GetAlbumin();
  SESubstance* aminoAcids = &m_data.GetSubstances().GetAminoAcids();
  SESubstance* bicarbonate = &m_data.GetSubstances().GetBicarbonate();
  SESubstance* calcium = &m_data.GetSubstances().GetCalcium();
  SESubstance* chloride = &m_data.GetSubstances().GetChloride();
  SESubstance* creatinine = &m_data.GetSubstances().GetCreatinine();
  SESubstance* epinephrine = &m_data.GetSubstances().GetEpi();
  SESubstance* glucagon = &m_data.GetSubstances().GetGlucagon();
  SESubstance* glucose = &m_data.GetSubstances().GetGlucose();
  SESubstance* insulin = &m_data.GetSubstances().GetInsulin();
  SESubstance* ketones = &m_data.GetSubstances().GetKetones();
  SESubstance* lactate = &m_data.GetSubstances().GetLactate();
  SESubstance* potassium = &m_data.GetSubstances().GetPotassium();
  SESubstance* sodium = &m_data.GetSubstances().GetSodium();
  SESubstance* triaclyglycerol = &m_data.GetSubstances().GetTriacylglycerol();
  SESubstance* urea = &m_data.GetSubstances().GetUrea();
  m_aorta = m_data.GetCompartments().GetLiquidCompartment(BGE::VascularCompartment::Aorta);
  m_aortaO2 = m_aorta->GetSubstanceQuantity(m_data.GetSubstances().GetO2());
  m_aortaCO2 = m_aorta->GetSubstanceQuantity(m_data.GetSubstances().GetCO2());
  m_aortaBicarbonate = m_aorta->GetSubstanceQuantity(m_data.GetSubstances().GetHCO3());
  m_brainO2 = m_data.GetCompartments().GetLiquidCompartment(BGE::VascularCompartment::Brain)->GetSubstanceQuantity(m_data.GetSubstances().GetO2());
  m_myocardiumO2 = m_data.GetCompartments().GetLiquidCompartment(BGE::VascularCompartment::Myocardium)->GetSubstanceQuantity(m_data.GetSubstances().GetO2());
  m_venaCava = m_data.GetCompartments().GetLiquidCompartment(BGE::VascularCompartment::VenaCava);
  m_venaCavaO2 = m_venaCava->GetSubstanceQuantity(m_data.GetSubstances().GetO2());
  m_venaCavaCO2 = m_venaCava->GetSubstanceQuantity(m_data.GetSubstances().GetCO2());
  m_venaCavaAlbumin = m_venaCava->GetSubstanceQuantity(*albumin);
  m_venaCavaAminoAcids = m_venaCava->GetSubstanceQuantity(*aminoAcids);
  m_venaCavaBicarbonate = m_venaCava->GetSubstanceQuantity(*bicarbonate);
  m_venaCavaCalcium = m_venaCava->GetSubstanceQuantity(*calcium);
  m_venaCavaChloride = m_venaCava->GetSubstanceQuantity(*chloride);
  m_venaCavaCreatinine = m_venaCava->GetSubstanceQuantity(*creatinine);
  m_venaCavaEpinephrine = m_venaCava->GetSubstanceQuantity(*epinephrine);
  m_venaCavaGlucagon = m_venaCava->GetSubstanceQuantity(*glucagon);
  m_venaCavaGlucose = m_venaCava->GetSubstanceQuantity(*glucose);
  m_venaCavaInsulin = m_venaCava->GetSubstanceQuantity(*insulin);
  m_venaCavaKetones = m_venaCava->GetSubstanceQuantity(*ketones);
  m_venaCavaLactate = m_venaCava->GetSubstanceQuantity(*lactate);
  m_venaCavaPotassium = m_venaCava->GetSubstanceQuantity(*potassium);
  m_venaCavaSodium = m_venaCava->GetSubstanceQuantity(*sodium);
  m_venaCavaTriacylglycerol = m_venaCava->GetSubstanceQuantity(*triaclyglycerol);
  m_venaCavaUrea = m_venaCava->GetSubstanceQuantity(*urea);
  SELiquidCompartment* pulmonaryArteries = m_data.GetCompartments().GetLiquidCompartment(BGE::VascularCompartment::PulmonaryArteries);
  m_pulmonaryArteriesO2 = pulmonaryArteries->GetSubstanceQuantity(m_data.GetSubstances().GetO2());
  m_pulmonaryArteriesCO2 = pulmonaryArteries->GetSubstanceQuantity(m_data.GetSubstances().GetCO2());
  SELiquidCompartment* pulmonaryVeins = m_data.GetCompartments().GetLiquidCompartment(BGE::VascularCompartment::PulmonaryVeins);
  m_pulmonaryVeinsO2 = pulmonaryVeins->GetSubstanceQuantity(m_data.GetSubstances().GetO2());
  m_pulmonaryVeinsCO2 = pulmonaryVeins->GetSubstanceQuantity(m_data.GetSubstances().GetCO2());
  double dT_s = m_data.GetTimeStep().GetValue(TimeUnit::s);
  m_PatientActions = &m_data.GetActions().GetPatientActions();
}
void BloodChemistry :: SetUp ( ) { const BioGearsConfiguration & ConfigData = m_data . GetConfiguration ( ) ; m_redBloodCellVolume_mL = ConfigData . GetMeanCorpuscularVolume ( VolumeUnit :: mL ) ; m_HbPerRedBloodCell_ug_Per_ct = ConfigData . GetMeanCorpuscularHemoglobin ( MassPerAmountUnit :: ug_Per_ct ) ; SESubstance * albumin = & m_data . GetSubstances ( ) . GetAlbumin ( ) ; SESubstance * aminoAcids = & m_data . GetSubstances ( ) . GetAminoAcids ( ) ; SESubstance * bicarbonate = & m_data . GetSubstances ( ) . GetBicarbonate ( ) ; SESubstance * calcium = & m_data . GetSubstances ( ) . GetCalcium ( ) ; SESubstance * chloride = & m_data . GetSubstances ( ) . GetChloride ( ) ; SESubstance * creatinine = & m_data . GetSubstances ( ) . GetCreatinine ( ) ; SESubstance * epinephrine = & m_data . GetSubstances ( ) . GetEpi ( ) ; SESubstance * glucagon = & m_data . GetSubstances ( ) . GetGlucagon ( ) ; SESubstance * glucose = & m_data . GetSubstances ( ) . GetGlucose ( ) ; SESubstance * insulin = & m_data . GetSubstances ( ) . GetInsulin ( ) ; SESubstance * ketones = & m_data . GetSubstances ( ) . GetKetones ( ) ; SESubstance * lactate = & m_data . GetSubstances ( ) . GetLactate ( ) ; SESubstance * potassium = & m_data . GetSubstances ( ) . GetPotassium ( ) ; SESubstance * sodium = & m_data . GetSubstances ( ) . GetSodium ( ) ; SESubstance * triaclyglycerol = & m_data . GetSubstances ( ) . GetTriacylglycerol ( ) ; SESubstance * urea = & m_data . GetSubstances ( ) . GetUrea ( ) ; m_aorta = m_data . GetCompartments ( ) . GetLiquidCompartment ( BGE :: VascularCompartment :: Aorta ) ; m_aortaO2 = m_aorta -> GetSubstanceQuantity ( m_data . GetSubstances ( ) . GetO2 ( ) ) ; m_aortaCO2 = m_aorta -> GetSubstanceQuantity ( m_data . GetSubstances ( ) . GetCO2 ( ) ) ; m_aortaBicarbonate = m_aorta -> GetSubstanceQuantity ( m_data . GetSubstances ( ) . GetHCO3 ( ) ) ; m_brainO2 = m_data . GetCompartments ( ) . GetLiquidCompartment ( BGE :: VascularCompartment :: Brain ) -> GetSubstanceQuantity ( m_data . GetSubstances ( ) . GetO2 ( ) ) ; m_myocardiumO2 = m_data . GetCompartments ( ) . GetLiquidCompartment ( BGE :: VascularCompartment :: Myocardium ) -> GetSubstanceQuantity ( m_data . GetSubstances ( ) . GetO2 ( ) ) ; m_venaCava = m_data . GetCompartments ( ) . GetLiquidCompartment ( BGE :: VascularCompartment :: VenaCava ) ; m_venaCavaO2 = m_venaCava -> GetSubstanceQuantity ( m_data . GetSubstances ( ) . GetO2 ( ) ) ; m_venaCavaCO2 = m_venaCava -> GetSubstanceQuantity ( m_data . GetSubstances ( ) . GetCO2 ( ) ) ; m_venaCavaAlbumin = m_venaCava -> GetSubstanceQuantity ( * albumin ) ; m_venaCavaAminoAcids = m_venaCava -> GetSubstanceQuantity ( * aminoAcids ) ; m_venaCavaBicarbonate = m_venaCava -> GetSubstanceQuantity ( * bicarbonate ) ; m_venaCavaCalcium = m_venaCava -> GetSubstanceQuantity ( * calcium ) ; m_venaCavaChloride = m_venaCava -> GetSubstanceQuantity ( * chloride ) ; m_venaCavaCreatinine = m_venaCava -> GetSubstanceQuantity ( * creatinine ) ; m_venaCavaEpinephrine = m_venaCava -> GetSubstanceQuantity ( * epinephrine ) ; m_venaCavaGlucagon = m_venaCava -> GetSubstanceQuantity ( * glucagon ) ; m_venaCavaGlucose = m_venaCava -> GetSubstanceQuantity ( * glucose ) ; m_venaCavaInsulin = m_venaCava -> GetSubstanceQuantity ( * insulin ) ; m_venaCavaKetones = m_venaCava -> GetSubstanceQuantity ( * ketones ) ; m_venaCavaLactate = m_venaCava -> GetSubstanceQuantity ( * lactate ) ; m_venaCavaPotassium = m_venaCava -> GetSubstanceQuantity ( * potassium ) ; m_venaCavaSodium = m_venaCava -> GetSubstanceQuantity ( * sodium ) ; m_venaCavaTriacylglycerol = m_venaCava -> GetSubstanceQuantity ( * triaclyglycerol ) ; m_venaCavaUrea = m_venaCava -> GetSubstanceQuantity ( * urea ) ; SELiquidCompartment * pulmonaryArteries = m_data . GetCompartments ( ) . GetLiquidCompartment ( BGE :: VascularCompartment :: PulmonaryArteries ) ; m_pulmonaryArteriesO2 = pulmonaryArteries -> GetSubstanceQuantity ( m_data . GetSubstances ( ) . GetO2 ( ) ) ; m_pulmonaryArteriesCO2 = pulmonaryArteries -> GetSubstanceQuantity ( m_data . GetSubstances ( ) . GetCO2 ( ) ) ; SELiquidCompartment * pulmonaryVeins = m_data . GetCompartments ( ) . GetLiquidCompartment ( BGE :: VascularCompartment :: PulmonaryVeins ) ; m_pulmonaryVeinsO2 = pulmonaryVeins -> GetSubstanceQuantity ( m_data . GetSubstances ( ) . GetO2 ( ) ) ; m_pulmonaryVeinsCO2 = pulmonaryVeins -> GetSubstanceQuantity ( m_data . GetSubstances ( ) . GetCO2 ( ) ) ; double dT_s = m_data . GetTimeStep ( ) . GetValue ( TimeUnit :: s ) ; m_PatientActions = & m_data . GetActions ( ) . GetPatientActions ( ) ; }
\brief
Initializes parameters for BloodChemistry Class
\ brief Initializes parameters for BloodChemistry Class
//Substance