The PLT Scheme Simulation Collection supports continuous simulation models as well as discrete event models. Unlike discrete event simulations in which time advances in response to the times of events, continuous simulations advance time continuously by integrating the differential equations defining the system of equations defining the continuous model.

The PLT Scheme Simulation Collection uses the ordinary differential equation (ODE) solver from the PLT Scheme Science Collection[13] to implement its integration loop for continuous models. Many aspects of the integration loop may be controlled by the model developer, including the ODE step-type, ODE control type, and step size limitations.

A continuous model is represented by a process which has a wait/continuously statement that specifies the differential equations for the continuous model and, optionally, the termination condition for the model.

Continuous variables are used in continuous simulation models. Each continuous variable is associated with the process instance that creates it and when that process instances executes a work/continuously statement, its continuous variables are added to the state vector for the ODE solver.

Continuous variables are variables and have the same data collection facilities available.

make-continuous-variable

Function:

(make-continuous-variableinitial-value)
(make-continuous-variable)

Contract:

(case-> (->real?variable?)
(->variable?))

This function returns a new continuous variable with the given initial-value. If no initial-value is specified, 'uninitialized is used. The continuous variable is associated with the current process.
The make-continuous-variable call is invalid outside the context of a process.

A continuous simulation model is implemented within a process using the work/continuously macro. This is analogous to the wait/work function in a discrete model, but also specifies the differential equations and, optionally, the terminating conditions, for the continuous model.

work/continuously

Macro:

(work/continuously
[untilexpr]
body ...)

The work/continuously defines a continuous model within a process instance. The body expressions should compute the values of the derivatives of the relevant continuous variables in the process and set them using the set-variable-dt! function. Note that side effects in the body expressions should be avoided since the integration loop will typical evaluate the body expressions multiple times for each time step and may even regress in time when the error estimates in the ODE control object are too high.

The expr in the until clause is evaluated at the start of each time step. If the expr is true, then the process drops out of the work/continuously and resumes execution (as a discrete event model).

If you look at the output of Model 2 above you will notice a distinct stair-step pattern in the temperature history of the ingots. You will also notice that it overshoots the maximum temperature by as much as 20 degrees. This is due to the nature of the near linear temperature function in conjunction with the default control strategy used by the integration loop. The default control strategy will dynamically adjust the step size while keeping the error estimate with an acceptable limit (by default this is 10-6). Unfortunately, this doesn't work well in this case.

In this example we modify Model 2 to use a fixed step size. In this case we will use a fixed step size of 1 minute.

We set the step size (in the current simulation environment) using the following statement:

(current-simulation-step-size (/1.060.0))

where (/ 1.0 60.0) is the step size. [The time unit being used is hours, so $1/60$ of an hour is $1$ minute.
Next, we make the integration loop use a fixed step size by setting the ODE control object to \texttt{\#f}.
\scm{
(current-simulation-control #f)}
These are the only changes to the model and are included in the updated \verbinitialize+ function below.

In this example we modify Model 2 to use a limited step size. In this case we will limit the step size to a maximul 1 minute.

We set the step size limit (in the current simulation environment) using the following statement:

(current-simulation-max-step-size (/1.060.0))

where (/ 1.0 60.0) is the maximum step size. [The time unit being used is hours, so $1/60$ of an hour is $1$ minute.
This is the only change to the model and is included in the updated \verbinitialize+ function below.