Commit 1fdc5324 authored by fmg005's avatar fmg005

Adding the realtime class..oops

parent db9815b9
#include "Realtime.h"
using namespace CLA;
Realtime::Realtime(std::unique_ptr<PhysiologyEngine>& engine, CLA::LOGGER*
logger): m_engine(engine), m_logger(logger) {
m_cycles = 0;
void Realtime::AdvanceModelTime(double time) {
m_cycles = static_cast<uint>(time * N);
for(int i = 0; i < m_cycles; i++) {
m_engine->AdvanceModelTime(time, TimeUnit::s);
void Realtime::LoadConfig(const char* file_path) {
try {
m_cfg.readFile(file_path); // Read configration file
catch(const FileIOException &fioex) {
m_logger->error("I/O error while reading file.");
catch(const ParseException &pex) {
m_logger->error("Error parsing configuration file.");
N = m_cfg.lookup("realtime.time_steps");
Realtime::~Realtime() {
#ifndef REALTIME_H
#define REALTIME_H
#include <string>
#include <libconfig.h++>
#include "CLA_Logger.h"
#include "PulsePhysiologyEngine.h"
#include "engine/SEEngineTracker.h"
#include "scenario/SEDataRequest.h"
#include "properties/SEScalarTime.h"
using namespace libconfig;
namespace CLA {
class Realtime {
double N; //system clock: 1s->600 sim time steps or 12 sim secs
std::unique_ptr<PhysiologyEngine>& m_engine;
uint m_cycles;
Config m_cfg;
CLA::LOGGER* m_logger;
Realtime(std::unique_ptr<PhysiologyEngine>&, CLA::LOGGER*);
void AdvanceModelTime(double);
void LoadConfig(const char*);
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