SSJ
V. labo.

umontreal.iro.lecuyer.simevents
Class Continuous

java.lang.Object
  extended by umontreal.iro.lecuyer.simevents.Continuous

public abstract class Continuous
extends Object

Continuous

Represents a variable in a continuous-time simulation. This abstract class provides the basic structures and tools for continuous-time simulation, where certain variables evolve continuously in time, according to differential equations. Such continuous variables can be mixed with events and processes.

Each type of continuous-time variable should be defined as a subclass of Continuous. The instances of these subclasses are the actual continuous-time variables. Each subclass must implement the method derivative which returns its derivative with respect to time. The trajectory of this variable is determined by integrating this derivative. The subclass may also reimplement the method afterEachStep, which is executed immediately after each integration step. It would probably be better if we could change this method when calling StartInteg, as in SIMOD.... By default (in the class Continuous), this method does nothing. This method could, for example, verify if the variable has reached a given threshold, or update a graphical illustration of the variable trajectory.

When creating a class representing a continuous variable, the toString method can be overridden to display information about the continuous variable. This information will be displayed when formating the event list as a string.

Each continuous variable has a linked simulator represented by an instance of the Simulator class. If no simulator is provided explicitly when constructing a variable, the default simulator returned by Simulator.getDefaultSimulator is used.


Constructor Summary
Continuous()
          .
Continuous(Simulator sim)
          .
 
Method Summary
 void afterEachStep()
          .
abstract  double derivative(double t)
          .
 void init(double val)
          .
static void selectEuler(double h)
          .
static void selectRungeKutta2(double h)
          .
static void selectRungeKutta4(double h)
          .
 void setSimulator(Simulator sim)
          .
 Simulator simulator()
          .
 void startInteg()
          .
 void startInteg(double val)
          .
 void stopInteg()
          .
 double value()
          .
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Continuous

public Continuous()
. \begin{tabb}Constructs a new continuous-time variable
 linked to the default simulator, {\em without\/} initializing it.
 \end{tabb}


Continuous

public Continuous(Simulator sim)
. \begin{tabb}Constructs a new continuous-time variable linked to
 the given simulator, {\em without\/}
 initializing it.
 \end{tabb}
simthe simulator associated to this variable.

Method Detail

init

public void init(double val)
. \begin{tabb}Initializes or reinitializes the continuous-time variable
 to \texttt{val}.
 \end{tabb}
valinitial value of the variable


value

public double value()
. \begin{tabb}Returns the current value of this continuous-time variable.
 \end{tabb}
the current value of the variable


simulator

public Simulator simulator()
. \begin{tabb}Returns the simulator linked to this continuous-time variable.
 \end{tabb}
the current simulator of the variable


setSimulator

public void setSimulator(Simulator sim)
. \begin{tabb}Sets the simulator linked to this continuous-time variable.
 This method should not be called while this variable is active.
 \end{tabb}
simthe simulator of the current variable


startInteg

public void startInteg()
. \begin{tabb}Starts the integration process that will change the state of
 this variable at each integration step.
 \end{tabb}


startInteg

public void startInteg(double val)
. \begin{tabb}Same as \method{startInteg}{}, after initializing the variable
 to \texttt{val}.
 \end{tabb}
valinitial value to start integration from


stopInteg

public void stopInteg()
. \begin{tabb}Stops the integration process for this continuous variable.
 The var...
 ...ook at the last integration step
 before calling \texttt{stopInteg}.
 \end{tabb}


derivative

public abstract double derivative(double t)
. \begin{tabb}This method should return the derivative of this variable
 with resp...
 ...sed with $t$\ not
 necessarily equal to the current simulation time.
 \end{tabb}
ttime at which the derivative must be computed


afterEachStep

public void afterEachStep()
. \begin{tabb}This method is executed after each integration step
 for this \textt...
 ...hing, but every subclass of \texttt{Continuous} may
 reimplement it.
 \end{tabb}


selectEuler

public static void selectEuler(double h)
. \begin{tabb}Selects the Euler method as the integration method,
 with the integr...
 ...imulator} instance rather than the default simulator is recommended.
 \end{tabb}
hintegration step, in simulation time units


selectRungeKutta4

public static void selectRungeKutta4(double h)
. \begin{tabb}Selects a Runge-Kutta method of order~4 as the integration
 method t...
 ...imulator} instance rather than the default simulator is recommended.
 \end{tabb}


selectRungeKutta2

public static void selectRungeKutta2(double h)
. \begin{tabb}Selects a Runge-Kutta method of order~2 as the integration
 method t...
 ...imulator} instance rather than the default simulator is recommended.
 \end{tabb}


SSJ
V. labo.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.