Example Code

PID Pressure Controller Using NI-DAQmx for LabVIEW NXG

Code and Documents

Attachment

Overview

Demonstrates how to build a PID control application using NI-DAQmx with support for LabVIEW NXG for Data Acquisition Hardware.

 

 

Description

In this example you can run a PID control on a simulated plant for use with feedback control loops. You can refer to "2nd Order System.gvi" to view the system model and change the process parameters. In this model, all Scale factors are in percent, Lag time is in minute, process dead time is measured as multiple of the loop cycle time.

You can also choose Measurement Execution mode to connect to a real plant through DAQ device and control the current output to maintain the pressure to a specific level. This example uses DAQmx driver to read strain gage values and apply PID control then output adjusted current values to an Analog output current channel.

You will need a DAQ device with strain gage AI channel and current AO channel,  to test the code in measurement mode.

 

 

Hardware and Software Requirements

Software:

LabVIEW NXG 1.0

DAQmx Support for LabVIEW NXG 1.0

 

Hardware:

NI-DAQ device with AI channel (for strain gage) and AO channel (current)

 

 

Steps to Implement or Execute Code

1. Open the project "PID Pressure Controller .lvproj"

2. Open the VI "PID Pressure Controller.gvi"

3. Select Execution mode of the VI (simulated or Measurement)

4. Update DAQ configuration if you are using Measurement Execution

5. Update PID parameters

6. Run the VI and notice the system response

7. Stop Execution

8. Right-Click the chart and click on Clear Data

 

 

Additional Information or References

For more information on PID control check this link.

To select a suitable DAQ device and modules refer to this link.

Note that you may need to apply some signal conditioning to adapt the sensor output to your DAQ device. Refer to this link to add channels, remove noise and improve accuracy with signal conditioning.

 

Front Panel View:

FP.PNG

 

Block Diagram View:

1. Measurement Mode:

BD.PNG

 

2. Simulation mode:

BD Simulated.PNG

 

You can also view this example in LabVIEW, by downloading the code in this link.

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors