SimMonitor.h 1.88 KB
Newer Older
fmg005's avatar
fmg005 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
#ifndef SimMonitor_H
#define SimMonitor_H

#include <string>
#include <iostream>
#include <cstdio>
#include <chrono>
#include <thread>
#include <map>
#include <libconfig.h++>
#include "serial/serial.h"
#include "CLA_Logger.h"
#include "Environment.h"
#include "Action.h"
#include "Pump.h"
#include "Monitor.h"
#include "PatientOut.h"


/* Pulse header files */
#include "PulsePhysiologyEngine.h"
#include "properties/SEScalarTime.h"
#include "properties/SEScalarPressure.h"
#include "properties/SEScalarFrequency.h"
#include "engine/SEEngineTracker.h"
#include "system/physiology/SECardiovascularSystem.h"
#include "system/physiology/SEBloodChemistrySystem.h"
#include "system/physiology/SERespiratorySystem.h"

using namespace std;
using namespace libconfig;
using namespace std::chrono;

class SimMonitor : public PatientOut {

  private:
      CLA::Environment m_env;
      CLA::Monitor* m_monitor;
      double systolic_pressure;
      double diastolic_pressure;
      double heart_rate;
      double resp_rate;
      double oxygen_sat;
      std::shared_ptr<CLA::LOGGER> m_logger;
      std::map<std::string, CLA::Pump*> m_pumps;
      void Clear();
      /* chrono */
      system_clock::time_point m_start;
      system_clock::time_point m_engine_advance_end;
      system_clock::time_point m_command_start;
      system_clock::time_point m_command_end;
      system_clock::time_point m_infusion_start;
      system_clock::time_point m_infusion_end;
      time_t m_delta;
      time_t m_next_update_time;
      time_t m_engine_duration_ms;
      time_t m_command_duration_ms;
      time_t m_infusion_duration_ms;
      time_t m_next_update_time_duration_ms;
      time_t m_total_duration_ms;

  public:
      SimMonitor(std::shared_ptr<CLA::LOGGER>&, CLA::Environment&, \
                  std::map<std::string,CLA::Pump*>&);
      ~SimMonitor();
      void update(std::unique_ptr<PhysiologyEngine>&);
};

#endif