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 | Public Attributes | Private Member Functions | Private Attributes | List of all members
oms::Model Class Reference

#include <Model.h>

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 rename (const ComRef &cref, const ComRef &newCref)
 
oms_status_enu_t list (const ComRef &cref, char **contents)
 
oms_status_enu_t listVariants (const ComRef &cref, char **contents)
 
oms_status_enu_t addSystem (const ComRef &cref, oms_system_enu_t type)
 
oms_status_enu_t newResources (const ComRef &cref)
 
oms_status_enu_t addResources (const ComRef &cref, const std::string &path)
 
oms_status_enu_t deleteReferencesInSSD (const ComRef &cref)
 
oms_status_enu_t deleteResourcesInSSP (const std::string &filename)
 
oms_status_enu_t duplicateVariant (const ComRef &crefA, const ComRef &crefB)
 
oms_status_enu_t activateVariant (const ComRef &crefA, const ComRef &crefB)
 
oms_status_enu_t referenceResources (const ComRef &cref, const std::string &ssmFile)
 
oms_status_enu_t reduceSSV (const std::string &ssvfile, const std::string &ssmfile, const std::string &filepath)
 
oms_status_enu_t exportToSSD (Snapshot &snapshot) 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)
 
void exportSignalFilter (Snapshot &snapshot) const
 
void exportUnitDefinitionsToSSD (pugi::xml_node &node) const
 
void exportEnumerationDefinitionsToSSD (pugi::xml_node &node) const
 
oms_status_enu_t importFromSnapshot (const Snapshot &snapshot)
 
oms_status_enu_t importSnapshot (const char *snapshot, char **newCref)
 
oms_status_enu_t importSignalFilter (const std::string &filename, const Snapshot &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, bool isTopSystemOrModel) const
 
void copyResources (bool copy_resources)
 
bool copyResources ()
 
oms::Element ** getElements ()
 
void writeAllResourcesToFilesystem (std::vector< std::string > &resources, Snapshot &snapshot) const
 
oms_status_enu_t instantiate ()
 
oms_status_enu_t initialize ()
 
oms_status_enu_t simulate ()
 
oms_status_enu_t doStep ()
 
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
 
double getTime () 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)
 
bool validState (int validStates) const
 
bool isIsolatedFMUModel () const
 
void setIsolatedFMUModel ()
 
bool useThreadPool ()
 
ctpl::thread_pool & getThreadPool ()
 
oms_status_enu_t loadSnapshot (const pugi::xml_node &node)
 
std::string getVariantName ()
 

Static Public Member Functions

static ModelNewModel (const ComRef &cref)
 

Public Attributes

std::vector< std::string > importedResources
 list of imported resources from ssp More...
 
std::map< ComRef, char * > ssdVariants
 list of all variants copied when user create a new variant using oms_duplicateVariant() More...
 

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
 
Clock clock
 
Values values
 
std::string resultFilename
 default <name>_res.mat More...
 
std::string signalFilterFilename = "resources/signalFilter.xml"
 
std::string variantName = "SystemStructure.ssd"
 default name More...
 
std::vector< std::string > externalResources
 list of external ssv or ssm resources from filesystem More...
 
bool isolatedFMU = false
 
ctpl::thread_pool * pool = nullptr
 
ComRef new_root_cref
 

Constructor & Destructor Documentation

◆ ~Model()

oms::Model::~Model ( )

◆ Model() [1/2]

oms::Model::Model ( const ComRef cref,
const std::string &  tempDir 
)
private

◆ Model() [2/2]

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

not implemented

Member Function Documentation

◆ activateVariant()

oms_status_enu_t oms::Model::activateVariant ( const ComRef crefA,
const ComRef crefB 
)

◆ addResources()

oms_status_enu_t oms::Model::addResources ( const ComRef cref,
const std::string &  path 
)

◆ addSignalsToResults()

oms_status_enu_t oms::Model::addSignalsToResults ( const char *  regex)

◆ addSystem()

oms_status_enu_t oms::Model::addSystem ( const ComRef cref,
oms_system_enu_t  type 
)

◆ copyResources() [1/2]

bool oms::Model::copyResources ( )
inline

◆ copyResources() [2/2]

void oms::Model::copyResources ( bool  copy_resources)
inline

◆ delete_()

oms_status_enu_t oms::Model::delete_ ( const ComRef cref)

◆ deleteReferencesInSSD()

oms_status_enu_t oms::Model::deleteReferencesInSSD ( const ComRef cref)

◆ deleteResourcesInSSP()

oms_status_enu_t oms::Model::deleteResourcesInSSP ( const std::string &  filename)

◆ doStep()

oms_status_enu_t oms::Model::doStep ( )

◆ duplicateVariant()

oms_status_enu_t oms::Model::duplicateVariant ( const ComRef crefA,
const ComRef crefB 
)

◆ emit()

oms_status_enu_t oms::Model::emit ( double  time,
bool  force = false,
bool *  emitted = NULL 
)

◆ exportEnumerationDefinitionsToSSD()

void oms::Model::exportEnumerationDefinitionsToSSD ( pugi::xml_node &  node) const

◆ exportSignalFilter()

void oms::Model::exportSignalFilter ( Snapshot snapshot) const

◆ exportSnapshot()

oms_status_enu_t oms::Model::exportSnapshot ( const ComRef cref,
char **  contents 
)

◆ exportSSMTemplate()

oms_status_enu_t oms::Model::exportSSMTemplate ( const ComRef cref,
const std::string &  filename 
)

◆ exportSSVTemplate()

oms_status_enu_t oms::Model::exportSSVTemplate ( const ComRef cref,
const std::string &  filename 
)

◆ exportToFile()

oms_status_enu_t oms::Model::exportToFile ( const std::string &  filename) const

◆ exportToSSD()

oms_status_enu_t oms::Model::exportToSSD ( Snapshot snapshot) const

◆ exportUnitDefinitionsToSSD()

void oms::Model::exportUnitDefinitionsToSSD ( pugi::xml_node &  node) const

◆ getComponent()

oms::Component * oms::Model::getComponent ( const ComRef cref)

◆ getCref()

const ComRef& oms::Model::getCref ( ) const
inline

◆ getElements()

oms::Element** oms::Model::getElements ( )
inline

◆ getLoggingInterval()

double oms::Model::getLoggingInterval ( ) const
inline

◆ getModelState()

oms_modelState_enu_t oms::Model::getModelState ( ) const
inline

◆ getResultFile()

oms_status_enu_t oms::Model::getResultFile ( char **  filename,
int *  bufferSize 
)

◆ getStartTime()

double oms::Model::getStartTime ( ) const
inline

◆ getStopTime()

double oms::Model::getStopTime ( ) const
inline

◆ getSystem()

oms::System * oms::Model::getSystem ( const ComRef cref)

◆ getSystemType()

oms_system_enu_t oms::Model::getSystemType ( const pugi::xml_node &  node,
const std::string &  sspVersion 
)

◆ getSystemTypeHelper()

oms_system_enu_t oms::Model::getSystemTypeHelper ( const pugi::xml_node &  node,
const std::string &  sspVersion 
)

◆ getTempDirectory()

std::string oms::Model::getTempDirectory ( ) const
inline

◆ getThreadPool()

ctpl::thread_pool& oms::Model::getThreadPool ( )
inline

◆ getTime()

double oms::Model::getTime ( ) const

◆ getTopLevelSystem()

System* oms::Model::getTopLevelSystem ( ) const
inline

◆ getVariantName()

std::string oms::Model::getVariantName ( )
inline

◆ importFromSnapshot()

oms_status_enu_t oms::Model::importFromSnapshot ( const Snapshot snapshot)

◆ importSignalFilter()

oms_status_enu_t oms::Model::importSignalFilter ( const std::string &  filename,
const Snapshot snapshot 
)

◆ importSnapshot()

oms_status_enu_t oms::Model::importSnapshot ( const char *  snapshot,
char **  newCref 
)

◆ initialize()

oms_status_enu_t oms::Model::initialize ( )

◆ instantiate()

oms_status_enu_t oms::Model::instantiate ( )

◆ isIsolatedFMUModel()

bool oms::Model::isIsolatedFMUModel ( ) const
inline

◆ list()

oms_status_enu_t oms::Model::list ( const ComRef cref,
char **  contents 
)

◆ listVariants()

oms_status_enu_t oms::Model::listVariants ( const ComRef cref,
char **  contents 
)

◆ loadSnapshot()

oms_status_enu_t oms::Model::loadSnapshot ( const pugi::xml_node &  node)

◆ 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.

◆ newResources()

oms_status_enu_t oms::Model::newResources ( const ComRef cref)

◆ operator=()

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

not implemented

◆ reduceSSV()

oms_status_enu_t oms::Model::reduceSSV ( const std::string &  ssvfile,
const std::string &  ssmfile,
const std::string &  filepath 
)

◆ referenceResources()

oms_status_enu_t oms::Model::referenceResources ( const ComRef cref,
const std::string &  ssmFile 
)

◆ registerSignalsForResultFile()

oms_status_enu_t oms::Model::registerSignalsForResultFile ( )
private

◆ removeSignalsFromResults()

oms_status_enu_t oms::Model::removeSignalsFromResults ( const char *  regex)

◆ rename() [1/2]

oms_status_enu_t oms::Model::rename ( const ComRef cref)

◆ rename() [2/2]

oms_status_enu_t oms::Model::rename ( const ComRef cref,
const ComRef newCref 
)

◆ reset()

oms_status_enu_t oms::Model::reset ( )

◆ setIsolatedFMUModel()

void oms::Model::setIsolatedFMUModel ( )
inline

◆ setLoggingInterval()

oms_status_enu_t oms::Model::setLoggingInterval ( double  loggingInterval)

◆ setResultFile()

oms_status_enu_t oms::Model::setResultFile ( const std::string &  filename,
int  bufferSize 
)

◆ setStartTime()

oms_status_enu_t oms::Model::setStartTime ( double  value)

◆ setStopTime()

oms_status_enu_t oms::Model::setStopTime ( double  value)

◆ simulate()

oms_status_enu_t oms::Model::simulate ( )

◆ stepUntil()

oms_status_enu_t oms::Model::stepUntil ( double  stopTime)

◆ terminate()

oms_status_enu_t oms::Model::terminate ( )

◆ updateParameterBindingsToSSD()

oms_status_enu_t oms::Model::updateParameterBindingsToSSD ( pugi::xml_node &  node,
bool  isTopSystemOrModel 
) const

◆ useThreadPool()

bool oms::Model::useThreadPool ( )
inline

◆ validState()

bool oms::Model::validState ( int  validStates) const
inline

◆ writeAllResourcesToFilesystem()

void oms::Model::writeAllResourcesToFilesystem ( std::vector< std::string > &  resources,
Snapshot snapshot 
) const

Member Data Documentation

◆ bufferSize

int oms::Model::bufferSize = 10
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

◆ externalResources

std::vector<std::string> oms::Model::externalResources
private

list of external ssv or ssm resources from filesystem

◆ importedResources

std::vector<std::string> oms::Model::importedResources

list of imported resources from ssp

◆ 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

◆ new_root_cref

ComRef oms::Model::new_root_cref
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

◆ signalFilterFilename

std::string oms::Model::signalFilterFilename = "resources/signalFilter.xml"
private

◆ ssdVariants

std::map<ComRef, char*> oms::Model::ssdVariants

list of all variants copied when user create a new variant using oms_duplicateVariant()

◆ 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

◆ values

Values oms::Model::values
private

◆ variantName

std::string oms::Model::variantName = "SystemStructure.ssd"
private

default name


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