Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cla_prosim_driver
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fmg005
cla_prosim_driver
Commits
db9815b9
Commit
db9815b9
authored
May 02, 2018
by
fmg005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Realtime capability added
parent
66017e52
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
9 deletions
+18
-9
CLA_Logger.cpp
CLA_Logger.cpp
+1
-1
SimulationEngine.cpp
SimulationEngine.cpp
+10
-4
prosim.cmake
prosim.cmake
+1
-0
resources/scenario.cfg
resources/scenario.cfg
+6
-4
No files found.
CLA_Logger.cpp
View file @
db9815b9
...
...
@@ -6,7 +6,7 @@ CLA::LOGGER::LOGGER() {
}
CLA
::
LOGGER
::
LOGGER
(
const
string
&
filename
)
:
m_filename
(
move
(
filename
))
{
m_logstream
.
open
(
prosim_logs_dir
+
m_filename
);
m_logstream
.
open
(
prosim_logs_dir
+
m_filename
,
ios
::
out
|
ios
::
binary
);
}
string
CLA
::
LOGGER
::
current_time
(
bool
display_tz
){
...
...
SimulationEngine.cpp
View file @
db9815b9
...
...
@@ -10,6 +10,7 @@
#include "HardwareSimulator.h"
#include "CLA_Logger.h"
#include "SimulationEngine.h"
#include "Realtime.h"
// Include the various types you will be using in your code
#include "scenario/SEDataRequestManager.h"
...
...
@@ -81,7 +82,8 @@ void Simulation(const string patient_name, const std::shared_ptr<Config>& cfg, c
HardwareSimulator
prosim
(
&
myserial
,
&
logger
,
&
sim_env
);
prosim
.
LoadConfig
(
filepath
);
//sim_env.logger = std::make_shared<SimulationLogger>(prosim_results_dir"SimulationEngineLog_"+patient_name+".txt");
CLA
::
Realtime
rt
(
pe
,
&
logger
);
rt
.
LoadConfig
(
filepath
);
bool
STOP
=
false
;
// Execute stop hemmorrhage only once; without this it be executed for each timestep
bool
DEVICES_START
=
false
;
...
...
@@ -118,9 +120,12 @@ void Simulation(const string patient_name, const std::shared_ptr<Config>& cfg, c
}
// track patient data
pe
->
GetEngineTracker
()
->
TrackData
(
pe
->
GetSimulationTime
(
TimeUnit
::
s
));
pe
->
AdvanceModelTime
();
//pe->GetEngineTracker()->TrackData(pe->GetSimulationTime(TimeUnit::s));
//pe->AdvanceModelTime();
rt
.
AdvanceModelTime
(
1.0
);
sim_env
.
time_index
++
;
pe
->
GetEngineTracker
()
->
TrackData
((
double
)
sim_env
.
time_index
);
}
// End while looop
}
// End Simulation function
...
...
@@ -139,7 +144,8 @@ void Global_LoadConfig(std::unique_ptr<PhysiologyEngine>& engine, const std::sha
env
->
simulation_injury_start
=
cf
->
lookup
(
"simulation.time.injury_start"
);
env
->
simulation_injury_stop
=
cf
->
lookup
(
"simulation.time.injury_stop"
);
env
->
time_index
=
0
;
// initialize the time index
env
->
engine_timestep
=
engine
->
GetTimeStep
(
TimeUnit
::
s
);
//env->engine_timestep = engine->GetTimeStep(TimeUnit::s);
env
->
engine_timestep
=
1.0
;
env
->
simulation_timesteps
=
env
->
simulation_time
/
env
->
engine_timestep
;
env
->
simulation_injury_start_timestep
=
env
->
simulation_injury_start
/
env
->
engine_timestep
;
env
->
simulation_injury_stop_timestep
=
env
->
simulation_injury_stop
/
env
->
engine_timestep
;
...
...
prosim.cmake
View file @
db9815b9
...
...
@@ -61,6 +61,7 @@ set( my_srcs
CLA_Logger.cpp
#example.cpp
SimulationEngine.cpp
Realtime.cpp
)
add_executable
(
prosim
${
my_srcs
}
)
...
...
resources/scenario.cfg
View file @
db9815b9
...
...
@@ -3,14 +3,16 @@
prosim = {
delay_5_sec = 5.0; # Prosim delay-->arbitrary value
};
}
realtime = {
time_steps = 12.0; # How many simulation seconds result into 1s of real time
}
simulation = {
time = {
run =
3600.0;
# Time -> Seconds # How long should simulation run
injury_start = 5.0; # When should injury be introduced to patient
run =
120.0;
# Time -> Seconds # How long should simulation run
injury_start = 5.0;
# When should injury be introduced to patient
injury_stop = 700.0; # When should injury be stopped
}
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment