Benchmarking LabVIEW Real-Time FieldPoint Systems
Table of Contents
Overview
FieldPoint and Compact FieldPoint hardware enable National Instruments customers to create reliable monitoring and control systems. When users implement these systems using an embedded controller running LabVIEW Real-Time, they can attain even faster loop rates, thus creating a more responsive control system. This document is intended for customers who are developing monitoring and control systems using FieldPoint and LabVIEW Real-Time. Use the information in this document to estimate the control loop rate for your FieldPoint monitoring and control system.

Figure 1: A simple embedded FieldPoint control system
An embedded FieldPoint control system, as shown in Figure 1 above, has at least one input module, one network controller, and one or more output modules. (An exception to this is the AIO-600 module, which has four analog input channels and four analog output channels.) The network module runs the control software in a real-time operating system. To determine the fastest repeatable loop rates for this control system, we must determine the time required for each of three modules to perform its task(s).
- What is the time elapsed between when the measured signal changes values and when the input module makes that new value available to the controller?
- How long after the controller receives the new input value does it perform the necessary calculations and make the desired output value available to the output module?
- What is the time elapsed between when the output module receives this new value and when it changes the state of its output signal?
By adding these three times together, we can determine the fastest repeatable control loop rate.
Note: When reading the following sections, refer to the Appendix for a full listing of results.
Input Module Timing
Most input modules fall into one of two categories, digital or analog. Digital modules add a negligible delay to the control system. Analog modules, on the other hand, take milliseconds to convert a voltage or current on the input pin to a value that can be read by the controller. To estimate the time that an analog input module adds to your control loop, use its specified update rate. For example, the AI-100 has a specified update rate of 2.8 ms, with a worst-case update rate of approximately 3.2 ms. The AIO-600 has a specified update rate of 0.588 ms, and its worst-case update rate is approximately 0.6 ms. For modules with filtering, the update rate depends on the filter setting. The rates for each module can be found in the module operating instructions.
Software Control Loop Timing
Once the input module completes its operation, the embedded FieldPoint controller must read the new input value, perform calculations, and return the new output value. This is done in LabVIEW by calling FP Read.vi to read a tag, processing the data with the PID VI, and finally outputting the value by calling FP Write.vi. An example of such a control VI is shown below in Figure 2.
The time required for each of these three operations can be measured using standard LabVIEW benchmarking techniques. The sum of these measurements is the approximate software loop time.
When using the FP Read and FP Write VIs, you should use multichannel items when possible. This is because two separate FP Read (or Write) VIs take longer to execute than one FP Read (or Write) VI addressed to two channels on the same module. Also, keep in mind that the more channels the VI has to read from or write to, the longer the VI takes to execute. Each FP Read VI in the control loop adds anywhere from 0.61 (for one channel) to 0.81 ms (for eight channels) to the execution time. Each FP Write VI in the control loop adds anywhere from 0.58 ms (for one channel) to 0.81 ms (for eight channels) to the execution time.
When the PID VI handles larger amounts of data, it also takes longer to execute. For one channel of PID control, the PID VI will add 0.22 ms to the software loop time. For eight channels of PID control, the PID VI will add 0.60 ms to the software loop time. For the complete benchmarks for FP Read, FP Write, and PID for one to eight channels refer to Table 4 in the Appendix.
Using a development machine with LabVIEW Real-Time installed and a [c]FP-20xx module, you can run your own benchmarks for other non-FieldPoint VIs. For more information about benchmarks, refer to Measuring the Determinism of Real-Time Applications at the NI Developer Zone. For more information about PID.vi and other VIs, refer to LabVIEW RT documentation and benchmarks.
Output Module Timing
Output is similar to input. Digital modules add a negligible delay to the control system. For the AO-200 and AO-210 analog modules, you can use a simple formula to calculate the time delay. If n is the number of output channels, you can calculate the maximum output time in milliseconds as follows:
output time = n(3.5 ms) + 7.5 ms
n = 8
output time = 32 ms
The AIO-600, on the other hand, has a specified update rate of 0.588 ms, but its worst-case update rate is approximately 0.6 ms. The update rate for this module is independent of the number of channels being used.
Putting It All Together
To calculate the control system loop time, use the following equation:
System time = input time + 2(software loop time) + output time
Because the software loop is asynchronous, an input may be available at any time, but the current software loop must be completed before the new value can be analyzed. Therefore, the time it takes to process an input is at least as long as one software loop but no longer than two. Calculate the control system loop times as shown in the following calculations:
For a one-channel AI/AO control loop,
System time = input time + 2(software loop time) + output time
= 16.6 ms
For an eight-channel AI/AO control loop,
System time = input time + 2(software loop time) + output time
= 39.8 ms
For an AI/AO control loop consisting of two AI and AO modules with one channel each,
System time = input time + 2(software loop time) + output time
= 44.4 ms
For an AI/AO control loop consisting of one AIO-600 module with four channels of input and output,
System time = input time + 2(software loop time) + output time
= 4.9 ms
When these loops execute without timing VIs, the loop times vary but are always less than these calculated values. In other words, these values are the smallest repeatable loop times. To create a deterministic control loop with consistent timing, round the calculated value to the next highest millisecond and use it as the input for the Wait Until Next ms Multiple function. If you try to run a control loop faster than its calculated result, oversampling of the input module or even irregular loop rates could result.
Considerations
A few important details should be noted about these examples. First, the example VIs were run at time-critical priority with the pause parameter of the FP-2000 set to 1000 ms. Second, the Get Tick Count function takes approximately 0.4 ms to execute. While this does decrease the loop rate somewhat, it is necessary for timing and benchmark purposes. You will also notice that the control loop is designed very efficiently. As recommended for all LabVIEW Real-Time applications, you should remove unnecessary controls, indicators, and VIs from the loop, as well as allocate any needed memory outside the loop. To gain a better understanding of these concepts, read Improving the Performance of a LabVIEW Real-Time Embedded Application on a FieldPoint FP-20xx Network Module. Other factors that can affect the system loop time include network traffic and Ethernet communication, although they are beyond the scope of this document. For additional information on the workings of FieldPoint software, refer to a separate document titled FieldPoint Software Basics. Both of these documents can be found in the NI Developer Zone.
Conclusions
This document provides approximate loop rates and basic explanations of those rates for LabVIEW Real-Time FieldPoint PID control systems. By estimating the input module loop times, software loop times, and output module loop times, you can calculate the overall control loop times for your system. Along with an understanding of the fundamentals of efficient LabVIEW Real-Time programming, the knowledge gained from this document enables FieldPoint users to get the most from their embedded control systems.
Appendix - Benchmark Data
This appendix contains the benchmarking results discussed in the body of this document. Table 1 compares the sums (Totals) of the mean execution times of the three VIs (FP Read, PID, and FP Write) to the measured mean execution time of the complete loop (Measured) for both one- and eight-channel systems. Tables 2 and 3 show that the sum of the input, software, and output loop times (Total) is approximately equal to the measured complete system loop time (Measured). Note that, for this comparison, the calculations in Tables 2 and 3 use the measured values from Table 1. Table 4 contains the complete benchmarks for FP Read, FP Write, and PID for one to eight channels.
Table 1: Mean software loop times - estimated versus measured
|
Benchmark
|
Channels
|
Mean Loop Time (ms)
|
|
FP Read
|
1
|
0.61
|
|
8
|
0.81
|
|
|
PID VI
|
1
|
0.22
|
|
8
|
0.60
|
|
|
FP Write
|
1
|
0.58
|
|
8
|
0.81
|
|
|
Total=Read+PID+Write
|
1
|
1.41
|
|
8
|
2.22
|
|
|
Complete
|
1
|
1.23
|
|
8
|
2.31
|
Table 2: Maximum operation times - estimated versus measured
|
Benchmark
|
Channels
|
Maximum Operation Time (ms)
|
|
FP-AI-100
|
1
|
3.2
|
|
8
|
3.2
|
|
|
Software
|
1
|
2.5
|
|
8
|
4.6
|
|
|
FP-AO-210
|
1
|
11.0
|
|
8
|
32.0
|
|
|
Total=AI+SW+AO
|
1
|
16.7
|
|
8
|
39.8
|
|
|
Measured
|
1
|
16.8
|
|
8
|
30.5
|
Table 3: Maximum operation times for the AIO-600 - estimated versus measured
|
Benchmark
|
Channels
|
Maximum Operation Time (ms)
|
|
FP-AIO-600
(input) |
1
|
0.6
|
|
4
|
0.6
|
|
|
Software
|
1
|
2.5
|
|
4
|
3.5
|
|
|
FP-AIO-600
(output) |
1
|
0.6
|
|
4
|
0.6
|
|
|
Total=AI+SW+AO
|
1
|
3.7
|
|
4
|
4.9
|
|
|
Measured
|
1
|
3.9
|
|
4
|
4.7
|
Table 4: Mean software loop times for one to eight channels
|
Number of
Channels |
Mean Software Loop Times (ms)
|
||
|
FP Read
|
PID
|
FP Write
|
|
|
1
|
0.61
|
0.22
|
0.58
|
|
2
|
0.64
|
0.53
|
0.64
|
|
3
|
0.67
|
0.54
|
0.67
|
|
4
|
0.70
|
0.55
|
0.69
|
|
5
|
0.72
|
0.57
|
0.72
|
|
6
|
0.75
|
0.58
|
0.75
|
|
7
|
0.78
|
0.59
|
0.78
|
|
8
|
0.81
|
0.60
|
0.81
|
Reader Comments | Submit a comment »
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).

