Commit 69b1a088 authored by fmg005's avatar fmg005

Bug fixes

parent 6a6a9a47
......@@ -19,7 +19,7 @@ void HardwareSimulator::update(std::unique_ptr<PhysiologyEngine>& engine) {
m_start = system_clock::now();
engine->AdvanceModelTime(advance_time, TimeUnit::s);
m_end = system_clock::now();
m_command_start = system_clock::now();
systolic_pressure = engine->GetCardiovascularSystem()->GetSystolicArterialPressure(PressureUnit::mmHg);
diastolic_pressure = engine->GetCardiovascularSystem()->GetDiastolicArterialPressure(PressureUnit::mmHg);
......@@ -89,37 +89,43 @@ void HardwareSimulator::SetHeartRate(double rate) {
/* RR range: 10-150 */
void HardwareSimulator::SetRespRate(double rate) {
int resp_rate = static_cast<int>(rate);
if (rate >= 10 && rate < 100 ) {
SendCommand("RESPRATE=0"+std::to_string(rate));
m_logger->info("Respiratory rate set to "+to_string(rate)+"bprm");
SendCommand("RESPRATE=0"+std::to_string(resp_rate));
m_logger->info("Respiratory rate set to "+to_string(resp_rate)+"bprm");
}
else if(rate > 99 && rate <=150) {
SendCommand("RESPRATE="+std::to_string(rate));
m_logger->info("Respiratory rate set to "+to_string(rate)+"bprm");
SendCommand("RESPRATE="+std::to_string(resp_rate));
m_logger->info("Respiratory rate set to "+to_string(resp_rate)+"bprm");
}
else {
m_logger->warning("Respiratory rate value: "+to_string(rate)+" not within acceptable range 10-150");
m_logger->warning("Respiratory rate value: "+to_string(resp_rate)+" not within acceptable range 10-150");
}
}
/* O2 range: 0-100 */
void HardwareSimulator::SetOxygenSat(double rate) {
int i_rate = rate - 1;
int o2_rate = static_cast<int>(rate);
/* prosim has a bug, monitor displays value which is 1 unit
higher than set value (for oxygen saturation)
*/
int i_rate = o2_rate - 1;
std::string s_rate = std::to_string(i_rate);
if (rate < 10) {
s_rate = "0" + s_rate;
if (rate >= 0 && rate < 10) {
SendCommand("SAT=00"+s_rate);
m_logger->info("Oxygen saturation set to " + to_string(o2_rate));
}
else if(rate > 10 && rate < 100 ) {
SendCommand("SAT=0"+s_rate);
m_logger->info("Oxygen saturation set to " + to_string(rate));
m_logger->info("Oxygen saturation set to " + to_string(o2_rate));
}
else if(rate == 100 ) {
SendCommand("SAT="+s_rate);
m_logger->info("Oxygen saturation set to " + to_string(rate));
m_logger->info("Oxygen saturation set to " + to_string(o2_rate));
}
else {
m_logger->warning("Oxygen saturation value: "+to_string(rate)+" not within acceptable range 0-100");
m_logger->warning("Oxygen saturation value: "+to_string(o2_rate)+" not within acceptable range 0-100");
}
}
......
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