Download the Step-by-Step Procedure PDF

Implementing Closed-Loop Control: Step by Step Procedure
This procedure requires a transducer/sensor to be connected to pins ai0+ and ai0- and an actuator/motor/
fan connected to pins ao0+ and AGND. A simple example of this is shown in the video. Another option is a
thermostat setup consisting of a thermometer, heating lamp, solid state relay, and fan to cool the system. The
control system is used to hold the system at a near steady temperature. Below is a generic setup procedure
that you can modify for your control system setup and parameters.
Before starting this procedure, you need to complete the exercise and use the solution in the Taking a
Measurement module. You can also create a numeric control to simulate the data acquisition input.
1. Connect the USB DAQ device to your PC
2. Connect the sensor being monitored: Analog Input 0 (ai0)
a.You can locate the device pinouts for a DAQ device by searching for your device online at
b.The user guide and specifications contain this diagram
c.Right-click your device in Measurement & Automation Explorer (MAX) configuration software and
select Device Pinouts
d.Connect the actuator/motor being controlled: Analog Output 0 (ao0)
3. Place a DAQ Assistant on the block diagram for analog output
a.Right-click on the block diagram and select Express >> Output >> DAQ Assistant
b.Place the DAQ Assistant to the right of the existing DAQ Assistant on the block diagram by left-clicking
4. Configure DAQ Assistant type
a.Select Generate Signals >> Analog Output >> Voltage
b.Select Dev1 (or the name of your device if not Dev1)
c.Select ao0
5. Configure generation settings
a.Select 1 Sample (On Demand) for Generation Mode
b.Enter 5 for the Max Signal Output Range
c.Enter 0 for the Min Signal Output Range
d.Select OK to apply these settings
6. Place a PID Control VI to control the analog output value
a.Right-click the block diagram and select Control Design & Simulation >> PID >> PID
b.Left-click to place the Simulate PID VI in between the DAQ Assistants
7. Crate the inputs for the PID VI
a.Right-click the Voltage Output Range input terminal and select Create >> Control
b.Right-click the PID Gains input terminal and select Create >> Control
c.Right-click the Set Point input terminal and select Create >> Control
d.Navigate to the front panel by pressing Ctrl-E
e.Enter 5 for the Output High
f. Enter 0 for the Output Low
g.Enter 1 for Proportional Gain
h.Enter 0.01 for Integral Time
i. Enter 0 for Derivative Time
Note: These values vary from system to system and must be tuned accordingly. Use the PID Autotuning VI to
have LabVIEW determine the gains for you.
8. Wire the Data output of the analog input DAQ Assistant to the Process Variable input of the PID VI
9. Wire the Output of the PID VI to the Data input of the analog output DAQ Assistant
10. Run the VI to observe the signal being output on the waveform graph
11. Merge the set point and output from the PID VI to one signal
a.Right-click the block diagram and select Express >> Signal Manipulation >> Merge Signals
b.Wire the Set Point to the top input terminal
c.Wire the Data output from the Analog Input DAQ Assistant to the bottom terminal
12. Create a waveform chart to indicate the set point and analog input data
a.Navigate to the front panel by pressing Ctrl-E
b.Right-click the front panel and select Express >> Graph Indicators >> Waveform Chart
c.Left-click to place the chart
d.Navigate to the block diagram by pressing Ctrl-E
e.Ensure the waveform chart terminal is within the While Loop
f. Wire output of Merge Signals to the input of the waveform chart
13. Run the VI to observe the output
a.Tune the PID gains if necessary
You can convert your DAQ Assistant Express VIs into low-level NI-DAQmx functions by right-clicking the DAQ
Assistant and selecting Generate NI-DAQmx Code. The low-level NI-DAQmx API exposes more functionality
and customization options for programming.
©2011 National Instruments. All rights reserved. LabVIEW, National Instruments, NI, and are trademarks of National Instruments.
Other product and company names listed are trademarks or trade names of their respective companies.
Similar pages