eosim::core::Experiment EoSimulator Programmer's Manual
NAME
Experiment
SYNOPSIS
#include <eosim/core/experiment.hpp>
namespace eosim {
namespace core {
class Experiment {
public:
Experiment ();
~Experiment();
void run (double simTime_);
void setModel (Model* model_);
void schedule (double offset_, Entity* who_);
void setSeed (unsigned long seed_);
void registerDist (dist::Distribution* dist_);
void registerCEvent (CEvent* cEv_);
double getSimTime();
};
}
}
DESCRIPTION
This class handles the execution of a simulation. It is a main class in EoSimulator. While Model is defines the system, Experiment handles the runs.
CLASS OPERATIONS
Experiment ():
The constructor creates an Experiment.
~Experiment():
The destructor deletes all the entities scheduled. It is assumed that all entities were created dynamically, so every entity stored is deleted.
void run (double simTime_):
This operation simulates the connected model until simTime_. Experiment could simulate any Model which use event method or three phase approach. An interesting feature of this operation is that the simulation actual time is not reseted after a run. The first run starts at zero, but next runs starts when the previous finished. If an experiment is not connected to a model, the simulation aborts immediately displaying an error message.
void setModel (Model* model_):
This operation links an experiment to model_. If model_ is null, the simulation aborts immediately displaying an error message. This operation is automatically invoked by EoSimulator, the programmer shouldn’t use it.
void schedule (double offset_, Entity* who_):
This operation schedules who_ at the simulation’s actual time plus offset_. It is assumed that who_ knows to which event it is scheduled.
void setSeed (unsigned long seed_):
This operation uses seed_ to assign a new seed to all distribution registered in the model_. To obtain different runs, set different seeds in the experiment. If the experiment is not connected to a model, the simulation aborts immediately displaying an error message.
void registerDist (dist::Distribution* dist_):
This operation register dist_ in the experiment. If the experiment is not connected to a model, the simulation aborts immediately displaying an error message. The programmer shouldn’t invoke this operation because it’s invoked automatically by EoSimulator.
void registerCEvent (CEvent* cEv_):
This operation register cEv_ in the experiment. If the experiment is not connected to a model, the simulation aborts immediately displaying an error message. The programmer shouldn’t invoke this operation because it’s invoked automatically by EoSimulator.
double getSimTime():
This operation returns the simulation’s actual time. If the experiment is not running, the simulation aborts immediately displaying an error message.
SEE ALSO