Commit 58df766d authored by Jeff Webb's avatar Jeff Webb
Browse files

New Mechanical Ventilation action is working.

Still needs more cleanup and testing - lots of to-dos in comments.
parent d191dd24
......@@ -116,6 +116,7 @@ equipment/MainstemIntubation.json = ScenarioTest
equipment/MechanicalVentilation.json = ScenarioTest
equipment/NasalCannula.json = ScenarioTest
equipment/NonRebreatherMask.json = ScenarioTest
equipment/PressureControlContinuousMandatoryVentilation.json = ScenarioTest
equipment/SimpleMask.json = ScenarioTest
@group Drugs
......
{
"Name": "PressureControlContinuousMandatoryVentilation",
"Description": "Apply a P-CMV mode ventilator.",
"StartType": { "PatientConfiguration": { "PatientFile": "StandardMale.json" }},
"DataRequestManager":
{
"DataRequest":
[
{ "DecimalFormat": { "Precision": 1 }, "PropertyName": "Weight", "Unit": "kg" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "HeartRate", "Unit": "1/min" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "Physiology", "PropertyName": "HeartStrokeVolume", "Unit": "mL" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "BloodVolume", "Unit": "L" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "Physiology", "PropertyName": "ExtravascularFluidVolume", "Unit": "L" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "Physiology", "PropertyName": "ArterialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "Physiology", "PropertyName": "MeanArterialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { }, "Category": "Physiology", "PropertyName": "SystolicArterialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "Physiology", "PropertyName": "DiastolicArterialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "CardiacOutput", "Unit": "L/min" },
{ "DecimalFormat": { }, "Category": "Physiology", "PropertyName": "HemoglobinContent", "Unit": "g" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "CentralVenousPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "PulmonaryCapillariesWedgePressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "TidalVolume", "Unit": "mL" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "TotalLungVolume", "Unit": "L" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "RespirationRate", "Unit": "1/min" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "OxygenSaturation", "Unit": "unitless" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "CarbonDioxideSaturation", "Unit": "unitless" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "EndTidalCarbonDioxideFraction", "Unit": "unitless" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "TotalAlveolarVentilation", "Unit": "L/min" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "TranspulmonaryPressure", "Unit": "cmH2O" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "Physiology", "PropertyName": "CoreTemperature", "Unit": "degC" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "Physiology", "PropertyName": "SkinTemperature", "Unit": "degC" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "RespiratoryExchangeRatio", "Unit": "unitless" },
{ "DecimalFormat": { }, "Category": "Physiology", "PropertyName": "OxygenConsumptionRate", "Unit": "mL/min" },
{ "DecimalFormat": { }, "Category": "Physiology", "PropertyName": "CarbonDioxideProductionRate", "Unit": "mL/min" },
{ "DecimalFormat": { }, "Category": "Physiology", "PropertyName": "GlomerularFiltrationRate", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "RenalBloodFlow", "Unit": "L/min" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "UrineProductionRate", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "LeftAfferentArterioleResistance", "Unit": "mmHg min/mL" },
{ "DecimalFormat": { "Precision": 4 }, "Category": "Physiology", "PropertyName": "RightAfferentArterioleResistance", "Unit": "mmHg min/mL" },
{ "DecimalFormat": { }, "Category": "GasCompartment", "CompartmentName": "LeftAlveoli", "PropertyName": "Pressure", "Unit": "cmH2O" },
{ "DecimalFormat": { }, "Category": "GasCompartment", "CompartmentName": "RightAlveoli", "PropertyName": "Pressure", "Unit": "cmH2O" },
{ "DecimalFormat": { }, "Category": "GasCompartment", "CompartmentName": "LeftAlveoli", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "GasCompartment", "CompartmentName": "LeftAlveoli", "SubstanceName": "CarbonDioxide", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { }, "Category": "GasCompartment", "CompartmentName": "RightAlveoli", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "GasCompartment", "CompartmentName": "RightAlveoli", "SubstanceName": "CarbonDioxide", "PropertyName": "PartialPressure", "Unit": "mmHg"},
{ "DecimalFormat": { }, "Category": "GasCompartment", "CompartmentName": "Carina", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "cmH2O" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "GasCompartment", "CompartmentName": "Carina", "SubstanceName": "CarbonDioxide", "PropertyName": "PartialPressure", "Unit": "cmH2O" },
{ "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": 1 }, "Category": "LiquidCompartment", "CompartmentName": "VenaCava", "SubstanceName": "Oxygen", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "LiquidCompartment", "CompartmentName": "VenaCava", "SubstanceName": "CarbonDioxide", "PropertyName": "PartialPressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "LiquidCompartment", "CompartmentName": "RightTubules", "SubstanceName": "Sodium", "PropertyName": "Concentration", "Unit": "g/L" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "LiquidCompartment", "CompartmentName": "LeftTubules", "SubstanceName": "Sodium", "PropertyName": "Concentration", "Unit": "g/L" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Substance", "SubstanceName": "Oxygen", "PropertyName": "AlveolarTransfer", "Unit": "mL/s" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Substance", "SubstanceName": "CarbonDioxide", "PropertyName": "AlveolarTransfer", "Unit": "mL/s" },
{ "DecimalFormat": { "Precision": 6 }, "Category": "Substance", "SubstanceName": "Epinephrine", "PropertyName": "BloodConcentration", "Unit": "ug/L" },
{ "DecimalFormat": { "Precision": 8 }, "Category": "Substance", "SubstanceName": "Epinephrine", "PropertyName": "SystemicMassCleared", "Unit": "ug" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "ChymeAbsorptionRate", "Unit": "mL/min" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "StomachContents-Carbohydrate", "Unit": "g" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "StomachContents-Fat", "Unit": "g" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "StomachContents-Protein", "Unit": "g" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "StomachContents-Calcium", "Unit": "g" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "Physiology", "PropertyName": "StomachContents-Sodium", "Unit": "g" },
{ "DecimalFormat": { }, "Category": "Physiology", "PropertyName": "StomachContents-Water", "Unit": "mL" },
{ "DecimalFormat": { }, "Category": "LiquidCompartment", "CompartmentName": "SmallIntestineChyme", "PropertyName": "Volume", "Unit": "mL" },
{ "DecimalFormat": { }, "Category": "LiquidCompartment", "CompartmentName": "SmallIntestineVasculature", "PropertyName": "Volume", "Unit": "mL" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "LiquidCompartment", "CompartmentName": "SmallIntestineVasculature", "PropertyName": "Pressure", "Unit": "mmHg" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "LiquidCompartment", "CompartmentName": "SmallIntestineChyme", "SubstanceName": "Glucose", "PropertyName": "Mass", "Unit": "g" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "LiquidCompartment", "CompartmentName": "SmallIntestineChyme", "SubstanceName": "Tristearin", "PropertyName": "Mass", "Unit": "g" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "LiquidCompartment", "CompartmentName": "SmallIntestineChyme", "SubstanceName": "Calcium", "PropertyName": "Mass", "Unit": "g" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "LiquidCompartment", "CompartmentName": "SmallIntestineChyme", "SubstanceName": "Sodium", "PropertyName": "Mass", "Unit": "g" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "LiquidCompartment", "CompartmentName": "SmallIntestineChyme", "SubstanceName": "Urea", "PropertyName": "Mass", "Unit": "g" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "LiquidCompartment", "CompartmentName": "SmallIntestineVasculature", "SubstanceName": "Glucose", "PropertyName": "Concentration", "Unit": "mg/dL" },
{ "DecimalFormat": { }, "Category": "LiquidCompartment", "CompartmentName": "SmallIntestineVasculature", "SubstanceName": "Tristearin", "PropertyName": "Concentration", "Unit": "mg/dL" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "LiquidCompartment", "CompartmentName": "SmallIntestineVasculature", "SubstanceName": "Calcium", "PropertyName": "Concentration", "Unit": "mg/L" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "LiquidCompartment", "CompartmentName": "SmallIntestineVasculature", "SubstanceName": "Sodium", "PropertyName": "Concentration", "Unit": "g/L" },
{ "DecimalFormat": { "Precision": 1 }, "Category": "LiquidCompartment", "CompartmentName": "SmallIntestineVasculature", "SubstanceName": "Urea", "PropertyName": "Concentration", "Unit": "mg/dL" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "HeartEjectionFraction" },
{ "DecimalFormat": { "Precision": 3 }, "Category": "Physiology", "PropertyName": "SystemicVascularResistance", "Unit": "mmHg s/mL" },
{ "DecimalFormat": { }, "Category": "LiquidCompartment", "CompartmentName": "Pericardium", "PropertyName": "Volume", "Unit": "mL" },
{ "DecimalFormat": { "Precision": 2 }, "Category": "LiquidCompartment", "CompartmentName": "Pericardium", "PropertyName": "Pressure", "Unit": "mmHg" }
]
},
"AnyAction":
[
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 1.0, "Unit": "min" } } } },
{ "PatientAction": { "Dyspnea": { "Severity": { "Scalar0To1": { "Value": 1.0 } } } } },
{
"EquipmentAction": {
"MechanicalVentilatorConfiguration": {
"MechanicalVentilatorAction": { "EquipmentAction": { "Action": {
"Comment": "Attach the mechanical ventilator" }}},
"Configuration":
{
"BreathProfile": {
"Rate": { "ScalarFrequency": { "Value": 12.0, "Unit": "1/min" } },
"InspiratoryExpiratoryRatio": { "Value": 0.5, "Unit": "" }
},
"Connection": "Mask",
"Control": "P_CMV",
"DriverWaveform": "Square",
"PeakInspiratoryPressure": { "ScalarPressure": { "Value": 10.0, "Unit": "cmH2O" } },
"PositiveEndExpiredPressure": { "ScalarPressure": { "Value": 5.0, "Unit": "cmH2O" } },
"FractionInspiredGas": [
{ "Name": "Nitrogen", "Amount": { "Scalar0To1": { "Value": 0.7896, "Unit": "" } } },
{ "Name": "Oxygen", "Amount": { "Scalar0To1": { "Value": 0.21, "Unit": "" } } },
{ "Name": "CarbonDioxide", "Amount": { "Scalar0To1": { "Value": 0.0004, "Unit": "" } } }
]
}
}
}
},
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 5.0, "Unit": "min" } } } }
]
}
\ No newline at end of file
......@@ -57,7 +57,8 @@ void SEMechanicalVentilator::Clear()
DELETE_VECTOR(m_cFractionInspiredGases);
m_cFractionInspiredGases.clear();
DELETE_VECTOR(m_FractionInspiredGases);
//Aaron - What's going on here?
//DELETE_VECTOR(m_FractionInspiredGases);
m_FractionInspiredGases.clear();
DELETE_VECTOR(m_cConcentrationInspiredAerosols);
......
......@@ -1105,29 +1105,31 @@ namespace pulse {
static std::vector<std::string> _values;
};
//Aaron - how do we want to share names between mechanical ventilator and anesthesia machine?
//Right now, I'm just adding "MechanicalVentilator"
class MechanicalVentilatorCompartment
{
public:
DEFINE_STATIC_STRING(Ventilator);
DEFINE_STATIC_STRING(ExpiratoryValve);
DEFINE_STATIC_STRING(InspiratoryValve);
DEFINE_STATIC_STRING(ExpiratoryLimb);
DEFINE_STATIC_STRING(InspiratoryLimb);
DEFINE_STATIC_STRING(YPiece);
DEFINE_STATIC_STRING(Connection);
DEFINE_STATIC_STRING(MechanicalVentilator);
DEFINE_STATIC_STRING(MechanicalVentilatorExpiratoryValve);
DEFINE_STATIC_STRING(MechanicalVentilatorInspiratoryValve);
DEFINE_STATIC_STRING(MechanicalVentilatorExpiratoryLimb);
DEFINE_STATIC_STRING(MechanicalVentilatorInspiratoryLimb);
DEFINE_STATIC_STRING(MechanicalVentilatorYPiece);
DEFINE_STATIC_STRING(MechanicalVentilatorConnection);
static const std::vector<std::string>& GetValues()
{
ScopedMutex lock;
if (_values.empty())
{
_values.push_back(Ventilator);
_values.push_back(ExpiratoryValve);
_values.push_back(InspiratoryValve);
_values.push_back(ExpiratoryLimb);
_values.push_back(InspiratoryLimb);
_values.push_back(YPiece);
_values.push_back(Connection);
_values.push_back(MechanicalVentilator);
_values.push_back(MechanicalVentilatorExpiratoryValve);
_values.push_back(MechanicalVentilatorInspiratoryValve);
_values.push_back(MechanicalVentilatorExpiratoryLimb);
_values.push_back(MechanicalVentilatorInspiratoryLimb);
_values.push_back(MechanicalVentilatorYPiece);
_values.push_back(MechanicalVentilatorConnection);
}
return _values;
}
......@@ -1135,33 +1137,35 @@ namespace pulse {
static std::vector<std::string> _values;
};
//Aaron - how do we want to share names between mechanical ventilator and anesthesia machine?
//Right now, I'm just adding "MechanicalVentilator"
class MechanicalVentilatorLink
{
public:
DEFINE_STATIC_STRING(VentilatorToExpiratoryValve);
DEFINE_STATIC_STRING(VentilatorToInspiratoryValve);
DEFINE_STATIC_STRING(ExpiratoryLimbToExpiratoryValve);
DEFINE_STATIC_STRING(InspiratoryValveToInspiratoryLimb);
DEFINE_STATIC_STRING(ExpiratoryLimbToYPiece);
DEFINE_STATIC_STRING(InspiratoryLimbToYPiece);
DEFINE_STATIC_STRING(YPieceToConnection);
DEFINE_STATIC_STRING(ConnectionToEnvironment);
DEFINE_STATIC_STRING(ConnectionToMouth);
DEFINE_STATIC_STRING(MechanicalVentilatorToExpiratoryValve);
DEFINE_STATIC_STRING(MechanicalVentilatorToInspiratoryValve);
DEFINE_STATIC_STRING(MechanicalVentilatorExpiratoryLimbToExpiratoryValve);
DEFINE_STATIC_STRING(MechanicalVentilatorInspiratoryValveToInspiratoryLimb);
DEFINE_STATIC_STRING(MechanicalVentilatorExpiratoryLimbToYPiece);
DEFINE_STATIC_STRING(MechanicalVentilatorInspiratoryLimbToYPiece);
DEFINE_STATIC_STRING(MechanicalVentilatorYPieceToConnection);
DEFINE_STATIC_STRING(MechanicalVentilatorConnectionToEnvironment);
DEFINE_STATIC_STRING(MechanicalVentilatorConnectionToMouth);
static const std::vector<std::string>& GetValues()
{
ScopedMutex lock;
if (_values.empty())
{
_values.push_back(VentilatorToExpiratoryValve);
_values.push_back(VentilatorToInspiratoryValve);
_values.push_back(ExpiratoryLimbToExpiratoryValve);
_values.push_back(InspiratoryValveToInspiratoryLimb);
_values.push_back(ExpiratoryLimbToYPiece);
_values.push_back(InspiratoryLimbToYPiece);
_values.push_back(YPieceToConnection);
_values.push_back(ConnectionToEnvironment);
_values.push_back(ConnectionToMouth);
_values.push_back(MechanicalVentilatorToExpiratoryValve);
_values.push_back(MechanicalVentilatorToInspiratoryValve);
_values.push_back(MechanicalVentilatorExpiratoryLimbToExpiratoryValve);
_values.push_back(MechanicalVentilatorInspiratoryValveToInspiratoryLimb);
_values.push_back(MechanicalVentilatorExpiratoryLimbToYPiece);
_values.push_back(MechanicalVentilatorInspiratoryLimbToYPiece);
_values.push_back(MechanicalVentilatorYPieceToConnection);
_values.push_back(MechanicalVentilatorConnectionToEnvironment);
_values.push_back(MechanicalVentilatorConnectionToMouth);
}
return _values;
}
......
......@@ -4444,6 +4444,8 @@ void PulseController::SetupMechanicalVentilator()
double connectioneVolume_L = 0.01;
double tubeResistance_cmH2O_s_Per_L = 0.01; //4 total tubes - this is per tube
/////////////
// Circuit //
// Nodes
SEFluidCircuit& cMechanicalVentilator = m_Circuits->GetMechanicalVentilatorCircuit();
SEFluidCircuitNode& Ambient = *cRespiratory.GetNode(pulse::EnvironmentNode::Ambient);
......@@ -4517,40 +4519,42 @@ void PulseController::SetupMechanicalVentilator()
cCombinedMechanicalVentilator.SetNextAndCurrentFromBaselines();
cCombinedMechanicalVentilator.StateChange();
//////////////////////
// GAS COMPARTMENTS //
// Grab the Environment Compartment
SEGasCompartment* eEnvironment = m_Compartments->GetGasCompartment(pulse::EnvironmentCompartment::Ambient);
// Mechanical Ventilator Compartments
SEGasCompartment& mVentilator = m_Compartments->CreateGasCompartment(pulse::MechanicalVentilatorCompartment::Ventilator);
SEGasCompartment& mVentilator = m_Compartments->CreateGasCompartment(pulse::MechanicalVentilatorCompartment::MechanicalVentilator);
mVentilator.MapNode(Ventilator);
SEGasCompartment& mExpiratoryValve = m_Compartments->CreateGasCompartment(pulse::MechanicalVentilatorCompartment::ExpiratoryValve);
SEGasCompartment& mExpiratoryValve = m_Compartments->CreateGasCompartment(pulse::MechanicalVentilatorCompartment::MechanicalVentilatorExpiratoryValve);
mExpiratoryValve.MapNode(ExpiratoryValve);
SEGasCompartment& mInspiratoryValve = m_Compartments->CreateGasCompartment(pulse::MechanicalVentilatorCompartment::InspiratoryValve);
SEGasCompartment& mInspiratoryValve = m_Compartments->CreateGasCompartment(pulse::MechanicalVentilatorCompartment::MechanicalVentilatorInspiratoryValve);
mInspiratoryValve.MapNode(InspiratoryValve);
SEGasCompartment& mExpiratoryLimb = m_Compartments->CreateGasCompartment(pulse::MechanicalVentilatorCompartment::ExpiratoryLimb);
SEGasCompartment& mExpiratoryLimb = m_Compartments->CreateGasCompartment(pulse::MechanicalVentilatorCompartment::MechanicalVentilatorExpiratoryLimb);
mExpiratoryLimb.MapNode(ExpiratoryLimb);
SEGasCompartment& mInspiratoryLimb = m_Compartments->CreateGasCompartment(pulse::MechanicalVentilatorCompartment::InspiratoryLimb);
SEGasCompartment& mInspiratoryLimb = m_Compartments->CreateGasCompartment(pulse::MechanicalVentilatorCompartment::MechanicalVentilatorInspiratoryLimb);
mInspiratoryLimb.MapNode(InspiratoryLimb);
SEGasCompartment& mYPiece = m_Compartments->CreateGasCompartment(pulse::MechanicalVentilatorCompartment::YPiece);
SEGasCompartment& mYPiece = m_Compartments->CreateGasCompartment(pulse::MechanicalVentilatorCompartment::MechanicalVentilatorYPiece);
mYPiece.MapNode(YPiece);
SEGasCompartment& mConnection = m_Compartments->CreateGasCompartment(pulse::MechanicalVentilatorCompartment::Connection);
SEGasCompartment& mConnection = m_Compartments->CreateGasCompartment(pulse::MechanicalVentilatorCompartment::MechanicalVentilatorConnection);
mConnection.MapNode(Connection);
// Setup Links //
SEGasCompartmentLink& mVentilatorToExpiratoryValve = m_Compartments->CreateGasLink(mVentilator, mExpiratoryValve, pulse::MechanicalVentilatorLink::VentilatorToExpiratoryValve);
SEGasCompartmentLink& mVentilatorToExpiratoryValve = m_Compartments->CreateGasLink(mVentilator, mExpiratoryValve, pulse::MechanicalVentilatorLink::MechanicalVentilatorToExpiratoryValve);
mVentilatorToExpiratoryValve.MapPath(VentilatorToExpiratoryValve);
SEGasCompartmentLink& mVentilatorToInspiratoryValve = m_Compartments->CreateGasLink(mVentilator, mInspiratoryValve, pulse::MechanicalVentilatorLink::VentilatorToInspiratoryValve);
SEGasCompartmentLink& mVentilatorToInspiratoryValve = m_Compartments->CreateGasLink(mVentilator, mInspiratoryValve, pulse::MechanicalVentilatorLink::MechanicalVentilatorToInspiratoryValve);
mVentilatorToInspiratoryValve.MapPath(VentilatorToInspiratoryValve);
SEGasCompartmentLink& mExpiratoryLimbToExpiratoryValve = m_Compartments->CreateGasLink(mExpiratoryLimb, mExpiratoryValve, pulse::MechanicalVentilatorLink::ExpiratoryLimbToExpiratoryValve);
SEGasCompartmentLink& mExpiratoryLimbToExpiratoryValve = m_Compartments->CreateGasLink(mExpiratoryLimb, mExpiratoryValve, pulse::MechanicalVentilatorLink::MechanicalVentilatorExpiratoryLimbToExpiratoryValve);
mExpiratoryLimbToExpiratoryValve.MapPath(ExpiratoryLimbToExpiratoryValve);
SEGasCompartmentLink& mInspiratoryValveToInspiratoryLimb = m_Compartments->CreateGasLink(mInspiratoryValve, mInspiratoryLimb, pulse::MechanicalVentilatorLink::InspiratoryValveToInspiratoryLimb);
SEGasCompartmentLink& mInspiratoryValveToInspiratoryLimb = m_Compartments->CreateGasLink(mInspiratoryValve, mInspiratoryLimb, pulse::MechanicalVentilatorLink::MechanicalVentilatorInspiratoryValveToInspiratoryLimb);
mInspiratoryValveToInspiratoryLimb.MapPath(InspiratoryValveToInspiratoryLimb);
SEGasCompartmentLink& mExpiratoryLimbToYPiece = m_Compartments->CreateGasLink(mExpiratoryLimb, mYPiece, pulse::MechanicalVentilatorLink::ExpiratoryLimbToYPiece);
SEGasCompartmentLink& mExpiratoryLimbToYPiece = m_Compartments->CreateGasLink(mExpiratoryLimb, mYPiece, pulse::MechanicalVentilatorLink::MechanicalVentilatorExpiratoryLimbToYPiece);
mExpiratoryLimbToYPiece.MapPath(ExpiratoryLimbToYPiece);
SEGasCompartmentLink& mInspiratoryLimbToYPiece = m_Compartments->CreateGasLink(mInspiratoryLimb, mYPiece, pulse::MechanicalVentilatorLink::InspiratoryLimbToYPiece);
SEGasCompartmentLink& mInspiratoryLimbToYPiece = m_Compartments->CreateGasLink(mInspiratoryLimb, mYPiece, pulse::MechanicalVentilatorLink::MechanicalVentilatorInspiratoryLimbToYPiece);
mInspiratoryLimbToYPiece.MapPath(InspiratoryLimbToYPiece);
SEGasCompartmentLink& mYPieceToConnection = m_Compartments->CreateGasLink(mYPiece, mConnection, pulse::MechanicalVentilatorLink::YPieceToConnection);
SEGasCompartmentLink& mYPieceToConnection = m_Compartments->CreateGasLink(mYPiece, mConnection, pulse::MechanicalVentilatorLink::MechanicalVentilatorYPieceToConnection);
mYPieceToConnection.MapPath(YPieceToConnection);
SEGasCompartmentLink& mConnectionToEnvironment = m_Compartments->CreateGasLink(mConnection, *eEnvironment, pulse::MechanicalVentilatorLink::ConnectionToEnvironment);
SEGasCompartmentLink& mConnectionToEnvironment = m_Compartments->CreateGasLink(mConnection, *eEnvironment, pulse::MechanicalVentilatorLink::MechanicalVentilatorConnectionToEnvironment);
mConnectionToEnvironment.MapPath(ConnectionToEnvironment);
SEGasCompartmentGraph& gMechanicalVentilator = m_Compartments->GetMechanicalVentilatorGraph();
......@@ -4574,16 +4578,85 @@ void PulseController::SetupMechanicalVentilator()
//Now do the combined transport setup
// Grab the mouth from pulmonary
SEGasCompartment* pMouth = m_Compartments->GetGasCompartment(pulse::PulmonaryCompartment::Mouth);
SEGasCompartmentLink& mConnectionToMouth = m_Compartments->CreateGasLink(mConnection, *pMouth, pulse::MechanicalVentilatorLink::ConnectionToMouth);
SEGasCompartmentLink& mConnectionToMouth = m_Compartments->CreateGasLink(mConnection, *pMouth, pulse::MechanicalVentilatorLink::MechanicalVentilatorConnectionToMouth);
mConnectionToMouth.MapPath(ConnectionToMouth);
SEGasCompartmentGraph& gCombinedRespiratoryMechanicalVentilator = m_Compartments->GetRespiratoryAndMechanicalVentilatorGraph();
gCombinedRespiratoryMechanicalVentilator.AddGraph(gRespiratory);
gCombinedRespiratoryMechanicalVentilator.AddGraph(gMechanicalVentilator);
gCombinedRespiratoryMechanicalVentilator.RemoveLink(pulse::PulmonaryLink::EnvironmentToMouth);
gCombinedRespiratoryMechanicalVentilator.RemoveLink(pulse::MechanicalVentilatorLink::ConnectionToEnvironment);
gCombinedRespiratoryMechanicalVentilator.RemoveLink(pulse::MechanicalVentilatorLink::MechanicalVentilatorConnectionToEnvironment);
gCombinedRespiratoryMechanicalVentilator.AddLink(mConnectionToMouth);
gCombinedRespiratoryMechanicalVentilator.StateChange();
///////////////////////////////////
// LIQUID (AEROSOL) COMPARTMENTS //
// Grab from pulmonary
SELiquidCompartment* lMouth = m_Compartments->GetLiquidCompartment(pulse::PulmonaryCompartment::Mouth);
SELiquidCompartment* lEnvironment = m_Compartments->GetLiquidCompartment(pulse::EnvironmentCompartment::Ambient);
// Mechanical Ventilator Compartments
SELiquidCompartment& lVentilator = m_Compartments->CreateLiquidCompartment(pulse::MechanicalVentilatorCompartment::MechanicalVentilator);
lVentilator.MapNode(Ventilator);
SELiquidCompartment& lExpiratoryValve = m_Compartments->CreateLiquidCompartment(pulse::MechanicalVentilatorCompartment::MechanicalVentilatorExpiratoryValve);
lExpiratoryValve.MapNode(ExpiratoryValve);
SELiquidCompartment& lInspiratoryValve = m_Compartments->CreateLiquidCompartment(pulse::MechanicalVentilatorCompartment::MechanicalVentilatorInspiratoryValve);
lInspiratoryValve.MapNode(InspiratoryValve);
SELiquidCompartment& lExpiratoryLimb = m_Compartments->CreateLiquidCompartment(pulse::MechanicalVentilatorCompartment::MechanicalVentilatorExpiratoryLimb);
lExpiratoryLimb.MapNode(ExpiratoryLimb);
SELiquidCompartment& lInspiratoryLimb = m_Compartments->CreateLiquidCompartment(pulse::MechanicalVentilatorCompartment::MechanicalVentilatorInspiratoryLimb);
lInspiratoryLimb.MapNode(InspiratoryLimb);
SELiquidCompartment& lYPiece = m_Compartments->CreateLiquidCompartment(pulse::MechanicalVentilatorCompartment::MechanicalVentilatorYPiece);
lYPiece.MapNode(YPiece);
SELiquidCompartment& lConnection = m_Compartments->CreateLiquidCompartment(pulse::MechanicalVentilatorCompartment::MechanicalVentilatorConnection);
lConnection.MapNode(Connection);
//Links
SELiquidCompartmentLink& lConnectionToMouth = m_Compartments->CreateLiquidLink(lConnection, *lMouth, pulse::MechanicalVentilationLink::ConnectionToMouth);
lConnectionToMouth.MapPath(ConnectionToMouth);
SELiquidCompartmentLink& lVentilatorToExpiratoryValve = m_Compartments->CreateLiquidLink(lVentilator, lExpiratoryValve, pulse::MechanicalVentilatorLink::MechanicalVentilatorToExpiratoryValve);
lVentilatorToExpiratoryValve.MapPath(VentilatorToExpiratoryValve);
SELiquidCompartmentLink& lVentilatorToInspiratoryValve = m_Compartments->CreateLiquidLink(lVentilator, lInspiratoryValve, pulse::MechanicalVentilatorLink::MechanicalVentilatorToInspiratoryValve);
lVentilatorToInspiratoryValve.MapPath(VentilatorToInspiratoryValve);
SELiquidCompartmentLink& lExpiratoryLimbToExpiratoryValve = m_Compartments->CreateLiquidLink(lExpiratoryLimb, lExpiratoryValve, pulse::MechanicalVentilatorLink::MechanicalVentilatorExpiratoryLimbToExpiratoryValve);
lExpiratoryLimbToExpiratoryValve.MapPath(ExpiratoryLimbToExpiratoryValve);
SELiquidCompartmentLink& lInspiratoryValveToInspiratoryLimb = m_Compartments->CreateLiquidLink(lInspiratoryValve, lInspiratoryLimb, pulse::MechanicalVentilatorLink::MechanicalVentilatorInspiratoryValveToInspiratoryLimb);
lInspiratoryValveToInspiratoryLimb.MapPath(InspiratoryValveToInspiratoryLimb);
SELiquidCompartmentLink& lExpiratoryLimbToYPiece = m_Compartments->CreateLiquidLink(lExpiratoryLimb, lYPiece, pulse::MechanicalVentilatorLink::MechanicalVentilatorExpiratoryLimbToYPiece);
lExpiratoryLimbToYPiece.MapPath(ExpiratoryLimbToYPiece);
SELiquidCompartmentLink& lInspiratoryLimbToYPiece = m_Compartments->CreateLiquidLink(lInspiratoryLimb, lYPiece, pulse::MechanicalVentilatorLink::MechanicalVentilatorInspiratoryLimbToYPiece);
lInspiratoryLimbToYPiece.MapPath(InspiratoryLimbToYPiece);
SELiquidCompartmentLink& lYPieceToConnection = m_Compartments->CreateLiquidLink(lYPiece, lConnection, pulse::MechanicalVentilatorLink::MechanicalVentilatorYPieceToConnection);
lYPieceToConnection.MapPath(YPieceToConnection);
SELiquidCompartmentLink& lConnectionToEnvironment = m_Compartments->CreateLiquidLink(lConnection, *lEnvironment, pulse::MechanicalVentilatorLink::MechanicalVentilatorConnectionToEnvironment);
lConnectionToEnvironment.MapPath(ConnectionToEnvironment);
//Graph
SELiquidCompartmentGraph& lCombinedMechanicalVentilator = m_Compartments->GetAerosolAndMechanicalVentilatorGraph();
//Respiratory Graph
lCombinedMechanicalVentilator.AddGraph(lAerosol);
lCombinedMechanicalVentilator.RemoveLink(pulse::PulmonaryLink::EnvironmentToMouth);
//Mechanical Ventilator Additions
lCombinedMechanicalVentilator.AddCompartment(lVentilator);
lCombinedMechanicalVentilator.AddCompartment(lExpiratoryValve);
lCombinedMechanicalVentilator.AddCompartment(lInspiratoryValve);
lCombinedMechanicalVentilator.AddCompartment(lExpiratoryLimb);
lCombinedMechanicalVentilator.AddCompartment(lInspiratoryLimb);
lCombinedMechanicalVentilator.AddCompartment(lYPiece);
lCombinedMechanicalVentilator.AddCompartment(lConnection);
lCombinedMechanicalVentilator.AddLink(lVentilatorToExpiratoryValve);
lCombinedMechanicalVentilator.AddLink(lVentilatorToInspiratoryValve);
lCombinedMechanicalVentilator.AddLink(lExpiratoryLimbToExpiratoryValve);
lCombinedMechanicalVentilator.AddLink(lInspiratoryValveToInspiratoryLimb);
lCombinedMechanicalVentilator.AddLink(lExpiratoryLimbToYPiece);
lCombinedMechanicalVentilator.AddLink(lInspiratoryLimbToYPiece);
lCombinedMechanicalVentilator.AddLink(lYPieceToConnection);
//lCombinedMechanicalVentilator.AddLink(lConnectionToEnvironment);
//Connection to Respiratory
lCombinedMechanicalVentilator.AddLink(lConnectionToMouth);
//Set it
lCombinedMechanicalVentilator.StateChange();
}
void PulseController::SetupNasalCannula()
......
......@@ -79,7 +79,7 @@ void MechanicalVentilator::SetUp()
// Compartments
m_Environment = m_data.GetCompartments().GetGasCompartment(pulse::EnvironmentCompartment::Ambient);
m_ventilator = m_data.GetCompartments().GetGasCompartment(pulse::MechanicalVentilatorCompartment::Ventilator);
m_ventilator = m_data.GetCompartments().GetGasCompartment(pulse::MechanicalVentilatorCompartment::MechanicalVentilator);
// Paths
m_pEnvironmentToVentilator = m_data.GetCircuits().GetMechanicalVentilatorCircuit().GetPath(pulse::MechanicalVentilatorPath::EnvironmentToVentilator);
......
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