Commit 6419cb05 authored by Aaron Bray's avatar Aaron Bray
Browse files

Branch Sync

parents 4fa868b3 077960b9
......@@ -7,11 +7,27 @@
# The IntelliJ build dir
/.idea/out
# This is for the C# how to
/sdk/howto/csharp/.vs
/sdk/howto/csharp/bin
/sdk/howto/csharp/obj
/sdk/howto/csharp/HowToCSharp.csproj.user
/sdk/howto/csharp/HowToCSharp.sdf
sdk/howto/csharp/*.db
sdk/howto/csharp/*.opendb
# This is for the C# projects
/engine/csharp/.vs
/engine/csharp/bin
/engine/csharp/obj
/engine/csharp/HowToCSharp.csproj.user
/engine/csharp/HowToCSharp.sdf
/engine/csharp/*.db
/engine/csharp/*.opendb
/sdk/howto/csharp/clr/.vs
/sdk/howto/csharp/clr/bin
/sdk/howto/csharp/clr/obj
/sdk/howto/csharp/clr/HowToCSharp.csproj.user
/sdk/howto/csharp/clr/HowToCSharp.sdf
/sdk/howto/csharp/clr/*.db
/sdk/howto/csharp/clr/*.opendb
/sdk/howto/csharp/c/.vs
/sdk/howto/csharp/c/bin
/sdk/howto/csharp/c/obj
/sdk/howto/csharp/c/HowToCSharp.csproj.user
/sdk/howto/csharp/c/HowToCSharp.sdf
/sdk/howto/csharp/c/*.db
/sdk/howto/csharp/c/*.opendb
......@@ -109,8 +109,10 @@ add_subdirectory(engine)
add_subdirectory(test)
add_subdirectory(sdk)
add_subdirectory(verification)
include(${CMAKE_CURRENT_SOURCE_DIR}/PulseJNI.cmake)
# Various interfaces for different languages
include(${CMAKE_CURRENT_SOURCE_DIR}/PulseC.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/PulseCLR.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/PulseJNI.cmake)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_target_properties (libprotobuf libprotobuf-lite PROPERTIES FOLDER protobufs)
......
add_library(PulseC SHARED engine/cpp/PulseEngineC.h
engine/cpp/PulseEngineC.cpp)
target_include_directories(PulseC PRIVATE ${CMAKE_BINARY_DIR}/schema/cpp/)
target_include_directories(PulseC PRIVATE ${CMAKE_BINARY_DIR}/schema/cpp/bind/)
target_include_directories(PulseC PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/engine/cpp)
target_include_directories(PulseC PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/cdm/cpp)
target_include_directories(PulseC PRIVATE ${EIGEN3_INCLUDE_DIR})
target_include_directories(PulseC PRIVATE ${LOG4CPLUS_INCLUDE_DIR})
target_include_directories(PulseC PRIVATE ${PROTOBUF_INCLUDE_DIR})
set(PulseC_FLAGS)
set_target_properties(PulseC PROPERTIES COMPILE_FLAGS "${PulseC_FLAGS}" PREFIX "")
if(APPLE)
set_target_properties(PulseC PROPERTIES MACOSX_RPATH ON)
endif()
target_link_libraries(PulseC PulseEngine)
set_target_properties(PulseC PROPERTIES
DEBUG_POSTFIX "${PULSE_DEBUG_POSTFIX}"
RELWITHDEBINFO_POSTFIX "${PULSE_RELWITHDEBINFO_POSTFIX}")
add_custom_command(TARGET PulseC POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:PulseC> ${INSTALL_BIN})
install(TARGETS PulseC
RUNTIME DESTINATION ${INSTALL_BIN}
LIBRARY DESTINATION ${INSTALL_LIB}
ARCHIVE DESTINATION ${INSTALL_LIB})
......@@ -18,6 +18,7 @@ target_include_directories(PulseCLR PRIVATE ${PROTOBUF_INCLUDE_DIR})
set(PulseCLR_FLAGS "/clr /EHa")
string( REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} )
set_target_properties(PulseCLR PROPERTIES COMPILE_FLAGS "${PulseCLR_FLAGS}" PREFIX "")
#set_target_properties(PulseCLR PROPERTIES COMMON_LANGUAGE_RUNTIME "") # CMake > 3.12 only
message(STATUS "PulseCLR COMPILE_FLAGS : ${CMAKE_CXX_FLAGS_DEBUG}")
set_target_properties(PulseCLR PROPERTIES
......
......@@ -41,7 +41,7 @@ message(STATUS "Eigen is here : ${eigen_SRC}" )
###################################################
message( STATUS "External project - log4cplus" )
set(log4cplus_SRC "${CMAKE_BINARY_DIR}/log4cplus/src/log4cplus")
set(log4cplus_SRC "${CMAKE_BINARY_DIR}/log4cplus/src/log4cplus" CACHE PATH "Log4cplus Source")
ExternalProject_Add( log4cplus
PREFIX log4cplus
......
Name: "BasicStandard"
Description: "Basic scenario measuring patient vitals with no insults or interventions"
EngineStateFile :"./states/StandardMale@0s.pba"
StartType { EngineStateFile :"./states/StandardMale@0s.pba" }
# Base system data required for all scenario verification
DataRequestManager
......@@ -65,7 +65,7 @@ DataRequestManager
# Specific to this scenario
DataRequest { Category:Substance SubstanceName:"Epinephrine" PropertyName:"SystemicMassCleared" Unit:"ug" DecimalFormat{Precision:8} }
DataRequest { Category:Physiology PropertyName:"ChymeAbsorbtionRate" Unit:"mL/min" DecimalFormat{Precision:2} }
DataRequest { Category:Physiology PropertyName:"ChymeAbsorptionRate" Unit:"mL/min" DecimalFormat{Precision:2} }
DataRequest { Category:Physiology PropertyName:"StomachContents-Carbohydrate" Unit:"g" DecimalFormat{Precision:2} }
DataRequest { Category:Physiology PropertyName:"StomachContents-Fat" Unit:"g" DecimalFormat{Precision:2} }
DataRequest { Category:Physiology PropertyName:"StomachContents-Protein" Unit:"g" DecimalFormat{Precision:2} }
......
Name: "Vitals Monitor"
Description: "Data associated with a vitals monitor."
InitialParameters { PatientFile:"StandardMale.pba" }
DataRequestManager
{
DataRequest { Category:ECG PropertyName:"Lead3ElectricPotential" Unit:"mV" DecimalFormat{Precision:3} }
DataRequest { Category:Physiology PropertyName:"HeartRate" Unit:"1/min" DecimalFormat{Precision:2} }
DataRequest { Category:Physiology PropertyName:"ArterialPressure" Unit:"mmHg" DecimalFormat{Precision:1} }
DataRequest { Category:Physiology PropertyName:"MeanArterialPressure" Unit:"mmHg" DecimalFormat{Precision:1} }
DataRequest { Category:Physiology PropertyName:"SystolicArterialPressure" Unit:"mmHg" DecimalFormat{Precision:1} }
DataRequest { Category:Physiology PropertyName:"DiastolicArterialPressure" Unit:"mmHg" DecimalFormat{Precision:1} }
DataRequest { Category:Physiology PropertyName:"OxygenSaturation" Unit:"unitless" DecimalFormat{Precision:3} }
DataRequest { Category:Physiology PropertyName:"EndTidalCarbonDioxidePressure" Unit:"mmHg" DecimalFormat{Precision:4} }
DataRequest { Category:Physiology PropertyName:"RespirationRate" Unit:"1/min" DecimalFormat{Precision:2} }
DataRequest { Category:Physiology PropertyName:"SkinTemperature" Unit:"degC" DecimalFormat{Precision:1} }
DataRequest { Category:GasCompartment CompartmentName:"Carina" SubstanceName:"CarbonDioxide" PropertyName:"PartialPressure" Unit:"mmHg" DecimalFormat{Precision:1} }
}
# Segment 1: Initialization
AnyAction
{
AdvanceTime
{
Time { ScalarTime {Value: 5.0 Unit: "min"} }
}
}
\ No newline at end of file
......@@ -116,7 +116,7 @@ struct CommonDataModelException : public std::runtime_error
#include "Macros.h"
#include "utils/Logger.h"
enum SerializationMode { BINARY = 0, ASCII };
enum SerializationFormat { BINARY = 0, ASCII };
// General Enums
// Keep enums in sync with appropriate schema/cdm/Enums.proto file !!
......
......@@ -6,6 +6,7 @@
class SEEventHandler;
class SEAdvanceHandler;
class SEPatient;
class SEPatientConfiguration;
class SEPatientAssessment;
class SECondition;
......@@ -62,14 +63,14 @@ public:
/// Engine will be in a cleared state if this method fails.
/// Note the provided configuration will overwrite any configuration options in the state with its contents (Use with caution!)
//--------------------------------------------------------------------------------------------------
virtual bool SerializeFromFile(const std::string& filename, SerializationMode m=ASCII, const SEScalarTime* simTime=nullptr, const SEEngineConfiguration* config = nullptr) = 0;
virtual bool SerializeFromFile(const std::string& filename, SerializationFormat m, const SEScalarTime* simTime=nullptr, const SEEngineConfiguration* config = nullptr) = 0;
//--------------------------------------------------------------------------------------------------
/// \brief
/// Save the current state of the engine to provided filename.
/// Engine will be in a cleared state if this method fails.
//--------------------------------------------------------------------------------------------------
virtual bool SerializeToFile(const std::string& filename="engine.state", SerializationMode m=ASCII) const = 0;
virtual bool SerializeToFile(const std::string& filename, SerializationFormat m) const = 0;
//--------------------------------------------------------------------------------------------------
/// \brief
......@@ -82,7 +83,7 @@ public:
/// Engine will be in a cleared state if this method fails.
/// Note the provided configuration will overwrite any configuration options in the state with its contents (Use with caution!)
//--------------------------------------------------------------------------------------------------
virtual bool SerializeFromString(const std::string& state, SerializationMode m=BINARY, const SEScalarTime* simTime = nullptr, const SEEngineConfiguration* config = nullptr) = 0;
virtual bool SerializeFromString(const std::string& state, SerializationFormat m, const SEScalarTime* simTime = nullptr, const SEEngineConfiguration* config = nullptr) = 0;
//--------------------------------------------------------------------------------------------------
/// \brief
......@@ -91,7 +92,7 @@ public:
/// Note that the bytes are binary, not text; we only use the string class as a convenient container.
/// Engine will be in a cleared state if this method fails.
//--------------------------------------------------------------------------------------------------
virtual bool SerializeToString(std::string& state, SerializationMode m=BINARY) const = 0;
virtual bool SerializeToString(std::string& state, SerializationFormat m) const = 0;
//--------------------------------------------------------------------------------------------------
/// \brief
......@@ -102,7 +103,7 @@ public:
/// Some combinations of patients and conditions may prevent the engine from stabilizing
///
//--------------------------------------------------------------------------------------------------
virtual bool InitializeEngine(const std::string& patientFile, const std::vector<const SECondition*>* conditions = nullptr, const SEEngineConfiguration* config = nullptr) = 0;
virtual bool InitializeEngine(const std::string& patient_configuration, SerializationFormat m, const SEEngineConfiguration* config = nullptr) = 0;
//--------------------------------------------------------------------------------------------------
/// \brief
......@@ -112,7 +113,7 @@ public:
/// Some combinations of patients and conditions may prevent the engine from stabilizing
///
//--------------------------------------------------------------------------------------------------
virtual bool InitializeEngine(const SEPatient& patient, const std::vector<const SECondition*>* conditions = nullptr, const SEEngineConfiguration* config = nullptr) = 0;
virtual bool InitializeEngine(const SEPatientConfiguration& patient_configuration, const SEEngineConfiguration* config = nullptr) = 0;
//--------------------------------------------------------------------------------------------------
/// \brief
......
......@@ -2,12 +2,11 @@
See accompanying NOTICE file for details.*/
#include "stdafx.h"
#include "scenario/SEAction.h"
#include "engine/SEAction.h"
#include "engine/SEAdvanceTime.h"
#include "engine/SESerializeState.h"
#include "substance/SESubstanceManager.h"
#include "scenario/SEAdvanceTime.h"
#include "scenario/SESerializeState.h"
SEAction::SEAction() : Loggable()
{
......
......@@ -2,18 +2,18 @@
See accompanying NOTICE file for details.*/
#include "stdafx.h"
#include "scenario/SEAction.h"
#include "scenario/SEActionManager.h"
#include "engine/SEAction.h"
#include "engine/SEActionManager.h"
#include "patient/actions/SEPatientAction.h"
#include "scenario/SEPatientActionCollection.h"
#include "engine/SEPatientActionCollection.h"
#include "system/equipment/anesthesiamachine/actions/SEAnesthesiaMachineAction.h"
#include "scenario/SEAnesthesiaMachineActionCollection.h"
#include "engine/SEAnesthesiaMachineActionCollection.h"
#include "system/environment/actions/SEEnvironmentAction.h"
#include "scenario/SEEnvironmentActionCollection.h"
#include "engine/SEEnvironmentActionCollection.h"
#include "system/equipment/inhaler/actions/SEInhalerAction.h"
#include "scenario/SEInhalerActionCollection.h"
#include "engine/SEInhalerActionCollection.h"
#include "substance/SESubstanceManager.h"
#include "io/protobuf/PBScenario.h"
#include "io/protobuf/PBEngine.h"
SEActionManager::SEActionManager(SESubstanceManager& substances) : Loggable(substances.GetLogger()),
m_Substances(substances)
......@@ -41,21 +41,34 @@ void SEActionManager::Clear()
m_InhalerActions->Clear();
}
bool SEActionManager::SerializeToString(std::string& output, SerializationMode m) const
bool SEActionManager::SerializeToString(std::string& output, SerializationFormat m) const
{
return PBScenario::SerializeToString(*this, output, m);
return PBEngine::SerializeToString(*this, output, m);
}
bool SEActionManager::SerializeToFile(const std::string& filename, SerializationMode m) const
bool SEActionManager::SerializeToFile(const std::string& filename, SerializationFormat m) const
{
return PBScenario::SerializeToFile(*this, filename, m);
return PBEngine::SerializeToFile(*this, filename, m);
}
bool SEActionManager::SerializeFromString(const std::string& src, SerializationMode m)
bool SEActionManager::SerializeFromString(const std::string& src, SerializationFormat m)
{
return PBScenario::SerializeFromString(src, *this, m);
return PBEngine::SerializeFromString(src, *this, m);
}
bool SEActionManager::SerializeFromFile(const std::string& filename, SerializationMode m)
bool SEActionManager::SerializeFromFile(const std::string& filename, SerializationFormat m)
{
return PBScenario::SerializeFromFile(filename, *this, m);
return PBEngine::SerializeFromFile(filename, *this, m);
}
// A raw serialize method
// The caller is the owner of these actions in the provided vector
// Actions will not be processed into an action manager, only inserted into the list
// Which could result in an invalid action being in the list
// This was created to support passing invalid actions over socket or languages (specifically PulseJNI)
// A hemorrhage with no flow rate isinvalid and used to turn off an existing hemorrhage
// So we need to serialize that invalid action in, and have it processed by the engine action manager
// So this method is intended to be a middle man between the socket/language client and an engine.
bool SEActionManager::SerializeFromString(const std::string& src, std::vector<SEAction*>& dst, SerializationFormat m, SESubstanceManager& subMgr)
{
return PBEngine::SerializeFromString(src, dst, m, subMgr);
}
bool SEActionManager::ProcessAction(const SEAction& action)
......@@ -92,12 +105,12 @@ bool SEActionManager::ProcessAction(const SEAction& action)
return bRet;
}
void SEActionManager::GetActiveActions(std::vector<const SEAction*>& actions) const
void SEActionManager::GetAllActions(std::vector<const SEAction*>& actions) const
{
m_PatientActions->GetActiveActions(actions);
m_EnvironmentActions->GetActiveActions(actions);
m_AnesthesiaMachineActions->GetActiveActions(actions);
m_InhalerActions->GetActiveActions(actions);
m_PatientActions->GetAllActions(actions);
m_EnvironmentActions->GetAllActions(actions);
m_AnesthesiaMachineActions->GetAllActions(actions);
m_InhalerActions->GetAllActions(actions);
}
......
......@@ -11,7 +11,7 @@ class SESubstanceManager;
class CDM_DECL SEActionManager : public Loggable
{
friend class PBScenario;//friend the serialization class
friend class PBEngine;//friend the serialization class
public:
SEActionManager(SESubstanceManager&);
......@@ -19,10 +19,12 @@ public:
void Clear();
bool SerializeToString(std::string& output, SerializationMode m) const;
bool SerializeToFile(const std::string& filename, SerializationMode m) const;
bool SerializeFromString(const std::string& src, SerializationMode m);
bool SerializeFromFile(const std::string& filename, SerializationMode m);
bool SerializeToString(std::string& output, SerializationFormat m) const;
bool SerializeToFile(const std::string& filename, SerializationFormat m) const;
bool SerializeFromString(const std::string& src, SerializationFormat m);
bool SerializeFromFile(const std::string& filename, SerializationFormat m);
static bool SerializeFromString(const std::string& src, std::vector<SEAction*>& dst, SerializationFormat m, SESubstanceManager& subMgr);
bool ProcessAction(const SEAction& action);// Will make a copy
......@@ -36,7 +38,7 @@ public:
const SEAnesthesiaMachineActionCollection& GetAnesthesiaMachineActions() const { return *m_AnesthesiaMachineActions; }
const SEInhalerActionCollection& GetInhalerActions() const { return *m_InhalerActions; }
void GetActiveActions(std::vector<const SEAction*>& v) const;
void GetAllActions(std::vector<const SEAction*>& v) const;
protected:
......
......@@ -2,7 +2,7 @@
See accompanying NOTICE file for details.*/
#include "stdafx.h"
#include "scenario/SEAdvanceTime.h"
#include "engine/SEAdvanceTime.h"
#include "properties/SEScalarTime.h"
SEAdvanceTime::SEAdvanceTime() : SEAction()
......
......@@ -2,7 +2,7 @@
See accompanying NOTICE file for details.*/
#pragma once
#include "scenario/SEAction.h"
#include "engine/SEAction.h"
class CDM_DECL SEAdvanceTime : public SEAction
{
......
......@@ -2,7 +2,7 @@
See accompanying NOTICE file for details.*/
#include "stdafx.h"
#include "scenario/SEAnesthesiaMachineActionCollection.h"
#include "engine/SEAnesthesiaMachineActionCollection.h"
#include "substance/SESubstanceManager.h"
#include "system/equipment/anesthesiamachine/SEAnesthesiaMachine.h"
#include "system/equipment/anesthesiamachine/actions/SEOxygenTankPressureLoss.h"
......@@ -441,7 +441,7 @@ void SEAnesthesiaMachineActionCollection::RemoveYPieceDisconnect()
SAFE_DELETE(m_YPieceDisconnect);
}
void SEAnesthesiaMachineActionCollection::GetActiveActions(std::vector<const SEAction*>& actions) const
void SEAnesthesiaMachineActionCollection::GetAllActions(std::vector<const SEAction*>& actions) const
{
if (HasConfiguration())
actions.push_back(GetConfiguration());
......
......@@ -24,7 +24,7 @@ CDM_BIND_DECL(AnyAnesthesiaMachineActionData)
class CDM_DECL SEAnesthesiaMachineActionCollection : public Loggable
{
friend class PBScenario;//friend the serialization class
friend class PBEngine;//friend the serialization class
friend class SEActionManager;
protected:
SEAnesthesiaMachineActionCollection(SESubstanceManager&);
......@@ -101,7 +101,7 @@ public:
const SEYPieceDisconnect* GetYPieceDisconnect() const;
void RemoveYPieceDisconnect();
void GetActiveActions(std::vector<const SEAction*>& v) const;
void GetAllActions(std::vector<const SEAction*>& v) const;
protected:
void Clear();
......
......@@ -2,7 +2,7 @@
See accompanying NOTICE file for details.*/
#include "stdafx.h"
#include "scenario/SECondition.h"
#include "engine/SECondition.h"
#include "substance/SESubstanceManager.h"
#include "patient/conditions/SEPatientCondition.h"
#include "system/environment/conditions/SEEnvironmentCondition.h"
......
......@@ -2,7 +2,7 @@
See accompanying NOTICE file for details.*/
#include "stdafx.h"
#include "scenario/SEConditionManager.h"
#include "engine/SEConditionManager.h"
//Patient Conditions
#include "patient/conditions/SEChronicAnemia.h"
#include "patient/conditions/SEChronicObstructivePulmonaryDisease.h"
......@@ -17,7 +17,7 @@
#include "system/environment/conditions/SEInitialEnvironmentConditions.h"
#include "substance/SESubstance.h"
#include "substance/SESubstanceManager.h"
#include "io/protobuf/PBScenario.h"
#include "io/protobuf/PBEngine.h"
SEConditionManager::SEConditionManager(SESubstanceManager& substances) : Loggable(substances.GetLogger()), m_Substances(substances)
{
......@@ -50,21 +50,21 @@ void SEConditionManager::Clear()
SAFE_DELETE(m_InitialEnvironmentConditions);
}
bool SEConditionManager::SerializeToString(std::string& output, SerializationMode m) const
bool SEConditionManager::SerializeToString(std::string& output, SerializationFormat m) const
{
return PBScenario::SerializeToString(*this, output, m);
return PBEngine::SerializeToString(*this, output, m);
}
bool SEConditionManager::SerializeToFile(const std::string& filename, SerializationMode m) const
bool SEConditionManager::SerializeToFile(const std::string& filename, SerializationFormat m) const
{
return PBScenario::SerializeToFile(*this, filename, m);
return PBEngine::SerializeToFile(*this, filename, m);
}
bool SEConditionManager::SerializeFromString(const std::string& src, SerializationMode m)
bool SEConditionManager::SerializeFromString(const std::string& src, SerializationFormat m)
{
return PBScenario::SerializeFromString(src, *this, m);
return PBEngine::SerializeFromString(src, *this, m);
}
bool SEConditionManager::SerializeFromFile(const std::string& filename, SerializationMode m)
bool SEConditionManager::SerializeFromFile(const std::string& filename, SerializationFormat m)
{
return PBScenario::SerializeFromFile(filename, *this, m);
return PBEngine::SerializeFromFile(filename, *this, m);
}
bool SEConditionManager::ProcessCondition(const SECondition& condition)
......@@ -333,7 +333,7 @@ const SEInitialEnvironmentConditions* SEConditionManager::GetInitialEnvironmentC
return m_InitialEnvironmentConditions;
}
void SEConditionManager::GetActiveConditions(std::vector<const SECondition*>& conditions) const
void SEConditionManager::GetAllConditions(std::vector<const SECondition*>& conditions) const
{
if (HasChronicAnemia())
conditions.push_back(GetChronicAnemia());
......
Supports Markdown
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