SyDEVS
v0.6.7
Multiscale Simulation and Systems Modeling Library
|
A class template for running simulations. More...
#include <simulation.h>
Inherited by sydevs::systems::real_time_simulation< Node >.
Public Member Functions | |
simulation (const time_point &start_t, const time_point &end_t, bool can_end_early, int64 seed, std::ostream &stream) | |
Constructs a simulation with the full set of configuration options. More... | |
simulation (duration total_dt, int64 seed, std::ostream &stream) | |
Constructs a simulation with a reduced set of configuration options. More... | |
simulation (const simulation &)=delete | |
No copy constructor. More... | |
simulation & | operator= (const simulation &)=delete |
No copy assignment. More... | |
simulation (simulation &&)=delete | |
No move constructor. More... | |
simulation & | operator= (simulation &&)=delete |
No move assignment. More... | |
virtual | ~simulation ()=default |
Destructor. More... | |
const time_point & | start_time () const |
Returns the start time of the simulation. More... | |
const time_point & | end_time () const |
Returns the end time of the simulation. More... | |
bool | can_end_early () const |
Returns true if the simulation can end before the specified end time. More... | |
bool | started () const |
Returns true if the simulation has started. More... | |
bool | finishing () const |
Returns true if all events are finished except finalization. More... | |
bool | finished () const |
Returns true if the simulation has finished. More... | |
const discrete_event_time & | time () const |
Returns the current point in discrete event time. More... | |
duration | imminent_duration () const |
Returns the duration until the imminent event. More... | |
void | process_next_event () |
Runs the next event of the topmost system node. More... | |
int64 | process_next_events () |
Runs all events until simulated time advances; returns the number of processed events. More... | |
int64 | process_events_until (const time_point &t) |
Runs all events until simulated time advances at least to t ; returns the number of processed events. More... | |
int64 | process_remaining_events () |
Runs simulation until completion; returns the number of processed events. More... | |
const timer & | event_timer () const |
Returns the object that accumulated wallclock event durations. More... | |
Public Attributes | |
Node | top |
The topmost system node. More... | |
A class template for running simulations.
The simulation
class template represents a simulation run based on a system_node
class specified as a template parameter. Member functions allow the represented simulation to be performed one event at a time or until completion.
Below is an example of how a simulation
object can be instantiated and used.
It is also possible to obtain wallclock times at each level in a model hierarchy, the cumulative time that the computer has spent executing events.
|
inline |
Constructs a simulation
with the full set of configuration options.
start_t | The starting point in simulated time. |
end_t | The end point in simulated time; only finalization events can occur at this time. |
can_end_early | Flag indicating that the simulation will end before the specified end time if all events are exhausted. |
seed | The integer used to seed the random number generator. |
stream | The output steam onto which printed results are directed. |
Node | The port-free system_node on which the simulation is based. |
|
inline |
Constructs a simulation
with a reduced set of configuration options.
total_dt | The duration of the simulation in simulated time; the simulation starts at time zero and does not end early. |
seed | The integer used to seed the random number generator. |
stream | The output steam onto which printed results are directed. |
Node | The port-free system_node on which the simulation is based. |
|
delete |
No copy constructor.
|
delete |
No move constructor.
|
virtualdefault |
Destructor.
|
inline |
Returns true
if the simulation can end before the specified end time.
|
inline |
Returns the end time of the simulation.
|
inline |
Returns the object that accumulated wallclock event durations.
|
inline |
Returns true
if the simulation has finished.
|
inline |
Returns true
if all events are finished except finalization.
|
inline |
Returns the duration until the imminent event.
|
delete |
No copy assignment.
|
delete |
No move assignment.
|
inline |
Runs all events until simulated time advances at least to t
; returns the number of processed events.
|
inline |
Runs the next event of the topmost system node.
|
inline |
Runs all events until simulated time advances; returns the number of processed events.
|
inline |
Runs simulation until completion; returns the number of processed events.
|
inline |
Returns the start time of the simulation.
|
inline |
Returns true
if the simulation has started.
|
inline |
Returns the current point in discrete event time.
Node sydevs::systems::simulation< Node >::top |
The topmost system node.