Skip to content

Commit b2cfb89

Browse files
ajbairdStevenAWhite
authored andcommitted
abaird-genstatesforBurn: still some debugging neeeded to get albumin administered at the right time
1 parent f49299d commit b2cfb89

File tree

2 files changed

+40
-10
lines changed

2 files changed

+40
-10
lines changed

projects/howto/BurnWoundPainStimulus/src/HowTo-BurnWoundPainStimulus.cpp

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ BurnThread::BurnThread(const std::string logFile, double tbsa)
135135
m_albumex = new SESubstanceCompoundInfusion(*albumex);
136136
m_escharotomy = new SEEscharotomy();
137137
m_ivBagVolume_mL = 0.0;
138+
m_ivBagVolumeAlbumin_mL = 0.0;
138139
m_ketamineBolus = new SESubstanceBolus(*ketamine);
139140
//m_genState = new SESerializeState();
140141
m_burnWound = new SEBurnWound();
@@ -216,24 +217,41 @@ void BurnThread::AdvanceTimeFluids()
216217
}
217218
m_bg->GetEngineTrack()->GetDataTrack().Probe("totalFluid_mL", m_TotalVolume_mL);
218219
m_bg->GetEngineTrack()->GetDataTrack().Probe("bagVolume_mL", m_ivBagVolume_mL);
220+
m_bg->GetEngineTrack()->GetDataTrack().Probe("totalFluidAlbumin_mL", m_TotalVolumeAlbumin_mL);
221+
m_bg->GetEngineTrack()->GetDataTrack().Probe("bagVolumeAlbumin_mL", m_ivBagVolumeAlbumin_mL);
219222
m_bg->GetEngineTrack()->TrackData(m_bg->GetSimulationTime(TimeUnit::s));
220223
m_mutex.unlock();
221224
std::this_thread::sleep_for(std::chrono::milliseconds(25));
225+
226+
if (fluid == albumin) {
227+
m_mutex.lock();
228+
m_bg->AdvanceModelTime(1.0, TimeUnit::s);
229+
if (m_albumex->HasBagVolume() && m_albumex->HasRate()) {
230+
m_TotalVolumeAlbumin_mL += (m_albumex->GetRate().GetValue(VolumePerTimeUnit::mL_Per_s));
231+
m_ivBagVolumeAlbumin_mL += (-m_albumex->GetRate().GetValue(VolumePerTimeUnit::mL_Per_s));
232+
if (m_ivBagVolume_mL < 0.0) {
233+
m_bg->GetLogger()->Info("Albumex_4PCT IV bag is empty \n");
234+
}
235+
}
236+
m_bg->GetEngineTrack()->TrackData(m_bg->GetSimulationTime(TimeUnit::s));
237+
m_mutex.unlock();
238+
std::this_thread::sleep_for(std::chrono::milliseconds(25));
239+
}
222240
}
223241

224242
void BurnThread::AdvanceTimeFluidsAlbumin()
225243
{
226244
m_mutex.lock();
227245
m_bg->AdvanceModelTime(1.0, TimeUnit::s);
228246
if (m_albumex->HasBagVolume() && m_albumex->HasRate()) {
229-
m_TotalVolume_mL += (m_albumex->GetRate().GetValue(VolumePerTimeUnit::mL_Per_s));
230-
m_ivBagVolume_mL += (-m_albumex->GetRate().GetValue(VolumePerTimeUnit::mL_Per_s));
247+
m_TotalVolumeAlbumin_mL += (m_albumex->GetRate().GetValue(VolumePerTimeUnit::mL_Per_s));
248+
m_ivBagVolumeAlbumin_mL += (-m_albumex->GetRate().GetValue(VolumePerTimeUnit::mL_Per_s));
231249
if (m_ivBagVolume_mL < 0.0) {
232250
m_bg->GetLogger()->Info("Albumex_4PCT IV bag is empty \n");
233251
}
234252
}
235-
m_bg->GetEngineTrack()->GetDataTrack().Probe("totalFluid_mL", m_TotalVolume_mL);
236-
m_bg->GetEngineTrack()->GetDataTrack().Probe("bagVolume_mL", m_ivBagVolume_mL);
253+
m_bg->GetEngineTrack()->GetDataTrack().Probe("totalFluidAlbumin_mL", m_TotalVolumeAlbumin_mL);
254+
m_bg->GetEngineTrack()->GetDataTrack().Probe("bagVolumeAlbumin_mL", m_ivBagVolumeAlbumin_mL);
237255
m_bg->GetEngineTrack()->TrackData(m_bg->GetSimulationTime(TimeUnit::s));
238256
m_mutex.unlock();
239257
std::this_thread::sleep_for(std::chrono::milliseconds(25));
@@ -265,7 +283,6 @@ void BurnThread::FluidLoading(double tbsa)
265283
{
266284
//fluidType fluid = ringers;
267285
// auto fluid = albumin; //set the type of fluid here
268-
auto fluid = ringers; //set the type of fluid here
269286
//double tbsa = tbsa;
270287
double urineProduction = 0.0;
271288
int checkTime_s = 3600;
@@ -283,6 +300,7 @@ void BurnThread::FluidLoading(double tbsa)
283300
double targetHighUrineProduction_mL_Per_Hr = 1.0 * weight_kg; //average of around 50ml/hr
284301
double DayLimit_mL = 4.0 * weight_kg * tbsa;
285302
double initialInfustion_mL_Per_hr = 0.0; //tbsa * 10.0; // Should start at 10*tbsa // (DayLimit_mL / 0.5) / 8.0; //half of the fluid should be loaded in the first 8 hours;
303+
double initialInfustionAlbumin_mL_Per_hr = 40.0; //tbsa * 10.0; // Should start at 10*tbsa // (DayLimit_mL / 0.5) / 8.0; //half of the fluid should be loaded in the first 8 hours;
286304
double hrsBeforeIntervention = 1.0;
287305
double DayLimit_Hr = DayLimit_mL / 25.0;
288306
double temp = 0.0;
@@ -295,7 +313,8 @@ void BurnThread::FluidLoading(double tbsa)
295313
}
296314
//same volume and rate
297315
if (fluid == albumin) {
298-
SetAlbuminInfusionRate(ringersVolume_mL, initialInfustion_mL_Per_hr);
316+
m_bg->GetLogger()->Info(asprintf("Beginning Intervention with infusion at %f %s", initialInfustionAlbumin_mL_Per_hr, "mL_Per_hr"));
317+
SetAlbuminInfusionRate(ringersVolume_mL, initialInfustionAlbumin_mL_Per_hr);
299318
}
300319

301320
while (m_runThread) {
@@ -310,8 +329,9 @@ void BurnThread::FluidLoading(double tbsa)
310329
fname.append(std::to_string(simTime_min));
311330
fname.append("min_");
312331
int ringersRate_mL_Per_hr = 0;
313-
if (m_ringers->HasRate())
314-
ringersRate_mL_Per_hr = (int)(m_ringers->GetRate().GetValue(VolumePerTimeUnit::mL_Per_hr));
332+
if (m_ringers->HasRate()) {
333+
ringersRate_mL_Per_hr = (int)(m_ringers->GetRate().GetValue(VolumePerTimeUnit::mL_Per_hr));
334+
}
315335
//ringersRate_mL_Per_hr = (int)(floor(ringersRate_mL_Per_hr * 100.0) / 100.0);
316336
fname.append(std::to_string(ringersRate_mL_Per_hr));
317337
fname.append("Ringers_");
@@ -323,6 +343,13 @@ void BurnThread::FluidLoading(double tbsa)
323343
fname.append("Albumin.xml");
324344
m_bg->SaveStateToFile(fname);
325345
}
346+
347+
//set fluid to albumin at the 8 hour mark
348+
if ((int)m_bg->GetSimulationTime(TimeUnit::min) == (int)120) {
349+
fluid = albumin;
350+
m_bg->GetLogger()->Info(asprintf("adding albumin"));
351+
}
352+
326353
//check urine every hour, reset the volume while we are at it
327354
if (((int)m_bg->GetSimulationTime(TimeUnit::s) + 1) % checkTime_s == 0) {
328355
Status();
@@ -410,11 +437,11 @@ void BurnThread::FluidLoading(double tbsa)
410437
}
411438

412439
if (fluid == albumin) {
413-
if (m_ivBagVolume_mL < 1.0) {
440+
if (m_ivBagVolumeAlbumin_mL < 1.0) {
414441
m_albumex->GetBagVolume().SetValue(ringersVolume_mL, VolumeUnit::mL);
415442
m_bg->GetLogger()->Info("albumin IV bag is low, refilling bag \n");
416443
m_bg->ProcessAction(*m_albumex);
417-
m_ivBagVolume_mL = ringersVolume_mL; //tracking purposes
444+
m_ivBagVolumeAlbumin_mL = ringersVolume_mL; //tracking purposes
418445
}
419446
}
420447

projects/howto/BurnWoundPainStimulus/src/HowTo-BurnWoundPainStimulus.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ class BurnThread {
6464
biogears::SESubstanceCompoundInfusion* m_ringers;
6565
biogears::SESubstanceCompoundInfusion* m_albumex;
6666
double m_ivBagVolume_mL;
67+
double m_ivBagVolumeAlbumin_mL;
68+
double m_TotalVolumeAlbumin_mL = 0.0;
6769
double m_TotalVolume_mL = 0.0;
70+
fluidType fluid = ringers; //set the type of fluid here
6871

6972

7073
};

0 commit comments

Comments
 (0)