Top Up Prev Next Bottom Contents Index Search

3.6 Running the simulation

Once a simulation has been constructed using the commands previously described (also see the source command in "Loading commands from a file" on page 3-13), use the commands in this section to run the simulation.

3.6.1 Creating a schedule

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


3.6.2 Running the 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 1). For the DE interpreter, this command runs the simulation for n time units, and n may be a floating point number (default 1.0). If this command is repeated, the simulation is started from the beginning. If animation is enabled, the full name of each star will be printed to the standard output when the star fires. The syntax is:

run n

3.6.3 Continuing 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 (1.0 if no argument was ever given). The syntax is

cont n

3.6.4 Wrapping up a simulation

The wrapup command calls the wrapup method of the current target (which, as a rule, will call the wrapup method of each star), signaling the end of the simulation run. The syntax is


3.6.5 Interrupting a simulation

The command

requests a halt of the currently executing simulation. Note that the halt does not occur immediately. This merely registers the request with the scheduler. This is especially useful within Tcl stars.

3.6.6 Obtaining the stop time of the current run

The command

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

3.6.7 Obtaining time information from the scheduler

The command

returns the current time from the top-level scheduler of the current universe. If the target has a parameter named "schedulePeriod", then the returned time is divided by this value. The command

schedtime actual
returns the scheduler time without dividing by "schedulePeriod."

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

3.6.8 Animating a simulation

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

animation on
enables animation, while

animation off
disables it. The syntax

simply tells you whether animation is enabled or disabled.

Top Up Prev Next Bottom Contents Index Search

Copyright © 1990-1997, University of California. All rights reserved.