Table of Contents Previous page Next page Index

ModelSim Documentation Bookcase

Model Technology Inc.


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.

  1. Draw the intersection by invoking this command and procedure at the ModelSim prompt:

  2. 
    source intersection.tcl 
    draw_intersection 
    
    
  3. From the ModelSim prompt, use the procedure set_light_state to change the color of the lights:

  4. 
    set_light_state green .traffic.i.ns_light  
    
    
    set_light_state green .traffic.i.ew_light 
    
    

You can use the Copy and Paste buttons on the Main toolbar to help build instructions from previous commands.

  1. View the source code with this command at the ModelSim prompt:

  2. 
    notepad intersection.tcl 
    
    

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 Inc.
Model Technology Incorporated
Voice: (503) 641-1340
Fax: (503)526-5410
www.model.com
sales@model.com
Table of Contents Previous page Next page Index

ModelSim