![]() |
![]() |
![]() |
![]() |
Example 3 - Simulate an intersection with traffic lights
In this example you'll simulate an intersection with traffic lights. The simulation interface you create allows you to run "what if" scenarios efficiently.
Introduction of the traffic intersection widget
This portion of our example introduces the traffic intersection widget. You'll add other widgets to the intersection to create a custom traffic simulation environment.
Once again, make sure you have completed "Initial setup" before working this example.
- Draw the intersection by invoking this command and procedure at the ModelSim prompt:
source intersection.tcl draw_intersection- From the ModelSim prompt, use the procedure set_light_state to change the color of the lights:
set_light_state green .traffic.i.ns_light set_light_state green .traffic.i.ew_lightYou can use the Copy and Paste buttons on the Main toolbar to help build instructions from previous commands.
You can locate the set_light_state procedure with Edit > Find from the Notepad menu (the procedure is located toward the middle of the file).
![]() Model Technology Incorporated Voice: (503) 641-1340 Fax: (503)526-5410 www.model.com sales@model.com |
![]() |
![]() |
![]() |
![]() |