adevs
Public Member Functions | List of all members
adevs::FMI< X > Class Template Reference

#include <adevs_fmi.h>

Inheritance diagram for adevs::FMI< X >:
adevs::ode_system< X >

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)
 
- Public Member Functions inherited from adevs::ode_system< X >
 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.
 

Detailed Description

template<typename X>
class adevs::FMI< X >

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.

Constructor & Destructor Documentation

template<typename X >
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 
)

This constructs a wrapper around an FMI. The constructor must be provided with the FMI's GUID, the number of state variables, number of event indicators, and the path to the .so file that contains the FMI functions for this model.

Member Function Documentation

template<typename X >
void adevs::FMI< X >::confluent_event ( double *  q,
const bool *  state_event,
const Bag< X > &  xb 
)
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().

template<typename X >
void adevs::FMI< X >::external_event ( double *  q,
double  e,
const Bag< X > &  xb 
)
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().

template<typename X >
void adevs::FMI< X >::gc_output ( Bag< X > &  gb)
virtual

Garbage collection function. This works just like the Atomic gc_output method. The default implementation does nothing.

Implements adevs::ode_system< X >.

template<typename X >
void adevs::FMI< X >::internal_event ( double *  q,
const bool *  state_event 
)
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().

template<typename X >
void adevs::FMI< X >::output_func ( const double *  q,
const bool *  state_event,
Bag< X > &  yb 
)
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 >.

template<typename X >
void adevs::FMI< X >::postStep ( double *  q)
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().

template<typename X >
void adevs::FMI< X >::postTrialStep ( double *  q)
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().


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