SSJ
V. 1.2.5.

umontreal.iro.lecuyer.simevents
Class Continuous

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

public abstract class Continuous
extends Object

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. 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.

One of the methods selectEuler, selectRungeKutta2 or selectRungeKutta4 must be called before starting any integration. These methods permit one to select the numerical integration method and the step size h (in time units) that will be used for all continuous-time variables. For all the methods, an integration step at time t changes the values of the variables from their old values at time t - h to their new values at time t.

Each integration step is scheduled as an event and added to the event list. When creating a continuous variable class, the toString method can be overriden to display information about the continuous variable. This information will be displayed when formating the event list as a string.


Constructor Summary
Continuous()
          Constructs a new continuous-time variable, without initializing it.
 
Method Summary
 void afterEachStep()
          This method is executed after each integration step for this Continuous variable.
abstract  double derivative(double t)
          This method should return the derivative of this variable with respect to time, at time t.
 void init(double val)
          Initializes or reinitializes the continuous-time variable to val.
static void selectEuler(double h)
          Selects the Euler method as the integration method, with the integration step size h, in time units.
static void selectRungeKutta2(double h)
          Selects a Runge-Kutta method of order 2 as the integration method to be used, with step size h.
static void selectRungeKutta4(double h)
          Selects a Runge-Kutta method of order 4 as the integration method to be used, with step size h.
 void startInteg()
          Starts the integration process that will change the state of this variable at each integration step.
 void startInteg(double val)
          Same as startInteg, after initializing the variable to val.
 void stopInteg()
          Stops the integration process for this continuous variable.
 double value()
          Returns the current value of this continuous-time variable.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Continuous

public Continuous()
Constructs a new continuous-time variable, without initializing it.

Method Detail

init

public void init(double val)
Initializes or reinitializes the continuous-time variable to val.

Parameters:
val - initial value of the variable

value

public double value()
Returns the current value of this continuous-time variable.

Returns:
the current value of the variable

selectEuler

public static void selectEuler(double h)
Selects the Euler method as the integration method, with the integration step size h, in time units.

Parameters:
h - integration step, in simulation time units

selectRungeKutta2

public static void selectRungeKutta2(double h)
Selects a Runge-Kutta method of order 2 as the integration method to be used, with step size h.

Parameters:
h - integration step, in simulation time units

selectRungeKutta4

public static void selectRungeKutta4(double h)
Selects a Runge-Kutta method of order 4 as the integration method to be used, with step size h.

Parameters:
h - integration step, in simulation time units

startInteg

public void startInteg()
Starts the integration process that will change the state of this variable at each integration step.


startInteg

public void startInteg(double val)
Same as startInteg, after initializing the variable to val.

Parameters:
val - initial value to start integration from

stopInteg

public void stopInteg()
Stops the integration process for this continuous variable. The variable keeps the value it took at the last integration step before calling stopInteg.


derivative

public abstract double derivative(double t)
This method should return the derivative of this variable with respect to time, at time t. Every subclass of Continuous that is to be instantiated must implement it. If the derivative does not depend explicitly on time, t becomes a dummy parameter. Internally, the method is used with t not necessarily equal to the current simulation time.

Parameters:
t - time at which the derivative must be computed

afterEachStep

public void afterEachStep()
This method is executed after each integration step for this Continuous variable. Here, it does nothing, but every subclass of Continuous may reimplement it.


SSJ
V. 1.2.5.

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