Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pulse Physiology Suite
engine
Commits
acca001e
Commit
acca001e
authored
Feb 22, 2021
by
Aaron Bray
Browse files
Clean up hemorrhage logic
Fix issues with some equipment actions
parent
ab985575
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
data/config/DebugRun.config
View file @
acca001e
...
...
@@ -31,4 +31,4 @@ Macro EngineUnitTest=EngineUnitTestDriver FastPlot Baseline=unit_tests/pulse/ Co
Macro
EngineUnitTestFull
=
EngineUnitTestDriver
FullPlot
Baseline
=
unit_tests
/
pulse
/
Computed
=./
test_results
/
unit_tests
/
pulse
Macro
ScenarioTest
=
ScenarioTestDriver
FastPlot
Baseline
=
scenarios
/
Computed
=./
test_results
/
scenarios
patient
/
BasicStandard
.
json
=
patient
/
BasicStandard
.
json
=
ScenarioTest
data/human/adult/scenarios/patient/HemorrhageVaryingSeverity.json
View file @
acca001e
...
...
@@ -97,7 +97,7 @@
"Compartment"
:
"LeftLegVasculature"
,
"Severity"
:
{
"Scalar0To1"
:
{
"Value"
:
0.0
5
"Value"
:
0.0
}
}
}
...
...
src/cpp/cdm/compartment/SECompartmentNodes.h
View file @
acca001e
...
...
@@ -22,6 +22,13 @@ public:
virtual
void
StateChange
();
//analyze and cache for optimization
virtual
bool
HasMapping
()
const
{
return
!
m_AllNodes
.
empty
();
}
virtual
bool
HasMapping
(
const
NodeType
&
n
)
const
{
for
(
auto
mine
:
m_AllNodes
)
if
(
&
n
==
mine
)
return
true
;
return
false
;
}
virtual
const
std
::
vector
<
NodeType
*>&
GetNodes
()
const
{
return
m_AllNodes
;
}
virtual
const
std
::
vector
<
NodeType
*>&
GetQuantityNodes
()
const
{
return
m_QuantityNodes
;
}
virtual
void
RemoveNode
(
NodeType
&
node
);
...
...
src/cpp/cdm/engine/SEEquipmentActionCollection.cpp
View file @
acca001e
...
...
@@ -269,7 +269,7 @@ void SEEquipmentActionCollection::RemoveAnesthesiaMachineConfiguration()
bool
SEEquipmentActionCollection
::
HasAnesthesiaMachineOxygenTankPressureLoss
()
const
{
return
m_AnesthesiaMachineOxygenTankPressureLoss
==
nullptr
?
false
:
true
;
return
m_AnesthesiaMachineOxygenTankPressureLoss
==
nullptr
?
false
:
m_AnesthesiaMachineOxygenTankPressureLoss
->
IsActive
()
;
}
SEAnesthesiaMachineOxygenTankPressureLoss
&
SEEquipmentActionCollection
::
GetAnesthesiaMachineOxygenTankPressureLoss
()
{
...
...
@@ -289,7 +289,7 @@ void SEEquipmentActionCollection::RemoveAnesthesiaMachineOxygenTankPressureLoss(
bool
SEEquipmentActionCollection
::
HasAnesthesiaMachineOxygenWallPortPressureLoss
()
const
{
return
m_AnesthesiaMachineOxygenWallPortPressureLoss
==
nullptr
?
false
:
true
;
return
m_AnesthesiaMachineOxygenWallPortPressureLoss
==
nullptr
?
false
:
m_AnesthesiaMachineOxygenWallPortPressureLoss
->
IsActive
()
;
}
SEAnesthesiaMachineOxygenWallPortPressureLoss
&
SEEquipmentActionCollection
::
GetAnesthesiaMachineOxygenWallPortPressureLoss
()
{
...
...
@@ -309,7 +309,7 @@ void SEEquipmentActionCollection::RemoveAnesthesiaMachineOxygenWallPortPressureL
bool
SEEquipmentActionCollection
::
HasAnesthesiaMachineExpiratoryValveLeak
()
const
{
return
m_AnesthesiaMachineExpiratoryValveLeak
==
nullptr
?
false
:
true
;
return
m_AnesthesiaMachineExpiratoryValveLeak
==
nullptr
?
false
:
m_AnesthesiaMachineExpiratoryValveLeak
->
IsActive
()
;
}
SEAnesthesiaMachineExpiratoryValveLeak
&
SEEquipmentActionCollection
::
GetAnesthesiaMachineExpiratoryValveLeak
()
{
...
...
@@ -329,7 +329,7 @@ void SEEquipmentActionCollection::RemoveAnesthesiaMachineExpiratoryValveLeak()
bool
SEEquipmentActionCollection
::
HasAnesthesiaMachineExpiratoryValveObstruction
()
const
{
return
m_AnesthesiaMachineExpiratoryValveObstruction
==
nullptr
?
false
:
true
;
return
m_AnesthesiaMachineExpiratoryValveObstruction
==
nullptr
?
false
:
m_AnesthesiaMachineExpiratoryValveObstruction
->
IsActive
()
;
}
SEAnesthesiaMachineExpiratoryValveObstruction
&
SEEquipmentActionCollection
::
GetAnesthesiaMachineExpiratoryValveObstruction
()
{
...
...
@@ -349,7 +349,7 @@ void SEEquipmentActionCollection::RemoveAnesthesiaMachineExpiratoryValveObstruct
bool
SEEquipmentActionCollection
::
HasAnesthesiaMachineInspiratoryValveLeak
()
const
{
return
m_AnesthesiaMachineInspiratoryValveLeak
==
nullptr
?
false
:
true
;
return
m_AnesthesiaMachineInspiratoryValveLeak
==
nullptr
?
false
:
m_AnesthesiaMachineInspiratoryValveLeak
->
IsActive
()
;
}
SEAnesthesiaMachineInspiratoryValveLeak
&
SEEquipmentActionCollection
::
GetAnesthesiaMachineInspiratoryValveLeak
()
{
...
...
@@ -369,7 +369,7 @@ void SEEquipmentActionCollection::RemoveAnesthesiaMachineInspiratoryValveLeak()
bool
SEEquipmentActionCollection
::
HasAnesthesiaMachineInspiratoryValveObstruction
()
const
{
return
m_AnesthesiaMachineInspiratoryValveObstruction
==
nullptr
?
false
:
true
;
return
m_AnesthesiaMachineInspiratoryValveObstruction
==
nullptr
?
false
:
m_AnesthesiaMachineInspiratoryValveObstruction
->
IsActive
()
;
}
SEAnesthesiaMachineInspiratoryValveObstruction
&
SEEquipmentActionCollection
::
GetAnesthesiaMachineInspiratoryValveObstruction
()
{
...
...
@@ -389,7 +389,7 @@ void SEEquipmentActionCollection::RemoveAnesthesiaMachineInspiratoryValveObstruc
bool
SEEquipmentActionCollection
::
HasAnesthesiaMachineMaskLeak
()
const
{
return
m_AnesthesiaMachineMaskLeak
==
nullptr
?
false
:
true
;
return
m_AnesthesiaMachineMaskLeak
==
nullptr
?
false
:
m_AnesthesiaMachineMaskLeak
->
IsActive
()
;
}
SEAnesthesiaMachineMaskLeak
&
SEEquipmentActionCollection
::
GetAnesthesiaMachineMaskLeak
()
{
...
...
@@ -409,7 +409,7 @@ void SEEquipmentActionCollection::RemoveAnesthesiaMachineMaskLeak()
bool
SEEquipmentActionCollection
::
HasAnesthesiaMachineSodaLimeFailure
()
const
{
return
m_AnesthesiaMachineSodaLimeFailure
==
nullptr
?
false
:
true
;
return
m_AnesthesiaMachineSodaLimeFailure
==
nullptr
?
false
:
m_AnesthesiaMachineSodaLimeFailure
->
IsActive
()
;
}
SEAnesthesiaMachineSodaLimeFailure
&
SEEquipmentActionCollection
::
GetAnesthesiaMachineSodaLimeFailure
()
{
...
...
@@ -429,7 +429,7 @@ void SEEquipmentActionCollection::RemoveAnesthesiaMachineSodaLimeFailure()
bool
SEEquipmentActionCollection
::
HasAnesthesiaMachineTubeCuffLeak
()
const
{
return
m_AnesthesiaMachineTubeCuffLeak
==
nullptr
?
false
:
true
;
return
m_AnesthesiaMachineTubeCuffLeak
==
nullptr
?
false
:
m_AnesthesiaMachineTubeCuffLeak
->
IsActive
()
;
}
SEAnesthesiaMachineTubeCuffLeak
&
SEEquipmentActionCollection
::
GetAnesthesiaMachineTubeCuffLeak
()
{
...
...
@@ -449,7 +449,7 @@ void SEEquipmentActionCollection::RemoveAnesthesiaMachineTubeCuffLeak()
bool
SEEquipmentActionCollection
::
HasAnesthesiaMachineVaporizerFailure
()
const
{
return
m_AnesthesiaMachineVaporizerFailure
==
nullptr
?
false
:
true
;
return
m_AnesthesiaMachineVaporizerFailure
==
nullptr
?
false
:
m_AnesthesiaMachineVaporizerFailure
->
IsActive
()
;
}
SEAnesthesiaMachineVaporizerFailure
&
SEEquipmentActionCollection
::
GetAnesthesiaMachineVaporizerFailure
()
{
...
...
@@ -469,7 +469,7 @@ void SEEquipmentActionCollection::RemoveAnesthesiaMachineVaporizerFailure()
bool
SEEquipmentActionCollection
::
HasAnesthesiaMachineVentilatorPressureLoss
()
const
{
return
m_AnesthesiaMachineVentilatorPressureLoss
==
nullptr
?
false
:
true
;
return
m_AnesthesiaMachineVentilatorPressureLoss
==
nullptr
?
false
:
m_AnesthesiaMachineVentilatorPressureLoss
->
IsActive
()
;
}
SEAnesthesiaMachineVentilatorPressureLoss
&
SEEquipmentActionCollection
::
GetAnesthesiaMachineVentilatorPressureLoss
()
{
...
...
@@ -489,7 +489,7 @@ void SEEquipmentActionCollection::RemoveAnesthesiaMachineVentilatorPressureLoss(
bool
SEEquipmentActionCollection
::
HasAnesthesiaMachineYPieceDisconnect
()
const
{
return
m_AnesthesiaMachineYPieceDisconnect
==
nullptr
?
false
:
true
;
return
m_AnesthesiaMachineYPieceDisconnect
==
nullptr
?
false
:
m_AnesthesiaMachineYPieceDisconnect
->
IsActive
()
;
}
SEAnesthesiaMachineYPieceDisconnect
&
SEEquipmentActionCollection
::
GetAnesthesiaMachineYPieceDisconnect
()
{
...
...
src/cpp/cdm/patient/actions/SESupplementalOxygen.cpp
View file @
acca001e
...
...
@@ -45,7 +45,8 @@ bool SESupplementalOxygen::IsActive() const
{
if
(
!
SEPatientAction
::
IsActive
())
return
false
;
return
m_Device
!=
eSupplementalOxygen_Device
::
None
&&
(
HasFlow
()
||
HasVolume
());
return
m_Device
!=
eSupplementalOxygen_Device
::
None
;
// Defaults will be used if no flow/volume supplied
}
void
SESupplementalOxygen
::
Deactivate
()
{
...
...
src/cpp/cpm/io/protobuf/PBPulsePhysiology.cpp
View file @
acca001e
...
...
@@ -95,33 +95,6 @@ void PBPulsePhysiology::Serialize(const PULSE_BIND::CardiovascularData& src, Car
PBProperty
::
Load
(
src
.
cardiaccyclepulmonaryarterypressure_mmhg
(),
*
dst
.
m_CardiacCyclePulmonaryArteryPressure_mmHg
);
PBProperty
::
Load
(
src
.
cardiaccyclecentralvenouspressure_mmhg
(),
*
dst
.
m_CardiacCycleCentralVenousPressure_mmHg
);
PBProperty
::
Load
(
src
.
cardiaccycleskinflow_ml_per_s
(),
*
dst
.
m_CardiacCycleSkinFlow_mL_Per_s
);
// As these are dynamically added to the system during run time,
// We will need to make the association within the system here
// Currently, there is no PulseCompartmentManager Load/Unload to do that for us
// It looks for the static cmpt/circuit memebers and adds those to the associated system
// As these were dynamically created, these will not be handled in that code
// (It probably should)
// But, anything that is dynamically created needs to be associated by the System Load
// So we are doing that here.
// Also, Internal Hemorrhage is a subset of Hemorrhage, so internal is associated via
// This regular hemorrhage links/paths getting associated properly
for
(
auto
name
:
src
.
hemorrhagelinks
())
{
SELiquidCompartmentLink
*
hLink
=
dst
.
m_data
.
GetCompartments
().
GetLiquidLink
(
name
);
dst
.
m_data
.
GetCompartments
().
GetCardiovascularGraph
().
AddLink
(
*
hLink
);
dst
.
m_HemorrhageLinks
.
push_back
(
hLink
);
}
if
(
!
dst
.
m_HemorrhageLinks
.
empty
())
dst
.
m_data
.
GetCompartments
().
GetCardiovascularGraph
().
StateChange
();
for
(
auto
name
:
src
.
hemorrhagepaths
())
{
SEFluidCircuitPath
*
hPath
=
dst
.
m_data
.
GetCircuits
().
GetFluidPath
(
name
);
dst
.
m_data
.
GetCircuits
().
GetCardiovascularCircuit
().
AddPath
(
*
hPath
);
dst
.
m_HemorrhagePaths
.
push_back
(
hPath
);
}
if
(
!
dst
.
m_HemorrhagePaths
.
empty
())
dst
.
m_data
.
GetCircuits
().
GetCardiovascularCircuit
().
StateChange
();
}
PULSE_BIND
::
CardiovascularData
*
PBPulsePhysiology
::
Unload
(
const
Cardiovascular
&
src
)
{
...
...
@@ -166,12 +139,6 @@ void PBPulsePhysiology::Serialize(const Cardiovascular& src, PULSE_BIND::Cardiov
dst
.
set_allocated_cardiaccyclepulmonaryarterypressure_mmhg
(
PBProperty
::
Unload
(
*
src
.
m_CardiacCyclePulmonaryArteryPressure_mmHg
));
dst
.
set_allocated_cardiaccyclecentralvenouspressure_mmhg
(
PBProperty
::
Unload
(
*
src
.
m_CardiacCycleCentralVenousPressure_mmHg
));
dst
.
set_allocated_cardiaccycleskinflow_ml_per_s
(
PBProperty
::
Unload
(
*
src
.
m_CardiacCycleSkinFlow_mL_Per_s
));
for
(
auto
*
l
:
src
.
m_HemorrhageLinks
)
dst
.
add_hemorrhagelinks
(
l
->
GetName
());
for
(
auto
*
p
:
src
.
m_HemorrhagePaths
)
dst
.
add_hemorrhagepaths
(
p
->
GetName
());
}
void
PBPulsePhysiology
::
Load
(
const
PULSE_BIND
::
DrugData
&
src
,
Drugs
&
dst
)
...
...
src/cpp/cpm/physiology/Cardiovascular.cpp
View file @
acca001e
This diff is collapsed.
Click to expand it.
src/cpp/cpm/physiology/Cardiovascular.h
View file @
acca001e
...
...
@@ -6,6 +6,7 @@
#include
"system/physiology/SECardiovascularSystem.h"
#include
"substance/SESubstanceTransport.h"
class
SEPatient
;
class
SEHemorrhage
;
class
SELiquidCompartment
;
class
SEGasCompartment
;
class
SELiquidSubstanceQuantity
;
...
...
@@ -106,9 +107,6 @@ protected:
double
m_CompressionTime_s
;
double
m_CompressionRatio
;
double
m_CompressionPeriod_s
;
//Hemorrhage
std
::
vector
<
SELiquidCompartmentLink
*>
m_HemorrhageLinks
;
std
::
vector
<
SEFluidCircuitPath
*>
m_HemorrhagePaths
;
// Vitals and Averages
double
m_CurrentCardiacCycleTime_s
;
double
m_CardiacCycleDiastolicVolume_mL
;
// Maximum left heart volume for the current cardiac cycle
...
...
@@ -132,7 +130,17 @@ protected:
bool
m_TuneCircuit
=
true
;
std
::
string
m_TuningFile
;
double
m_minIndividialSystemicResistance__mmHg_s_Per_mL
;
// Hemorrhage
struct
HemorrhageTrack
{
SELiquidCompartment
*
Compartment
=
nullptr
;
std
::
vector
<
SEFluidCircuitNode
*>
Nodes
;
std
::
map
<
SEFluidCircuitPath
*
,
SELiquidCompartmentLink
*>
Paths2Links
;
short
NumNodesWithVolume
=
0
;
};
std
::
map
<
SEHemorrhage
*
,
HemorrhageTrack
*>
m_HemorrhageTrack
;
double
m_minIndividialSystemicResistance_mmHg_s_Per_mL
;
SEFluidCircuitCalculator
*
m_circuitCalculator
;
SELiquidTransporter
*
m_transporter
;
...
...
src/schema/pulse/cpm/bind/PulsePhysiology.proto
View file @
acca001e
...
...
@@ -52,9 +52,6 @@ message CardiovascularData
pulse.cdm.bind.RunningAverageData
CardiacCyclePulmonaryArteryPressure_mmHg
=
30
;
pulse.cdm.bind.RunningAverageData
CardiacCycleCentralVenousPressure_mmHg
=
31
;
pulse.cdm.bind.RunningAverageData
CardiacCycleSkinFlow_mL_Per_s
=
32
;
repeated
string
HemorrhageLinks
=
33
;
repeated
string
HemorrhagePaths
=
34
;
}
message
DrugData
...
...
Write
Preview
Supports
Markdown
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