Example Code

On/Off Temperature Control with LabVIEW and FieldPoint Using [c]FP-TC-120 and [c]FP-DO-401

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW PID Control Toolkit

Code and Documents

Attachment

Description

This VI shows how use Relay.vi to implement a closed-loop control strategy to control an analog process variable such as room temperature. The feedback signal is a thermocouple measurement of the room temperature. The control output turns the heating unit on if the room is too cold and off if the room is too warm.
I/O Connections:
1. Connect the thermocouple signal to Channel 0 of the [c]FP-TC-120.
2. Connect the heating unit control to Channel 0 of the [c]FP-DO-401.

Setup:
1. Edit your comm resource from the FieldPoint software and click Find Devices.
2. Configure the channel ranges using the FieldPoint software.
3. Save your .iak file.
4. Verify that the configuration information above matches the names in the FieldPoint software. If not, edit the values listed above.
5. Close the FieldPoint software.
6. Run the VI.
Using the VI:
1. There are two inputs: the set temperature and the hysteresis.
2. Adjust the set temperature to the temperature you want the room to be.
3. Adjust the hysteresis to determine at what temperatures the digital output is turned on and off. For example, if the hysteresis is set to 2, and the set temperature is 21 degrees, the relay will turn on at 19 degrees and off at 23 degrees.
Because this is a software-timed control system, the Loop Delay controls the rate of acquisition and generation.


Related Links:
LabVIEW PID Control Toolset for Windows

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