Running a model

Once you create your model you can run it by clicking on the run button (see Figure 1) or pressing the F5 key.

run button

Figure 1: Run button

You can also run a model from the Python interpreter as shown below.

>>> system.run(300)

Warning

When using this method, you should provide the number of timesteps as well.

Mekanimo is a discrete event simulator and uses Box2D as its rigid body dynamics solver. The solver computes the positions and orientations of the rigid bodies in the system for a given time increment (step size) then these newly computed values are displayed in the canvas. If the time increments are small enought and the canvas can update the graphics fast enough then we get the illusion of continuous motion. The speed slider located next to the Time indicator (see Figure 2) can be used to adjust the time increment. Using larger time increments (system.dt) yield faster runs but usually they are less accurate, smaller time increments yield slower runs but usually they are more accurate.

../_images/slider.png

Figure 2: Speed slider

The exact value of the time increment can be printed at the Python interpreter as shown below.

>>> system.dt
.05

By default, system.dt can take values between .025 and .1 by using the slider. You can overwrite this value from the Python interpreter as shwon below.

>>> system.dt = .001

Or change the frame.speedMultiplier from the Python interpreter as shown below.

>>> frame.speedMultiplier = 1000

The default value of the frame.speedMultiplier is 400. The frame.speedSlider’s min and max values are 1 and 40 respectively. When you scroll the speed slider, system.dt is computed by dividing the frame.speedSlider‘s value by the frame.speedMultiplier value. So, if you change the frame.speedMultiplier to 1000 then scrolling the speed slider can set the system.dt values between .001 (1/1000) and .04 (40/1000).

The system.dt can be manipulated while the model is running too. This way you can immediately see the results of using different time increment values.

Increasing the speed

There are a few actions you can take to increase the run speed.

  • Turn off transparency
  • Turn off grid
  • Turn off CG indicators
  • Skip frames
  • Increase system time increment (system.dt)
  • Use a faster CPU
  • Use a faster graphics card

Table Of Contents

Previous topic

Running and postprocessing

Next topic

Postprocessing

This Page