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
69b1a088
Commit
69b1a088
authored
May 08, 2018
by
fmg005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixes
parent
6a6a9a47
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
+18
-12
HardwareSimulator.cpp
HardwareSimulator.cpp
+18
-12
No files found.
HardwareSimulator.cpp
View file @
69b1a088
...
...
@@ -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
(
r
esp_r
ate
));
m_logger
->
info
(
"Respiratory rate set to "
+
to_string
(
r
esp_r
ate
)
+
"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
(
r
esp_r
ate
));
m_logger
->
info
(
"Respiratory rate set to "
+
to_string
(
r
esp_r
ate
)
+
"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
(
r
esp_r
ate
)
+
" 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"
);
}
}
...
...
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