Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
Makefile | 2022-11-13 | 2.6 kB | |
README.txt | 2022-11-13 | 1.2 kB | |
stoplight.sm | 2022-11-13 | 3.2 kB | |
stoplight.tcl | 2022-11-13 | 24.3 kB | |
TRAFFIC.TCL | 2022-11-13 | 13.0 kB | |
VEHICLE.SM | 2022-11-13 | 2.8 kB | |
VEHICLE.TCL | 2022-11-13 | 15.2 kB | |
Totals: 7 Items | 62.2 kB | 0 |
Tcl Example 4 Simplistic, graphical simulation of a stoplight. Demonstrates how to use state machines to handle external events (in this case timeouts). + Building ---------- NOTE: Smc.jar must be built and installed. Unix & Windows: $ java -jar ../../../bin/Smc.jar -tcl [-g] Stoplight.sm Vehicle.sm (Note: -g is optional and needed only for observing the FSM debug output.) To turn on the debug output, do the following: 1. Compile Stoplight.sm and Vehicle.sm with the -g command line option. 2. In Traffic.tcl, Vehicle.tcl and Stoplight.tcl, find the comment "# DEBUG". The comments following this line explain which line to uncomment to cause the SMC-generated code to output the debug messages. You may not want to turn on the Vehicle.sm debug output since it is quite verbose. + Executing ----------- Unix & Windows $ wish traffic.tcl Click on the "Configure..." button and modify the demo's settings. Increase the vehicle speed and appearance rate. Decrease the stoplight times. Also, click on "Pause" and "Continue". "Stop" halts the demonstration but does not terminate the demo.