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

Cleanup, remove probes, final tuning for review

parent 15ea0b03
......@@ -649,37 +649,6 @@ namespace pulse
HeartDriver();
UpdatePulmonaryCapillaries();
CalculatePleuralCavityVenousEffects();
m_data.GetDataTrack().Probe("ArrhythmiaHeartComplianceModifier", m_ArrhythmiaHeartComplianceModifier);
m_data.GetDataTrack().Probe("ArrhythmiaHeartRateBaseline_Per_min", m_ArrhythmiaHeartRateBaseline_Per_min);
m_data.GetDataTrack().Probe("ArrhythmiaVascularComplianceModifier", m_ArrhythmiaVascularComplianceModifier);
m_data.GetDataTrack().Probe("ArrhythmiaSystemicVascularResistanceModifier", m_ArrhythmiaSystemicVascularResistanceModifier);
m_data.GetDataTrack().Probe("LeftHeartCompliance_mL_Per_mmHg", m_pLeftHeart->GetNextCompliance(VolumePerPressureUnit::mL_Per_mmHg));
m_data.GetDataTrack().Probe("RightHeartCompliance_mL_Per_mmHg", m_pRightHeart->GetNextCompliance(VolumePerPressureUnit::mL_Per_mmHg));
m_data.GetDataTrack().Probe("LeftHeartElastance_mmHg_Per_mL", m_LeftHeartElastance_mmHg_Per_mL);
m_data.GetDataTrack().Probe("RightHeartElastance_mmHg_Per_mL", m_RightHeartElastance_mmHg_Per_mL);
m_data.GetDataTrack().Probe("LeftPulmonaryArteriesToVeinsFlow_mL_Per_s", m_LeftPulmonaryArteriesToVeins->GetNextFlow(VolumePerTimeUnit::mL_Per_s));
m_data.GetDataTrack().Probe("LeftPulmonaryArteriesToCapillariesFlow_mL_Per_s", m_LeftPulmonaryArteriesToCapillaries->GetNextFlow(VolumePerTimeUnit::mL_Per_s));
m_data.GetDataTrack().Probe("RightPulmonaryArteriesToVeinsFlow_mL_Per_s", m_RightPulmonaryArteriesToVeins->GetNextFlow(VolumePerTimeUnit::mL_Per_s));
m_data.GetDataTrack().Probe("RightPulmonaryArteriesToCapillariesFlow_mL_Per_s", m_RightPulmonaryArteriesToCapillaries->GetNextFlow(VolumePerTimeUnit::mL_Per_s));
m_data.GetDataTrack().Probe("LeftPulmonaryVeinsCompliance_mL_Per_mmHg", m_LeftPulmonaryVeinsCompliance->GetNextCompliance(VolumePerPressureUnit::mL_Per_mmHg));
m_data.GetDataTrack().Probe("RighPulmonaryVeinstCompliance_mL_Per_mmHg", m_RightPulmonaryVeinsCompliance->GetNextCompliance(VolumePerPressureUnit::mL_Per_mmHg));
m_data.GetDataTrack().Probe("LeftPulmonaryVeinsPressure_mmHg", m_LeftPulmonaryVeinsCompliance->GetSourceNode().GetNextPressure(PressureUnit::mmHg));
m_data.GetDataTrack().Probe("RighPulmonaryVeinsPressure_mmHg", m_RightPulmonaryVeinsCompliance->GetSourceNode().GetNextPressure(PressureUnit::mmHg));
m_data.GetDataTrack().Probe("LeftHeartPressureSource_mmHg", m_pLeftHeartToGnd->GetNextPressureSource().GetValue(PressureUnit::mmHg));
m_data.GetDataTrack().Probe("RightHeartPressureSource_mmHg", m_pRightHeartToGnd->GetNextPressureSource().GetValue(PressureUnit::mmHg));
m_data.GetDataTrack().Probe("PulmonaryCapillariesCoverageFraction", GetPulmonaryCapillariesCoverageFraction().GetValue());
m_data.GetDataTrack().Probe("MeanArterialPressureBaseline", m_data.GetCurrentPatient().GetMeanArterialPressureBaseline(PressureUnit::mmHg));
m_data.GetDataTrack().Probe("HeartRateBaseline", m_data.GetCurrentPatient().GetHeartRateBaseline(FrequencyUnit::Per_min));
}
//--------------------------------------------------------------------------------------------------
......@@ -1742,16 +1711,18 @@ namespace pulse
m_CurrentArrhythmiaTransitionTime_s = 0;
m_TotalArrhythmiaTransitionTime_s = 20;
m_InitialArrhythmiaHeartComplianceModifier = m_ArrhythmiaHeartComplianceModifier;
m_InitialArrhythmiaHeartRateBaseline_Per_min = m_ArrhythmiaHeartRateBaseline_Per_min = GetHeartRate(FrequencyUnit::Per_min);
m_InitialArrhythmiaVascularComplianceModifier = m_ArrhythmiaVascularComplianceModifier;
m_InitialArrhythmiaSystemicVascularResistanceModifier = m_ArrhythmiaSystemicVascularResistanceModifier;
m_InitialArrhythmiaHeartComplianceModifier =
m_ArrhythmiaHeartComplianceModifier =
m_TargetArrhythmiaHeartComplianceModifier = 1;// Does not matter, we hard code the heart compliance during cardiac arrest
m_TargetArrhythmiaHeartComplianceModifier = 20;
m_TargetArrhythmiaHeartRateBaseline_Per_min = 35;
m_TargetArrhythmiaVascularComplianceModifier = 2.;
m_TargetArrhythmiaSystemicVascularResistanceModifier = 0.5;
m_InitialArrhythmiaHeartRateBaseline_Per_min = m_ArrhythmiaHeartRateBaseline_Per_min = GetHeartRate(FrequencyUnit::Per_min);
m_TargetArrhythmiaVascularComplianceModifier = 2.;
m_InitialArrhythmiaVascularComplianceModifier = m_ArrhythmiaVascularComplianceModifier;
m_TargetArrhythmiaSystemicVascularResistanceModifier = 0.33;
m_InitialArrhythmiaSystemicVascularResistanceModifier = m_ArrhythmiaSystemicVascularResistanceModifier;
m_data.GetCurrentPatient().GetMeanArterialPressureBaseline().SetValue(m_TargetArrhythmiaHeartRateBaseline_Per_min, PressureUnit::mmHg);
......@@ -1765,27 +1736,25 @@ namespace pulse
m_CurrentArrhythmiaTransitionTime_s = 0;
m_TotalArrhythmiaTransitionTime_s = 150;
m_TargetArrhythmiaHeartRateBaseline_Per_min = m_StabilizedHeartRateBaseline_Per_min;
m_ArrhythmiaHeartComplianceModifier =
m_InitialArrhythmiaHeartComplianceModifier = 2.0;
m_TargetArrhythmiaHeartComplianceModifier = 1.0;
m_InitialArrhythmiaHeartRateBaseline_Per_min =
m_ArrhythmiaHeartRateBaseline_Per_min;
m_TargetArrhythmiaHeartRateBaseline_Per_min = m_StabilizedHeartRateBaseline_Per_min;
m_InitialArrhythmiaVascularComplianceModifier =
m_ArrhythmiaVascularComplianceModifier = 3.0;
m_ArrhythmiaVascularComplianceModifier;
m_TargetArrhythmiaVascularComplianceModifier = 1.0;
m_TargetArrhythmiaSystemicVascularResistanceModifier = 1.0;
m_InitialArrhythmiaSystemicVascularResistanceModifier =
m_ArrhythmiaSystemicVascularResistanceModifier = 0.25;
m_ArrhythmiaHeartComplianceModifier =
m_InitialArrhythmiaHeartComplianceModifier = 1.0;
m_TargetArrhythmiaHeartComplianceModifier = 1.0;
m_ArrhythmiaSystemicVascularResistanceModifier;
m_TargetArrhythmiaSystemicVascularResistanceModifier = 1.0;
m_EnableFeedbackAfterArrhythmiaTrasition = eSwitch::On;
m_data.GetEvents().SetEvent(eEvent::CardiacArrest, false, m_data.GetSimulationTime());
m_data.GetCurrentPatient().GetMeanArterialPressureBaseline().SetValue(m_StabilizedMeanArterialPressureBaseline_mmHg, PressureUnit::mmHg);
// Force a new cardiac cycle
m_StartSystole = true;
m_HeartFlowDetected = true;
......@@ -1812,24 +1781,28 @@ namespace pulse
m_CurrentArrhythmiaTransitionTime_s = 0;
m_TotalArrhythmiaTransitionTime_s = 150;
m_TargetArrhythmiaHeartRateBaseline_Per_min = 130;
m_InitialArrhythmiaHeartRateBaseline_Per_min = m_ArrhythmiaHeartRateBaseline_Per_min;
m_ArrhythmiaHeartComplianceModifier =
m_InitialArrhythmiaHeartComplianceModifier = 2.0;
m_TargetArrhythmiaHeartComplianceModifier = 1.0;
m_InitialArrhythmiaVascularComplianceModifier = m_ArrhythmiaVascularComplianceModifier;
m_InitialArrhythmiaHeartRateBaseline_Per_min =
m_ArrhythmiaHeartRateBaseline_Per_min;
m_TargetArrhythmiaHeartRateBaseline_Per_min = 130;
m_InitialArrhythmiaVascularComplianceModifier =
m_ArrhythmiaVascularComplianceModifier;
m_TargetArrhythmiaVascularComplianceModifier = 1.0;
m_InitialArrhythmiaSystemicVascularResistanceModifier = m_ArrhythmiaSystemicVascularResistanceModifier;
m_ArrhythmiaHeartComplianceModifier = 1.0;
m_InitialArrhythmiaHeartComplianceModifier = 1.0;
m_InitialArrhythmiaSystemicVascularResistanceModifier =
m_ArrhythmiaSystemicVascularResistanceModifier;
m_TargetArrhythmiaSystemicVascularResistanceModifier = 1.0;
m_EnableFeedbackAfterArrhythmiaTrasition = eSwitch::On;
m_data.GetEvents().SetEvent(eEvent::CardiacArrest, false, m_data.GetSimulationTime());
// Force a new cardiac cycle
m_HeartFlowDetected = false;
m_StartSystole = true;
m_HeartFlowDetected = true;
m_CurrentDriverCycleTime_s = 0;
m_DriverCyclePeriod_s = m_CurrentCardiacCycleTime_s = 60 / m_InitialArrhythmiaHeartRateBaseline_Per_min;
}
......@@ -1930,12 +1903,18 @@ namespace pulse
{
Info("Completed Arrhythmia Transition");
m_TotalArrhythmiaTransitionTime_s = 0;
m_CurrentArrhythmiaTransitionTime_s = 0;
m_data.GetNervous().SetBaroreceptorFeedback(m_EnableFeedbackAfterArrhythmiaTrasition);
m_data.GetNervous().SetChemoreceptorFeedback(m_EnableFeedbackAfterArrhythmiaTrasition);
m_ArrhythmiaHeartComplianceModifier = m_TargetArrhythmiaHeartComplianceModifier;
m_ArrhythmiaHeartRateBaseline_Per_min = m_TargetArrhythmiaHeartRateBaseline_Per_min;
m_ArrhythmiaVascularComplianceModifier = m_TargetArrhythmiaVascularComplianceModifier;
m_ArrhythmiaSystemicVascularResistanceModifier = m_TargetArrhythmiaSystemicVascularResistanceModifier;
m_data.GetCurrentPatient().GetMeanArterialPressureBaseline().Set(GetMeanArterialPressure()); //
//m_data.GetCurrentPatient().GetMeanArterialPressureBaseline().SetValue(m_StabilizedMeanArterialPressureBaseline_mmHg, PressureUnit::mmHg);
}
else
{
......@@ -2254,12 +2233,29 @@ namespace pulse
BaroreceptorComplianceScale = m_data.GetNervous().GetBaroreceptorComplianceScale().GetValue();
}
double VascularComplianceModifier;
double SystemicVascularResistanceModifier;
double map_mmHg = GetMeanArterialPressure(PressureUnit::mmHg);
// Handle any MAP changes due to CPR
if (m_data.GetEvents().IsEventActive(eEvent::CardiacArrest) && (m_CurrentArrhythmiaTransitionTime_s==0) && map_mmHg < 45)
{
// 1/45 == 0.02
VascularComplianceModifier = GeneralMath::ExponentialDecayFunction(10, 1.15, 1.85, map_mmHg*0.02);
SystemicVascularResistanceModifier = GeneralMath::ExponentialGrowthFunction(10, 0.25, 0.75, map_mmHg*0.02);
}
else
{
VascularComplianceModifier = m_ArrhythmiaVascularComplianceModifier;
SystemicVascularResistanceModifier = m_ArrhythmiaSystemicVascularResistanceModifier;
}
for (SEFluidCircuitPath* Path : m_systemicResistancePaths)
{
/// \todo We are treating all systemic resistance paths equally, including the brain.
UpdatedResistance_mmHg_s_Per_mL = Path->GetNextResistance(PressureTimePerVolumeUnit::mmHg_s_Per_mL);
UpdatedResistance_mmHg_s_Per_mL *= BaroreceptorResistanceScale;
UpdatedResistance_mmHg_s_Per_mL *= m_ArrhythmiaSystemicVascularResistanceModifier;
UpdatedResistance_mmHg_s_Per_mL *= SystemicVascularResistanceModifier;
if (UpdatedResistance_mmHg_s_Per_mL < m_minIndividialSystemicResistance_mmHg_s_Per_mL)
{
UpdatedResistance_mmHg_s_Per_mL = m_minIndividialSystemicResistance_mmHg_s_Per_mL;
......@@ -2271,38 +2267,38 @@ namespace pulse
{
UpdatedCompliance_mL_Per_mmHg = Path->GetNextCompliance(VolumePerPressureUnit::mL_Per_mmHg);
UpdatedCompliance_mL_Per_mmHg *= BaroreceptorComplianceScale;
UpdatedCompliance_mL_Per_mmHg *= m_ArrhythmiaVascularComplianceModifier;
UpdatedCompliance_mL_Per_mmHg *= VascularComplianceModifier;
Path->GetNextCompliance().SetValue(UpdatedCompliance_mL_Per_mmHg, VolumePerPressureUnit::mL_Per_mmHg);
}
// Aorta Compliance
UpdatedCompliance_mL_Per_mmHg = m_AortaCompliance->GetNextCompliance(VolumePerPressureUnit::mL_Per_mmHg);
UpdatedCompliance_mL_Per_mmHg *= m_ArrhythmiaVascularComplianceModifier;
UpdatedCompliance_mL_Per_mmHg *= VascularComplianceModifier;
m_AortaCompliance->GetNextCompliance().SetValue(UpdatedCompliance_mL_Per_mmHg, VolumePerPressureUnit::mL_Per_mmHg);
// Vena Cava Compliance
UpdatedCompliance_mL_Per_mmHg = m_VenaCavaCompliance->GetNextCompliance(VolumePerPressureUnit::mL_Per_mmHg);
UpdatedCompliance_mL_Per_mmHg *= m_ArrhythmiaVascularComplianceModifier;
UpdatedCompliance_mL_Per_mmHg *= VascularComplianceModifier;
m_VenaCavaCompliance->GetNextCompliance().SetValue(UpdatedCompliance_mL_Per_mmHg, VolumePerPressureUnit::mL_Per_mmHg);
// Pulmonary Arteries
UpdatedCompliance_mL_Per_mmHg = m_LeftPulmonaryArteriesCompliance->GetNextCompliance(VolumePerPressureUnit::mL_Per_mmHg);
UpdatedCompliance_mL_Per_mmHg *= m_ArrhythmiaVascularComplianceModifier;
UpdatedCompliance_mL_Per_mmHg *= VascularComplianceModifier;
m_LeftPulmonaryArteriesCompliance->GetNextCompliance().SetValue(UpdatedCompliance_mL_Per_mmHg, VolumePerPressureUnit::mL_Per_mmHg);
UpdatedCompliance_mL_Per_mmHg = m_RightPulmonaryArteriesCompliance->GetNextCompliance(VolumePerPressureUnit::mL_Per_mmHg);
UpdatedCompliance_mL_Per_mmHg *= m_ArrhythmiaVascularComplianceModifier;
UpdatedCompliance_mL_Per_mmHg *= VascularComplianceModifier;
m_RightPulmonaryArteriesCompliance->GetNextCompliance().SetValue(UpdatedCompliance_mL_Per_mmHg, VolumePerPressureUnit::mL_Per_mmHg);
// Pulmonary Capillaries
UpdatedCompliance_mL_Per_mmHg = m_LeftPulmonaryCapillariesCompliance->GetNextCompliance(VolumePerPressureUnit::mL_Per_mmHg);
UpdatedCompliance_mL_Per_mmHg *= m_ArrhythmiaVascularComplianceModifier;
UpdatedCompliance_mL_Per_mmHg *= VascularComplianceModifier;
m_LeftPulmonaryCapillariesCompliance->GetNextCompliance().SetValue(UpdatedCompliance_mL_Per_mmHg, VolumePerPressureUnit::mL_Per_mmHg);
UpdatedCompliance_mL_Per_mmHg = m_RightPulmonaryCapillariesCompliance->GetNextCompliance(VolumePerPressureUnit::mL_Per_mmHg);
UpdatedCompliance_mL_Per_mmHg *= m_ArrhythmiaVascularComplianceModifier;
UpdatedCompliance_mL_Per_mmHg *= VascularComplianceModifier;
m_RightPulmonaryCapillariesCompliance->GetNextCompliance().SetValue(UpdatedCompliance_mL_Per_mmHg, VolumePerPressureUnit::mL_Per_mmHg);
// Pulmonary Veins
UpdatedCompliance_mL_Per_mmHg = m_LeftPulmonaryVeinsCompliance->GetNextCompliance(VolumePerPressureUnit::mL_Per_mmHg);
UpdatedCompliance_mL_Per_mmHg *= m_ArrhythmiaVascularComplianceModifier;
UpdatedCompliance_mL_Per_mmHg *= VascularComplianceModifier;
m_LeftPulmonaryVeinsCompliance->GetNextCompliance().SetValue(UpdatedCompliance_mL_Per_mmHg, VolumePerPressureUnit::mL_Per_mmHg);
UpdatedCompliance_mL_Per_mmHg = m_RightPulmonaryVeinsCompliance->GetNextCompliance(VolumePerPressureUnit::mL_Per_mmHg);
UpdatedCompliance_mL_Per_mmHg *= m_ArrhythmiaVascularComplianceModifier;
UpdatedCompliance_mL_Per_mmHg *= VascularComplianceModifier;
m_RightPulmonaryVeinsCompliance->GetNextCompliance().SetValue(UpdatedCompliance_mL_Per_mmHg, VolumePerPressureUnit::mL_Per_mmHg);
//The drug response adjusts the systemic resistances according to the mean arterial pressure change calculated in Drugs.cpp
......@@ -2359,18 +2355,6 @@ namespace pulse
if (meanArterialPressure_mmHg > shuntEffect_mmHg)
{
GetPulmonaryCapillariesCoverageFraction().SetValue(standardPulmonaryCapillaryCoverage);
m_data.GetDataTrack().Probe("PulmonaryShuntResistanceModifier", 0);
double leftPulmonaryShuntResistance = m_LeftPulmonaryArteriesToVeins->GetNextResistance().GetValue(PressureTimePerVolumeUnit::mmHg_s_Per_mL);
double rightPulmonaryShuntResistance = m_RightPulmonaryArteriesToVeins->GetNextResistance().GetValue(PressureTimePerVolumeUnit::mmHg_s_Per_mL);
m_data.GetDataTrack().Probe("LeftPulmonaryShuntResistance", leftPulmonaryShuntResistance);
m_data.GetDataTrack().Probe("RightPulmonaryShuntResistance", rightPulmonaryShuntResistance);
m_data.GetDataTrack().Probe("PulmonaryCapillariesResistanceModifier", 0);
double leftPulmonaryCapillariesResistance = m_LeftPulmonaryArteriesToCapillaries->GetNextResistance().GetValue(PressureTimePerVolumeUnit::mmHg_s_Per_mL);
double rightPulmonaryCapillariesResistance = m_RightPulmonaryArteriesToCapillaries->GetNextResistance().GetValue(PressureTimePerVolumeUnit::mmHg_s_Per_mL);
m_data.GetDataTrack().Probe("LeftPulmonaryCapillariesResistance", leftPulmonaryCapillariesResistance);
m_data.GetDataTrack().Probe("RightPulmonaryCapillariesResistance", rightPulmonaryCapillariesResistance);
return;
}
......@@ -2398,14 +2382,6 @@ namespace pulse
rightPulmonaryCapillariesResistance *= 1/shuntModifier;
m_LeftPulmonaryArteriesToCapillaries->GetNextResistance().SetValue(leftPulmonaryCapillariesResistance, PressureTimePerVolumeUnit::mmHg_s_Per_mL);
m_RightPulmonaryArteriesToCapillaries->GetNextResistance().SetValue(rightPulmonaryCapillariesResistance, PressureTimePerVolumeUnit::mmHg_s_Per_mL);
m_data.GetDataTrack().Probe("PulmonaryShuntResistanceModifier", shuntModifier);
m_data.GetDataTrack().Probe("LeftPulmonaryShuntResistance", leftPulmonaryShuntResistance);
m_data.GetDataTrack().Probe("RightPulmonaryShuntResistance", rightPulmonaryShuntResistance);
m_data.GetDataTrack().Probe("PulmonaryCapillariesResistanceModifier", 1/ shuntModifier);
m_data.GetDataTrack().Probe("LeftPulmonaryCapillariesResistance", leftPulmonaryCapillariesResistance);
m_data.GetDataTrack().Probe("RightPulmonaryCapillariesResistance", rightPulmonaryCapillariesResistance);
}
//--------------------------------------------------------------------------------------------------
......@@ -2487,7 +2463,6 @@ namespace pulse
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);
......
......@@ -563,9 +563,6 @@ namespace pulse
//Do the overrides
SetRespiratoryResistance();
SetRespiratoryCompliance();
m_data.GetDataTrack().Probe("m_CardiacArrestEffect", m_CardiacArrestEffect);
}
//--------------------------------------------------------------------------------------------------
......
......@@ -55,6 +55,10 @@ namespace pulse
::PBPhysiology::Serialize(src.common(), dst);
dst.m_StartSystole = src.startsystole();
dst.m_HeartFlowDetected = src.heartflowdetected();
dst.m_FullyCompressedHeart = src.fullycompressedheart();
dst.m_StabilizedHeartRateBaseline_Per_min = src.stabilizedheartratebaseline_per_min();
dst.m_StabilizedMeanArterialPressureBaseline_mmHg = src.stabilizedmeanarterialpressurebaseline_mmhg();
dst.m_CurrentCardiacCycleTime_s = src.currentcardiaccycletime_s();
dst.m_CurrentDriverCycleTime_s = src.currentdrivercycletime_s();
dst.m_DriverCyclePeriod_s = src.drivercycleperiod_s();
......@@ -74,7 +78,6 @@ namespace pulse
dst.m_ArrhythmiaHeartRateBaseline_Per_min = src.arrhythmiaheartratebaseline_per_min();
dst.m_InitialArrhythmiaHeartRateBaseline_Per_min = src.initialarrhythmiaheartratebaseline_per_min();
dst.m_TargetArrhythmiaHeartRateBaseline_Per_min = src.targetarrhythmiaheartratebaseline_per_min();
dst.m_StabilizedHeartRateBaseline_Per_min = src.stabilizedheartratebaseline_per_min();
dst.m_ArrhythmiaHeartComplianceModifier = src.arrhythmiaheartcompliancemodifier();
dst.m_InitialArrhythmiaHeartComplianceModifier = src.initialarrhythmiaheartcompliancemodifier();
dst.m_TargetArrhythmiaHeartComplianceModifier = src.targetarrhythmiaheartcompliancemodifier();
......@@ -121,6 +124,10 @@ namespace pulse
::PBPhysiology::Serialize(src, *dst.mutable_common());
dst.set_startsystole(src.m_StartSystole);
dst.set_heartflowdetected(src.m_HeartFlowDetected);
dst.set_fullycompressedheart(src.m_FullyCompressedHeart);
dst.set_stabilizedheartratebaseline_per_min(src.m_StabilizedHeartRateBaseline_Per_min);
dst.set_stabilizedmeanarterialpressurebaseline_mmhg(src.m_StabilizedMeanArterialPressureBaseline_mmHg);
dst.set_currentcardiaccycletime_s(src.m_CurrentCardiacCycleTime_s);
dst.set_currentdrivercycletime_s(src.m_CurrentDriverCycleTime_s);
dst.set_drivercycleperiod_s(src.m_DriverCyclePeriod_s);
......@@ -140,7 +147,6 @@ namespace pulse
dst.set_arrhythmiaheartratebaseline_per_min(src.m_ArrhythmiaHeartRateBaseline_Per_min);
dst.set_initialarrhythmiaheartratebaseline_per_min(src.m_InitialArrhythmiaHeartRateBaseline_Per_min);
dst.set_targetarrhythmiaheartratebaseline_per_min(src.m_TargetArrhythmiaHeartRateBaseline_Per_min);
dst.set_stabilizedheartratebaseline_per_min(src.m_StabilizedHeartRateBaseline_Per_min);
dst.set_arrhythmiaheartcompliancemodifier(src.m_ArrhythmiaHeartComplianceModifier);
dst.set_initialarrhythmiaheartcompliancemodifier(src.m_InitialArrhythmiaHeartComplianceModifier);
dst.set_targetarrhythmiaheartcompliancemodifier(src.m_TargetArrhythmiaHeartComplianceModifier);
......
......@@ -47,19 +47,16 @@ void HowToACLS()
std::map<eHeartRhythm, std::string> endArrhythmias =
{
{eHeartRhythm::NormalSinus, "sinus"},
//{eHeartRhythm::SinusTachycardia, "tachycardia"},
{eHeartRhythm::SinusTachycardia, "tachycardia"},
//{eHeartRhythm::SinusBradycardia, "bradycardia"},
//{eHeartRhythm::SinusPulselessElectricalActivity, "pea"}
};
std::vector<std::string> interventions =
{
"no",
"good_cpr",
//"bad_cpr",
"good_cpr_bvm",
//"bad_cpr_bvm"
"cpr",
"cpr_and_bvm"
};
size_t interventionTime_s = 5*60;
size_t extraBVMTime = 60; // BVM time after the heart starts back up
SEAdvanceTime adv;
......@@ -82,15 +79,17 @@ void HowToACLS()
for (auto ivn : interventions)
{
bool performBVM = false;
bool performBadCPR = false;
bool performGoodCPR = false;
bool performCPR = false;
size_t interventionTime_s = 5*60;
if (ivn == "cpr")
interventionTime_s = 2*60;
std::string name;
if (ivn == "no")
name = start.second + "_for_" + std::to_string(arrestLength_min) + "m_to_" + end.second + "_with_" + ivn + "_intervention";
else
name = start.second + "_for_" + std::to_string(arrestLength_min) + "m_then_" + std::to_string(interventionTime_s / 60) + "m_of_" + ivn + "_to_" + end.second;
logger.Info("Creating scenario " + name);
SEScenario sce(&logger);
......@@ -117,12 +116,12 @@ void HowToACLS()
dMgr.CreateLiquidCompartmentDataRequest(pulse::VascularCompartment::Aorta, "CarbonDioxide", "PartialPressure");
dMgr.CreateECGDataRequest("Lead3ElectricPotential", ElectricPotentialUnit::mV);
dMgr.CreatePhysiologyDataRequest("BaroreceptorHeartRateScale");
dMgr.CreatePhysiologyDataRequest("BaroreceptorHeartElastanceScale");
dMgr.CreatePhysiologyDataRequest("BaroreceptorResistanceScale");
dMgr.CreatePhysiologyDataRequest("BaroreceptorComplianceScale");
dMgr.CreatePhysiologyDataRequest("BloodVolume", VolumeUnit::mL);
dMgr.CreatePhysiologyDataRequest("SystemicVascularResistance", PressureTimePerVolumeUnit::mmHg_s_Per_mL);
//dMgr.CreatePhysiologyDataRequest("BaroreceptorHeartRateScale");
//dMgr.CreatePhysiologyDataRequest("BaroreceptorHeartElastanceScale");
//dMgr.CreatePhysiologyDataRequest("BaroreceptorResistanceScale");
//dMgr.CreatePhysiologyDataRequest("BaroreceptorComplianceScale");
//dMgr.CreatePhysiologyDataRequest("BloodVolume", VolumeUnit::mL);
//dMgr.CreatePhysiologyDataRequest("SystemicVascularResistance", PressureTimePerVolumeUnit::mmHg_s_Per_mL);
double simTime_s = 0;
......@@ -142,14 +141,11 @@ void HowToACLS()
if (ivn != "no")
{
if (ivn.find("good_cpr") != std::string::npos)
{
performGoodCPR = true;
}
else if (ivn.find("bad_cpr") != std::string::npos)
if (ivn.find("cpr") != std::string::npos)
{
performBadCPR = true;
performCPR = true;
}
if (ivn.find("bvm") != std::string::npos)
{
......@@ -187,20 +183,13 @@ void HowToACLS()
sce.AddAction(bvmSqueeze);
}
if (performGoodCPR)
if (performCPR)
{
logger.Info(" -Adding Good CPR Compression @ " + PULSE_CDM::to_string(simTime_s));
logger.Info(" -Adding CPR Compression @ " + PULSE_CDM::to_string(simTime_s));
cpr.GetForceScale().SetValue(0.6228);
sce.AddAction(cpr);
}
if (performBadCPR)
{
logger.Info(" -Adding Bad CPR Compression @ " + PULSE_CDM::to_string(simTime_s));
cpr.GetForceScale().SetValue(0.2228);
sce.AddAction(cpr);
}
adv.GetTime().SetValue(simStep_s, TimeUnit::s);
sce.AddAction(adv);
simTime_s += adv.GetTime(TimeUnit::s);
......@@ -212,7 +201,7 @@ void HowToACLS()
logger.Info(" -Setting heart rhythm to " + eHeartRhythm_Name(end.first));
// Extra BVM Time
if (extraBVMTime>0)
if (performBVM && extraBVMTime>0)
{
size_t bvmSqueezeCnt = 10;
size_t doSqueeze = bvmSqueezeCnt;
......
......@@ -20,65 +20,66 @@ message CardiovascularData
pulse.cdm.bind.CardiovascularSystemData Common = 1;
bool HeartFlowDetected = 2;
bool FullyCompressedHeart = 3;
double StabilizedHeartRateBaseline_Per_min = 4;
double StabilizedMeanArterialPressureBaseline_mmHg = 5;
// Driver Variables
bool StartSystole = 4;
double CurrentCardiacCycleTime_s = 5;
double CurrentDriverCycleTime_s = 6;
double DriverCyclePeriod_s = 7;
double LeftHeartElastanceModifier = 8;
double LeftHeartElastance_mmHg_Per_mL = 9;
double LeftHeartElastanceMax_mmHg_Per_mL = 10;
double LeftHeartElastanceMin_mmHg_Per_mL = 11;
double RightHeartElastance_mmHg_Per_mL = 12;
double RightHeartElastanceMax_mmHg_Per_mL = 13;
double RightHeartElastanceMin_mmHg_Per_mL = 14;
bool StartSystole = 6;
double CurrentCardiacCycleTime_s = 7;
double CurrentDriverCycleTime_s = 8;
double DriverCyclePeriod_s = 9;
double LeftHeartElastanceModifier = 10;
double LeftHeartElastance_mmHg_Per_mL = 11;
double LeftHeartElastanceMax_mmHg_Per_mL = 12;
double LeftHeartElastanceMin_mmHg_Per_mL = 13;
double RightHeartElastance_mmHg_Per_mL = 14;
double RightHeartElastanceMax_mmHg_Per_mL = 15;
double RightHeartElastanceMin_mmHg_Per_mL = 16;
// Arrhythmia
pulse.cdm.bind.eSwitch EnableFeedbackAfterArrhythmiaTrasition = 15;
bool StartCardiacArrest = 16;
double CardiacArrestVitalsUpdateTimer_s = 17;
double TotalArrhythmiaTransitionTime_s = 18;
double CurrentArrhythmiaTransitionTime_s = 19;
double ArrhythmiaHeartRateBaseline_Per_min = 20;
double InitialArrhythmiaHeartRateBaseline_Per_min = 21;
double TargetArrhythmiaHeartRateBaseline_Per_min = 22;
double StabilizedHeartRateBaseline_Per_min = 23;
double ArrhythmiaHeartComplianceModifier = 24;
double InitialArrhythmiaHeartComplianceModifier = 25;
double TargetArrhythmiaHeartComplianceModifier = 26;
double ArrhythmiaSystemicVascularResistanceModifier = 27;
double InitialArrhythmiaSystemicVascularResistanceModifier = 28;
double TargetArrhythmiaSystemicVascularResistanceModifier = 29;
double ArrhythmiaVascularComplianceModifier = 30;
double InitialArrhythmiaVascularComplianceModifier = 31;
double TargetArrhythmiaVascularComplianceModifier = 32;
pulse.cdm.bind.eSwitch EnableFeedbackAfterArrhythmiaTrasition = 17;
bool StartCardiacArrest = 18;
double CardiacArrestVitalsUpdateTimer_s = 19;
double TotalArrhythmiaTransitionTime_s = 20;
double CurrentArrhythmiaTransitionTime_s = 21;
double ArrhythmiaHeartRateBaseline_Per_min = 22;
double InitialArrhythmiaHeartRateBaseline_Per_min = 23;
double TargetArrhythmiaHeartRateBaseline_Per_min = 24;
double ArrhythmiaHeartComplianceModifier = 25;
double InitialArrhythmiaHeartComplianceModifier = 26;
double TargetArrhythmiaHeartComplianceModifier = 27;
double ArrhythmiaSystemicVascularResistanceModifier = 28;
double InitialArrhythmiaSystemicVascularResistanceModifier = 29;
double TargetArrhythmiaSystemicVascularResistanceModifier = 30;
double ArrhythmiaVascularComplianceModifier = 31;
double InitialArrhythmiaVascularComplianceModifier = 32;
double TargetArrhythmiaVascularComplianceModifier = 33;
// CPR
double CompressionTime_s = 33;
double CompressionRatio = 34;
double CompressionPeriod_s = 35;
double CompressionTime_s = 34;
double CompressionRatio = 35;
double CompressionPeriod_s = 36;
// Vitals and Averages
double CardiacCycleDiastolicVolume_mL = 36;
double CardiacCycleAortaPressureHigh_mmHg = 37;
double CardiacCycleAortaPressureLow_mmHg = 38;
double CardiacCycleLeftHeartPressureHigh_mmHg = 39;
double CardiacCycleLeftHeartPressureLow_mmHg = 40;
double CardiacCyclePulmonaryArteryPressureHigh_mmHg = 41;
double CardiacCyclePulmonaryArteryPressureLow_mmHg = 42;
double CardiacCycleRightHeartPressureHigh_mmHg = 43;
double CardiacCycleRightHeartPressureLow_mmHg = 44;
double LastCardiacCycleMeanArterialCO2PartialPressure_mmHg = 45;
double CardiacCycleStrokeVolume_mL = 46;
double CardiacCycleDiastolicVolume_mL = 37;
double CardiacCycleAortaPressureHigh_mmHg = 38;
double CardiacCycleAortaPressureLow_mmHg = 39;
double CardiacCycleLeftHeartPressureHigh_mmHg = 40;
double CardiacCycleLeftHeartPressureLow_mmHg = 41;
double CardiacCyclePulmonaryArteryPressureHigh_mmHg = 42;
double CardiacCyclePulmonaryArteryPressureLow_mmHg = 43;
double CardiacCycleRightHeartPressureHigh_mmHg = 44;
double CardiacCycleRightHeartPressureLow_mmHg = 45;
double LastCardiacCycleMeanArterialCO2PartialPressure_mmHg = 46;
double CardiacCycleStrokeVolume_mL = 47;
pulse.cdm.bind.RunningAverageData CardiacCycleArterialPressure_mmHg = 47;
pulse.cdm.bind.RunningAverageData CardiacCycleArterialCO2PartialPressure_mmHg = 48;
pulse.cdm.bind.RunningAverageData CardiacCyclePulmonaryCapillariesWedgePressure_mmHg = 49;
pulse.cdm.bind.RunningAverageData CardiacCyclePulmonaryCapillariesFlow_mL_Per_s = 50;
pulse.cdm.bind.RunningAverageData CardiacCyclePulmonaryShuntFlow_mL_Per_s = 51;
pulse.cdm.bind.RunningAverageData CardiacCyclePulmonaryArteryPressure_mmHg = 52;
pulse.cdm.bind.RunningAverageData CardiacCycleCentralVenousPressure_mmHg = 53;
pulse.cdm.bind.RunningAverageData CardiacCycleSkinFlow_mL_Per_s = 54;
pulse.cdm.bind.RunningAverageData CardiacCycleArterialPressure_mmHg = 48;
pulse.cdm.bind.RunningAverageData CardiacCycleArterialCO2PartialPressure_mmHg = 49;
pulse.cdm.bind.RunningAverageData CardiacCyclePulmonaryCapillariesWedgePressure_mmHg = 50;
pulse.cdm.bind.RunningAverageData CardiacCyclePulmonaryCapillariesFlow_mL_Per_s = 51;
pulse.cdm.bind.RunningAverageData CardiacCyclePulmonaryShuntFlow_mL_Per_s = 52;
pulse.cdm.bind.RunningAverageData CardiacCyclePulmonaryArteryPressure_mmHg = 53;
pulse.cdm.bind.RunningAverageData CardiacCycleCentralVenousPressure_mmHg = 54;
pulse.cdm.bind.RunningAverageData CardiacCycleSkinFlow_mL_Per_s = 55;
}
message DrugData
......
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