Example of a DDE in the EJS editor of equations
Here is how to use of the ODE editor for the DDE: with constant pre-initial conditions y = 1 for t<0.
Step 1: Declare your variables as usual
Definition of variables for the DDE.
Step 2: Enter the equations
Here is the first difference with respect to ODEs. You will need past values of the state to enter the DDE. Just use these values as if the past state were a function of the independent variable.
This function (y(t) in our example) is defined automatically by EJS whenever it detects you are defining a DDE (when you specify the delays - see below) and can be used also in other parts of your simulation, such as the view, for instance. But it is important to remember that the function is only correctly defined for past instants of time.
You can also write preliminary code, if needed, choose your favorite solver algorithm, fine-tune its parameters, and add events as usual.
Entering the equation of a DDE.
Step 3: Add DDE specific information
This is the most important step in correctly specifying a DDE. You need to click the Advanced button of the ODE editor and choose the DDE tab of the ODE parameters dialog. In it, you need to enter:
- the delays. In this example, we just need to type in 1.0.
- the pre-initial conditions code. EJS was able to guess the pre-initial code for this example automatically.
- the possible discontinuities of the pre-initial conditions. The pre-initial conditions of this example is completely smooth (since it is constant!)
DDE specific parameters.