Recent Changes - Search:

Information

Installation

Documentation

ModelEvolution

As a generic example, let us name our model variables as x1,x2,...,xn. (In an actual model it is of course always advisable to give them more descriptive names.)

The system developes from the current state of the variables x1,x2,...,xn, to a new state, x*1,x*2,...,x*n. Almost always the simulation will model development over time, in which case time is one of the variables of the system of equations.

In EJS two ways are available to implement evolution from state to state: direct mathematical expressions and differential equations.

An animation of a harmonic oscillator can be created by specifying (in code that complies with Java syntax) the following expression, which has the x-coordinate as a function of time.

{$$ x = Math.sin(t) $$}

But in the actual world an oscillator will experience some form of friction. With friction the oscillation will decay, but what will the decay look like? To obtain an answer to that question the setup must be framed in the form of differential equations. In EJS the differential equations that can be entered are of the type called 'Ordinary Differential Equation' (ODE).

On an empty evolution panel the top half says 'Click to create a page of code', and the bottom half says 'Click to create a page of ODEs'. The code on a code page is not processed further, it will be inserted literally as statements in the Java code that is created. The ODE editor is for declaring differential expressions. EJS slots these expressions in the Java code that it generates for evaluating the differential equations.

Time settings

Three factors affect the rate at which the simulation is computed, and the rate at which it is displayed: the Increment, the Frames Per Second (FPS) and the Steps Per Display (SPD).

20 frames per second is a good choice, and there is rarely a situation where there is any benefit in choosing another frame rate.

With the settings as displayed in the image, increment at 0.05 and SPD at 1, the simulation will unfold in real time.

If the increment is set to for example 0.01 then simulation time will progress 5 times slower than real time. To compensate for that you can adjust the SPD entry. With SPD at 5 the simulation will process 5 increment steps in between displayed frames. With FPS at 20, increment at 0.01 and SPD at 5 the simulation will proceed in real time again. (If the calculations are very demanding the computer may be unable to keep up. The simulation won't be real time then, but it won't break.)

The slider position and the value in the number field FPS are connected. Moving the slider will reflect in the number field, and the other way round.

Autoplay

If the checkbox Autoplay is checked the simulation will start automatically when the program is opened.

Edit - History - Print - Recent Changes - Search
Page last modified on September 11, 2010, at 07:59 PM