Skip to content

Commit e8dad51

Browse files
ntatum94StevenAWhite
authored andcommitted
f/ntatum-GenStatesforBurn: Added functionality and fixed state
generation bug - State generation works as expected again, should not create empty folders - Added ability to randomly affect titration using array of scaling factors - Added escharotomy check on hourly checkups
1 parent 73991cf commit e8dad51

File tree

1 file changed

+34
-25
lines changed

1 file changed

+34
-25
lines changed

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

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,14 @@ void BurnThread::FluidLoading(double tbsa)
328328
Status();
329329
//m_bg->GetLogger()->Info(asprintf("Checking urine production %f %s", m_bg->GetRenalSystem()->GetMeanUrineOutput(VolumePerTimeUnit::mL_Per_hr), "mL_Per_hr"));
330330
urineProduction = m_bg->GetRenalSystem()->GetMeanUrineOutput(VolumePerTimeUnit::mL_Per_hr);
331+
332+
// to add "too high" and "too low" options for titrating
333+
double scaleTitration = 1.0;
334+
double errTitrate[] {0.9, 1.0, 1.1};
335+
int errSelection = rand() % (3 - 1 + 1) + 1;
336+
scaleTitration = errTitrate[errSelection - 1];
337+
//m_bg->GetLogger()->Info(asprintf("Were they right? titrate percent is: %f %s", scaleTitration, "percent"));
338+
331339
if (fluid == ringers && fluidOn == true) {
332340
if (((int)m_bg->GetSimulationTime(TimeUnit::s) + 1) == ((int)hrsBeforeIntervention*3600)) {
333341
double beginningInfusion_mL_Per_hr = 10.0 * tbsa;
@@ -337,50 +345,51 @@ void BurnThread::FluidLoading(double tbsa)
337345
} else {
338346
if (urineProduction < targetLowUrineProduction_mL_Per_Hr) {
339347
m_bg->GetLogger()->Info(asprintf("Urine production is too low at %f %s", urineProduction, "mL_Per_hr"));
340-
m_ringers->GetRate().SetValue((m_ringers->GetRate().GetValue(VolumePerTimeUnit::mL_Per_hr)) * (1 + titrate), VolumePerTimeUnit::mL_Per_hr);
348+
m_ringers->GetRate().SetValue((m_ringers->GetRate().GetValue(VolumePerTimeUnit::mL_Per_hr)) * (1 + titrate) * scaleTitration, VolumePerTimeUnit::mL_Per_hr);
341349
m_bg->ProcessAction(*m_ringers);
342350
}
343351
if ((m_bg->GetRenalSystem()->GetMeanUrineOutput(VolumePerTimeUnit::mL_Per_hr) > targetHighUrineProduction_mL_Per_Hr)) {
344352
m_bg->GetLogger()->Info(asprintf("Urine production is too high at %f %s", urineProduction, "mL_Per_hr"));
345-
m_ringers->GetRate().SetValue((m_ringers->GetRate().GetValue(VolumePerTimeUnit::mL_Per_hr)) * (1 - titrate), VolumePerTimeUnit::mL_Per_hr);
353+
m_ringers->GetRate().SetValue((m_ringers->GetRate().GetValue(VolumePerTimeUnit::mL_Per_hr)) * (1 - titrate) * scaleTitration, VolumePerTimeUnit::mL_Per_hr);
346354
m_bg->ProcessAction(*m_ringers);
347355
}
348356
}
349357
}
350358
if (fluid == albumin && fluidOn == true) {
351359
if (urineProduction < targetLowUrineProduction_mL_Per_Hr) {
352360
m_bg->GetLogger()->Info(asprintf("Urine production is too low at %f %s", urineProduction, "mL_Per_hr"));
353-
m_albumex->GetRate().SetValue((m_albumex->GetRate().GetValue(VolumePerTimeUnit::mL_Per_hr)) * (1 + titrate), VolumePerTimeUnit::mL_Per_hr);
361+
m_albumex->GetRate().SetValue((m_albumex->GetRate().GetValue(VolumePerTimeUnit::mL_Per_hr)) * (1 + titrate) * scaleTitration, VolumePerTimeUnit::mL_Per_hr);
354362
m_bg->ProcessAction(*m_albumex);
355363
}
356364
if ((m_bg->GetRenalSystem()->GetMeanUrineOutput(VolumePerTimeUnit::mL_Per_hr) > targetHighUrineProduction_mL_Per_Hr)) {
357365
m_bg->GetLogger()->Info(asprintf("Urine production is too high at %f %s", urineProduction, "mL_Per_hr"));
358-
m_albumex->GetRate().SetValue((m_albumex->GetRate().GetValue(VolumePerTimeUnit::mL_Per_hr)) * (1 - titrate), VolumePerTimeUnit::mL_Per_hr);
366+
m_albumex->GetRate().SetValue((m_albumex->GetRate().GetValue(VolumePerTimeUnit::mL_Per_hr)) * (1 - titrate) * scaleTitration, VolumePerTimeUnit::mL_Per_hr);
359367
m_bg->ProcessAction(*m_albumex);
360368
}
361369
}
370+
// escharotomy, uncomment below for escharotomy, should happen at next hour checkpoint
371+
if (m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_Abdominal)
372+
|| m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_LeftArm)
373+
|| m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_LeftLeg)
374+
|| m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_RightArm)
375+
|| m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_RightLeg)) {
376+
if (m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_Abdominal)) {
377+
m_escharotomy->SetLocation("Trunk");
378+
} else if (m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_LeftArm)) {
379+
m_escharotomy->SetLocation("LeftArm");
380+
} else if (m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_LeftLeg)) {
381+
m_escharotomy->SetLocation("LeftLeg");
382+
} else if (m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_RightArm)) {
383+
m_escharotomy->SetLocation("RightArm");
384+
} else if (m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_RightLeg)) {
385+
m_escharotomy->SetLocation("RightLeg");
386+
} else {
387+
return;
388+
}
389+
m_bg->ProcessAction(*m_escharotomy);
390+
}
362391
}
363-
// escharotomy
364-
/*if (m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_Abdominal)
365-
|| m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_LeftArm)
366-
|| m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_LeftLeg)
367-
|| m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_RightArm)
368-
|| m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_RightLeg)) {
369-
if (m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_Abdominal)) {
370-
m_escharotomy->SetLocation("Trunk");
371-
} else if (m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_LeftArm)) {
372-
m_escharotomy->SetLocation("LeftArm");
373-
} else if (m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_LeftLeg)) {
374-
m_escharotomy->SetLocation("LeftLeg");
375-
} else if (m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_RightArm)) {
376-
m_escharotomy->SetLocation("RightArm");
377-
} else if (m_bg->GetPatient().IsEventActive(CDM::enumPatientEvent::CompartmentSyndrome_RightLeg)) {
378-
m_escharotomy->SetLocation("RightLeg");
379-
} else {
380-
return;
381-
}
382-
m_bg->ProcessAction(*m_escharotomy);
383-
}*/
392+
384393
if (fluid == ringers) {
385394
if (m_ivBagVolume_mL < 1.0) {
386395
m_ringers->GetBagVolume().SetValue(ringersVolume_mL, VolumeUnit::mL);

0 commit comments

Comments
 (0)