Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

3. Building the Simulation (Control Design and Simulation Module)

LabVIEW 2012 Control Design and Simulation Module Help

Edition Date: June 2012

Part Number: 371894G-01

»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

  1. Navigate to the Simulation palette.
  2. 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.
  3. 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.
  4. 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.
  5. Click the OK button to save changes and return to the simulation diagram.
  6. 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.
  7. Return to the Simulation palette and select the Continuous Linear Systems palette.
  8. 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.
  9. 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.
  10. 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.
  11. 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.
  12. Each SimTime Waveform function has an associated Waveform Chart. Label the first waveform chart Velocity and the second waveform chart Position.
  13. 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.
  14. 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.
  1. 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.
  2. Label this control Force.
  3. Double-click this control on the simulation diagram. LabVIEW displays the front panel and highlights the Force control.
  4. Display the block diagram and create a control for the Operand2 input of the Calculate Acceleration function. Label this new control Mass.
  5. Wire the Result output of the Calculate Acceleration function to the input input of the Calculate Velocity function.
  6. Wire the output output of the Calculate Velocity function to the input input of the Calculate Position function.
  7. 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.
  8. 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.

Previous
2. Configuring Simulation Parameters
Home
Tutorial: Getting Started with Simulation
Next
4. Running the Simulation

 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit