Commit 1aee5c0f authored by fmg005's avatar fmg005

getters for infusion rates

parent 6a3c335e
......@@ -3,12 +3,13 @@
using namespace CLA;
Action::Action(std::shared_ptr<CLA::LOGGER>& logger, \
std::map<std::string,CLA::Pump*>& pumps, CLA::Environment& env) : m_logger(\
logger), m_pumps(pumps), m_env(env) {
std::map<std::string,CLA::Pump*>& pumps) : m_logger(logger), m_pumps(pumps) {
NorepiConcentration = 16;
bpdrug_prev_rate = 0;
saline_prev_rate = 0;
SalineBagVolume = 500;
bpdrug_rate = 0;
saline_rate = 0;
}
void Action::initialize(std::unique_ptr<PhysiologyEngine>& engine) {
......@@ -25,29 +26,37 @@ void Action::initialize(std::unique_ptr<PhysiologyEngine>& engine) {
}
void Action::infuse_drug(std::unique_ptr<PhysiologyEngine>& engine) {
m_env.bpdrug_rate = m_pumps["bpdrug"]->getCurrentInfusionRate();
m_env.saline_rate = m_pumps["saline"]->getCurrentInfusionRate();
bpdrug_rate = m_pumps["bpdrug"]->getCurrentInfusionRate();
saline_rate = m_pumps["saline"]->getCurrentInfusionRate();
if (m_pumps["bpdrug"]->getSubstance() != "") {
if (bpdrug_prev_rate != m_env.bpdrug_rate && m_env.bpdrug_rate > 0) {
m_bpdrug_infusion->GetRate().SetValue(m_env.bpdrug_rate, VolumePerTimeUnit::mL_Per_hr);
if (bpdrug_prev_rate != bpdrug_rate && bpdrug_rate > 0) {
m_bpdrug_infusion->GetRate().SetValue(bpdrug_rate, VolumePerTimeUnit::mL_Per_hr);
engine->ProcessAction(*m_bpdrug_infusion);
bpdrug_prev_rate = m_env.bpdrug_rate;
bpdrug_prev_rate = bpdrug_rate;
m_logger->info(m_pumps["bpdrug"]->getSubstance()+": infusing patient at "\
+to_string(int(m_env.bpdrug_rate))+" mL/hr");
+to_string(int(bpdrug_rate))+" mL/hr");
}
}
if (m_pumps["saline"]->getSubstance() != "") {
if (saline_prev_rate != m_env.saline_rate && m_env.saline_rate > 0) {
m_infusion->GetRate().SetValue(m_env.saline_rate, VolumePerTimeUnit::mL_Per_hr);
if (saline_prev_rate != saline_rate && saline_rate > 0) {
m_infusion->GetRate().SetValue(saline_rate, VolumePerTimeUnit::mL_Per_hr);
engine->ProcessAction(*m_infusion);
saline_prev_rate = m_env.saline_rate;
saline_prev_rate = saline_rate;
m_logger->info(m_pumps["saline"]->getSubstance()+": infusing patient at "\
+to_string(int(m_env.saline_rate))+" mL/hr");
+to_string(int(saline_rate))+" mL/hr");
}
}
}
double Action::get_bpdrug_rate() const {
return bpdrug_rate;
}
double Action::get_saline_rate() const {
return saline_rate;
}
void Action::clear() {
m_bpdrug = nullptr;
m_bpdrug_infusion = nullptr;
......
......@@ -32,14 +32,17 @@ namespace CLA {
double saline_prev_rate; /* cache the last received rate */
double NorepiConcentration;
double SalineBagVolume;
double bpdrug_rate;
double saline_rate;
std::shared_ptr<CLA::LOGGER> m_logger;
CLA::Environment m_env;
public:
Action(std::shared_ptr<CLA::LOGGER>&, std::map<std::string,CLA::Pump*>&, \
CLA::Environment&);
Action(std::shared_ptr<CLA::LOGGER>&, std::map<std::string,CLA::Pump*>&);
~Action();
void infuse_drug(std::unique_ptr<PhysiologyEngine>&);
void initialize(std::unique_ptr<PhysiologyEngine>&);
double get_bpdrug_rate() const;
double get_saline_rate() const;
void clear();
};
}
......
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