Commit 161051dd authored by Aaron Bray's avatar Aaron Bray
Browse files

Fix several issues in setting up action data requests

Fixed an invalid data request in the Hemorrhage Groups
parent 395fd01a
......@@ -32,6 +32,44 @@ Macro EngineUnitTestFull=EngineUnitTestDriver FullPlot Baseline=unit_tests/pulse
Macro ScenarioTest=ScenarioTestDriver FastPlot Baseline=scenarios/ Computed=./test_results/scenarios
#patient/BasicStandard.json = ScenarioTest
patient/HemorrhageSeverity1.json = ScenarioTest
patient/HemorrhageVaryingSeverity.json = ScenarioTest
#patient/HemorrhageClass1Femoral.json = ScenarioTest
#patient/HemorrhageClass2Blood.json = ScenarioTest
#patient/HemorrhageClass2BrachialArtery.json = ScenarioTest
#patient/HemorrhageClass2InternalMultiple.json = ScenarioTest
#patient/HemorrhageClass2InternalSpleen.json = ScenarioTest
#patient/HemorrhageClass2NoFluid.json = ScenarioTest
#patient/HemorrhageClass2Saline.json = ScenarioTest
#patient/HemorrhageClass3NoFluid.json = ScenarioTest
#patient/HemorrhageClass3PackedRBC.json = ScenarioTest
#patient/HemorrhageClass4NoFluid.json = ScenarioTest
#patient/HemorrhageGroup1.json = ScenarioTest
#patient/HemorrhageGroup2.json = ScenarioTest
#patient/HemorrhageGroup3.json = ScenarioTest
#patient/HemorrhageGroup4.json = ScenarioTest
#patient/HemorrhageGroup5.json = ScenarioTest
#patient/HemorrhageGroup6.json = ScenarioTest
#patient/HemorrhageInternalSeverity.json = ScenarioTest
#patient/HemorrhageSeverity1.json = ScenarioTest
#patient/HemorrhageSeverityMultipleCompartments.json = ScenarioTest
#patient/HemorrhageSeverityToFlowToSeverity.json = ScenarioTest
#patient/HemorrhageToShock.json = ScenarioTest
#patient/HemorrhageVaryingSeverity.json = ScenarioTest
#drug/Albuterol.json = ScenarioTest
#drug/Desflurane.json = ScenarioTest
#drug/Epinephrine.json = ScenarioTest
drug/Fentanyl.json = ScenarioTest
drug/Furosemide.json = ScenarioTest
drug/Ketamine.json = ScenarioTest
drug/Midazolam.json = ScenarioTest
drug/Morphine.json = ScenarioTest
drug/Naloxone.json = ScenarioTest
#drug/Norepinephrine.json = ScenarioTest
drug/NorepinephrineBolus.json = ScenarioTest
drug/Pralidoxime.json = ScenarioTest
drug/Prednisone.json = ScenarioTest
drug/Propofol.json = ScenarioTest
drug/Rocuronium.json = ScenarioTest
drug/Succinylcholine.json = ScenarioTest
......@@ -20,13 +20,13 @@
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "TidalVolume", "Unit": "mL" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "RespirationRate", "Unit": "1/min" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "OxygenSaturation", "Unit": "unitless" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "VenaCava", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "RightHeartVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "VenaCava", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "RightHeart", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "SystemicVascularResistance", "Unit": "mmHg s/mL"},
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "TotalHemorrhageRate", "Unit": "mL/s"},
......
......@@ -20,13 +20,13 @@
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "TidalVolume", "Unit": "mL" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "RespirationRate", "Unit": "1/min" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "OxygenSaturation", "Unit": "unitless" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "VenaCava", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "RightHeartVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "VenaCava", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "RightHeart", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "SystemicVascularResistance", "Unit": "mmHg s/mL"},
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "TotalHemorrhageRate", "Unit": "mL/s"},
......
......@@ -20,13 +20,13 @@
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "TidalVolume", "Unit": "mL" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "RespirationRate", "Unit": "1/min" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "OxygenSaturation", "Unit": "unitless" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "VenaCava", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "RightHeartVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "VenaCava", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "RightHeart", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "SystemicVascularResistance", "Unit": "mmHg s/mL"},
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "TotalHemorrhageRate", "Unit": "mL/s"},
......
......@@ -20,13 +20,13 @@
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "TidalVolume", "Unit": "mL" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "RespirationRate", "Unit": "1/min" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "OxygenSaturation", "Unit": "unitless" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "VenaCava", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "RightHeartVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "VenaCava", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "RightHeart", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "SystemicVascularResistance", "Unit": "mmHg s/mL"},
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "TotalHemorrhageRate", "Unit": "mL/s"},
......
......@@ -20,13 +20,13 @@
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "TidalVolume", "Unit": "mL" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "RespirationRate", "Unit": "1/min" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "OxygenSaturation", "Unit": "unitless" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "VenaCava", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "RightHeartVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "VenaCava", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "RightHeart", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "SystemicVascularResistance", "Unit": "mmHg s/mL"},
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "TotalHemorrhageRate", "Unit": "mL/s"},
......
......@@ -21,12 +21,12 @@
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "RespirationRate", "Unit": "1/min" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "OxygenSaturation", "Unit": "unitless" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "VenaCava", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "RightHeartVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "MyocardiumVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "BrainVasculature", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "VenaCava", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "LiquidCompartment", "CompartmentName": "RightHeart", "PropertyName": "InFlow", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "SystemicVascularResistance", "Unit": "mmHg s/mL"},
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "TotalHemorrhageRate", "Unit": "mL/s"},
......
......@@ -249,7 +249,7 @@ bool SEEquipmentActionCollection::ProcessAction(const SEEquipmentAction& action)
bool SEEquipmentActionCollection::HasAnesthesiaMachineConfiguration() const
{
return m_AnesthesiaMachineConfiguration == nullptr ? false : true;
return m_AnesthesiaMachineConfiguration == nullptr ? false : m_AnesthesiaMachineConfiguration->IsActive();
}
SEAnesthesiaMachineConfiguration& SEEquipmentActionCollection::GetAnesthesiaMachineConfiguration()
{
......@@ -509,7 +509,7 @@ void SEEquipmentActionCollection::RemoveAnesthesiaMachineYPieceDisconnect()
bool SEEquipmentActionCollection::HasInhalerConfiguration() const
{
return m_InhalerConfiguration == nullptr ? false : true;
return m_InhalerConfiguration == nullptr ? false : m_InhalerConfiguration->IsActive();
}
SEInhalerConfiguration& SEEquipmentActionCollection::GetInhalerConfiguration()
{
......@@ -529,7 +529,7 @@ void SEEquipmentActionCollection::RemoveInhalerConfiguration()
bool SEEquipmentActionCollection::HasMechanicalVentilatorConfiguration() const
{
return m_MechanicalVentilatorConfiguration == nullptr ? false : true;
return m_MechanicalVentilatorConfiguration == nullptr ? false : m_MechanicalVentilatorConfiguration->IsActive();
}
SEMechanicalVentilatorConfiguration& SEEquipmentActionCollection::GetMechanicalVentilatorConfiguration()
{
......
......@@ -64,9 +64,9 @@ bool SEHemorrhage::IsActive() const
{
if (!SEPatientAction::IsActive())
return false;
if (HasSeverity() && m_Severity->IsPositive())
if (HasSeverity())
return true;
if (HasFlowRate() && m_FlowRate->IsPositive())
if (HasFlowRate())
return true;
return false;
}
......
......@@ -13,6 +13,7 @@ SESubstanceBolus::SESubstanceBolus(const SESubstance& substance, Logger* logger)
{
m_AdminRoute=eSubstanceAdministration_Route::Intravenous;
m_AdminDuration=nullptr;
m_AdministeredDose = nullptr;
m_Dose=nullptr;
m_Concentration=nullptr;
}
......@@ -21,6 +22,7 @@ SESubstanceBolus::~SESubstanceBolus()
{
m_AdminRoute = eSubstanceAdministration_Route::Intravenous;
SAFE_DELETE(m_AdminDuration);
SAFE_DELETE(m_AdministeredDose);
SAFE_DELETE(m_Dose);
SAFE_DELETE(m_Concentration);
}
......@@ -30,6 +32,7 @@ void SESubstanceBolus::Clear()
SEPatientAction::Clear();
m_AdminRoute=eSubstanceAdministration_Route::Intravenous;
INVALIDATE_PROPERTY(m_AdminDuration);
INVALIDATE_PROPERTY(m_AdministeredDose);
INVALIDATE_PROPERTY(m_Dose);
INVALIDATE_PROPERTY(m_Concentration);
}
......@@ -48,7 +51,14 @@ bool SESubstanceBolus::IsValid() const
bool SESubstanceBolus::IsActive() const
{
return !SEPatientAction::IsActive();
if (!SEPatientAction::IsActive())
return false;
return !m_Dose->IsZero() && !m_Concentration->IsZero();
}
void SESubstanceBolus::Activate()
{
SEPatientAction::Activate();
GetAdministeredDose().SetValue(0, VolumeUnit::mL);
}
void SESubstanceBolus::Deactivate()
{
......@@ -60,6 +70,8 @@ const SEScalar* SESubstanceBolus::GetScalar(const std::string& name)
{
if (name.compare("AdminDuration") == 0)
return &GetAdminDuration();
if (name.compare("AdministeredDose") == 0)
return &GetAdministeredDose();
if (name.compare("Dose") == 0)
return &GetDose();
if (name.compare("Concentration") == 0)
......@@ -93,6 +105,23 @@ double SESubstanceBolus::GetAdminDuration(const TimeUnit& unit) const
return m_AdminDuration->GetValue(unit);
}
bool SESubstanceBolus::HasAdministeredDose() const
{
return m_AdministeredDose == nullptr ? false : m_AdministeredDose->IsValid();
}
SEScalarVolume& SESubstanceBolus::GetAdministeredDose()
{
if (m_AdministeredDose == nullptr)
m_AdministeredDose = new SEScalarVolume();
return *m_AdministeredDose;
}
double SESubstanceBolus::GetAdministeredDose(const VolumeUnit& unit) const
{
if (m_AdministeredDose == nullptr)
return SEScalar::dNaN();
return m_AdministeredDose->GetValue(unit);
}
bool SESubstanceBolus::HasDose() const
{
return m_Dose==nullptr?false:m_Dose->IsValid();
......@@ -146,5 +175,6 @@ void SESubstanceBolus::ToString(std::ostream &str) const
str << "\n\tAdministration Duration: "; HasAdminDuration() ? str << *m_AdminDuration : str << "No Administration Duration Set";
str << "\n\tDose: "; HasDose()? str << *m_Dose : str << "No Dose Set";
str << "\n\tConcentration: "; HasConcentration()? str << *m_Concentration : str << "NaN";
str << "\n\AdministeredDose: "; HasAdministeredDose() ? str << *m_AdministeredDose : str << "NaN";
str << std::flush;
}
......@@ -18,6 +18,7 @@ public:
virtual bool IsValid() const;
virtual bool IsActive() const;
virtual void Activate();
virtual void Deactivate();
virtual eSubstanceAdministration_Route GetAdminRoute() const;
......@@ -42,10 +43,16 @@ public:
virtual const SEScalar* GetScalar(const std::string& name);
virtual bool HasAdministeredDose() const;
virtual SEScalarVolume& GetAdministeredDose();
virtual double GetAdministeredDose(const VolumeUnit& unit) const;
protected:
const SESubstance& m_Substance;
eSubstanceAdministration_Route m_AdminRoute;
SEScalarTime* m_AdminDuration;
SEScalarVolume* m_AdministeredDose;
SEScalarMassPerVolume* m_Concentration;
SEScalarVolume* m_Dose;
};
......@@ -993,6 +993,7 @@ void Cardiovascular::Hemorrhage()
bool completeStateChange = false;
double TotalLossRate_mL_Per_s = 0.0;
std::vector<SEHemorrhage*> zero_hemorrhages;
std::vector<SEHemorrhage*> invalid_hemorrhages;
const std::vector<SEHemorrhage*>& hems = m_data.GetActions().GetPatientActions().GetHemorrhages();
//Loop over all hemorrhages to check for validity
......@@ -1270,18 +1271,23 @@ void Cardiovascular::Hemorrhage()
}
}
// Keep track of bleeding on the action
double hemorrhagePathFlow_mL_Per_s = 0;
if (hemorrhagePath->HasNextFlow())
hemorrhagePathFlow_mL_Per_s = hemorrhagePath->GetNextFlow().GetValue(VolumePerTimeUnit::mL_Per_s);
double hemorrhagePathFlow_mL_Per_s;
if (h->HasSeverity())
{
hemorrhagePathFlow_mL_Per_s = hemorrhagePath->GetNextFlow().GetValue(VolumePerTimeUnit::mL_Per_s);
h->GetFlowRate().SetValue(hemorrhagePathFlow_mL_Per_s, VolumePerTimeUnit::mL_Per_s);
}
if (!h->GetFlowRate().IsPositive())
zero_hemorrhages.push_back(h);
hemorrhagePathFlow_mL_Per_s = h->GetFlowRate(VolumePerTimeUnit::mL_Per_s);
h->GetTotalBloodLost().IncrementValue(hemorrhagePathFlow_mL_Per_s* m_dT_s, VolumeUnit::mL);
}
}
// Remove any invalid hemorrhages
// Remove any zero hemorrhages
for (SEHemorrhage* ih : zero_hemorrhages)
m_data.GetActions().GetPatientActions().RemoveHemorrhage(ih->GetCompartment());
// Destroy any invalid hemorrhages
for (SEHemorrhage* ih : invalid_hemorrhages)
m_data.GetActions().GetPatientActions().RemoveHemorrhage(ih->GetCompartment());
......
......@@ -196,7 +196,6 @@ void Drugs::AdministerSubstanceBolus()
double dose_mL;
double concentration_ugPermL;
double massIncrement_ug = 0;
double volumeDecrement_mL = 0;
double administrationTime_s;
for (auto bolus : boluses)
......@@ -204,8 +203,8 @@ void Drugs::AdministerSubstanceBolus()
if (!bolus->IsActive())
continue;
dose_mL = bolus->GetDose().GetValue(VolumeUnit::mL);
if (dose_mL<=0)
dose_mL = bolus->GetDose(VolumeUnit::mL);
if (bolus->GetAdministeredDose().GetValue(VolumeUnit::mL) >= dose_mL)
{
// Finished, remove it
completedBolus.push_back(&bolus->GetSubstance());
......@@ -238,14 +237,10 @@ void Drugs::AdministerSubstanceBolus()
}
administrationTime_s = bolus->GetAdminDuration(TimeUnit::s);
concentration_ugPermL = bolus->GetConcentration(MassPerVolumeUnit::ug_Per_mL);
massIncrement_ug = dose_mL*concentration_ugPermL*m_dt_s / administrationTime_s;
volumeDecrement_mL = -massIncrement_ug / concentration_ugPermL;
massIncrement_ug = dose_mL * concentration_ugPermL * m_dt_s / administrationTime_s;
subQ->GetMass().IncrementValue(massIncrement_ug, MassUnit::ug);
subQ->Balance(BalanceLiquidBy::Mass);
if (volumeDecrement_mL < 0)
volumeDecrement_mL = 0;
bolus->GetDose().IncrementValue(volumeDecrement_mL,VolumeUnit::mL);
bolus->GetAdministeredDose().IncrementValue(massIncrement_ug / concentration_ugPermL, VolumeUnit::mL);
/// \todo Add fluid amount to fluid system
}
// Remove any bolus that are complete
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment