#include <adevs_fmi.h>
Public Member Functions | |
FMI (const char *modelname, const char *guid, int num_state_variables, int num_event_indicators, const char *shared_lib_name, const double tolerance=1E-8, int num_extra_event_indicators=0) | |
virtual void | init (double *q) |
Copy the initial state of the model to q. | |
virtual void | der_func (const double *q, double *dq) |
Compute the derivative for state q and put it in dq. | |
virtual void | state_event_func (const double *q, double *z) |
Compute the state event functions for state q and put them in z. | |
virtual double | time_event_func (const double *q) |
Compute the time event function using state q. | |
virtual void | postStep (double *q) |
virtual void | internal_event (double *q, const bool *state_event) |
virtual void | external_event (double *q, double e, const Bag< X > &xb) |
virtual void | confluent_event (double *q, const bool *state_event, const Bag< X > &xb) |
virtual void | output_func (const double *q, const bool *state_event, Bag< X > &yb) |
virtual void | gc_output (Bag< X > &gb) |
virtual | ~FMI () |
Destructor. | |
double | get_time () const |
double | get_real (int k) |
void | set_real (int k, double val) |
int | get_int (int k) |
void | set_int (int k, int val) |
bool | get_bool (int k) |
void | set_bool (int k, bool val) |
Load an FMI wrapped continuous system model for use in a discrete event simulation. The FMI can then be attached to any of the ODE solvers and event detectors in adevs for simulation with the Hybrid class. This FMI loader does not automatically extract model information from the description XML, and so that information must be provided explicitly by the end-user, but you probably need to know this information regardless if you are using the FMI inside of a larger discrete event simulation.
adevs::FMI< X >::FMI | ( | const char * | modelname, | |
const char * | guid, | |||
int | num_state_variables, | |||
int | num_event_indicators, | |||
const char * | shared_lib_name, | |||
const double | tolerance = 1E-8 , |
|||
int | num_extra_event_indicators = 0 | |||
) | [inline] |
void adevs::FMI< X >::confluent_event | ( | double * | q, | |
const bool * | state_event, | |||
const Bag< X > & | xb | |||
) | [inline, virtual] |
The confluent transition function. See the notes on the internal_event function for derived classes.
Implements adevs::ode_system< X >.
References adevs::ode_system< X >::numVars().
void adevs::FMI< X >::external_event | ( | double * | q, | |
double | e, | |||
const Bag< X > & | xb | |||
) | [inline, virtual] |
The external transition See the notes on the internal_event function for derived classes.
Implements adevs::ode_system< X >.
References adevs::ode_system< X >::numVars().
void adevs::FMI< X >::gc_output | ( | Bag< X > & | gb | ) | [inline, virtual] |
Garbage collection function. This works just like the Atomic gc_output method. The default implementation does nothing.
Implements adevs::ode_system< X >.
void adevs::FMI< X >::internal_event | ( | double * | q, | |
const bool * | state_event | |||
) | [inline, virtual] |
The internal transition function. This function will process all events required by the FMI. Any derived class should call this method for the parent class, then set or get any variables as appropriate, and then call the base class method again to account for these changes.
Implements adevs::ode_system< X >.
References adevs::ode_system< X >::numVars().
void adevs::FMI< X >::output_func | ( | const double * | q, | |
const bool * | state_event, | |||
Bag< X > & | yb | |||
) | [inline, virtual] |
The output function. This can read variables for the FMI, but should not make any modifications to those variables.
Implements adevs::ode_system< X >.
void adevs::FMI< X >::postStep | ( | double * | q | ) | [inline, virtual] |
This method is invoked immediately following an update of the continuous state variables and signal to the FMI the end of an integration state.
Reimplemented from adevs::ode_system< X >.
References adevs::ode_system< X >::numVars().