Updates will be applied on October 27th between 12pm - 12:45pm EDT (UTC-0400). Gitlab may be slow during the maintenance window.

Commit 88875da5 authored by Jeff Webb's avatar Jeff Webb
Browse files

Added dead space increase and increased shunting with positive pressure ventilation.

Tweaks to respiratory disease mapping.
Added intrathoracici pressure effects to show up during ventilation - commented out for now.
parent 7560e08d
......@@ -100,18 +100,18 @@
"EquipmentAction": {
"MechanicalVentilatorConfiguration": {
"MechanicalVentilatorAction": { "EquipmentAction": { "Action": {
"Comment": "Attach the mechanical ventilator - RR = 16 bpm, I:E = 0.6, TV = 7 mL/kg(ideal)" }}},
"Comment": "Attach the mechanical ventilator - RR = 17 bpm, I:E = 0.6, TV = 8 mL/kg(ideal)" }}},
"Configuration":
{
"Connection": "Tube",
"InspirationWaveform": "Square",
"ExpirationWaveform": "Square",
"PeakInspiratoryPressure": { "ScalarPressure": { "Value": 16.5, "Unit": "cmH2O" } },
"PeakInspiratoryPressure": { "ScalarPressure": { "Value": 18.5, "Unit": "cmH2O" } },
"PositiveEndExpiredPressure": { "ScalarPressure": { "Value": 5.0, "Unit": "cmH2O" } },
"InspirationMachineTriggerTime": { "ScalarTime": { "Value": 2.344, "Unit": "s" } },
"ExpirationCycleTime": { "ScalarTime": { "Value": 1.406, "Unit": "s" } },
"InspirationMachineTriggerTime": { "ScalarTime": { "Value": 2.206, "Unit": "s" } },
"ExpirationCycleTime": { "ScalarTime": { "Value": 1.324, "Unit": "s" } },
"FractionInspiredGas": [
{ "Name": "Oxygen", "Amount": { "Scalar0To1": { "Value": 0.21, "Unit": "" } } }
{ "Name": "Oxygen", "Amount": { "Scalar0To1": { "Value": 0.3, "Unit": "" } } }
]
}
}
......
......@@ -119,7 +119,7 @@
"InspirationMachineTriggerTime": { "ScalarTime": { "Value": 1.974, "Unit": "s" } },
"ExpirationCycleTime": { "ScalarTime": { "Value": 1.776, "Unit": "s" } },
"FractionInspiredGas": [
{ "Name": "Oxygen", "Amount": { "Scalar0To1": { "Value": 0.35, "Unit": "" } } }
{ "Name": "Oxygen", "Amount": { "Scalar0To1": { "Value": 0.47, "Unit": "" } } }
]
}
}
......
......@@ -114,12 +114,12 @@
"Connection": "Tube",
"InspirationWaveform": "Square",
"ExpirationWaveform": "Square",
"PeakInspiratoryPressure": { "ScalarPressure": { "Value": 25.5, "Unit": "cmH2O" } },
"PeakInspiratoryPressure": { "ScalarPressure": { "Value": 30.0, "Unit": "cmH2O" } },
"PositiveEndExpiredPressure": { "ScalarPressure": { "Value": 11.0, "Unit": "cmH2O" } },
"InspirationMachineTriggerTime": { "ScalarTime": { "Value": 1.974, "Unit": "s" } },
"ExpirationCycleTime": { "ScalarTime": { "Value": 1.776, "Unit": "s" } },
"FractionInspiredGas": [
{ "Name": "Oxygen", "Amount": { "Scalar0To1": { "Value": 0.35, "Unit": "" } } }
{ "Name": "Oxygen", "Amount": { "Scalar0To1": { "Value": 0.47, "Unit": "" } } }
]
}
}
......
......@@ -129,7 +129,7 @@
"InspirationMachineTriggerTime": { "ScalarTime": { "Value": 3.228, "Unit": "s" } },
"ExpirationCycleTime": { "ScalarTime": { "Value": 1.388, "Unit": "s" } },
"FractionInspiredGas": [
{ "Name": "Oxygen", "Amount": { "Scalar0To1": { "Value": 0.31, "Unit": "" } } }
{ "Name": "Oxygen", "Amount": { "Scalar0To1": { "Value": 0.38, "Unit": "" } } }
]
}
}
......
......@@ -98,19 +98,19 @@
"EquipmentAction": {
"MechanicalVentilatorConfiguration": {
"MechanicalVentilatorAction": { "EquipmentAction": { "Action": {
"Comment": "Attach the mechanical ventilator - TV = 7 mL/kg(ideal)" }}},
"Comment": "Attach the mechanical ventilator - TV = 8 mL/kg(ideal)" }}},
"Configuration":
{
"Connection": "Tube",
"InspirationWaveform": "Square",
"ExpirationWaveform": "Square",
"InspirationTargetFlow": { "ScalarVolumePerTime": { "Value": 0.375, "Unit": "L/s" } },
"InspirationTargetFlow": { "ScalarVolumePerTime": { "Value": 0.455, "Unit": "L/s" } },
"PositiveEndExpiredPressure": { "ScalarPressure": { "Value": 5.0, "Unit": "cmH2O" } },
"InspirationMachineTriggerTime": { "ScalarTime": { "Value": 10.0, "Unit": "s" } },
"InspirationPatientTriggerPressure": { "ScalarPressure": { "Value": -0.000001, "Unit": "cmH2O" } },
"ExpirationCycleVolume": { "ScalarVolume": { "Value": 0.527, "Unit": "L" } },
"ExpirationCycleVolume": { "ScalarVolume": { "Value": 0.602, "Unit": "L" } },
"FractionInspiredGas": [
{ "Name": "Oxygen", "Amount": { "Scalar0To1": { "Value": 0.21, "Unit": "" } } }
{ "Name": "Oxygen", "Amount": { "Scalar0To1": { "Value": 0.3, "Unit": "" } } }
]
}
}
......
......@@ -100,18 +100,18 @@
"EquipmentAction": {
"MechanicalVentilatorConfiguration": {
"MechanicalVentilatorAction": { "EquipmentAction": { "Action": {
"Comment": "Attach the mechanical ventilator - RR = 16 bpm, I:E = 0.6, TV = 7 mL/kg(ideal)" }}},
"Comment": "Attach the mechanical ventilator - RR = 17 bpm, I:E = 0.6, TV = 8 mL/kg(ideal)" }}},
"Configuration":
{
"Connection": "Tube",
"InspirationWaveform": "Square",
"ExpirationWaveform": "Square",
"InspirationTargetFlow": { "ScalarVolumePerTime": { "Value": 0.375, "Unit": "L/s" } },
"InspirationTargetFlow": { "ScalarVolumePerTime": { "Value": 0.455, "Unit": "L/s" } },
"PositiveEndExpiredPressure": { "ScalarPressure": { "Value": 5.0, "Unit": "cmH2O" } },
"InspirationMachineTriggerTime": { "ScalarTime": { "Value": 2.344, "Unit": "s" } },
"ExpirationCycleVolume": { "ScalarVolume": { "Value": 0.527, "Unit": "L" } },
"InspirationMachineTriggerTime": { "ScalarTime": { "Value": 2.206, "Unit": "s" } },
"ExpirationCycleVolume": { "ScalarVolume": { "Value": 0.602, "Unit": "L" } },
"FractionInspiredGas": [
{ "Name": "Oxygen", "Amount": { "Scalar0To1": { "Value": 0.21, "Unit": "" } } }
{ "Name": "Oxygen", "Amount": { "Scalar0To1": { "Value": 0.3, "Unit": "" } } }
]
}
}
......
......@@ -7086,3 +7086,26 @@ title = {{Sympathetic nerve activity and heart rate variability during severe he
url = {www.elsevier.com/locate/autneu},
year = {2007}
}
@article{verhoeff2017cardiopulmonary,
title={Cardiopulmonary physiology: why the heart and lungs are inextricably linked},
author={Verhoeff, Kevin and Mitchell, Jamie R},
journal={Advances in physiology education},
volume={41},
number={3},
pages={348--353},
year={2017},
publisher={American Physiological Society Bethesda, MD}
}
@article{luecke2005clinical,
title={Clinical review: positive end-expiratory pressure and cardiac output},
author={Luecke, Thomas and Pelosi, Paolo},
journal={Critical Care},
volume={9},
number={6},
pages={607},
year={2005},
publisher={BioMed Central}
}
......@@ -160,6 +160,8 @@ void Cardiovascular::Clear()
m_leftPleuralCavity = nullptr;
m_rightPleuralCavity = nullptr;
m_PleuralCavity = nullptr;
m_Ambient = nullptr;
m_CardiacCycleArterialPressure_mmHg->Clear();
m_CardiacCycleArterialCO2PartialPressure_mmHg->Clear();
......@@ -296,6 +298,8 @@ void Cardiovascular::SetUp()
//Respiratory Compartments
m_leftPleuralCavity = m_data.GetCompartments().GetGasCompartment(pulse::PulmonaryCompartment::LeftPleuralCavity);
m_rightPleuralCavity = m_data.GetCompartments().GetGasCompartment(pulse::PulmonaryCompartment::RightPleuralCavity);
m_PleuralCavity = m_data.GetCompartments().GetGasCompartment(pulse::PulmonaryCompartment::PleuralCavity);
m_Ambient = m_data.GetCompartments().GetGasCompartment(pulse::EnvironmentCompartment::Ambient);
//Nodes
m_MainPulmonaryArteries = m_CirculatoryCircuit->GetNode(pulse::CardiovascularNode::MainPulmonaryArteries);
m_LeftHeart2 = m_CirculatoryCircuit->GetNode(pulse::CardiovascularNode::LeftHeart2);
......@@ -1846,14 +1850,47 @@ void Cardiovascular::UpdateHeartRhythm()
/// When a lung collapses (as with pneumothorax), increased pleural cavity pressure pushes on the
/// mediastinum and great veins. As an effect, the mediastinum is displaced and the great veins
/// become kinked, leading to decreased venous return to the heart. This leads to increasing cardiac
/// and respiratory embarrasment. http://medind.nic.in/jac/t08/i1/jact08i1p42.pdf
/// and respiratory embarrasment. @cite jain2008understanding
//--------------------------------------------------------------------------------------------------
void Cardiovascular::CalculatePleuralCavityVenousEffects()
{
//The left and right pleural pressures are likely to have large differences only due to a pneumothorax
//Pressure difference causes a mediastinum shift
double rightHeartResistance_mmHg_s_Per_mL = m_RightHeartResistance->GetNextResistance(PressureTimePerVolumeUnit::mmHg_s_Per_mL);
//-----------------------------------------------------------------------------------------------------
//\\\todo Add this and test/tune
////Lung volume/pressure has a direct effect on cardiac output ///\cite verhoeff2017cardiopulmonary
////Decreased venous return occurs in disease states and with mechanical ventilation through an increased PEEP ///\cite luecke2005clinical
////Get the current pleural cavity pressure (reletive to ambient)
//double baselineIntrapleuralPressure_cmH2O = -5.0; /// \cite Levitzky2013pulmonary
//double pleuralCavityPressureBaselineDiff_cmH2O = m_PleuralCavity->GetPressure(PressureUnit::cmH2O) - m_Ambient->GetPressure(PressureUnit::cmH2O) - baselineIntrapleuralPressure_cmH2O;
////Increase resistance if it's above healthy PEEP
////Healthy PEEP is always zero and pleural cavity pressure is negative during inhalation
//if (pleuralCavityPressureBaselineDiff_cmH2O > 0.0)
//{
// double maxPressure_cmH2O = 5.0;
// double maxResistanceMultiplier = 10.0;
// pleuralCavityPressureBaselineDiff_cmH2O = MIN(pleuralCavityPressureBaselineDiff_cmH2O, maxPressure_cmH2O);
// //Interpolate into a parabola to effect things much more at larger differences
// double min = 1.0;
// double max = maxResistanceMultiplier;
// double a = max - min;
// double factor = pleuralCavityPressureBaselineDiff_cmH2O / maxPressure_cmH2O;
// double resistanceMultiplier = a * factor * factor + min;
// rightHeartResistance_mmHg_s_Per_mL *= resistanceMultiplier;
//}
//-----------------------------------------------------------------------------------------------------
//Pressure difference causes a mediastinum shift, which also effects the venous return
//The left and right pleural pressures are likely to have large differences only due to a pneumothorax
double pleuralCavityPressureDiff_cmH2O = std::abs(m_leftPleuralCavity->GetPressure(PressureUnit::cmH2O) - m_rightPleuralCavity->GetPressure(PressureUnit::cmH2O));
double maxPressureDiff_cmH2O = 20.0;
double maxResistanceMultiplier = 10.0;
pleuralCavityPressureDiff_cmH2O = MIN(pleuralCavityPressureDiff_cmH2O, maxPressureDiff_cmH2O);
......@@ -1865,20 +1902,23 @@ void Cardiovascular::CalculatePleuralCavityVenousEffects()
double factor = pleuralCavityPressureDiff_cmH2O / maxPressureDiff_cmH2O;
double resistanceMultiplier = a * factor * factor + min;
double rightHeartResistance_mmHg_s_Per_mL = m_RightHeartResistance->GetNextResistance(PressureTimePerVolumeUnit::mmHg_s_Per_mL);
rightHeartResistance_mmHg_s_Per_mL *= resistanceMultiplier;
//-----------------------------------------------------------------------------------------------------
//Dampen the change to prevent potential craziness
//It will only change half as much as it wants to each time step to ensure it's critically damped and doesn't overshoot
//It will only change a fraction as much as it wants to each time step to ensure it's critically damped and doesn't overshoot
double dampenFraction_perSec = 0.001 * 50.0;
double previousRightHeartResistance_mmHg_s_Per_mL = m_RightHeartResistance->GetResistance(PressureTimePerVolumeUnit::mmHg_s_Per_mL);
double resistanceChange_L_Per_mmHg_s_Per_mL = (rightHeartResistance_mmHg_s_Per_mL - previousRightHeartResistance_mmHg_s_Per_mL) * dampenFraction_perSec * m_dT_s;
rightHeartResistance_mmHg_s_Per_mL = previousRightHeartResistance_mmHg_s_Per_mL + resistanceChange_L_Per_mmHg_s_Per_mL;
m_RightHeartResistance->GetNextResistance().SetValue(rightHeartResistance_mmHg_s_Per_mL, PressureTimePerVolumeUnit::mmHg_s_Per_mL);
//For tuning
//m_data.GetDataTrack().Probe("pleuralCavityPressureBaselineDiff_cmH2O", pleuralCavityPressureBaselineDiff_cmH2O);
//m_data.GetDataTrack().Probe("pleuralCavityPressureDiff_cmH2O", pleuralCavityPressureDiff_cmH2O);
//m_data.GetDataTrack().Probe("resistanceMultiplier", resistanceMultiplier);
//m_data.GetDataTrack().Probe("rightHeartResistance_mmHg_s_Per_mL", rightHeartResistance_mmHg_s_Per_mL);
......
......@@ -211,6 +211,8 @@ protected:
SEGasCompartment* m_leftPleuralCavity;
SEGasCompartment* m_rightPleuralCavity;
SEGasCompartment* m_PleuralCavity;
SEGasCompartment* m_Ambient;
std::vector<SEFluidCircuitPath*> m_systemicResistancePaths;
std::vector<SEFluidCircuitPath*> m_systemicCompliancePaths;
......
......@@ -1308,7 +1308,8 @@ void Respiratory::RespiratoryDriver()
m_data.GetEvents().SetEvent(eEvent::StartOfExhale, true, m_data.GetSimulationTime());
}
//double pi = 3.14159265359;
//jbw - updated expiration to new waveforms
double pi = 3.14159265359;
if (m_BreathingCycleTime_s >= ResidueFractionTimeStart_s)
{
m_DriverPressure_cmH2O = 0.0;
......@@ -1333,11 +1334,11 @@ void Respiratory::RespiratoryDriver()
}
else if (m_BreathingCycleTime_s >= InspiratoryReleaseTimeStart_s)
{
double ventilationFrequency_Per_min = 60.0 / (m_InspiratoryReleaseFraction * TotalBreathingCycleTime_s);
m_DriverPressure_cmH2O = m_PeakInspiratoryPressure_cmH2O * (exp(-((ventilationFrequency_Per_min + m_VentilatoryOcclusionPressure_cmH2O / 2.0) / 10.0) * (m_BreathingCycleTime_s - InspiratoryReleaseTimeStart_s)));
//double ventilationFrequency_Per_min = 60.0 / (m_InspiratoryReleaseFraction * TotalBreathingCycleTime_s);
//m_DriverPressure_cmH2O = m_PeakInspiratoryPressure_cmH2O * (exp(-((ventilationFrequency_Per_min + m_VentilatoryOcclusionPressure_cmH2O / 2.0) / 10.0) * (m_BreathingCycleTime_s - InspiratoryReleaseTimeStart_s)));
//double segmentTime_s = InspiratoryToExpiratoryPauseTimeStart_s - InspiratoryReleaseTimeStart_s;
//m_DriverPressure_cmH2O = m_PeakInspiratoryPressure_cmH2O * sin(pi / 2.0 * (m_BreathingCycleTime_s + segmentTime_s - InspiratoryReleaseTimeStart_s) / (segmentTime_s));
double segmentTime_s = InspiratoryToExpiratoryPauseTimeStart_s - InspiratoryReleaseTimeStart_s;
m_DriverPressure_cmH2O = m_PeakInspiratoryPressure_cmH2O * sin(pi / 2.0 * (m_BreathingCycleTime_s + segmentTime_s - InspiratoryReleaseTimeStart_s) / (segmentTime_s));
}
else if (m_BreathingCycleTime_s >= InspiratoryHoldTimeStart_s)
{
......@@ -1345,10 +1346,10 @@ void Respiratory::RespiratoryDriver()
}
else //(m_BreathingCycleTime_s >= InspiratoryRiseTimeStart_s)
{
double ventilationFrequency_Per_min = 60.0 / (m_InspiratoryRiseFraction * TotalBreathingCycleTime_s);
m_DriverPressure_cmH2O = m_PeakInspiratoryPressure_cmH2O * (1.0 - exp(-((ventilationFrequency_Per_min + 4.0 * m_VentilatoryOcclusionPressure_cmH2O) / 10.0) * m_BreathingCycleTime_s));
//double ventilationFrequency_Per_min = 60.0 / (m_InspiratoryRiseFraction * TotalBreathingCycleTime_s);
//m_DriverPressure_cmH2O = m_PeakInspiratoryPressure_cmH2O * (1.0 - exp(-((ventilationFrequency_Per_min + 4.0 * m_VentilatoryOcclusionPressure_cmH2O) / 10.0) * m_BreathingCycleTime_s));
//m_DriverPressure_cmH2O = m_PeakInspiratoryPressure_cmH2O * sin(pi / 2.0 * m_BreathingCycleTime_s / InspiratoryHoldTimeStart_s);
m_DriverPressure_cmH2O = m_PeakInspiratoryPressure_cmH2O * sin(pi / 2.0 * m_BreathingCycleTime_s / InspiratoryHoldTimeStart_s);
}
if (!m_PatientActions->HasConsciousRespiration())
......@@ -1393,11 +1394,14 @@ void Respiratory::SetBreathCycleFractions()
//Healthy = ~1:2 IE Ratio = 0.33 inpiration and 0.67 expiration
///\cite Fresnel2014musclePressure
//Adjust for standard 12 bpm giving ~0.33 instead of 16 bpm by adding 4
m_InspiratoryRiseFraction = (0.0125 * (m_VentilationFrequency_Per_min + 4.0) + 0.125) * m_IERatioScaleFactor;
m_InspiratoryRiseFraction = LIMIT(m_InspiratoryRiseFraction, 0.1, 0.9);
double inspiratoryFraction = (0.0125 * (m_VentilationFrequency_Per_min + 4.0) + 0.125) * m_IERatioScaleFactor;
inspiratoryFraction = LIMIT(inspiratoryFraction, 0.1, 0.9);
double expiratoryFraction = 1.0 - inspiratoryFraction;
m_InspiratoryRiseFraction = inspiratoryFraction;
m_InspiratoryHoldFraction = 0.0;
m_InspiratoryReleaseFraction = 1.0 - m_InspiratoryRiseFraction;
m_InspiratoryToExpiratoryPauseFraction = 0.0;
m_InspiratoryReleaseFraction = 0.5 * expiratoryFraction;
m_InspiratoryToExpiratoryPauseFraction = 0.5 * expiratoryFraction;
m_ExpiratoryRiseFraction = 0.0;
m_ExpiratoryHoldFraction = 0.0;
m_ExpiratoryReleaseFraction = 0.0;
......@@ -2318,6 +2322,17 @@ void Respiratory::UpdateVolumes()
double leftAlveolarDeadSpaceIncrease_L = 0.0;
double rightAlveolarDeadSpaceIncrease_L = 0.0;
//------------------------------------------------------------------------------------------------------
//Positive Pressure Ventilation
if (m_data.GetAirwayMode() == eAirwayMode::AnesthesiaMachine ||
m_data.GetAirwayMode() == eAirwayMode::MechanicalVentilation ||
m_data.GetAirwayMode() == eAirwayMode::MechanicalVentilator)
{
double ventilatorIncrease_L = 0.05;
leftAlveolarDeadSpaceIncrease_L += ventilatorIncrease_L;
rightAlveolarDeadSpaceIncrease_L += ventilatorIncrease_L;
}
//------------------------------------------------------------------------------------------------------
//COPD
//Exacerbation will overwrite the condition, even if it means improvement
......@@ -2623,8 +2638,8 @@ void Respiratory::UpdateAlveolarCompliances()
emphysemaSeverity = m_data.GetConditions().GetChronicObstructivePulmonaryDisease().GetEmphysemaSeverity().GetValue();
}
double complianceScalingFactor = GeneralMath::LinearInterpolator(0.0, 1.0, 1.0, 1.2, emphysemaSeverity);
double complianceScalingFactor = GeneralMath::LinearInterpolator(0.0, 1.0, 1.0, 1.1, emphysemaSeverity);
leftObstructiveComplianceScalingFactor = MAX(leftObstructiveComplianceScalingFactor, complianceScalingFactor);
rightObstructiveComplianceScalingFactor = MAX(rightObstructiveComplianceScalingFactor, complianceScalingFactor);
}
......@@ -3134,6 +3149,17 @@ void Respiratory::UpdatePulmonaryShunt()
double rightSeverity = 0.0;
double leftSeverity = 0.0;
//------------------------------------------------------------------------------------------------------
//Positive Pressure Ventilation
if (m_data.GetAirwayMode() == eAirwayMode::AnesthesiaMachine ||
m_data.GetAirwayMode() == eAirwayMode::MechanicalVentilation ||
m_data.GetAirwayMode() == eAirwayMode::MechanicalVentilator)
{
double shuntResistanceFactor = 0.3;
m_RightPulmonaryArteriesToVeins->GetNextResistance().MultiplyValue(shuntResistanceFactor, PressureTimePerVolumeUnit::mmHg_s_Per_mL);
m_LeftPulmonaryArteriesToVeins->GetNextResistance().MultiplyValue(shuntResistanceFactor, PressureTimePerVolumeUnit::mmHg_s_Per_mL);
}
//------------------------------------------------------------------------------------------------------
//PulmonaryShunt
//Exacerbation will overwrite the condition, even if it means improvement
......@@ -3208,8 +3234,8 @@ void Respiratory::UpdatePulmonaryShunt()
leftSeverity = MAX(leftSeverity, leftScaledSeverity);
}
double rightPulmonaryShuntScalingFactor = GeneralMath::ExponentialDecayFunction(10, 0.01, 1.0, rightSeverity);
double leftPulmonaryShuntScalingFactor = GeneralMath::ExponentialDecayFunction(10, 0.01, 1.0, leftSeverity);
double rightPulmonaryShuntScalingFactor = GeneralMath::ExponentialDecayFunction(10, 0.05, 1.0, rightSeverity);
double leftPulmonaryShuntScalingFactor = GeneralMath::ExponentialDecayFunction(10, 0.05, 1.0, leftSeverity);
double rightPulmonaryShuntResistance = m_RightPulmonaryArteriesToVeins->GetNextResistance().GetValue(PressureTimePerVolumeUnit::mmHg_s_Per_mL);
double leftPulmonaryShuntResistance = m_LeftPulmonaryArteriesToVeins->GetNextResistance().GetValue(PressureTimePerVolumeUnit::mmHg_s_Per_mL);
......
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