Skip to content

Commit 93f44cd

Browse files
committed
Updates to cmd_bio as well as bug patches for rebase
1 parent 6bdf415 commit 93f44cd

File tree

8 files changed

+33
-14
lines changed

8 files changed

+33
-14
lines changed

projects/biogears/libBiogears/include/biogears/engine/Equipment/AnesthesiaMachine.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class BIOGEARS_API AnesthesiaMachine : public SEAnesthesiaMachine, public BioGea
113113
SEGasSubstanceQuantity* m_scubberCO2;
114114
SEGasSubstanceQuantity* m_scrubberN2;
115115
SEFluidCircuitNode* m_nVentilator;
116+
SEFluidCircuitNode* m_nSelector;
116117
SEFluidCircuitPath* m_pAnesthesiaConnectionToEnvironment;
117118
SEFluidCircuitPath* m_pYPieceToExpiratoryLimb;
118119
SEFluidCircuitPath* m_pGasSourceToGasInlet;

projects/biogears/libBiogears/src/engine/Equipment/AnesthesiaMachine.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,24 @@ void AnesthesiaMachine::Clear()
8080
void AnesthesiaMachine::Initialize()
8181
{
8282
BioGearsSystem::Initialize();
83+
m_nVentilator->GetPressure().SetValue(1033.23, PressureUnit::cmH2O);
84+
m_nVentilator->GetNextPressure().SetValue(1033.23, PressureUnit::cmH2O);
85+
m_nVentilator->GetVolume().SetValue(1.0, VolumeUnit::L);
86+
m_nVentilator->GetNextVolume().SetValue(1.0, VolumeUnit::L);
87+
m_nSelector->GetPressure().SetValue(1033.23, PressureUnit::cmH2O);
88+
m_nSelector->GetNextPressure().SetValue(1033.23, PressureUnit::cmH2O);
89+
m_nSelector->GetVolume().SetValue(0.1, VolumeUnit::L);
90+
m_nSelector->GetNextVolume().SetValue(0.1, VolumeUnit::L);
8391

8492
SetConnection(CDM::enumAnesthesiaMachineConnection::Off);
8593
GetInletFlow().SetValue(5.0, VolumePerTimeUnit::L_Per_min);
8694
GetRespiratoryRate().SetValue(12.0, FrequencyUnit::Per_min);
87-
GetPositiveEndExpiredPressure().SetValue(3.0, PressureUnit::cmH2O);
95+
GetPositiveEndExpiredPressure().SetValue(0.0, PressureUnit::cmH2O);
8896
GetInspiratoryExpiratoryRatio().SetValue(0.5);
8997
GetOxygenFraction().SetValue(0.5);
9098
SetOxygenSource(CDM::enumAnesthesiaMachineOxygenSource::Wall);
9199
SetPrimaryGas(CDM::enumAnesthesiaMachinePrimaryGas::Nitrogen);
92-
GetVentilatorPressure().SetValue(15.0, PressureUnit::cmH2O);
100+
GetVentilatorPressure().SetValue(0.0, PressureUnit::cmH2O);
93101
GetOxygenBottleOne().GetVolume().SetValue(660.0, VolumeUnit::L);
94102
GetOxygenBottleTwo().GetVolume().SetValue(660.0, VolumeUnit::L);
95103
GetReliefValvePressure().SetValue(100.0, PressureUnit::cmH2O);
@@ -164,6 +172,7 @@ void AnesthesiaMachine::SetUp()
164172

165173
// Circuit Nodes
166174
m_nVentilator = m_data.GetCircuits().GetAnesthesiaMachineCircuit().GetNode(BGE::AnesthesiaMachineNode::Ventilator);
175+
m_nSelector = m_data.GetCircuits().GetAnesthesiaMachineCircuit().GetNode(BGE::AnesthesiaMachineNode::Selector);
167176

168177
// Circuit Paths
169178
m_pAnesthesiaConnectionToEnvironment = m_data.GetCircuits().GetAnesthesiaMachineCircuit().GetPath(BGE::AnesthesiaMachinePath::AnesthesiaConnectionToEnvironment);
@@ -647,7 +656,7 @@ void AnesthesiaMachine::CalculateValveResistances()
647656
void AnesthesiaMachine::CalculateVentilator()
648657
{
649658
//Calculate the driver pressure
650-
double dDriverPressure = 0.0;
659+
double dDriverPressure = 1033.23;
651660
if (m_inhaling) {
652661
dDriverPressure = GetVentilatorPressure(PressureUnit::cmH2O);
653662
} else {

projects/biogears/libBiogears/src/engine/Systems/BloodChemistry.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,14 @@ void BloodChemistry::Process()
295295
m_data.GetSubstances().GetUrea().GetBloodConcentration().Set(m_venaCavaUrea->GetConcentration());
296296

297297
double otherIons_mmol_Per_L = -5.4; //Na, K, and Cl baseline concentrations give SID = 45.83, we assume baseline SID = 40.5, thus "other ions" (i.e. Mg, Ca, Ketones) make up -5.3 mmol_Per_L equivalent of charge
298-
double strongIonDifference_mmol_Per_L = m_venaCavaSodium->GetMolarity(AmountPerVolumeUnit::mmol_Per_L) + m_venaCavaPotassium->GetMolarity(AmountPerVolumeUnit::mmol_Per_L) - (m_venaCavaChloride->GetMolarity(AmountPerVolumeUnit::mmol_Per_L) + m_venaCavaLactate->GetMolarity(AmountPerVolumeUnit::mmol_Per_L)) + otherIons_mmol_Per_L;
299-
GetStrongIonDifference().SetValue(strongIonDifference_mmol_Per_L, AmountPerVolumeUnit::mmol_Per_L);
298+
double strongIonDifference_mmol_Per_L = m_venaCavaSodium->GetMolarity(AmountPerVolumeUnit::mmol_Per_L) + m_venaCavaPotassium->GetMolarity(AmountPerVolumeUnit::mmol_Per_L) - (m_venaCavaChloride->GetMolarity(AmountPerVolumeUnit::mmol_Per_L) + (m_venaCavaLactate->GetMolarity(AmountPerVolumeUnit::mmol_Per_L))) + otherIons_mmol_Per_L;
299+
//GetStrongIonDifference().SetValue(strongIonDifference_mmol_Per_L, AmountPerVolumeUnit::mmol_Per_L);
300300

301301

302302
// Calculate pH
303303
GetArterialBloodPH().Set(m_aorta->GetPH());
304304
GetVenousBloodPH().Set(m_venaCava->GetPH());
305+
m_data.GetDataTrack().Probe("BloodLactate",GetArterialBloodPH().GetValue());
305306

306307
// Pressures
307308
// arterial gas partial pressures -

projects/biogears/libBiogears/src/engine/Systems/Energy.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ void Energy::Initialize()
105105
GetEnergyDeficit().SetValue(0.0, PowerUnit::W);
106106
GetExerciseMeanArterialPressureDelta().SetValue(0.0, PressureUnit::mmHg);
107107
GetTotalWorkRateLevel().SetValue(0.0);
108+
GetAchievedExerciseLevel().SetValue(0.0);
108109
GetFatigueLevel().SetValue(0.0);
109110
GetSweatRate().SetValue(0.0, MassPerTimeUnit::kg_Per_s);
110111
GetChlorideLostToSweat().SetValue(0.0, MassUnit::mg);
@@ -262,6 +263,8 @@ void Energy::Process()
262263
{
263264
m_circuitCalculator.Process(*m_TemperatureCircuit, m_dT_s);
264265
CalculateVitalSigns();
266+
267+
265268
}
266269

267270
//--------------------------------------------------------------------------------------------------

projects/biogears/libBiogears/src/engine/Systems/Respiratory.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ void Respiratory::Initialize()
211211

212212
//Get the fluid mechanics to a good starting point
213213
TuneCircuit();
214+
214215
}
215216

216217
bool Respiratory::Load(const CDM::BioGearsRespiratorySystemData& in)

projects/biogears/libBiogears/src/engine/Systems/Tissue.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ void Tissue::Initialize()
170170
GetStoredFat().SetValue(m_data.GetPatient().GetWeight(MassUnit::g) * m_data.GetPatient().GetBodyFatFraction().GetValue(), MassUnit::g);
171171

172172
GetDehydrationFraction().SetValue(0);
173+
174+
175+
173176
}
174177

175178
bool Tissue::Load(const CDM::BioGearsTissueSystemData& in)
@@ -1366,13 +1369,14 @@ void Tissue::CalculateMetabolicConsumptionAndProduction(double time_s)
13661369
if (m_PatientActions->HasExercise()) {
13671370
m_energy->GetTotalWorkRateLevel().SetValue(achievedWorkRate_W / maxWorkRate_W);
13681371
double intensity = m_PatientActions->GetExercise()->GetIntensity().GetValue();
1369-
if (intensity > 1e-6) //approx. zero
1372+
if (intensity > 1e-6) { //approx. zero
13701373
m_energy->GetAchievedExerciseLevel().SetValue(achievedWorkRate_W / maxWorkRate_W / intensity);
1371-
else
1372-
m_energy->GetAchievedExerciseLevel().Clear();
1373-
} else {
1374-
m_energy->GetAchievedExerciseLevel().Clear();
1375-
m_energy->GetTotalWorkRateLevel().Clear();
1374+
} else {
1375+
m_energy->GetAchievedExerciseLevel().SetValue(0.0);
1376+
}
1377+
} else {
1378+
m_energy->GetAchievedExerciseLevel().SetValue(0.0);
1379+
m_energy->GetTotalWorkRateLevel().SetValue(0.0);
13761380
}
13771381

13781382
double fatigue = ((brainEnergyDeficit_kcal + nonbrainEnergyDeficit_kcal) / (baseEnergyRequested_kcal + exerciseEnergyRequested_kcal));

projects/cmd_bio/src/cmd_bio_main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ int main(int argc, char** argv)
104104
biogears::Config runs{ "BGEUnitTests.config" };
105105
driver.queue(runs);
106106
} else {
107-
std::cout << "Warrning: No Test known as " << test << "exists.\n";
107+
std::cout << "Warning: No Test known as " << test << "exists.\n";
108108
}
109109
}
110110
}
@@ -122,7 +122,7 @@ int main(int argc, char** argv)
122122
} else if (test == "all") {
123123
run_patient_validation = run_drug_validation = run_system_validation = run_verification = true;
124124
} else {
125-
std::cout << "Warning: No Validation known as " << test << "exists.\n";
125+
std::cout << "Warning: No Validation known as " << test << "exists.\n";
126126
}
127127
}
128128
}

share/Scenarios/EnergyEnvironment/SarinLethal.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,6 @@
169169
</Conditions>
170170
</Action>
171171
<Action xsi:type="AdvanceTimeData">
172-
<Time value="15" unit="min"/>
172+
<Time value="30" unit="min"/>
173173
</Action>
174174
</Scenario>

0 commit comments

Comments
 (0)