You can find a shipping example, called Cruise Control User Interface VI, that combines the LabVIEW Statechart Module with the LabVIEW Control Design and Simulation Module here:
C:\Program Files\National Instruments\LabVIEW 8.5\examples\simulation\Cruise Control\Simple Cruise Control
The front panel for the Cruise Control User Interface VI is shown in Figure 1. In this example, you test-drive a hybrid control system simulation that combines discrete logic for the user interface with a continuous-time simulation of the vehicle dynamics, road profile, and PID cruise control system.
When you run the VI, you can drive the vehicle manually and then put in a desired speed on the accelerator slider. As the vehicle goes over the simulated road, observe the speed of the vehicle (red needle on the speed gauge) slowing down when it goes up an incline and then speeding up when it goes downhill. You can observe the vehicle slow down to a stop if you set the accelerator to zero (in other words, take your foot off the pedal). You can also see the vehicle stop at a specified point on the road profile if you apply the brake.
To activate the cruise control, click the on button in the cruise control section of the front panel. This sets the cruise control state to idle. Then you can click on the set button to provide the setpoint speed for the cruise control system. At this point, the green needle on the speed gauge moves up to match the setpoint speed. Note that the accelerator slider begins moving on its own to indicate the control action of the cruise control system. There is less speed variation than in the manual control system (you) as the vehicle goes uphill and downhill.
If you want to disable the cruise control system and switch to manual control, you can press the on button again to turn the cruise control off. You can press the resume button in the cruise control section of the front panel to bring the cruise control immediately back to the last setpoint for speed and to the on state.
Figure 1. Front Panel for the Cruise Control User Interface VI
Figure 2 displays the top-level block diagram for the Cruise Control User Interface VI. It shows a simulation loop with both the hierarchy for different physical subsystems (cruise control, road, and vehicle) as well as the Run Statechart VI for the Cruise Control Logic.
Figure 2. Top-Level Block Diagram for the Cruise Control User Interface VI
You can view the Cruise Control Logic statechart diagram by right-clicking on the Run Statechart VI and selecting the “Open Statechart” option. Figure 3 shows the statechart diagram for this example. It includes an Initial state as well as four other states: Off, Idle, On, and Set.
Figure 3. Cruise Control Logic Statechart Diagram Featuring Initial, Off, Idle, On, and Set States
Figure 4 shows an example of a subsystem in the continuous-time simulation – the PID control system. The block diagram of the control system is easily visible along with a saturation block to restrict the control signal.
Figure 4. Subsystem in the Continuous-Time Simulation – The PID Control System