Commit 6ecaa399 authored by Harald Scheirich's avatar Harald Scheirich
Browse files

Fix warnings in cpm tests

parent 67e0b420
......@@ -76,19 +76,19 @@ void PulseEngineTest::AcidBaseMathTest(const std::string& rptDirectory)
SELiquidSubstanceQuantity* nHCO3 = cmpt.GetSubstanceQuantity(*HCO3);
SELiquidSubstanceQuantity* nHbCO2 = cmpt.GetSubstanceQuantity(*HbCO2);
double cmptVolume_mL = 100.0;
double normalTotalO2_mM = 6.2;
double normalTotalCO2_mM = 28.86;
const double cmptVolume_mL = 100.0;
const double normalTotalO2_mM = 6.2;
const double normalTotalCO2_mM = 28.86;
double currentTotalO2_mM;
double currentTotalCO2_mM;
double normalDissolvedCO2_gPerL = 0.05526; // 0.05526;
double normalDissolvedO2_gPerL = 0.004287; // 0.004287;
double normalBicarbonate_gPerL = 0.026*61.0168;
double normalHgb_mM = 1.55;
double percentNothingBound = 0.01;
double percentO2OnlyBound = 0.73;
double percentO2CO2Bound = 0.25;
double percentCO2Bound = 0.01;
const double normalDissolvedCO2_gPerL = 0.05526; // 0.05526;
const double normalDissolvedO2_gPerL = 0.004287; // 0.004287;
const double normalBicarbonate_gPerL = 0.026*61.0168;
const double normalHgb_mM = 1.55;
const double percentNothingBound = 0.01;
const double percentO2OnlyBound = 0.73;
const double percentO2CO2Bound = 0.25;
const double percentCO2Bound = 0.01;
//double O2ppGuess_mmHg = 100.0;
//double CO2ppGuess_mmHg = 1000.0*normalDissolvedCO2_gPerL/(44.01*0.0314);
//normalDissolvedCO2_gPerL = CO2ppGuess_mmHg*(44.01*0.0314) / 1000.0;
......@@ -572,16 +572,16 @@ void PulseEngineTest::AcidBaseLimitsTest(const std::string& rptDirectory)
c.CalculateBloodGasDistribution(cmpt);
// Get and print results
double finalDissovledCO2_gPerL = nCO2->GetConcentration().GetValue(MassPerVolumeUnit::g_Per_L);
double finalDissovledCO2_mM = finalDissovledCO2_gPerL / CO2->GetMolarMass(MassPerAmountUnit::g_Per_mmol);
double finalBicarb_gPerL = nHCO3->GetConcentration().GetValue(MassPerVolumeUnit::g_Per_L);
double finalBicarbCO2_mM = finalBicarb_gPerL / HCO3->GetMolarMass(MassPerAmountUnit::g_Per_mmol); // Yes this should be m_CO2_g_Per_mmol because 1 mol CO2 per mol bicarb
double finalBicarbCO2_gPerL = finalBicarbCO2_mM * CO2->GetMolarMass(MassPerAmountUnit::g_Per_mmol);
double finalBoundCO2_mM = 4.0 * (nHbCO2->GetMass().GetValue(MassUnit::g) / cmpt.GetVolume(VolumeUnit::L) / HbCO2->GetMolarMass(MassPerAmountUnit::g_Per_mmol) + nHbO2CO2->GetMass().GetValue(MassUnit::g) / cmpt.GetVolume(VolumeUnit::L) / HbO2CO2->GetMolarMass(MassPerAmountUnit::g_Per_mmol)); //4 moles CO2 per mole Hb
double finalBoundCO2_gPerL = finalBoundCO2_mM * CO2->GetMolarMass(MassPerAmountUnit::g_Per_mmol);
double finalTotalCO2_mM = finalDissovledCO2_mM + finalBicarbCO2_mM + finalBoundCO2_mM;
double finalTotalCO2_gPerL = finalDissovledCO2_gPerL + finalBicarbCO2_gPerL + finalBoundCO2_gPerL;
double finalTotalHemoglobin_gPerL = nHb->GetConcentration().GetValue(MassPerVolumeUnit::g_Per_L) +
finalDissovledCO2_gPerL = nCO2->GetConcentration().GetValue(MassPerVolumeUnit::g_Per_L);
finalDissovledCO2_mM = finalDissovledCO2_gPerL / CO2->GetMolarMass(MassPerAmountUnit::g_Per_mmol);
finalBicarb_gPerL = nHCO3->GetConcentration().GetValue(MassPerVolumeUnit::g_Per_L);
finalBicarbCO2_mM = finalBicarb_gPerL / HCO3->GetMolarMass(MassPerAmountUnit::g_Per_mmol); // Yes this should be m_CO2_g_Per_mmol because 1 mol CO2 per mol bicarb
finalBicarbCO2_gPerL = finalBicarbCO2_mM * CO2->GetMolarMass(MassPerAmountUnit::g_Per_mmol);
finalBoundCO2_mM = 4.0 * (nHbCO2->GetMass().GetValue(MassUnit::g) / cmpt.GetVolume(VolumeUnit::L) / HbCO2->GetMolarMass(MassPerAmountUnit::g_Per_mmol) + nHbO2CO2->GetMass().GetValue(MassUnit::g) / cmpt.GetVolume(VolumeUnit::L) / HbO2CO2->GetMolarMass(MassPerAmountUnit::g_Per_mmol)); //4 moles CO2 per mole Hb
finalBoundCO2_gPerL = finalBoundCO2_mM * CO2->GetMolarMass(MassPerAmountUnit::g_Per_mmol);
finalTotalCO2_mM = finalDissovledCO2_mM + finalBicarbCO2_mM + finalBoundCO2_mM;
finalTotalCO2_gPerL = finalDissovledCO2_gPerL + finalBicarbCO2_gPerL + finalBoundCO2_gPerL;
finalTotalHemoglobin_gPerL = nHb->GetConcentration().GetValue(MassPerVolumeUnit::g_Per_L) +
nHbO2->GetConcentration().GetValue(MassPerVolumeUnit::g_Per_L) +
nHbCO2->GetConcentration().GetValue(MassPerVolumeUnit::g_Per_L) +
nHbO2CO2->GetConcentration().GetValue(MassPerVolumeUnit::g_Per_L);
......@@ -896,7 +896,6 @@ void PulseEngineTest::AcidBaseBloodGasTest(PulseController& pc, bloodType bloodC
double CO2sat_max = 0; //Computed using Dash model
double pH_min = 0; //Leeuwen
double pH_max = 0; //Leeuwen
double percentTolerance = .02;
double O2_sat = 0;
double CO2_sat = 0;
......
......@@ -122,7 +122,6 @@ void PulseEngineTest::AnesthesiaMachineCircuitAndTransportTest(RespiratoryConfig
SEFluidCircuitPath* EnvironmentToVentilatorPath = amCircuit->GetPath(pulse::AnesthesiaMachinePath::EnvironmentToVentilator);
SEFluidCircuitPath* EnvironmentToReliefValve = amCircuit->GetPath(pulse::AnesthesiaMachinePath::EnvironmentToReliefValve);
SEFluidCircuitPath* GasSourceToGasInlet = amCircuit->GetPath(pulse::AnesthesiaMachinePath::GasSourceToGasInlet);
SEFluidCircuitPath* EnvironmentToGasSource = amCircuit->GetPath(pulse::AnesthesiaMachinePath::EnvironmentToGasSource);
SEGasTransporter txpt(VolumePerTimeUnit::L_Per_s, VolumeUnit::L, VolumeUnit::L, pc.GetLogger());
SEFluidCircuitCalculator calc(VolumePerPressureUnit::L_Per_cmH2O, VolumePerTimeUnit::L_Per_s, PressureTimeSquaredPerVolumeUnit::cmH2O_s2_Per_L, PressureUnit::cmH2O, VolumeUnit::L, PressureTimePerVolumeUnit::cmH2O_s_Per_L, pc.GetLogger());
......
......@@ -367,11 +367,6 @@ void PulseEngineTest::CardiovascularCircuitAndTransportTest(CardiovascularDriver
SEFluidCircuitNode* VenaCava = cvCircuit.GetNode("VenaCava");
SEFluidCircuitPath *RightCompliance = cvCircuit.GetPath(pulse::CardiovascularPath::RightHeart1ToRightHeart3);
SEFluidCircuitPath *LeftCompliance = cvCircuit.GetPath(pulse::CardiovascularPath::LeftHeart1ToLeftHeart3);
SEFluidCircuitPath *HeartLeft = cvCircuit.GetPath(pulse::CardiovascularPath::LeftHeart1ToAorta2);
SELiquidSubstanceQuantity* venaCavaN2 = cvGraph.GetCompartment(pulse::VascularCompartment::VenaCava)->GetSubstanceQuantity(pc.GetSubstances().GetN2());
SELiquidSubstanceQuantity* leftPulmonaryCapillariesN2 = cvGraph.GetCompartment(pulse::VascularCompartment::LeftPulmonaryCapillaries)->GetSubstanceQuantity(pc.GetSubstances().GetN2());
SELiquidSubstanceQuantity* rightPulmonaryCapillariesN2 = cvGraph.GetCompartment(pulse::VascularCompartment::LeftPulmonaryCapillaries)->GetSubstanceQuantity(pc.GetSubstances().GetN2());
SELiquidTransporter txpt(VolumePerTimeUnit::mL_Per_s, VolumeUnit::mL, MassUnit::ug, MassPerVolumeUnit::ug_Per_mL, pc.GetLogger());
SEFluidCircuitCalculator calc(VolumePerPressureUnit::mL_Per_mmHg, VolumePerTimeUnit::mL_Per_s, PressureTimeSquaredPerVolumeUnit::mmHg_s2_Per_mL, PressureUnit::mmHg, VolumeUnit::mL, PressureTimePerVolumeUnit::mmHg_s_Per_mL, pc.GetLogger());
......@@ -694,7 +689,7 @@ void PulseEngineTest::CardiovascularCircuitScaleTests(const std::string& sTestDi
// Note: You could scale the amplitude/elastance of the driver if want (We didn't at the time I wrote it, but its possible!)
double heartRate_bpm = 72;// Note, you should always pass in a bpm other than <=0 for a well named file
ss << heartRate_bpm;
double comp = 1.0, res = 1.0, vol = 1, sysRes = 1, sysComp = 1, aortaRes = 0.7, aortaComp = 0.7, venaRes = 1, venaComp = 1;
const double comp = 1.0, res = 1.0, vol = 1, sysRes = 1, sysComp = 1, aortaRes = 0.7, aortaComp = 0.7, venaRes = 1, venaComp = 1;
//for (double rFactor = 0.3; rFactor <= 1.7; rFactor += 0.1)
//{
......
......@@ -52,31 +52,31 @@ double TotalHbMols(SELiquidCompartmentGraph& Graph, SESubstance& Hb, SESubstance
return totalHb_g / Hb_g_Per_mol + totalHbO2_g / HbO2_g_Per_mol + totalHbCO2_g / HbCO2_g_Per_mol + totalHBO2CO2_g / HbO2CO2_g_Per_mol;
}
void PulseEngineTest::FourCompartmentTest(bool usingAcidBase, bool usingProductionConsumption, bool usingDiffusion, const std::string& rptDirectory)
void PulseEngineTest::FourCompartmentTest(bool localUsingAcidBase, bool localUsingProductionConsumption, bool localUsingDiffusion, const std::string& rptDirectory)
{
DataTrack trk;
std::string outputName;
if (!usingAcidBase && !usingProductionConsumption && !usingDiffusion)
if (!localUsingAcidBase && !localUsingProductionConsumption && !localUsingDiffusion)
{
outputName = "/FourCompartmentTestSimple";
}
else if (usingAcidBase && !usingProductionConsumption && !usingDiffusion)
else if (localUsingAcidBase && !localUsingProductionConsumption && !localUsingDiffusion)
{
outputName = "/AcidBaseFourCompartmentTest";
}
else if (!usingAcidBase && !usingProductionConsumption && usingDiffusion)
else if (!localUsingAcidBase && !localUsingProductionConsumption && localUsingDiffusion)
{
outputName = "/FiveCompartmentTestWithDiffusion";
}
else if (usingAcidBase && usingProductionConsumption && !usingDiffusion)
else if (localUsingAcidBase && localUsingProductionConsumption && !localUsingDiffusion)
{
outputName = "/AcidBaseFourCompartmentTestWithProductionConsumption";
}
else if (usingAcidBase && !usingProductionConsumption && usingDiffusion)
else if (localUsingAcidBase && !localUsingProductionConsumption && localUsingDiffusion)
{
outputName = "/AcidBaseFiveCompartmentTestWithDiffusion";
}
else if (usingAcidBase && usingProductionConsumption && usingDiffusion)
else if (localUsingAcidBase && localUsingProductionConsumption && localUsingDiffusion)
{
outputName = "/AcidBaseFiveCompartmentTestWithProductionConsumptionAndDiffusion";
}
......@@ -241,7 +241,7 @@ void PulseEngineTest::FourCompartmentTest(bool usingAcidBase, bool usingProducti
pc.GetSubstances().InitializeBloodGases(cCapillaries, Hb_total_mM, Low_O2_sat, Low_O2_mmol_Per_L, Low_CO2_sat, Low_CO2_mmol_Per_L, Low_HCO3_mmol_Per_L, Low_pH, false);
pc.GetSubstances().InitializeBloodGases(cVeins, Hb_total_mM, Low_O2_sat, Low_O2_mmol_Per_L, Low_CO2_sat, Low_CO2_mmol_Per_L, Low_HCO3_mmol_Per_L, Low_pH, false);
if (usingAcidBase)
if (localUsingAcidBase)
{
pc.GetSaturationCalculator().CalculateBloodGasDistribution(cPulmonary);
pc.GetSaturationCalculator().CalculateBloodGasDistribution(cArteries);
......@@ -253,7 +253,7 @@ void PulseEngineTest::FourCompartmentTest(bool usingAcidBase, bool usingProducti
double tissueVolume_L = 61.7; //sum of all tissue volumes
double tissueO2Mass_g = tissueVolume_L * cCapillaries.GetSubstanceQuantity(O2)->GetConcentration(MassPerVolumeUnit::g_Per_L);
double tissueCO2Mass_g = tissueVolume_L * cCapillaries.GetSubstanceQuantity(CO2)->GetConcentration(MassPerVolumeUnit::g_Per_L);
if (usingDiffusion)
if (localUsingDiffusion)
{
//cTissue.GetTotalVolume().SetValue(tissueVolume_L, VolumeUnit::L);
cTissue.GetVolume().SetValue(tissueVolume_L, VolumeUnit::L);
......@@ -281,9 +281,9 @@ void PulseEngineTest::FourCompartmentTest(bool usingAcidBase, bool usingProducti
for (unsigned int i = 0; i < runTime_min * 60.0 / deltaT_s; i++)
{
//PreProcess - Mimic Produce, Consume, and Alveolar Transfer
if (usingProductionConsumption)
if (localUsingProductionConsumption)
{
if (usingDiffusion)
if (localUsingDiffusion)
{
//Do it in the tissues and let it diffuse
cPulmonary.GetSubstanceQuantity(O2)->GetMass().IncrementValue(O2Consumption_ugPerS * deltaT_s, MassUnit::ug);
......@@ -352,7 +352,7 @@ void PulseEngineTest::FourCompartmentTest(bool usingAcidBase, bool usingProducti
//Execute the substance transport function
txpt.Transport(Graph, deltaT_s);
if (usingAcidBase)
if (localUsingAcidBase)
{
for (SELiquidCompartment* cmpt : Graph.GetCompartments())
{
......@@ -361,7 +361,7 @@ void PulseEngineTest::FourCompartmentTest(bool usingAcidBase, bool usingProducti
}
//Diffuse if necessary
if (usingDiffusion)
if (localUsingDiffusion)
{
tsu.MoveMassByInstantDiffusion(cCapillaries, cTissue, O2, deltaT_s);
tsu.MoveMassByInstantDiffusion(cCapillaries, cTissue, CO2, deltaT_s);
......@@ -406,7 +406,7 @@ void PulseEngineTest::FourCompartmentTest(bool usingAcidBase, bool usingProducti
}
//Tissue and total oxygen w/ diffusion
if (usingDiffusion)
if (localUsingDiffusion)
{
cTissue.Balance(BalanceLiquidBy::Mass);
cCapillaries.Balance(BalanceLiquidBy::Mass);
......
......@@ -269,11 +269,10 @@ void PulseEngineTest::RenalFeedbackTest(RenalFeedback feedback, const std::strin
double venaCavaPressure_mmHg = 4.0;
double maxSteadyCycles = 1.0 / deltaT_s * 30.0; // must be steady for 30 second
double convergencePercentage = 0.01; // within 1%
double AffResistance_mmHg_Per_mL_Per_s = 0.0;
//fit parameters for upr curve:
double a = 2.9e-4;
double b = -0.017;
double c = 0.219;
const double a = 2.9e-4;
const double b = -0.017;
const double c = 0.219;
SEScalarTime eventTime;
eventTime.SetValue(0, TimeUnit::s);
......@@ -321,7 +320,7 @@ void PulseEngineTest::RenalFeedbackTest(RenalFeedback feedback, const std::strin
bool UPRSteady = false;
bool convergedCheck = false;
//validation data of urine production:
double urineValidation = (a*pow(MAP, 2) + b*MAP + c);
// unused: double urineValidation = (a*pow(MAP, 2) + b*MAP + c);
//get the permeability and resistance for output:
double permeabilityCurrentLeft_mL_Per_s_Per_mmHg_Per_m2 = 0.0;
double permeabilityCurrentRight_mL_Per_s_Per_mmHg_Per_m2 = 0.0;
......@@ -564,11 +563,6 @@ void PulseEngineTest::RenalSystemTest(RenalSystems systemtest, const std::string
SEFluidCircuitNode* RightRenalVenaCavaConnectionNode = RenalCircuit.GetNode(pulse::RenalNode::RightVenaCavaConnection);
SEFluidCircuitNode* LeftRenalArteryNode = RenalCircuit.GetNode(pulse::RenalNode::LeftRenalArtery);
SEFluidCircuitNode* LeftRenalVenaCavaConnectionNode = RenalCircuit.GetNode(pulse::RenalNode::LeftVenaCavaConnection);
SEFluidCircuitNode* LeftUreterNode = RenalCircuit.GetNode(pulse::RenalNode::LeftUreter);
SEFluidCircuitNode* RightUreterNode = RenalCircuit.GetNode(pulse::RenalNode::RightUreter);
SEFluidCircuitNode* Bladder = RenalCircuit.GetNode(pulse::RenalNode::Bladder);
SEFluidCircuitNode* RightPeritubularCapillariesNode = RenalCircuit.GetNode(pulse::RenalNode::RightPeritubularCapillaries);
SEFluidCircuitNode* LeftPeritubularCapillariesNode = RenalCircuit.GetNode(pulse::RenalNode::LeftPeritubularCapillaries);
//Renal/vascular compartments
SELiquidCompartment* BladderCompartment = pc.GetCompartments().GetLiquidCompartment(pulse::UrineCompartment::Bladder);
......@@ -576,8 +570,6 @@ void PulseEngineTest::RenalSystemTest(RenalSystems systemtest, const std::string
SELiquidCompartment* LeftUreterCompartment = pc.GetCompartments().GetLiquidCompartment(pulse::UrineCompartment::LeftUreter);
SELiquidCompartment* RightArteryCompartment = pc.GetCompartments().GetLiquidCompartment(pulse::VascularCompartment::RightRenalArtery);
SELiquidCompartment* LeftArteryCompartment = pc.GetCompartments().GetLiquidCompartment(pulse::VascularCompartment::LeftRenalArtery);
SELiquidCompartment* RightAfferentArterioleCompartment = pc.GetCompartments().GetLiquidCompartment(pulse::VascularCompartment::RightAfferentArteriole);
SELiquidCompartment* LeftAfferentArterioleCompartment = pc.GetCompartments().GetLiquidCompartment(pulse::VascularCompartment::LeftAfferentArteriole);
SELiquidCompartment* RightPeritubularCapillariesCompartment = pc.GetCompartments().GetLiquidCompartment(pulse::VascularCompartment::RightPeritubularCapillaries);
SELiquidCompartment* LeftPeritubularCapillariesCompartment = pc.GetCompartments().GetLiquidCompartment(pulse::VascularCompartment::LeftPeritubularCapillaries);
......
......@@ -244,7 +244,6 @@ void PulseEngineTest::RespiratoryDriverTest(const std::string& sTestDirectory)
SEFluidCircuitPath* driverPressurePath = RespCircuit.GetPath(pulse::RespiratoryPath::EnvironmentToRespiratoryMuscle);
SEFluidCircuitPath* rightPleuralToRespiratoryMuscle = RespCircuit.GetPath(pulse::RespiratoryPath::RightPleuralToRespiratoryMuscle);
SEFluidCircuitPath* leftPleuralToRespiratoryMuscle = RespCircuit.GetPath(pulse::RespiratoryPath::LeftPleuralToRespiratoryMuscle);
SEFluidCircuitPath* AirwayToCarina = RespCircuit.GetPath(pulse::RespiratoryPath::AirwayToCarina);
SEFluidCircuitPath* RightAlveoliToRightPleuralConnection = RespCircuit.GetPath(pulse::RespiratoryPath::RightAlveoliToRightPleuralConnection);
SEFluidCircuitPath* LeftAlveoliToLeftPleuralConnection = RespCircuit.GetPath(pulse::RespiratoryPath::LeftAlveoliToLeftPleuralConnection);
......
......@@ -97,7 +97,7 @@ void PulseEngineTest::InhalerState(PhysiologyEngine* pc, HowToTracker& tracker)
inhale.GetInspiratoryCapacityFraction().SetValue(1.0);
inhale.GetInhalePeriod().SetValue(5.0, TimeUnit::s);
SEUseInhaler& inhaler = cResp.AddUseInhaler();
cResp.AddUseInhaler();
SEForcedPause& pause = cResp.AddForcedPause();
pause.GetPeriod().SetValue(10, TimeUnit::s);
......@@ -186,8 +186,6 @@ void PulseEngineTest::SerializationTest(const std::string& sTestDirectory)
pc->GetLogger()->SetLogFile("SerializationTestSetup.log");
HowToTracker tracker(*pc);
const SESubstance* O2 = pc->GetSubstanceManager().GetSubstance("Oxygen");
const SESubstance* CO2 = pc->GetSubstanceManager().GetSubstance("CarbonDioxide");
/*
SESubstanceDataRequest* subRequest;
......
......@@ -147,7 +147,7 @@ void PulseEngineTest::SolverSpeedTest(const std::string& rptDirectory)
}
std::vector<std::chrono::microseconds::rep> times;
for (int i = 0; i < numSolves; i++)
for (int j = 0; j < numSolves; j++)
{
failed = false;
......@@ -222,7 +222,7 @@ void PulseEngineTest::SolverSpeedTest(const std::string& rptDirectory)
}
times.clear();
for (int i = 0; i < numSolves; i++)
for (int j = 0; j < numSolves; j++)
{
failed = false;
......@@ -298,7 +298,7 @@ void PulseEngineTest::SolverSpeedTest(const std::string& rptDirectory)
}
times.clear();
for (int i = 0; i < numSolves; i++)
for (int j = 0; j < numSolves; j++)
{
failed = false;
......@@ -374,7 +374,7 @@ void PulseEngineTest::SolverSpeedTest(const std::string& rptDirectory)
}
times.clear();
for (int i = 0; i < numSolves; i++)
for (int j = 0; j < numSolves; j++)
{
failed = false;
......@@ -449,7 +449,7 @@ void PulseEngineTest::SolverSpeedTest(const std::string& rptDirectory)
}
times.clear();
for (int i = 0; i < numSolves; i++)
for (int j = 0; j < numSolves; j++)
{
failed = false;
......@@ -524,7 +524,7 @@ void PulseEngineTest::SolverSpeedTest(const std::string& rptDirectory)
}
times.clear();
for (int i = 0; i < numSolves; i++)
for (int j = 0; j < numSolves; j++)
{
failed = false;
......@@ -600,7 +600,7 @@ void PulseEngineTest::SolverSpeedTest(const std::string& rptDirectory)
}
times.clear();
for (int i = 0; i < numSolves; i++)
for (int j = 0; j < numSolves; j++)
{
failed = false;
......@@ -675,7 +675,7 @@ void PulseEngineTest::SolverSpeedTest(const std::string& rptDirectory)
}
times.clear();
for (int i = 0; i < numSolves; i++)
for (int j = 0; j < numSolves; j++)
{
failed = false;
......@@ -750,7 +750,7 @@ void PulseEngineTest::SolverSpeedTest(const std::string& rptDirectory)
}
times.clear();
for (int i = 0; i < numSolves; i++)
for (int j = 0; j < numSolves; j++)
{
failed = false;
......
......@@ -362,8 +362,8 @@ void PulseEngineTest::EnvironmentVariableTemperatureCircuitTest(const std::strin
SEThermalCircuitNode& MetabolicNode = m_ECircuit.CreateNode("Metabolic");
SEThermalCircuitPath& MetabolicPath = m_ECircuit.CreatePath(*Ground, MetabolicNode, "GroundToMetabolic");
SEThermalCircuitPath& MetabolicToCore = m_ECircuit.CreatePath(*Core, MetabolicNode, "CoreToMetabolic");
SEThermalCircuitPath& MetabolicToSkin = m_ECircuit.CreatePath(*Skin, MetabolicNode, "SkinToMetabolic");
m_ECircuit.CreatePath(*Core, MetabolicNode, "CoreToMetabolic");
m_ECircuit.CreatePath(*Skin, MetabolicNode, "SkinToMetabolic");
//Hold BMR constant
MetabolicPath.GetHeatSourceBaseline().SetValue(testBMR, PowerUnit::kcal_Per_day);
......@@ -471,12 +471,12 @@ void PulseEngineTest::CombinedInternalAndEnvironmentVariableBMRandTemperatureCir
SEThermalCircuitPath* MetabolicPath = m_TECircuit.GetPath(pulse::InternalTemperaturePath::GroundToInternalCore);
SEThermalCircuitPath* CoreToSkin = m_TECircuit.GetPath(pulse::InternalTemperaturePath::InternalCoreToInternalSkin);
SEThermalCircuitPath* EnvCoreToGround = m_TECircuit.GetPath(pulse::ExternalTemperaturePath::ExternalCoreToGround);
SEThermalCircuitPath* EnvSkinToGround = m_TECircuit.GetPath(pulse::ExternalTemperaturePath::ExternalSkinToGround);
m_TECircuit.GetPath(pulse::ExternalTemperaturePath::ExternalCoreToGround);
m_TECircuit.GetPath(pulse::ExternalTemperaturePath::ExternalSkinToGround);
SEThermalCircuitPath* EnvSkinToClothing = m_TECircuit.GetPath(pulse::ExternalTemperaturePath::ExternalSkinToClothing);
SEThermalCircuitPath* ClothingToEnclosure = m_TECircuit.GetPath(pulse::ExternalTemperaturePath::ClothingToEnclosure);
SEThermalCircuitPath* GroundToEnvironment = m_TECircuit.GetPath(pulse::ExternalTemperaturePath::GroundToEnvironment);
SEThermalCircuitPath* GroundToEnclosure = m_TECircuit.GetPath(pulse::ExternalTemperaturePath::GroundToEnclosure);
m_TECircuit.GetPath(pulse::ExternalTemperaturePath::GroundToEnclosure);
SEThermalCircuitPath* ClothingToEnvironment = m_TECircuit.GetPath(pulse::ExternalTemperaturePath::ClothingToEnvironment);
//You must initialize these resistors or the circuit won't solve
......@@ -631,8 +631,8 @@ void PulseEngineTest::CombinedInternalAndEnvironmentSkinTempDropCircuitTest(cons
SEThermalCircuitPath* MetabolicPath = m_TECircuit.GetPath(pulse::InternalTemperaturePath::GroundToInternalCore);
SEThermalCircuitPath* CoreToSkin = m_TECircuit.GetPath(pulse::InternalTemperaturePath::InternalCoreToInternalSkin);
SEThermalCircuitPath* EnvCoreToGround = m_TECircuit.GetPath(pulse::ExternalTemperaturePath::ExternalCoreToGround);
SEThermalCircuitPath* EnvSkinToGround = m_TECircuit.GetPath(pulse::ExternalTemperaturePath::ExternalSkinToGround);
m_TECircuit.GetPath(pulse::ExternalTemperaturePath::ExternalCoreToGround);
m_TECircuit.GetPath(pulse::ExternalTemperaturePath::ExternalSkinToGround);
SEThermalCircuitPath* EnvSkinToClothing = m_TECircuit.GetPath(pulse::ExternalTemperaturePath::ExternalSkinToClothing);
SEThermalCircuitPath* ClothingToEnclosure = m_TECircuit.GetPath(pulse::ExternalTemperaturePath::ClothingToEnclosure);
SEThermalCircuitPath* GroundToEnvironment = m_TECircuit.GetPath(pulse::ExternalTemperaturePath::GroundToEnvironment);
......@@ -764,8 +764,8 @@ void PulseEngineTest::EnvironmentISO7730ComparisonTest(const std::string& sTestD
SEThermalCircuitNode& MetabolicNode = EnvironmentCircuit.CreateNode("Metabolic");
MetabolicNode.GetTemperature().SetValue(dAmbientTemperature_K, TemperatureUnit::K);
SEThermalCircuitPath &MetabolicPath = EnvironmentCircuit.CreatePath(*AbsoluteReferenceNode, MetabolicNode, "AbsoluteReferenceToMetabolic");
SEThermalCircuitPath &MetabolicToEnvironmentSkinPath = EnvironmentCircuit.CreatePath(MetabolicNode, *EnvironmentSkinNode, "MetabolicToEnvironmentSkin");
SEThermalCircuitPath &MetabolicToEnvironmentCorePath = EnvironmentCircuit.CreatePath(MetabolicNode, *EnvironmentCoreNode, "MetabolicToEnvironmentCore");
EnvironmentCircuit.CreatePath(MetabolicNode, *EnvironmentSkinNode, "MetabolicToEnvironmentSkin");
EnvironmentCircuit.CreatePath(MetabolicNode, *EnvironmentCoreNode, "MetabolicToEnvironmentCore");
//Initialize the new source so that circuit solves on first loop
MetabolicPath.GetNextHeatSource().SetValue(0, PowerUnit::W);
......
......@@ -497,8 +497,6 @@ void PulseEngineTest::InstantDiffusionTest(SETestSuite& testSuite)
pc.GetSubstances().AddActiveSubstance(*o2);
SELiquidCompartment& cmpt1 = pc.GetCompartments().CreateLiquidCompartment("cmpt1");
SELiquidCompartment& cmpt2 = pc.GetCompartments().CreateLiquidCompartment("cmpt2");
SELiquidCompartment& cmpt3 = pc.GetCompartments().CreateLiquidCompartment("cmpt3");
SELiquidCompartment& cmpt4 = pc.GetCompartments().CreateLiquidCompartment("cmpt4");
// First test - simple two compartment instant diffusion test
timer.Start("Test");
......@@ -624,7 +622,7 @@ void PulseEngineTest::SimpleDiffusionFourCompartmentTest(const std::string& rptD
pc.GetSubstances().LoadSubstanceDirectory();
SESubstance* o2 = pc.GetSubstances().GetSubstance("Oxygen");
pc.GetSubstances().AddActiveSubstance(*o2);
SETissueCompartment& tissue = pc.GetCompartments().CreateTissueCompartment("Tissue");
pc.GetCompartments().CreateTissueCompartment("Tissue");
SELiquidCompartment& cmpt1_IC = pc.GetCompartments().CreateLiquidCompartment("cmpt1_IC");
SELiquidCompartment& cmpt2_EC = pc.GetCompartments().CreateLiquidCompartment("cmpt2_EC");
SELiquidCompartment& cmpt3_LQ = pc.GetCompartments().CreateLiquidCompartment("cmpt3_LQ");
......@@ -663,11 +661,6 @@ void PulseEngineTest::SimpleDiffusionFourCompartmentTest(const std::string& rptD
tsu.MoveMassBySimpleDiffusion(cmpt2_EC, cmpt4_LQ, *o2, permeabilityCoefficient_mL_Per_s, timestep_s);
tsu.MoveMassBySimpleDiffusion(cmpt3_LQ, cmpt4_LQ, *o2, permeabilityCoefficient_mL_Per_s, timestep_s);
double v3CalculatedConcentration_g_Per_mL = cmpt3_LQ.GetSubstanceQuantity(*o2)->GetConcentration(MassPerVolumeUnit::g_Per_mL);
double v4CalculatedConcentration_g_Per_mL = cmpt4_LQ.GetSubstanceQuantity(*o2)->GetConcentration(MassPerVolumeUnit::g_Per_mL);
double v3ExpectedConcentration_g_Per_mL = (v3Mass_g / v3Vol_mL);
double v4ExpectedConcentration_g_Per_mL = (v4Mass_g / v4Vol_mL);
// Ok, now balance
cmpt4_LQ.Balance(BalanceLiquidBy::Mass);
cmpt3_LQ.Balance(BalanceLiquidBy::Mass);
......@@ -853,7 +846,7 @@ void PulseEngineTest::FacilitatedDiffusionTest(const std::string& rptDirectory)
pc.GetSubstances().LoadSubstanceDirectory();
SESubstance* sub = pc.GetSubstances().GetSubstance("Glucose");
pc.GetSubstances().AddActiveSubstance(*sub);
SETissueCompartment& tissue = pc.GetCompartments().CreateTissueCompartment("Tissue");
pc.GetCompartments().CreateTissueCompartment("Tissue");
SELiquidCompartment& tissueExtracellular = pc.GetCompartments().CreateLiquidCompartment("Extracellular");
SELiquidCompartment& vascular = pc.GetCompartments().CreateLiquidCompartment("Vascular");
......@@ -897,12 +890,12 @@ void PulseEngineTest::ActiveTransportTest(SETestSuite& testSuite)
TimingProfile timer;
PulseEngine pe(testSuite.GetLogger());
PulseController& pc = pe.GetController();
Tissue& tsu = (Tissue&)pc.GetTissue();
double timestep_s = 1. / 90.;
pc.GetSubstances().LoadSubstanceDirectory();
SESubstance* sub = pc.GetSubstances().GetSubstance("Desflurane");
pc.GetSubstances().AddActiveSubstance(*sub);
SETissueCompartment& tissue = pc.GetCompartments().CreateTissueCompartment("Tissue");
pc.GetCompartments().CreateTissueCompartment("Tissue");
SELiquidCompartment& extracellular = pc.GetCompartments().CreateLiquidCompartment("Extracellular");
SELiquidCompartment& intracellular = pc.GetCompartments().CreateLiquidCompartment("Intracellular");
......@@ -913,7 +906,6 @@ void PulseEngineTest::ActiveTransportTest(SETestSuite& testSuite)
double ecVol_mL = 20.0;
double icVol_mL = 50.0;
double vMass_g = 1.5;
double ecMass_g = 1.5;
double icMass_g = 2.0;
......@@ -933,14 +925,13 @@ void PulseEngineTest::GenericClearanceTest(SETestSuite& testSuite)
{
TimingProfile timer;
PulseEngine pe(testSuite.GetLogger());
PulseController& pc = pe.GetController();
Tissue& tsu = (Tissue&)pc.GetTissue();
// First test case
SETestCase& testCase1 = testSuite.CreateTestCase();
testCase1.SetName("GenericClearanceTestLiquid");
// You at least need 2 test cases here (liquid and tissue)
SETestCase& testCase = testSuite.CreateTestCase();
testSuite.CreateTestCase();
timer.Start("Test");
// Test Logic
//testCase.GetFailures().push_back("Report any errors like this");
......@@ -960,8 +951,6 @@ void PulseEngineTest::GenericExcretionTest(SETestSuite& testSuite)
{
TimingProfile timer;
PulseEngine pe(testSuite.GetLogger());
PulseController& pc = pe.GetController();
Tissue& tsu = (Tissue&)pc.GetTissue();
// First test case
SETestCase& testCase1 = testSuite.CreateTestCase();
......
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