adevs
Public Member Functions | List of all members
adevs::Simulator< DataType, TimeType > Class Template Reference

The simulator generates trajectories for its models. More...

#include <adevs_base.h>

Inheritance diagram for adevs::Simulator< DataType, TimeType >:
adevs::SimEnv< DataType, TimeType >

Public Member Functions

 Simulator (TimeType tStart=adevs_zero< TimeType >())
 Constructor sets the simulation start time. More...
 
 ~Simulator ()
 Destructor leaves all models intact.
 
void send (Model< DataType, TimeType > *src, Model< DataType, TimeType > *dst, DataType data)
 Send a message to a model. More...
 
void add (Model< DataType, TimeType > *model)
 Add a model to the simulation context. More...
 
void remove (Model< DataType, TimeType > *model)
 Remove a model from the simulation context. More...
 
TimeType now ()
 Returns the current simulation time.
 
TimeType next_event_time () const
 Returns the time of the next event.
 
void exec_next_event ()
 Execute update() methods at the next event time.
 
void exec_until (TimeType t)
 Advance until the simulation time until it equals the supplied time.
 
- Public Member Functions inherited from adevs::SimEnv< DataType, TimeType >
virtual ~SimEnv ()
 Destructor.
 

Detailed Description

template<typename DataType, typename TimeType = Time>
class adevs::Simulator< DataType, TimeType >

The simulator generates trajectories for its models.

The template argument is the data type of a message.

Constructor & Destructor Documentation

◆ Simulator()

template<typename DataType , typename TimeType >
adevs::Simulator< DataType, TimeType >::Simulator ( TimeType  tStart = adevs_zero<TimeType>())

Constructor sets the simulation start time.

Parameters
tStartThe simulation start time. Default is zero.

Member Function Documentation

◆ add()

template<typename DataType , typename TimeType >
void adevs::Simulator< DataType, TimeType >::add ( Model< DataType, TimeType > *  model)
virtual

Add a model to the simulation context.

This causes Model::init(SimEnv*) to be called at the current simulation time.

Implements adevs::SimEnv< DataType, TimeType >.

References adevs::Model< DataType, TimeType >::init().

◆ remove()

template<typename DataType , typename TimeType >
void adevs::Simulator< DataType, TimeType >::remove ( Model< DataType, TimeType > *  model)
virtual

Remove a model from the simulation context.

This causes Model::fini() to be called at the next instant of simulation time.

Implements adevs::SimEnv< DataType, TimeType >.

◆ send()

template<typename DataType , typename TimeType >
void adevs::Simulator< DataType, TimeType >::send ( Model< DataType, TimeType > *  src,
Model< DataType, TimeType > *  dst,
DataType  data 
)
virtual

Send a message to a model.

This method is used by model's in the context to send to messages to each other. It can also be used to inject data into the simulation. This latter case can use src = NULL.

Implements adevs::SimEnv< DataType, TimeType >.

References adevs::Model< DataType, TimeType >::relay().


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