Commit dda8566b authored by Aaron Bray's avatar Aaron Bray
Browse files

Update PC_CMV setting enum

Fix COVID showcase scenario
Fix supplemental O2 action getting removed too early
Fix a few logging bugs
parent c45e5c2f
......@@ -113,7 +113,7 @@
"InspiratoryExpiratoryRatio": { "Value": 0.5, "Unit": "" }
},
"Connection": "Tube",
"Control": "P_CMV",
"Control": "PC_CMV",
"DriverWaveform": "Square",
"PeakInspiratoryPressure": { "ScalarPressure": { "Value": 20.0, "Unit": "cmH2O" } },
"PositiveEndExpiredPressure": { "ScalarPressure": { "Value": 8.0, "Unit": "cmH2O" } },
......
......@@ -104,7 +104,7 @@
"InspiratoryExpiratoryRatio": { "Value": 0.5, "Unit": "" }
},
"Connection": "Mask",
"Control": "P_CMV",
"Control": "PC_CMV",
"DriverWaveform": "Square",
"PeakInspiratoryPressure": { "ScalarPressure": { "Value": 10.0, "Unit": "cmH2O" } },
"PositiveEndExpiredPressure": { "ScalarPressure": { "Value": 5.0, "Unit": "cmH2O" } },
......@@ -134,7 +134,7 @@
"InspiratoryExpiratoryRatio": { "Value": 1.0, "Unit": "" }
},
"Connection": "Tube",
"Control": "P_CMV",
"Control": "PC_CMV",
"DriverWaveform": "Square",
"PeakInspiratoryPressure": { "ScalarPressure": { "Value": 20.0, "Unit": "cmH2O" } },
"PositiveEndExpiredPressure": { "ScalarPressure": { "Value": 10.0, "Unit": "cmH2O" } },
......
......@@ -8,7 +8,7 @@
"Severity": { "Scalar0To1": { "Value": 0.6 } },
"LeftLungAffected": { "Scalar0To1": { "Value": 1.0 } },
"RightLungAffected": { "Scalar0To1": { "Value": 1.0 } } } } }
] }
] }
}
},
"DataRequestManager":
......@@ -31,58 +31,51 @@
{ "DecimalFormat": { "Precision": 1 }, "Category": "LiquidCompartment", "CompartmentName": "Aorta", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "LiquidCompartment", "CompartmentName": "Aorta", "SubstanceName": "CarbonDioxide", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "InspiratoryExpiratoryRatio", "Unit": "unitless" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "ExpiratoryFlow", "Unit": "L/s" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "InspiratoryFlow", "Unit": "L/s" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "PulmonaryCompliance", "Unit": "L/cmH2O" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "InspiratoryExpiratoryRatio", "Unit": "unitless" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "ExpiratoryFlow", "Unit": "L/s" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "InspiratoryFlow", "Unit": "L/s" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "PulmonaryCompliance", "Unit": "L/cmH2O" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "InspiratoryPulmonaryResistance", "Unit": "cmH2O s/L" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "ExpiratoryPulmonaryResistance", "Unit": "cmH2O s/L" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "CarricoIndex", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "TransthoracicPressure", "Unit": "cmH2O" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "ShuntFraction", "Unit": "unitless" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "AlveolarArterialGradient", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "TotalPulmonaryVentilation", "Unit": "L/min" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Patient", "PropertyName": "AlveoliSurfaceArea", "Unit": "m^2" }
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "ExpiratoryPulmonaryResistance", "Unit": "cmH2O s/L" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "CarricoIndex", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "TransthoracicPressure", "Unit": "cmH2O" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "ShuntFraction", "Unit": "unitless" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "AlveolarArterialGradient", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "TotalPulmonaryVentilation", "Unit": "L/min" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Patient", "PropertyName": "AlveoliSurfaceArea", "Unit": "m^2" }
]
},
"AnyAction":
[
//Segment 0
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 1.0, "Unit": "min" } } } },
{ "PatientAction": { "SupplementalOxygen": { "Device": "NasalCannula" } } },
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 1.0, "Unit": "min" } } } },
//ToDo: Administer vasopressor
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 10.0, "Unit": "min" } } } },
//Segment 1
//ToDo: Comment that is the next Day
{ "PatientAction": { "AcuteRespiratoryDistressSyndromeExacerbation":
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 1.0, "Unit": "min" } } } },
{ "PatientAction": { "SupplementalOxygen": { "Device": "NasalCannula" } } },
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 1.0, "Unit": "min" } } } },
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 10.0, "Unit": "min" } } } },
{ "PatientAction": { "AcuteRespiratoryDistressSyndromeExacerbation":
{
"Severity": { "Scalar0To1": { "Value": 0.9 }},
"LeftLungAffected": { "Scalar0To1": { "Value": 1.0 }},
"RightLungAffected": { "Scalar0To1": { "Value": 1.0 }}
}}
},
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 5.0, "Unit": "min" } } } },
{ "PatientAction": { "SupplementalOxygen": { "Device": "None" } } },
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 30.0, "Unit": "s" } } } },
//ToDo: Give sedative
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 30.0, "Unit": "s" } } } },
{ "PatientAction": {
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 5.0, "Unit": "min" } } } },
{ "PatientAction": { "SupplementalOxygen": { "Device": "None" } } },
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 30.0, "Unit": "s" } } } },
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 30.0, "Unit": "s" } } } },
{ "PatientAction": {
"SubstanceBolus": { "Substance": "Succinylcholine",
"Concentration": { "ScalarMassPerVolume": {
"Value": 1000.0,
......@@ -92,12 +85,12 @@
"Value": 77.0,
"Unit": "mL"
} } } } },
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 30.0, "Unit": "s" } } } },
{ "PatientAction": { "Intubation": { "Type": "RightMainstem" } } },
{
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 30.0, "Unit": "s" } } } },
{ "PatientAction": { "Intubation": { "Type": "RightMainstem" } } },
{
"EquipmentAction": {
"MechanicalVentilatorConfiguration": {
"MechanicalVentilatorAction": { "EquipmentAction": { "Action": {
......@@ -109,7 +102,7 @@
"InspiratoryExpiratoryRatio": { "Value": 0.5, "Unit": "" }
},
"Connection": "Tube",
"Control": "P_CMV",
"Control": "PC_CMV",
"DriverWaveform": "Square",
"PeakInspiratoryPressure": { "ScalarPressure": { "Value": 10.0, "Unit": "cmH2O" } },
"PositiveEndExpiredPressure": { "ScalarPressure": { "Value": 0.0, "Unit": "cmH2O" } },
......@@ -120,16 +113,14 @@
}
}
},
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 1.0, "Unit": "min" } } } },
//Segment 2
{ "PatientAction": { "Intubation": { "Type": "Tracheal" } } },
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 1.0, "Unit": "min" } } } },
{ "PatientAction": { "Intubation": { "Type": "Tracheal" } } },
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 1.0, "Unit": "min" } } } },
{
{
"EquipmentAction": {
"MechanicalVentilatorConfiguration": {
"MechanicalVentilatorAction": { "EquipmentAction": { "Action": {
......@@ -141,7 +132,7 @@
"InspiratoryExpiratoryRatio": { "Value": 0.5, "Unit": "" }
},
"Connection": "Tube",
"Control": "P_CMV",
"Control": "PC_CMV",
"DriverWaveform": "Square",
"PeakInspiratoryPressure": { "ScalarPressure": { "Value": 32.0, "Unit": "cmH2O" } },
"PositiveEndExpiredPressure": { "ScalarPressure": { "Value": 15.0, "Unit": "cmH2O" } },
......@@ -152,24 +143,20 @@
}
}
},
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 5.0, "Unit": "min" } } } },
//Segment 3
//ToDo: Comment that is several days later
{ "PatientAction": { "AcuteRespiratoryDistressSyndromeExacerbation":
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 5.0, "Unit": "min" } } } },
{ "PatientAction": { "AcuteRespiratoryDistressSyndromeExacerbation":
{
"Severity": { "Scalar0To1": { "Value": 0.6 }},
"LeftLungAffected": { "Scalar0To1": { "Value": 1.0 }},
"RightLungAffected": { "Scalar0To1": { "Value": 1.0 }}
}}
},
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 5.0, "Unit": "min" } } } },
{
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 5.0, "Unit": "min" } } } },
{
"EquipmentAction": {
"MechanicalVentilatorConfiguration": {
"MechanicalVentilatorAction": { "EquipmentAction": { "Action": {
......@@ -181,7 +168,7 @@
"InspiratoryExpiratoryRatio": { "Value": 0.5, "Unit": "" }
},
"Connection": "Tube",
"Control": "P_CMV",
"Control": "PC_CMV",
"DriverWaveform": "Square",
"PeakInspiratoryPressure": { "ScalarPressure": { "Value": 25.0, "Unit": "cmH2O" } },
"PositiveEndExpiredPressure": { "ScalarPressure": { "Value": 10.0, "Unit": "cmH2O" } },
......@@ -191,24 +178,21 @@
}
}
}
},
},
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 5.0, "Unit": "min" } } } },
//Segment 4
//ToDo: Comment that is several days later
{ "PatientAction": { "AcuteRespiratoryDistressSyndromeExacerbation":
{ "PatientAction": { "AcuteRespiratoryDistressSyndromeExacerbation":
{
"Severity": { "Scalar0To1": { "Value": 0.3 }},
"LeftLungAffected": { "Scalar0To1": { "Value": 1.0 }},
"RightLungAffected": { "Scalar0To1": { "Value": 1.0 }}
}}
},
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 5.0, "Unit": "min" } } } },
{
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 5.0, "Unit": "min" } } } },
{
"EquipmentAction": {
"MechanicalVentilatorConfiguration": {
"MechanicalVentilatorAction": { "EquipmentAction": { "Action": {
......@@ -220,7 +204,7 @@
"InspiratoryExpiratoryRatio": { "Value": 0.5, "Unit": "" }
},
"Connection": "Tube",
"Control": "P_CMV",
"Control": "PC_CMV",
"DriverWaveform": "Square",
"PeakInspiratoryPressure": { "ScalarPressure": { "Value": 20.0, "Unit": "cmH2O" } },
"PositiveEndExpiredPressure": { "ScalarPressure": { "Value": 8.0, "Unit": "cmH2O" } },
......@@ -230,8 +214,8 @@
}
}
}
},
},
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 5.0, "Unit": "min" } } } }
]
}
......@@ -286,7 +286,7 @@ bool SEConditionManager::ProcessCondition(const SECondition& condition)
}
/// \error Unsupported Condition
Error("Unsupported Condition");
Error(condition.GetName()+" is an unsupported Condition");
return false;
}
......
......@@ -145,7 +145,7 @@ bool SEDynamicStabilization::StabilizeConditions(Controller& engine, const SECon
{
if (!HasConditionConvergence(c->GetName()))
{
Error("Engine does not support Condition "+c->GetName());
Error("Engine does not have convergence criteria for condition "+c->GetName());
return false;
}
else
......@@ -216,7 +216,7 @@ bool SEDynamicStabilization::Stabilize(Controller& engine, const SEDynamicStabil
double stablizationTime_s = 0;
double dT_s = engine.GetTimeStep(TimeUnit::s);
SEDynamicStabilizationLedger ledger(dT_s, Convergence);
SEDynamicStabilizationLedger ledger(dT_s, Convergence, GetLogger());
while (!(ledger.HasConverged() && ledger.HasConvergedOptional()))
{
if (m_Cancelled)
......
......@@ -8,7 +8,7 @@
#include "engine/SEDynamicStabilizationPropertyConvergence.h"
#include "properties/SEScalarTime.h"
SEDynamicStabilizationLedger::SEDynamicStabilizationLedger(double timeStep_s, const SEDynamicStabilizationEngineConvergence& criteria) : m_properties(criteria.GetPropertyConvergence())
SEDynamicStabilizationLedger::SEDynamicStabilizationLedger(double timeStep_s, const SEDynamicStabilizationEngineConvergence& criteria, Logger* logger) : Loggable(logger), m_properties(criteria.GetPropertyConvergence())
{
m_dT_s = timeStep_s;
m_totTime_s = 0;
......
......@@ -9,7 +9,7 @@ class SEDynamicStabilizationPropertyConvergence;
class CDM_DECL SEDynamicStabilizationLedger : public Loggable
{
public:
SEDynamicStabilizationLedger(double timeStep_s, const SEDynamicStabilizationEngineConvergence& convergence);
SEDynamicStabilizationLedger(double timeStep_s, const SEDynamicStabilizationEngineConvergence& convergence, Logger* logger);
virtual ~SEDynamicStabilizationLedger() {};
virtual void TestConvergence();
......
......@@ -37,11 +37,6 @@ bool SESupplementalOxygen::IsValid() const
return SEPatientAction::IsValid();
}
bool SESupplementalOxygen::IsActive() const
{
return IsValid() && m_Device != eSupplementalOxygen_Device::None;
}
eSupplementalOxygen_Device SESupplementalOxygen::GetDevice() const
{
return m_Device;
......
......@@ -21,7 +21,6 @@ public:
virtual void Copy(const SESupplementalOxygen& src);
virtual bool IsValid() const;
virtual bool IsActive() const;
virtual eSupplementalOxygen_Device GetDevice() const;
virtual void SetDevice(eSupplementalOxygen_Device name);
......
......@@ -14,7 +14,7 @@ enum class eMechanicalVentilator_Connection { NullConnection = 0, Off, Mask, Tub
extern const std::string& eMechanicalVentilator_Connection_Name(eMechanicalVentilator_Connection m);
// Keep enums in sync with appropriate schema/cdm/MechanicalVentilator.proto file !!
enum class eMechanicalVentilator_Control { NullControl = 0, P_CMV };
enum class eMechanicalVentilator_Control { NullControl = 0, PC_CMV };
extern const std::string& eMechanicalVentilator_Control_Name(eMechanicalVentilator_Control m);
// Keep enums in sync with appropriate schema/cdm/MechanicalVentilator.proto file !!
......
......@@ -100,11 +100,11 @@ void MechanicalVentilator::StateChange()
return;
}
if (GetControl() != eMechanicalVentilator_Control::P_CMV)
if (GetControl() != eMechanicalVentilator_Control::PC_CMV)
{
//Only one option for now
//jbw - error for unsupported
SetControl(eMechanicalVentilator_Control::P_CMV);
SetControl(eMechanicalVentilator_Control::PC_CMV);
}
if (GetDriverWaveform() != eMechanicalVentilator_DriverWaveform::Square)
......
......@@ -42,10 +42,10 @@ bool GenerateStabilizedPatients()
{
int minCompliance = 10;
int maxCompliance = 50;
int stepCompliance = 10;
int stepCompliance = 5;
float minImpairment = 0.0;
float maxImpairment = 1.0;
float stepImpairment = 0.1f;
float stepImpairment = 0.2f;
int minPEEP = 12;
int maxPEEP = 20;
int stepPEEP = 2;
......@@ -75,7 +75,7 @@ bool GenerateStabilizedPatients()
SEMechanicalVentilatorConfiguration mvc(subMgr);
auto& mv = mvc.GetConfiguration();
mv.SetConnection(eMechanicalVentilator_Connection::Tube);
mv.SetControl(eMechanicalVentilator_Control::P_CMV);
mv.SetControl(eMechanicalVentilator_Control::PC_CMV);
mv.SetDriverWaveform(eMechanicalVentilator_DriverWaveform::Square);
mv.GetRespiratoryRate().SetValue(20, FrequencyUnit::Per_min);
mv.GetInspiratoryExpiratoryRatio().SetValue(0.5);
......@@ -152,5 +152,6 @@ bool GenerateStabilizedPatients()
std::cerr << "Unable to write generated patients list file\n";
return false;
}
logger.Info("Created "+std::to_string(patients.patients_size()) + " patients");
return WriteFile(out, "mv_solo_ventilated_patients.json", SerializationFormat::JSON);
}
\ No newline at end of file
......@@ -21,7 +21,7 @@ message MechanicalVentilatorData
enum eControl
{
NullControl = 0;/**<< Signals not provided, or no change */
P_CMV = 1;/**<< Pressure Control Ventilation with Continuous Mandatory Ventilation */
PC_CMV = 1;/**<< Pressure Control Ventilation with Continuous Mandatory Ventilation */
}
enum eDriverWaveform
......
Supports Markdown
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