LabVIEW 2012 Control Design and Simulation Module Help
»View Product Info
The next step is to build the simulation by placing Simulation functions on the simulation diagram and wiring these functions together. Note that you can place most Simulation functions only on the simulation diagram, that is, you cannot place Simulation functions on a LabVIEW block diagram. Complete the following steps to build the simulation of this dynamic system.
Placing Functions on the Simulation Diagram
- Navigate to the Simulation palette.
- Select the Signal Arithmetic palette and place a Multiplication function on the simulation diagram. You will use this function to divide the force by the mass to calculate the acceleration.
- Double-click the Multiplication function to display the configuration dialog box for the function. You can double-click most Simulation functions to view and change the parameters of that function.
- The function currently displays two × symbols on the left side of the dialog box. This setting specifies that both incoming signals are multiplied together. Click the bottom × symbol to change it to a ÷ symbol. This Multiplication function now divides the top signal by the bottom signal.
||Tip To view detailed information about the Multiplication function, click the Help button in this dialog box.
- Click the OK button to save changes and return to the simulation diagram.
- Right-click the Multiplication function and select Visible Items»Label from the shortcut menu. Double-click the Multiplication label and enter Calculate Acceleration as the new label.
- Return to the Simulation palette and select the Continuous Linear Systems palette.
- Place an Integrator function on the simulation diagram. You will use this function to calculate velocity by integrating acceleration.
||Note If you move the Integrator function close enough to the Multiplication function, LabVIEW might automatically create a wire between the two functions. In this situation, place the Integrator on the simulation diagram and then delete the wire LabVIEW creates by right-clicking the wire and selecting Delete Wire Branch from the shortcut menu.
- Label this Integrator function Calculate Velocity.
||Tip To view detailed information about the Integrator function, right-click this function and select Help from the shortcut menu.
- Press the <Ctrl> key and click and drag the Integrator function to another location on the simulation diagram. This action creates a copy of the Integrator function, which you will use to calculate position by integrating velocity. Label this new Integrator function Calculate Position.
- Select the Graph Utilities palette and place two SimTime Waveform functions on the simulation diagram. You will use these functions to view the results of the simulation over time.
- Each SimTime Waveform function has an associated Waveform Chart. Label the first waveform chart Velocity and the second waveform chart Position.
- Arrange the functions to look like the following simulation diagram.
||Note If the Velocity and Position indicators do not resemble the previous block diagram, you can right-click each indicator and remove the checkmark from the View as Icon option on the shortcut menu.
- Select File»Save and save this VI to a convenient location as Spring-Mass Damper Example.vi.
Wiring the Simulation Functions Together
The next step is wiring the functions together to represent the flow of data from one function to another.
||Note Wires on the simulation diagram include arrows that show the direction of the dataflow, whereas wires on a LabVIEW block diagram do not show these arrows.
Complete the following steps to wire these functions together.
||Tip If you have trouble viewing the input and output terminals the following steps mention, display the Context Help window by pressing <Ctrl-H>. This window displays all input and output terminals when you move the cursor over a function.
- Right-click the Operand1 input of the Calculate Acceleration function and select Create»Control from the shortcut menu to add a numeric control to the front panel window.
- Label this control Force.
- Double-click this control on the simulation diagram. LabVIEW displays the front panel and highlights the Force control.
- Display the block diagram and create a control for the Operand2 input of the Calculate Acceleration function. Label this new control Mass.
- Wire the Result output of the Calculate Acceleration function to the input input of the Calculate Velocity function.
- Wire the output output of the Calculate Velocity function to the input input of the Calculate Position function.
- Right-click the wire you just created and select Create Wire Branch from the shortcut menu. Wire this branch to the Value input of the SimTime Waveform function that has the Velocity waveform chart.
- Wire the output output of the Calculate Position function to the Value input of the SimTime Waveform function that has the Position waveform chart. The simulation diagram now resembles the following image.
||Note If the Force and Mass controls do not resemble the previous block diagram, you can right-click each control and remove the checkmark from the View as Icon option in the shortcut menu.
In the previous simulation diagram, notice how the arrows on each wire indicate data flow. For example, the values you will provide for Force and Mass controls flow into the Calculate Acceleration function, the result of this function flows into the Calculate Velocity function, and so on.