adevs
|
#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, double start_time=0.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 | postTrialStep (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) |
std::string | get_string (int k) |
void | set_string (int k, std::string &val) |
![]() | |
ode_system (int N_vars, int M_event_funcs) | |
Make a system with N state variables and M state event functions. | |
int | numVars () const |
Get the number of state variables. | |
int | numEvents () const |
Get the number of state events. | |
virtual | ~ode_system () |
Destructor. | |
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 , |
||
double | start_time = 0.0 |
||
) |
|
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().
|
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().
|
virtual |
Garbage collection function. This works just like the Atomic gc_output method. The default implementation does nothing.
Implements adevs::ode_system< X >.
|
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().
|
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 >.
|
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().
|
virtual |
This is called after a trial step. It can be used to restore the values of any variables that might have been changed by der_func or state_event_func while calculating the trial step. By default this method does nothing.
Reimplemented from adevs::ode_system< X >.
References adevs::ode_system< X >::numVars().