Main Page | Namespace List | Alphabetical List | Class List | Directories | File List | Class Members | File Members

SimulationClock Class Reference

#include <SimulationClock.h>

List of all members.

Public Member Functions

 SimulationClock ()
 ~SimulationClock ()
double getSimulationTime ()
unsigned int getTimeStep ()
double getTimeStepDuration_ms ()

Private Member Functions

 SimulationClock (const SimulationClock &)
SimulationClock operator= (const SimulationClock &)
void advance ()
void reset ()
void setLiveMode (bool lMode)
void setTimeStepDuration (double)

Private Attributes

unsigned int timeStep
double timeStepDuration_millisec
double simulationTime
bool liveMode
timeval startTimeStruct
timeval currentTimeStruct

Friends

class SpikeStreamSimulation


Detailed Description

Keeps track of the time and the time step of the simulation. Time is in milliseconds. Each time step includes the processing of all messages up to the sending of the spike lists to other tasks, after which the time step is advanced. In live mode the time is advanced in real time; in other modes it is advanced by the time step duration.

Definition at line 38 of file SimulationClock.h.


Constructor & Destructor Documentation

SimulationClock::SimulationClock  ) 
 

Constructor.

Definition at line 34 of file SimulationClock.cpp.

References liveMode, simulationTime, timeStep, and timeStepDuration_millisec.

SimulationClock::~SimulationClock  ) 
 

Destructor.

Definition at line 44 of file SimulationClock.cpp.

SimulationClock::SimulationClock const SimulationClock  )  [private]
 

Declare copy constructor private so it cannot be used inadvertently.


Member Function Documentation

void SimulationClock::advance  )  [private]
 

Increases the time step of the simulation and increases the simulation time.

Definition at line 81 of file SimulationClock.cpp.

References currentTimeStruct, liveMode, simulationTime, startTimeStruct, timeStep, and timeStepDuration_millisec.

Referenced by SpikeStreamSimulation::sendSpikeMessages().

double SimulationClock::getSimulationTime  ) 
 

Returns the time that has elapsed since the beginning of the simulation. In live mode this is the actual time elapsed. In non-live mode this is the number of time steps multiplied by the time step duration.

Definition at line 58 of file SimulationClock.cpp.

References simulationTime.

Referenced by Neuron::fireNeuron(), SpikeStreamSimulation::sendNeuronData(), and SpikeStreamSimulation::sendSynapseData().

unsigned int SimulationClock::getTimeStep  ) 
 

Returns the current time step.

Definition at line 64 of file SimulationClock.cpp.

References timeStep.

Referenced by SpikeStreamSimulation::processSpikeList(), NeuronTaskHolder::sendFiringNeuronMessages(), UDPSynchronizedServer::sendSpikeData(), TaskHolder::sendSpikeMessages(), SpikeStreamSimulation::sendSpikeMessages(), SpikeStreamSimulation::startSimulation(), and SpikeStreamSimulation::~SpikeStreamSimulation().

double SimulationClock::getTimeStepDuration_ms  ) 
 

Returns the amount of time that the clock advances with each time step This is only meaningful in non live mode.

Definition at line 71 of file SimulationClock.cpp.

References timeStepDuration_millisec.

Referenced by SpikeStreamSimulation::loadGlobalParameters().

SimulationClock SimulationClock::operator= const SimulationClock  )  [private]
 

Declare assignment private so it cannot be used.

void SimulationClock::reset  )  [private]
 

Resets the clock.

Definition at line 95 of file SimulationClock.cpp.

References currentTimeStruct, liveMode, simulationTime, startTimeStruct, and timeStep.

Referenced by SpikeStreamSimulation::loadSimulationData().

void SimulationClock::setLiveMode bool  lMode  )  [private]
 

In live mode the clock advances in real time. Otherwise the clock advances in its own simulation time by timeStepDuration_millisec.

Definition at line 110 of file SimulationClock.cpp.

References currentTimeStruct, liveMode, simulationTime, and startTimeStruct.

Referenced by SpikeStreamSimulation::loadGlobalParameters().

void SimulationClock::setTimeStepDuration double  tsDuration  )  [private]
 

Sets the amount that the clock will advance with each time step in non live mode.

Definition at line 128 of file SimulationClock.cpp.

References timeStepDuration_millisec.

Referenced by SpikeStreamSimulation::loadGlobalParameters().


Friends And Related Function Documentation

friend class SpikeStreamSimulation [friend]
 

Definition at line 49 of file SimulationClock.h.


Member Data Documentation

timeval SimulationClock::currentTimeStruct [private]
 

Structure used to get and hold the current simulation time for live mode operation.

Definition at line 73 of file SimulationClock.h.

Referenced by advance(), reset(), and setLiveMode().

bool SimulationClock::liveMode [private]
 

Controls whether simulationTime is derived by adding timeStep_millisec or getting the actual system time.

Definition at line 65 of file SimulationClock.h.

Referenced by advance(), reset(), setLiveMode(), and SimulationClock().

double SimulationClock::simulationTime [private]
 

The total amount of simulated time that has elapsed in millisedonds.

Definition at line 61 of file SimulationClock.h.

Referenced by advance(), getSimulationTime(), reset(), setLiveMode(), and SimulationClock().

timeval SimulationClock::startTimeStruct [private]
 

Structure used to get and hold the start simulation time for live mode operation.

Definition at line 69 of file SimulationClock.h.

Referenced by advance(), reset(), and setLiveMode().

unsigned int SimulationClock::timeStep [private]
 

Holds the number of update cycles of the simulation.

Definition at line 55 of file SimulationClock.h.

Referenced by advance(), getTimeStep(), reset(), and SimulationClock().

double SimulationClock::timeStepDuration_millisec [private]
 

The amount of simulated time for each time step.

Definition at line 58 of file SimulationClock.h.

Referenced by advance(), getTimeStepDuration_ms(), setTimeStepDuration(), and SimulationClock().


The documentation for this class was generated from the following files:
Generated on Mon Sep 3 22:24:34 2007 for SpikeStream Simulation by  doxygen 1.4.4