Lab 3 – Programming Structures - Timing Issues

I. Objective:

To give the student a lesson in using user-defined Sub-VIs, graphics, local/global variables, and other programming structures in LabVIEW.

II. Procedure:

Create a simulation traffic light at a four-way intersection. Import a picture for the intersection from the web page or make one of your own. To import a picture, simply cut and paste it onto the front panel. On top of this picture of the intersection, place your traffic lights. This traffic light should have

  1. two sets of lights for North-South Traffic and Two sets of lights for East-West: Each set should have a red, yellow, and green light.
  2. The user should be able to control the duration of each set of colored lights. To accomplish this requirement, create four controls:

    Control

    Function

    Slide control A Controls duration of N-S Green Light
    Slide control B Controls duration of N-S Yellow Light

    Slide control C

    Controls duration of E-W Green light

    Slide control D

    Controls duration of E-W Yellow light

    Using these four controls, you should be able to figure out the duration of the E-W and N-S red lights. Remember that the North-South and East-West traffic lights have to be in sync with each other (i.e. both traffic lights cannot show green—this would cause an accident).

  3. There should not be any numeric inputs in the system (the user must choose the duration of the lights via slides or other controllers).
  4. There should also be an interrupt switch to allow the VI to be turned on and off.
  5. Included in the VI should be an emergency switch that makes both the traffic lights switch to flashing red.
  6. Make sure that your VI includes AT LEAST ONE subVi which you constructed.

Additional information and a copy of this lab is located at: www.njit.edu/Directory/Centers/OPSE

Submit the created VI by attaching it to an e-mail document that contains the answers to the discussion questions below. (Note that you can either attach the VI or zip the VI by using WinZIP). E-mail the answers to the discussion questions and VI to: gnita@njit.edu

III. Discussion:

  1. Why should you have included the interrupt switch in part (e)?
  2. How did you solve the timing issue of the two directions? (eg. The NS light is red while the EW light is green?)
  3. How did you solve the problem of updating the duration of the lights that are dependent upon the duration of other lights?
  4. If you were to use this as a sub-VI for a traffic control system, what would be some of the input and output parameters of the sub-VI? Describe why these choices are appropriate.