Run a simulation

Commands to start and stop simulations and to display scheduler information.

The commands described here enable you to:

Run a PTcl script

Once a simulation has been constructed using the commands previously described you can use execute to run a simulation (see also Load commands from a file). In the PTcl Shell panel of the Console View, change to the directory where the files are stored and type:

execute <systemname.ptcl>

An MLDesigner PTcl shell makes it possible to execute PTcl simulations independent of the MLDesigner GUI. To execute the simulation type

$MLD/ptclsh -x Systemname.ptcl

into your command shell.

On Windows® you may use the MSYS command shell which is shipped with MLDesigner.

To top

Create a schedule

The schedule command generates and returns the order in which primitives are invoked. For domains such as DE, this command returns a not-implemented message, since there is no "compile time" schedule for the DE domains. The syntax is:


To top

Start a simulation

The run command generates the schedule and runs it n times, where n is the argument. The argument may be omitted, its default value is then 1. For the DE interpreter, this command runs the simulation for n time units, and n may be a floating point number. If omitted the default value is 1.0. If this command is repeated while the simulation is running the simulation is restarted from the beginning. If animation is enabled, the full name of each primitive will be printed to the standard output when the primitive fires. The syntax of the command is:

run [<n>]

To top

Continue a simulation

The cont command continues the simulation for n additional steps, or time units. If the argument is omitted, the default value of the argument is the value of the last argument given to a run or cont command or 1.0 if no argument was given. The syntax is

cont [<n>]

To top

Wrap-up a simulation

The wrapup command calls the wrapup method of the current target, which in turn calls the wrapup method of each primitive, signaling the end of the simulation run. The syntax is


To top

Interrupt a simulation

The command


requests a halt of the current simulation. Note that the halt does not occur immediately. This merely registers the request within the scheduler and depends on the type of domain where the simulation is being executed. The scheduler will halt the simulation on completion of a cycle. This is especially useful within Tcl primitives.

To top

Obtain the stop time of the current run

The command


returns the time until which the current simulation will run. Tcl/Tk primitives can use this command in their setup or go methods to find out the stop time of the current run.

To top

Obtain time information from the scheduler

The command

schedtime [actual]

returns the current time from the top-level scheduler of the current system. If the target has a parameter named schedulePeriod, then the returned time is divided by this value. Using the schedtime command with argument actual returns the scheduler time without dividing by schedulePeriod.

In SDF domains, schedtime actual should return the number of iterations. In SDF domain, schedulePeriod is usually set to 0, since SDF has no notion of time, and to a timed domain, such as DE, SDF systems appear to fire instantaneously.

To top

Animate a simulation

The animation command can be used to display, on the standard output, the name of each primitive as it runs. The syntax

animation [<on | off>]

Typing animation on enables animation, while animation off disables it. Typing animation returns whether animation is on or off.

To top