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
c69cbbcb
Commit
c69cbbcb
authored
May 29, 2018
by
fmg005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
To handle simulation actions i.e. infusions
parent
64050d8c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
102 additions
and
0 deletions
+102
-0
Action.cpp
Action.cpp
+60
-0
include/Action.h
include/Action.h
+42
-0
No files found.
Action.cpp
0 → 100644
View file @
c69cbbcb
#include "Action.h"
using
namespace
CLA
;
Action
::
Action
(
std
::
shared_ptr
<
CLA
::
LOGGER
>&
logger
)
:
m_logger
(
logger
)
{
NorepiConcentration
=
16
;
bpdrug_prev_rate
=
0
;
saline_prev_rate
=
0
;
SalineBagVolume
=
500
;
}
void
Action
::
initialize
(
std
::
unique_ptr
<
PhysiologyEngine
>&
engine
,
const
string
&
substance
)
{
if
(
substance
==
"Norepinephrine"
)
{
m_bpdrug
=
engine
->
GetSubstanceManager
().
GetSubstance
(
substance
);
m_bpdrug_infusion
=
new
SESubstanceInfusion
(
*
m_bpdrug
);
m_bpdrug_infusion
->
GetConcentration
().
SetValue
(
NorepiConcentration
,
MassPerVolumeUnit
::
ug_Per_mL
);
}
else
if
(
substance
==
"Saline"
)
{
m_saline
=
engine
->
GetSubstanceManager
().
GetCompound
(
substance
);
m_infusion
=
new
SESubstanceCompoundInfusion
(
*
m_saline
);
m_infusion
->
GetBagVolume
().
SetValue
(
SalineBagVolume
,
VolumeUnit
::
mL
);
}
}
void
Action
::
infuse_drug
(
std
::
unique_ptr
<
PhysiologyEngine
>&
engine
,
const
string
&
substance
,
double
new_rate
)
{
if
(
substance
==
"Norepinephrine"
)
{
if
(
bpdrug_prev_rate
!=
new_rate
&&
new_rate
>
0
)
{
m_bpdrug_infusion
->
GetRate
().
SetValue
(
new_rate
,
VolumePerTimeUnit
::
mL_Per_hr
);
engine
->
ProcessAction
(
*
m_bpdrug_infusion
);
bpdrug_prev_rate
=
new_rate
;
m_logger
->
info
(
"currently "
+
substance
+
" infusing patient at rate a of "
+
to_string
(
int
(
new_rate
))
+
" mL/hr"
);
}
}
else
if
(
substance
==
"Saline"
)
{
if
(
saline_prev_rate
!=
new_rate
&&
new_rate
>
0
)
{
m_infusion
->
GetRate
().
SetValue
(
new_rate
,
VolumePerTimeUnit
::
mL_Per_hr
);
engine
->
ProcessAction
(
*
m_infusion
);
saline_prev_rate
=
new_rate
;
m_logger
->
info
(
"currently "
+
substance
+
" infusing patient at rate a of "
+
to_string
(
int
(
new_rate
))
+
" mL/hr"
);
}
}
}
void
Action
::
clear
()
{
m_bpdrug
=
nullptr
;
m_bpdrug_infusion
=
nullptr
;
m_infusion
=
nullptr
;
m_saline
=
nullptr
;
}
Action
::~
Action
()
{
clear
();
delete
m_bpdrug
;
delete
m_bpdrug_infusion
;
delete
m_infusion
;
delete
m_saline
;
}
include/Action.h
0 → 100644
View file @
c69cbbcb
#ifndef ACTION_H
#define ACTION_H
#include <iostream>
#include <string>
#include <map>
#include "CLA_Logger.h"
/* pulse stuff */
#include "PulsePhysiologyEngine.h"
#include "patient/actions/SESubstanceCompoundInfusion.h"
#include "patient/actions/SESubstanceInfusion.h"
#include "substance/SESubstanceManager.h"
#include "substance/SESubstanceCompound.h"
#include "properties/SEScalarMassPerVolume.h"
#include "substance/SESubstance.h"
#include "properties/SEScalarVolume.h"
#include "properties/SEScalarVolumePerTime.h"
using
namespace
std
;
namespace
CLA
{
class
Action
{
private:
SESubstance
*
m_bpdrug
;
SESubstanceInfusion
*
m_bpdrug_infusion
;
SESubstanceCompoundInfusion
*
m_infusion
;
SESubstanceCompound
*
m_saline
;
double
bpdrug_prev_rate
;
/* cache the last received rate */
double
saline_prev_rate
;
/* cache the last received rate */
double
NorepiConcentration
;
double
SalineBagVolume
;
std
::
shared_ptr
<
CLA
::
LOGGER
>
m_logger
;
public:
Action
(
std
::
shared_ptr
<
CLA
::
LOGGER
>&
);
~
Action
();
void
infuse_drug
(
std
::
unique_ptr
<
PhysiologyEngine
>&
,
const
string
&
,
double
);
void
initialize
(
std
::
unique_ptr
<
PhysiologyEngine
>&
,
const
string
&
);
void
clear
();
};
}
#endif
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