OMSimulatorLib
The OMSimulator project is a FMI-based co-simulation environment that supports ordinary (i.e., non-delayed) and TLM connections.
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
oms::Model Class Reference

#include <Model.h>

Collaboration diagram for oms::Model:
Collaboration graph

Public Member Functions

 ~Model ()
 
const ComRefgetCref () const
 
SystemgetSystem (const ComRef &cref)
 
oms_status_enu_t delete_ (const ComRef &cref)
 
ComponentgetComponent (const ComRef &cref)
 
SystemgetTopLevelSystem () const
 
std::string getTempDirectory () const
 
oms_status_enu_t rename (const ComRef &cref)
 
oms_status_enu_t list (const ComRef &cref, char **contents)
 
oms_status_enu_t addSystem (const ComRef &cref, oms_system_enu_t type)
 
oms_status_enu_t exportToSSD (pugi::xml_node &node, pugi::xml_node &ssvNode) const
 
oms_status_enu_t exportSnapshot (const ComRef &cref, char **contents)
 
oms_status_enu_t exportSSVTemplate (const ComRef &cref, const std::string &filename)
 
oms_status_enu_t exportSSMTemplate (const ComRef &cref, const std::string &filename)
 
oms_status_enu_t importFromSSD (const pugi::xml_node &node)
 
oms_status_enu_t importSnapshot (const char *snapshot)
 
oms_status_enu_t exportToFile (const std::string &filename) const
 
oms_system_enu_t getSystemType (const pugi::xml_node &node, const std::string &sspVersion)
 
oms_system_enu_t getSystemTypeHelper (const pugi::xml_node &node, const std::string &sspVersion)
 
oms_status_enu_t updateParameterBindingsToSSD (pugi::xml_node &node, pugi::xml_node &ssvNode, bool isTopSystemOrModel) const
 
void copyResources (bool copy_resources)
 
bool copyResources ()
 
oms::Element ** getElements ()
 
oms_status_enu_t getAllResources (std::vector< std::string > &resources) const
 
oms_status_enu_t instantiate ()
 
oms_status_enu_t initialize ()
 
oms_status_enu_t simulate_asynchronous (void(*cb)(const char *cref, double time, oms_status_enu_t status))
 
oms_status_enu_t simulate ()
 
oms_status_enu_t stepUntil (double stopTime)
 
oms_status_enu_t terminate ()
 
oms_status_enu_t reset ()
 
oms_modelState_enu_t getModelState () const
 
oms_status_enu_t setStartTime (double value)
 
double getStartTime () const
 
oms_status_enu_t setStopTime (double value)
 
double getStopTime () const
 
oms_status_enu_t setLoggingInterval (double loggingInterval)
 
double getLoggingInterval () const
 
oms_status_enu_t setResultFile (const std::string &filename, int bufferSize)
 
oms_status_enu_t getResultFile (char **filename, int *bufferSize)
 
oms_status_enu_t emit (double time, bool force=false, bool *emitted=NULL)
 
oms_status_enu_t addSignalsToResults (const char *regex)
 
oms_status_enu_t removeSignalsFromResults (const char *regex)
 
oms_status_enu_t setSignalFilter (const std::string &regex)
 
oms_status_enu_t getSignalFilter (char **regex)
 
oms_status_enu_t cancelSimulation_asynchronous ()
 
bool cancelSimulation () const
 
bool validState (int validStates) const
 
bool isIsolatedFMUModel () const
 
void setIsolatedFMUModel ()
 
bool useThreadPool ()
 
ctpl::thread_pool & getThreadPool ()
 
oms_status_enu_t loadSnapshot (const char *snapshot)
 
pugi::xml_node getSnapshot ()
 

Static Public Member Functions

static ModelNewModel (const ComRef &cref)
 

Private Member Functions

 Model (const ComRef &cref, const std::string &tempDir)
 
 Model (Model const &copy)
 not implemented More...
 
Modeloperator= (Model const &copy)
 not implemented More...
 
oms_status_enu_t registerSignalsForResultFile ()
 

Private Attributes

ComRef cref
 
Systemsystem = NULL
 
std::string tempDir
 
std::vector< oms::Element * > elements
 
bool copy_resources = true
 
oms_modelState_enu_t modelState = oms_modelState_virgin
 
double startTime = 0.0
 
double stopTime = 1.0
 
ResultWriterresultFile = NULL
 
double lastEmit
 
double loggingInterval = 0.0
 
int bufferSize = 10
 
std::string resultFilename
 default <name>_res.mat More...
 
Clock clock
 
std::string signalFilter = ".*"
 default More...
 
pugi::xml_node snapShot
 top level snapshot node which contains ssd, ssv and ssm as child nodes More...
 
bool cancelSim
 
bool isolatedFMU = false
 
ctpl::thread_pool * pool = nullptr
 

Constructor & Destructor Documentation

◆ ~Model()

oms::Model::~Model ( )
Here is the call graph for this function:

◆ Model() [1/2]

oms::Model::Model ( const ComRef cref,
const std::string &  tempDir 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Model() [2/2]

oms::Model::Model ( Model const &  copy)
private

not implemented

Member Function Documentation

◆ addSignalsToResults()

oms_status_enu_t oms::Model::addSignalsToResults ( const char *  regex)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addSystem()

oms_status_enu_t oms::Model::addSystem ( const ComRef cref,
oms_system_enu_t  type 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cancelSimulation()

bool oms::Model::cancelSimulation ( ) const
inline
Here is the caller graph for this function:

◆ cancelSimulation_asynchronous()

oms_status_enu_t oms::Model::cancelSimulation_asynchronous ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ copyResources() [1/2]

void oms::Model::copyResources ( bool  copy_resources)
inline
Here is the caller graph for this function:

◆ copyResources() [2/2]

bool oms::Model::copyResources ( )
inline
Here is the caller graph for this function:

◆ delete_()

oms_status_enu_t oms::Model::delete_ ( const ComRef cref)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ emit()

oms_status_enu_t oms::Model::emit ( double  time,
bool  force = false,
bool *  emitted = NULL 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ exportSnapshot()

oms_status_enu_t oms::Model::exportSnapshot ( const ComRef cref,
char **  contents 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ exportSSMTemplate()

oms_status_enu_t oms::Model::exportSSMTemplate ( const ComRef cref,
const std::string &  filename 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ exportSSVTemplate()

oms_status_enu_t oms::Model::exportSSVTemplate ( const ComRef cref,
const std::string &  filename 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ exportToFile()

oms_status_enu_t oms::Model::exportToFile ( const std::string &  filename) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ exportToSSD()

oms_status_enu_t oms::Model::exportToSSD ( pugi::xml_node &  node,
pugi::xml_node &  ssvNode 
) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAllResources()

oms_status_enu_t oms::Model::getAllResources ( std::vector< std::string > &  resources) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getComponent()

oms::Component * oms::Model::getComponent ( const ComRef cref)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCref()

const ComRef& oms::Model::getCref ( ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getElements()

oms::Element** oms::Model::getElements ( )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLoggingInterval()

double oms::Model::getLoggingInterval ( ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getModelState()

oms_modelState_enu_t oms::Model::getModelState ( ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getResultFile()

oms_status_enu_t oms::Model::getResultFile ( char **  filename,
int *  bufferSize 
)
Here is the caller graph for this function:

◆ getSignalFilter()

oms_status_enu_t oms::Model::getSignalFilter ( char **  regex)
Here is the caller graph for this function:

◆ getSnapshot()

pugi::xml_node oms::Model::getSnapshot ( )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getStartTime()

double oms::Model::getStartTime ( ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getStopTime()

double oms::Model::getStopTime ( ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSystem()

oms::System * oms::Model::getSystem ( const ComRef cref)
Here is the call graph for this function:

◆ getSystemType()

oms_system_enu_t oms::Model::getSystemType ( const pugi::xml_node &  node,
const std::string &  sspVersion 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSystemTypeHelper()

oms_system_enu_t oms::Model::getSystemTypeHelper ( const pugi::xml_node &  node,
const std::string &  sspVersion 
)
Here is the caller graph for this function:

◆ getTempDirectory()

std::string oms::Model::getTempDirectory ( ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getThreadPool()

ctpl::thread_pool& oms::Model::getThreadPool ( )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTopLevelSystem()

System* oms::Model::getTopLevelSystem ( ) const
inline
Here is the caller graph for this function:

◆ importFromSSD()

oms_status_enu_t oms::Model::importFromSSD ( const pugi::xml_node &  node)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ importSnapshot()

oms_status_enu_t oms::Model::importSnapshot ( const char *  snapshot)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialize()

oms_status_enu_t oms::Model::initialize ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ instantiate()

oms_status_enu_t oms::Model::instantiate ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isIsolatedFMUModel()

bool oms::Model::isIsolatedFMUModel ( ) const
inline
Here is the caller graph for this function:

◆ list()

oms_status_enu_t oms::Model::list ( const ComRef cref,
char **  contents 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadSnapshot()

oms_status_enu_t oms::Model::loadSnapshot ( const char *  snapshot)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NewModel()

oms::Model * oms::Model::NewModel ( const ComRef cref)
static

NewModel() is used instead of a constructor to make sure that only instances with valid names can be created.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

Model& oms::Model::operator= ( Model const &  copy)
private

not implemented

Here is the caller graph for this function:

◆ registerSignalsForResultFile()

oms_status_enu_t oms::Model::registerSignalsForResultFile ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeSignalsFromResults()

oms_status_enu_t oms::Model::removeSignalsFromResults ( const char *  regex)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rename()

oms_status_enu_t oms::Model::rename ( const ComRef cref)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

oms_status_enu_t oms::Model::reset ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setIsolatedFMUModel()

void oms::Model::setIsolatedFMUModel ( )
inline
Here is the caller graph for this function:

◆ setLoggingInterval()

oms_status_enu_t oms::Model::setLoggingInterval ( double  loggingInterval)
Here is the caller graph for this function:

◆ setResultFile()

oms_status_enu_t oms::Model::setResultFile ( const std::string &  filename,
int  bufferSize 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSignalFilter()

oms_status_enu_t oms::Model::setSignalFilter ( const std::string &  regex)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setStartTime()

oms_status_enu_t oms::Model::setStartTime ( double  value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setStopTime()

oms_status_enu_t oms::Model::setStopTime ( double  value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ simulate()

oms_status_enu_t oms::Model::simulate ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ simulate_asynchronous()

oms_status_enu_t oms::Model::simulate_asynchronous ( void(*)(const char *cref, double time, oms_status_enu_t status)  cb)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stepUntil()

oms_status_enu_t oms::Model::stepUntil ( double  stopTime)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ terminate()

oms_status_enu_t oms::Model::terminate ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateParameterBindingsToSSD()

oms_status_enu_t oms::Model::updateParameterBindingsToSSD ( pugi::xml_node &  node,
pugi::xml_node &  ssvNode,
bool  isTopSystemOrModel 
) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ useThreadPool()

bool oms::Model::useThreadPool ( )
inline
Here is the caller graph for this function:

◆ validState()

bool oms::Model::validState ( int  validStates) const
inline
Here is the caller graph for this function:

Member Data Documentation

◆ bufferSize

int oms::Model::bufferSize = 10
private

◆ cancelSim

bool oms::Model::cancelSim
private

◆ clock

Clock oms::Model::clock
private

◆ copy_resources

bool oms::Model::copy_resources = true
private

◆ cref

ComRef oms::Model::cref
private

◆ elements

std::vector<oms::Element*> oms::Model::elements
private

◆ isolatedFMU

bool oms::Model::isolatedFMU = false
private

◆ lastEmit

double oms::Model::lastEmit
private

◆ loggingInterval

double oms::Model::loggingInterval = 0.0
private

◆ modelState

oms_modelState_enu_t oms::Model::modelState = oms_modelState_virgin
private

◆ pool

ctpl::thread_pool* oms::Model::pool = nullptr
private

◆ resultFile

ResultWriter* oms::Model::resultFile = NULL
private

◆ resultFilename

std::string oms::Model::resultFilename
private

default <name>_res.mat

◆ signalFilter

std::string oms::Model::signalFilter = ".*"
private

default

◆ snapShot

pugi::xml_node oms::Model::snapShot
private

top level snapshot node which contains ssd, ssv and ssm as child nodes

◆ startTime

double oms::Model::startTime = 0.0
private

◆ stopTime

double oms::Model::stopTime = 1.0
private

◆ system

System* oms::Model::system = NULL
private

◆ tempDir

std::string oms::Model::tempDir
private

The documentation for this class was generated from the following files: