|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object umontreal.iro.lecuyer.simevents.Continuous
public abstract class 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.
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()
Constructs a new continuous-time variable linked to the default simulator, without initializing it. |
|
Continuous(Simulator sim)
Constructs a new continuous-time variable linked to the given simulator, 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, for the default simulator. |
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 |
setSimulator(Simulator sim)
Sets the simulator linked to this continuous-time variable. |
Simulator |
simulator()
Returns the simulator linked to this continuous-time variable. |
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 |
---|
public Continuous()
public Continuous(Simulator sim)
sim
- the simulator associated to this variable.Method Detail |
---|
public void init(double val)
val
- initial value of the variablepublic double value()
public Simulator simulator()
public void setSimulator(Simulator sim)
sim
- the simulator of the current variablepublic void startInteg()
public void startInteg(double val)
startInteg
, after initializing the variable
to val.
val
- initial value to start integration frompublic void stopInteg()
public abstract double derivative(double t)
t
- time at which the derivative must be computedpublic void afterEachStep()
public static void selectEuler(double h)
selectEuler
in ContinuousState
can be used to set the integration method for any given simulator.
This method appears here only to keep compatibility with older versions of SSJ; using
a non-static Simulator
instance rather than the default simulator is recommended.
h
- integration step, in simulation time unitspublic static void selectRungeKutta4(double h)
selectRungeKutta4
in ContinuousState
can be used to set the integration method for any given simulator.
This method appears here only to keep compatibility with older versions of SSJ; using
a non-static Simulator
instance rather than the default simulator is recommended.
public static void selectRungeKutta2(double h)
selectRungeKutta2
in ContinuousState
can be used to set the integration method for any given simulator.
This method appears here only to keep compatibility with older versions of SSJ; using
a non-static Simulator
instance rather than the default simulator is recommended.
|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |