OMSimulatorLib
The OMSimulator project is a FMI-based co-simulation environment that supports ordinary (i.e., non-delayed) and TLM connections.
|
#include <System.h>
Public Member Functions | |
virtual | ~System () |
virtual oms_status_enu_t | exportToSSD_SimulationInformation (pugi::xml_node &node) const =0 |
virtual oms_status_enu_t | importFromSSD_SimulationInformation (const pugi::xml_node &node, const std::string &sspVersion)=0 |
virtual oms_status_enu_t | registerSignalsForResultFile (ResultWriter &resultFile) |
virtual oms_status_enu_t | updateSignals (ResultWriter &resultFile) |
virtual oms_status_enu_t | setSolver (oms_solver_enu_t solver) |
virtual oms_status_enu_t | instantiate ()=0 |
virtual oms_status_enu_t | initialize ()=0 |
virtual oms_status_enu_t | terminate ()=0 |
virtual oms_status_enu_t | reset ()=0 |
virtual oms_status_enu_t | doStep ()=0 |
virtual oms_status_enu_t | stepUntil (double stopTime)=0 |
const ComRef & | getCref () const |
ComRef | getFullCref () const |
System * | getSystem (const ComRef &cref) |
Component * | getComponent (const ComRef &cref) |
Variable * | getVariable (const ComRef &cref) |
Element * | getElement () |
oms_status_enu_t | listUnconnectedConnectors (char **contents) const |
oms_system_enu_t | getType () const |
oms_status_enu_t | addSubSystem (const ComRef &cref, oms_system_enu_t type) |
oms_status_enu_t | addSubModel (const ComRef &cref, const std::string &fmuPath) |
oms_status_enu_t | replaceSubModel (const ComRef &cref, const std::string &fmuPath, bool dryRun, int &warningCount) |
bool | isValidScalarVariable (Component *referenceComponent, Component *replacingComponent, Connection *connection, const ComRef &crefA, const ComRef &crefB, const ComRef &signalName, const std::string &path, std::vector< std::string > &warningList) |
bool | validCref (const ComRef &cref) |
oms_status_enu_t | exportToSSD (pugi::xml_node &node, Snapshot &snapshot, std::string variantName) const |
oms_status_enu_t | exportToSSV (Snapshot &snapshot) const |
oms_status_enu_t | importFromSnapshot (const pugi::xml_node &node, const std::string &sspVersion, const Snapshot &snapshot, std::string variantName) |
void | setGeometry (const ssd::ElementGeometry &geometry) |
oms_status_enu_t | addConnector (const ComRef &cref, oms_causality_enu_t causality, oms_signal_type_enu_t type) |
Connector * | getConnector (const ComRef &cref) |
std::string | getConnectorOwner (const ComRef &cref) const |
Connector ** | getConnectors () |
BusConnector * | getBusConnector (const ComRef &cref) |
oms_status_enu_t | addTLMConnection (const ComRef &crefA, const ComRef &crefB, double delay, double alpha, double linearimpedance, double angularimpedance) |
oms_status_enu_t | setTLMConnectionParameters (const ComRef &crefA, const ComRef &crefB, const oms_tlm_connection_parameters_t *parameters) |
oms_status_enu_t | addTLMBus (const ComRef &cref, oms_tlm_domain_t domain, const int dimensions, const oms_tlm_interpolation_t interpolation) |
oms_status_enu_t | addConnectorToTLMBus (const ComRef &busCref, const ComRef &connectorCref, const std::string type) |
oms_status_enu_t | deleteConnectorFromTLMBus (const ComRef &busCref, const ComRef &connectorCref) |
oms_status_enu_t | setTLMBusGeometry (const ComRef &cref, const oms::ssd::ConnectorGeometry *geometry) |
TLMBusConnector * | getTLMBusConnector (const ComRef &cref) |
TLMBusConnector ** | getTLMBusConnectors () |
Connection * | getConnection (const ComRef &crefA, const ComRef &crefB) |
Connection ** | getConnections (const ComRef &cref) |
oms_status_enu_t | addConnection (const ComRef &crefA, const ComRef &crefB, bool suppressUnitConversion=false) |
oms_status_enu_t | deleteConnection (const ComRef &crefA, const ComRef &crefB) |
oms_status_enu_t | setConnectorGeometry (const ComRef &cref, const oms::ssd::ConnectorGeometry *geometry) |
oms_status_enu_t | setConnectionGeometry (const ComRef &crefA, const ComRef &crefB, const oms::ssd::ConnectionGeometry *geometry) |
oms_status_enu_t | addBus (const ComRef &cref) |
oms_status_enu_t | newResources (const ComRef &cref, const std::string &ssvFilename, const std::string &ssmFilename="", bool externalresources=false) |
oms_status_enu_t | addConnectorToBus (const ComRef &busCref, const ComRef &connectorCref) |
oms_status_enu_t | deleteConnectorFromBus (const ComRef &busCref, const ComRef &connectorCref) |
oms_status_enu_t | setBusGeometry (const ComRef &cref, const oms::ssd::ConnectorGeometry *geometry) |
oms_status_enu_t | addExternalModel (const ComRef &cref, std::string path, std::string startscript) |
oms_status_enu_t | delete_ (const ComRef &cref) |
oms_status_enu_t | deleteAllConectionsTo (const ComRef &cref) |
oms_status_enu_t | deleteReferencesInSSD (const ComRef &cref, const std::string &filename) |
oms_status_enu_t | deleteResourcesInSSP (const std::string &filename) |
bool | isConnected (const ComRef &cref) const |
Model & | getModel () |
System * | getParentSystem () const |
bool | copyResources () |
void | getAllResources (std::vector< std::string > &resources) const |
std::map< ComRef, System * > & | getSubSystems () |
std::map< ComRef, Component * > & | getComponents () |
std::vector< Connection * > & | getConnections () |
oms_status_enu_t | updateDependencyGraphs () |
const DirectedGraph & | getInitialUnknownsGraph () |
const DirectedGraph & | getOutputsGraph () |
oms_status_enu_t | exportDependencyGraphs (const std::string &pathInitialization, const std::string &pathEvent, const std::string &pathSimulation) |
oms_status_enu_t | setFaultInjection (const ComRef &signal, oms_fault_type_enu_t faultType, double faultValue) |
double | getTime () const |
oms_status_enu_t | getBoolean (const ComRef &cref, bool &value) |
oms_status_enu_t | getInteger (const ComRef &cref, int &value) |
oms_status_enu_t | getReal (const ComRef &cref, double &value) |
oms_status_enu_t | getString (const ComRef &cref, std::string &value) |
oms_status_enu_t | setBoolean (const ComRef &cref, bool value) |
oms_status_enu_t | setInteger (const ComRef &cref, int value) |
oms_status_enu_t | setReal (const ComRef &cref, double value) |
oms_status_enu_t | setString (const ComRef &cref, const std::string &value) |
oms_status_enu_t | setUnit (const ComRef &cref, const std::string &value) |
oms_status_enu_t | getReals (const std::vector< ComRef > &crefs, std::vector< double > &values) |
oms_status_enu_t | setReals (const std::vector< ComRef > &crefs, std::vector< double > values) |
oms_status_enu_t | setRealInputDerivatives (const ComRef &cref, int order, double value) |
oms_status_enu_t | getDirectionalDerivative (const ComRef &unknownCref, const ComRef &knownCref, double &value) |
oms_status_enu_t | getState (const ComRef &cref) |
oms_status_enu_t | setState (const ComRef &cref) |
oms_status_enu_t | freeState (const ComRef &cref) |
oms_status_enu_t | rename (const ComRef &newCref) |
rename the system itself More... | |
oms_status_enu_t | rename (const ComRef &cref, const ComRef &newCref) |
rename any component within the system More... | |
oms_status_enu_t | renameConnections (const ComRef &cref, const ComRef &newCref) |
oms_status_enu_t | renameConnectors () |
bool | isTopLevelSystem () const |
oms_status_enu_t | addSignalsToResults (const char *regex) |
oms_status_enu_t | removeSignalsFromResults (const char *regex) |
void | getTolerance (double *absoluteTolerance, double *relativeTolerance) const |
void | getStepSize (double *initialStepSize, double *minimumStepSize, double *maximumStepSize) const |
oms_status_enu_t | setTolerance (double absoluteTolerance, double relativeTolerance) |
oms_status_enu_t | setFixedStepSize (double stepSize) |
oms_status_enu_t | setVariableStepSize (double initialStepSize, double minimumStepSize, double maximumStepSize) |
double | getMaximumStepSize () |
oms_solver_enu_t | getSolver () |
AlgLoop * | getAlgLoop (const int systemNumber) |
oms_status_enu_t | addAlgLoop (scc_t SCC, const int algLoopNum, DirectedGraph &graph, bool supportsDirectionalDerivatives) |
oms_status_enu_t | updateAlgebraicLoops (const std::vector< scc_t > &sortedConnections, DirectedGraph &graph) |
oms_status_enu_t | solveAlgLoop (DirectedGraph &graph, int loopNumber) |
bool | useThreadPool () |
ctpl::thread_pool & | getThreadPool () |
std::string | getUniqueID () const |
void | forceLoopsToBeUpdated () |
void | getFilteredSignals (std::vector< Connector > &filteredSignals) const |
bool | supportsDirectionalDerivatives (int i, DirectedGraph &graph) |
returns true if all FMUs support providesDirectionalDerivative More... | |
Values & | getValues () |
Static Public Member Functions | |
static System * | NewSystem (const ComRef &cref, oms_system_enu_t type, Model *parentModel, System *parentSystem) |
Public Attributes | |
std::map< std::string, filesystem::path > | fmuGuid |
Protected Member Functions | |
System (const ComRef &cref, oms_system_enu_t type, Model *parentModel, System *parentSystem, oms_solver_enu_t solverMethod) | |
System (System const ©) | |
not implemented More... | |
System & | operator= (System const ©) |
not implemented More... | |
Protected Attributes | |
double | time |
DirectedGraph | initializationGraph |
dependency graph, with all connections, solved at initialization More... | |
DirectedGraph | eventGraph |
filtered dependency graph, without parameters, solved at event mode More... | |
DirectedGraph | simulationGraph |
filtered dependency graph, with connections of type Real, solved at continuous time mode; More... | |
Clock | clock |
unsigned int | clock_id |
oms_solver_enu_t | solverMethod = oms_solver_none |
double | absoluteTolerance = 1e-4 |
double | relativeTolerance = 1e-4 |
double | minimumStepSize |
double | maximumStepSize |
double | initialStepSize |
std::unordered_map< unsigned int, unsigned int > | resultFileMapping |
std::unordered_map< ComRef, bool > | exportConnectors |
Private Member Functions | |
oms_status_enu_t | importFromSSD_ConnectionGeometry (const pugi::xml_node &node, const ComRef &crefA, const ComRef &crefB) |
oms_status_enu_t | importTLMBus (const pugi::xml_node &node, Component *component) |
oms_status_enu_t | importBusConnectorSignals (const pugi::xml_node &node) |
oms_status_enu_t | importBusConnectorGeometry (const pugi::xml_node &node) |
Private Attributes | |
ComRef | cref |
oms_system_enu_t | type |
Model * | parentModel |
System * | parentSystem |
std::map< ComRef, System * > | subsystems |
std::map< ComRef, Component * > | components |
Values | values |
system level connectors, parameters and their start values defined before instantiating the FMU and external inputs defined after initialization More... | |
Element | element |
std::vector< Connector * > | connectors |
last element is always NULL More... | |
std::vector< oms_element_t * > | subelements |
last element is always NULL; don't free it More... | |
std::vector< BusConnector * > | busconnectors |
std::vector< TLMBusConnector * > | tlmbusconnectors |
std::vector< Connection * > | connections |
last element is always NULL More... | |
bool | loopsNeedUpdate = true |
std::vector< AlgLoop > | algLoops |
vector of algebraic loop objects More... | |
|
virtual |
|
protected |
|
protected |
not implemented
oms_status_enu_t oms::System::addAlgLoop | ( | scc_t | SCC, |
const int | algLoopNum, | ||
DirectedGraph & | graph, | ||
bool | supportsDirectionalDerivatives | ||
) |
oms_status_enu_t oms::System::addBus | ( | const ComRef & | cref | ) |
< TODO: Implement bus connectors for components
oms_status_enu_t oms::System::addConnection | ( | const ComRef & | crefA, |
const ComRef & | crefB, | ||
bool | suppressUnitConversion = false |
||
) |
oms_status_enu_t oms::System::addConnector | ( | const ComRef & | cref, |
oms_causality_enu_t | causality, | ||
oms_signal_type_enu_t | type | ||
) |
oms_status_enu_t oms::System::addConnectorToBus | ( | const ComRef & | busCref, |
const ComRef & | connectorCref | ||
) |
oms_status_enu_t oms::System::addConnectorToTLMBus | ( | const ComRef & | busCref, |
const ComRef & | connectorCref, | ||
const std::string | type | ||
) |
oms_status_enu_t oms::System::addExternalModel | ( | const ComRef & | cref, |
std::string | path, | ||
std::string | startscript | ||
) |
oms_status_enu_t oms::System::addSignalsToResults | ( | const char * | regex | ) |
oms_status_enu_t oms::System::addSubModel | ( | const ComRef & | cref, |
const std::string & | fmuPath | ||
) |
oms_status_enu_t oms::System::addSubSystem | ( | const ComRef & | cref, |
oms_system_enu_t | type | ||
) |
oms_status_enu_t oms::System::addTLMBus | ( | const ComRef & | cref, |
oms_tlm_domain_t | domain, | ||
const int | dimensions, | ||
const oms_tlm_interpolation_t | interpolation | ||
) |
oms_status_enu_t oms::System::addTLMConnection | ( | const ComRef & | crefA, |
const ComRef & | crefB, | ||
double | delay, | ||
double | alpha, | ||
double | linearimpedance, | ||
double | angularimpedance | ||
) |
bool oms::System::copyResources | ( | ) |
oms_status_enu_t oms::System::delete_ | ( | const ComRef & | cref | ) |
oms_status_enu_t oms::System::deleteAllConectionsTo | ( | const ComRef & | cref | ) |
oms_status_enu_t oms::System::deleteConnectorFromBus | ( | const ComRef & | busCref, |
const ComRef & | connectorCref | ||
) |
oms_status_enu_t oms::System::deleteConnectorFromTLMBus | ( | const ComRef & | busCref, |
const ComRef & | connectorCref | ||
) |
oms_status_enu_t oms::System::deleteReferencesInSSD | ( | const ComRef & | cref, |
const std::string & | filename | ||
) |
oms_status_enu_t oms::System::deleteResourcesInSSP | ( | const std::string & | filename | ) |
|
pure virtual |
Implemented in oms::SystemSC, oms::SystemTLM, and oms::SystemWC.
oms_status_enu_t oms::System::exportDependencyGraphs | ( | const std::string & | pathInitialization, |
const std::string & | pathEvent, | ||
const std::string & | pathSimulation | ||
) |
oms_status_enu_t oms::System::exportToSSD | ( | pugi::xml_node & | node, |
Snapshot & | snapshot, | ||
std::string | variantName | ||
) | const |
|
pure virtual |
Implemented in oms::SystemSC, oms::SystemWC, and oms::SystemTLM.
oms_status_enu_t oms::System::exportToSSV | ( | Snapshot & | snapshot | ) | const |
|
inline |
oms_status_enu_t oms::System::freeState | ( | const ComRef & | cref | ) |
oms::AlgLoop * oms::System::getAlgLoop | ( | const int | systemNumber | ) |
void oms::System::getAllResources | ( | std::vector< std::string > & | resources | ) | const |
oms_status_enu_t oms::System::getBoolean | ( | const ComRef & | cref, |
bool & | value | ||
) |
oms::BusConnector * oms::System::getBusConnector | ( | const ComRef & | cref | ) |
oms::Component * oms::System::getComponent | ( | const ComRef & | cref | ) |
oms::Connection * oms::System::getConnection | ( | const ComRef & | crefA, |
const ComRef & | crefB | ||
) |
|
inline |
oms::Connection ** oms::System::getConnections | ( | const ComRef & | cref | ) |
oms::Connector * oms::System::getConnector | ( | const ComRef & | cref | ) |
std::string oms::System::getConnectorOwner | ( | const ComRef & | cref | ) | const |
|
inline |
|
inline |
oms_status_enu_t oms::System::getDirectionalDerivative | ( | const ComRef & | unknownCref, |
const ComRef & | knownCref, | ||
double & | value | ||
) |
|
inline |
void oms::System::getFilteredSignals | ( | std::vector< Connector > & | filteredSignals | ) | const |
oms::ComRef oms::System::getFullCref | ( | ) | const |
|
inline |
oms_status_enu_t oms::System::getInteger | ( | const ComRef & | cref, |
int & | value | ||
) |
|
inline |
oms::Model & oms::System::getModel | ( | ) |
|
inline |
|
inline |
oms_status_enu_t oms::System::getReal | ( | const ComRef & | cref, |
double & | value | ||
) |
oms_status_enu_t oms::System::getReals | ( | const std::vector< ComRef > & | crefs, |
std::vector< double > & | values | ||
) |
|
inline |
oms_status_enu_t oms::System::getState | ( | const ComRef & | cref | ) |
|
inline |
oms_status_enu_t oms::System::getString | ( | const ComRef & | cref, |
std::string & | value | ||
) |
oms::System * oms::System::getSystem | ( | const ComRef & | cref | ) |
ctpl::thread_pool & oms::System::getThreadPool | ( | ) |
|
inline |
oms::TLMBusConnector * oms::System::getTLMBusConnector | ( | const ComRef & | cref | ) |
|
inline |
|
inline |
|
inline |
std::string oms::System::getUniqueID | ( | ) | const |
|
inline |
oms::Variable * oms::System::getVariable | ( | const ComRef & | cref | ) |
|
private |
|
private |
oms_status_enu_t oms::System::importFromSnapshot | ( | const pugi::xml_node & | node, |
const std::string & | sspVersion, | ||
const Snapshot & | snapshot, | ||
std::string | variantName | ||
) |
|
private |
|
pure virtual |
Implemented in oms::SystemSC, oms::SystemWC, and oms::SystemTLM.
|
private |
|
pure virtual |
Implemented in oms::SystemSC, oms::SystemTLM, and oms::SystemWC.
|
pure virtual |
Implemented in oms::SystemSC, oms::SystemTLM, and oms::SystemWC.
bool oms::System::isConnected | ( | const ComRef & | cref | ) | const |
|
inline |
bool oms::System::isValidScalarVariable | ( | Component * | referenceComponent, |
Component * | replacingComponent, | ||
Connection * | connection, | ||
const ComRef & | crefA, | ||
const ComRef & | crefB, | ||
const ComRef & | signalName, | ||
const std::string & | path, | ||
std::vector< std::string > & | warningList | ||
) |
oms_status_enu_t oms::System::listUnconnectedConnectors | ( | char ** | contents | ) | const |
oms_status_enu_t oms::System::newResources | ( | const ComRef & | cref, |
const std::string & | ssvFilename, | ||
const std::string & | ssmFilename = "" , |
||
bool | externalresources = false |
||
) |
|
static |
|
virtual |
Reimplemented in oms::SystemWC, and oms::SystemTLM.
oms_status_enu_t oms::System::removeSignalsFromResults | ( | const char * | regex | ) |
rename any component within the system
oms_status_enu_t oms::System::rename | ( | const ComRef & | newCref | ) |
rename the system itself
oms_status_enu_t oms::System::renameConnectors | ( | ) |
oms_status_enu_t oms::System::replaceSubModel | ( | const ComRef & | cref, |
const std::string & | fmuPath, | ||
bool | dryRun, | ||
int & | warningCount | ||
) |
|
pure virtual |
Implemented in oms::SystemSC, oms::SystemTLM, and oms::SystemWC.
oms_status_enu_t oms::System::setBoolean | ( | const ComRef & | cref, |
bool | value | ||
) |
oms_status_enu_t oms::System::setBusGeometry | ( | const ComRef & | cref, |
const oms::ssd::ConnectorGeometry * | geometry | ||
) |
oms_status_enu_t oms::System::setConnectionGeometry | ( | const ComRef & | crefA, |
const ComRef & | crefB, | ||
const oms::ssd::ConnectionGeometry * | geometry | ||
) |
oms_status_enu_t oms::System::setConnectorGeometry | ( | const ComRef & | cref, |
const oms::ssd::ConnectorGeometry * | geometry | ||
) |
oms_status_enu_t oms::System::setFaultInjection | ( | const ComRef & | signal, |
oms_fault_type_enu_t | faultType, | ||
double | faultValue | ||
) |
|
inline |
|
inline |
oms_status_enu_t oms::System::setInteger | ( | const ComRef & | cref, |
int | value | ||
) |
oms_status_enu_t oms::System::setReal | ( | const ComRef & | cref, |
double | value | ||
) |
oms_status_enu_t oms::System::setRealInputDerivatives | ( | const ComRef & | cref, |
int | order, | ||
double | value | ||
) |
oms_status_enu_t oms::System::setReals | ( | const std::vector< ComRef > & | crefs, |
std::vector< double > | values | ||
) |
|
inlinevirtual |
Reimplemented in oms::SystemSC, and oms::SystemWC.
oms_status_enu_t oms::System::setState | ( | const ComRef & | cref | ) |
oms_status_enu_t oms::System::setString | ( | const ComRef & | cref, |
const std::string & | value | ||
) |
oms_status_enu_t oms::System::setTLMBusGeometry | ( | const ComRef & | cref, |
const oms::ssd::ConnectorGeometry * | geometry | ||
) |
oms_status_enu_t oms::System::setTLMConnectionParameters | ( | const ComRef & | crefA, |
const ComRef & | crefB, | ||
const oms_tlm_connection_parameters_t * | parameters | ||
) |
|
inline |
oms_status_enu_t oms::System::setUnit | ( | const ComRef & | cref, |
const std::string & | value | ||
) |
|
inline |
oms_status_enu_t oms::System::solveAlgLoop | ( | DirectedGraph & | graph, |
int | loopNumber | ||
) |
|
pure virtual |
Implemented in oms::SystemSC, oms::SystemTLM, and oms::SystemWC.
bool oms::System::supportsDirectionalDerivatives | ( | int | i, |
DirectedGraph & | graph | ||
) |
returns true if all FMUs support providesDirectionalDerivative
|
pure virtual |
Implemented in oms::SystemSC, oms::SystemTLM, and oms::SystemWC.
oms_status_enu_t oms::System::updateAlgebraicLoops | ( | const std::vector< scc_t > & | sortedConnections, |
DirectedGraph & | graph | ||
) |
oms_status_enu_t oms::System::updateDependencyGraphs | ( | ) |
|
virtual |
Reimplemented in oms::SystemWC, and oms::SystemTLM.
bool oms::System::useThreadPool | ( | ) |
bool oms::System::validCref | ( | const ComRef & | cref | ) |
|
protected |
|
private |
vector of algebraic loop objects
|
private |
|
protected |
|
protected |
|
private |
last element is always NULL
|
private |
last element is always NULL
|
private |
|
private |
|
protected |
filtered dependency graph, without parameters, solved at event mode
|
protected |
std::map<std::string, filesystem::path> oms::System::fmuGuid |
|
protected |
dependency graph, with all connections, solved at initialization
|
protected |
|
private |
|
protected |
|
protected |
|
private |
|
private |
|
protected |
|
protected |
|
protected |
filtered dependency graph, with connections of type Real, solved at continuous time mode;
|
protected |
|
private |
last element is always NULL; don't free it
|
protected |
|
private |
|
private |
|
private |
system level connectors, parameters and their start values defined before instantiating the FMU and external inputs defined after initialization