Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Designing an Automated Fuel Cell Validation Stand Using Compact FieldPoint for Custom Analog and Discrete Control

  Print

Using Compact FieldPoint, Viewpoint Systems built a fuel-cell test stand that predicts system response and eliminates overshoot while achieving a faster settling time.

Author(s):
Jim Campbell - Viewpoint Systems

Industry:
Biotechnology, Automotive

Products:
Compact FieldPoint, cFP-AO-200, cFP-TC-120, LabVIEW, cFP-AI-110, PID and Fuzzy Logic, cFP-PWM-520, Real-Time Module

The Challenge:
Combining slow safety clocks and faster proportional integral derivative (PID) control loops, as well as precisely and reliably controlling a fuel cell test stand that implements advanced control algorithms.

The Solution:
Using the NI Compact FieldPoint programmable automation controller (PAC) and NI LabVIEW Real-Time Module to run advanced control algorithms and multiple parallel loops to control our process and communicate with a PC.

"Compact FieldPoint with LabVIEW Real-Time ran our custom control algorithms and surpassed the capabilities offered by standard PLCs."

Selecting a PAC as an Alternative to Traditional PLCs

Micro Instrument, an automation vendor that builds test and validation stands for a major fuel cell company, has extensive experience with programmable logic controllers (PLCs) and stand-alone controllers for controlling repetitive motion, safeties, and other “environmental” parameters such as pressure and temperature. The company uses PLCs to reliably deliver discrete I/O control and standard PID loop control.

However, Micro Instrument’s customer needed to implement more advanced control algorithms than simple PID. The company contracted Viewpoint Systems Inc. to develop a flexible control environment using NI Compact FieldPoint and LabVIEW Real-Time to meet their system demands. For example, we programmed Compact FieldPoint to run control loops that were aware of imminent system-state changes. These control loops predicted system response and could eliminate overshoot or achieve a faster approach to a set point. Because the customer did not know in advance what “smart” controls would entail, it was beneficial to have the full power of LabVIEW to develop such controls. Providing this functionality with a PLC would be cumbersome, if not impossible.

Achieving Superior PID Control with Compact FieldPoint

First, we needed to ensure that Compact FieldPoint running LabVIEW Real-Time could deliver the required control tolerances. In this system, we conducted PID control in two forms – PWM and continuous control.

Because we did not have the NI cFP-PWM-520 module when we performed our initial testing, we used LabVIEW to create the PWM control with a standard digital output module. We set the PWM period to 100 ms and used a high-speed 1 ms loop that created the PWM pulse by setting the output on or off according to the PWM pulse width. This provided a PWM pulse-width granularity of 1 percent. Inside the 100 ms loop, we read the process variable, performed a PID calculation using the LabVIEW PID and Fuzzy Logic Toolkit to compute a new PWM pulse width, and passed the new width to the inner 1 ms loop to build the PWM pulse through a digital output.

Even with this customized, software-timed PWM, we achieved similar or better control than with our existing PLC controller. Ultimately, we used the cFP-PWM-520 module rather than the inner 1 ms loop so the CPU running LabVIEW Real-Time can perform advanced control tasks. For example, we implemented gain scheduling for the PID parameters in LabVIEW and included some nonlinear control based on process error to change the minimum and maximum outputs allowed by the PID controller. These programming enhancements boosted our PWM control capabilities beyond the PLC in terms of reaction time and stability.

In the continuous control case, we passed an analog input value through a parallel PID calculation and passed it to an analog output. We designed this loop to run at a 100 ms loop rate. Again, we achieved similar or better control than with our traditional controller.

Safety and Tooling Control

Our second task was to validate the capabilities of Compact FieldPoint to perform discrete control. A typical PLC application uses discrete I/O to watch and manipulate the state of the machine. These discrete I/Os tend to be 24 VDC or 120 VAC, and we used Compact FieldPoint digital I/O modules to implement this functionality.

For our application, we needed to watch several safety sensors to monitor the test stand health. Because the loop time on these sensors did not need to be extremely fast, we chose a 25 ms loop time. On some PLC applications, the reaction time to discrete inputs may need to be on the order of milliseconds. In our tests, we found that Compact FieldPoint was able to achieve a 2 to 5 ms response time through careful application of LabVIEW coding techniques and appropriate digital I/O hardware. However, with the nearly 30 parallel analog and discrete loops we used, a loop time of 25 ms was more realistic. If we had needed the 2 to 5 ms response, we would have needed to include another Compact FieldPoint controller.

Communicating with the PC

Our final task consisted of communicating the state of the test stand to the master PC. In addition, we needed to update new control setpoints to the various PID loops on the Compact FieldPoint controller.

On most PLCs, such communication between the PLC controller and a PC is done through a proprietary communication protocol, such as Modbus or Profibus, or through standards such as Ethernet. The PC commonly has a driver written to communicate with the PLC, or the user can incorporate a standard layer, such as OPC, to communicate with the PLC. In either case, to update a setpoint value held in a PLC memory location, the PLC tag associated with the memory is read from or written to through the

On the Compact FieldPoint controller, there are several options for moving data to and from the PC. First, since LabVIEW Real-Time is running on the cFP controller, we could use a number of communication methods, including remote VI server, raw TCP/IP, and the FP tag I/O VIs used in conjunction with “memory” tags created with the ‘FP Publish.vi’ function. This VI automatically creates tags that appear in FieldPoint Explorer.

We chose to use the “memory” tags for performance and ease of programming. With this approach, we were able to read the process variable values from Compact FieldPoint, as well as write new setpoints and PID coefficients.

Achieving Advanced Control Capabilities

The final solution used a single Compact FieldPoint controller to control the following independent parallel loops:

  • Seven parallel loops for PWM based temperatures control
  • Two parallel loops for continuous pressures monitoring
  • Four parallel loops for discrete solenoid and sensor monitoring and control
  • 15 parallel loops discrete safety loops

Each control loop performs in a separate LabVIEW “while” loop. We programmed control loops of similar type into a single VI, so we could tweak performance by placing the control VIs into separate threads.

The PWM control used inputs on the cFP-TC-120 module and outputs on the cFP-PWM-520 module. As stated above, we used the PID toolkit to perform the PID calculations. In addition, we incorporated some of the advanced features the customer wanted by switching control methodology and PID coefficients based on system state. Each temperature loop was in a separate LabVIEW “while” loop. The PWM temperature PID loops ran with a 500 ms cycle. We coded all loops into a single VI that was set at ‘above normal’ priority.

We also perform the pressure control within separate loops, programmed in fashion similar to the temperature loops. The inputs here came from the cFP-AI-110 module and the cFP-AO-200 module drove the outputs. These loops ran at a 100 ms cycle. We coded these loops into a single VI that was set at ‘above normal’ priority.

We coded the discrete control into a third VI. These loops monitored sensor input and reacted by closing or opening solenoids. We also switched solenoids based on thresholds on some analog levels. We used multiple DI-300 and DO-400 modules. These loops ran with a 25 ms cycle, and we coded the loops into a single VI that was set at ‘time-critical’ priority. Finally, we set a VI at ‘normal’ priority for communication with the PC.

In summary, Compact FieldPoint with LabVIEW Real-Time were able to run our custom control algorithms and surpassed the capabilities offered by standard PLCs.

Micro Instrument, an automation vendor that builds test and validation stands for a major fuel cell company, has extensive experience with programmable logic controllers (PLCs) and stand-alone controllers for controlling repetitive motion, safeties, and other “environmental” parameters such as pressure and temperature. The company uses PLCs to reliably deliver discrete I/O control and standard PID loop control.

However, Micro Instrument’s customer needed to implement more advanced control algorithms than simple PID. The company contracted Viewpoint Systems Inc. to develop a flexible control environment using NI Compact FieldPoint and LabVIEW Real-Time to meet their system demands. For example, we programmed Compact FieldPoint to run control loops that were aware of imminent system-state changes. These control loops predicted system response and could eliminate overshoot or achieve a faster approach to a set point. Because the customer did not know in advance what “smart” controls would entail, it was beneficial to have the full power of LabVIEW to develop such controls. Providing this functionality with a PLC would be cumbersome, if not impossible.

Achieving Superior PID Control with Compact FieldPoint

First, we needed to ensure that Compact FieldPoint running LabVIEW Real-Time could deliver the required control tolerances. In this system, we conducted PID control in two forms – PWM and continuous control.

Because we did not have the NI cFP-PWM-520 module when we performed our initial testing, we used LabVIEW to create the PWM control with a standard digital output module. We set the PWM period to 100 ms and used a high-speed 1 ms loop that created the PWM pulse by setting the output on or off according to the PWM pulse width. This provided a PWM pulse-width granularity of 1 percent. Inside the 100 ms loop, we read the process variable, performed a PID calculation using the LabVIEW PID and Fuzzy Logic Toolkit to compute a new PWM pulse width, and passed the new width to the inner 1 ms loop to build the PWM pulse through a digital output.

Even with this customized, software-timed PWM, we achieved similar or better control than with our existing PLC controller. Ultimately, we used the cFP-PWM-520 module rather than the inner 1 ms loop so the CPU running LabVIEW Real-Time can perform advanced control tasks. For example, we implemented gain scheduling for the PID parameters in LabVIEW and included some nonlinear control based on process error to change the minimum and maximum outputs allowed by the PID controller. These programming enhancements boosted our PWM control capabilities beyond the PLC in terms of reaction time and stability.

In the continuous control case, we passed an analog input value through a parallel PID calculation and passed it to an analog output. We designed this loop to run at a 100 ms loop rate. Again, we achieved similar or better control than with our traditional controller.

Safety and Tooling Control

Our second task was to validate the capabilities of Compact FieldPoint to perform discrete control. A typical PLC application uses discrete I/O to watch and manipulate the state of the machine. These discrete I/Os tend to be 24 VDC or 120 VAC, and we used Compact FieldPoint digital I/O modules to implement this functionality.

For our application, we needed to watch several safety sensors to monitor the health of the test stand. Because we did not need the loop time on these sensors to be extremely fast, we chose a 25 ms loop time. On some PLC applications, the reaction time to discrete inputs may need to be on the order of milliseconds. In our tests, Compact FieldPoint achieved a 2 to 5 ms response time through careful application of LabVIEW coding techniques and appropriate digital I/O hardware. However, by using nearly 30 parallel analog and discrete loops, a loop time of 25 ms was more realistic. If we had needed the 2 to 5 ms response, we would have needed to include another Compact FieldPoint controller.

Communicating with the PC

Our final task consisted of communicating the state of the test stand to the master PC. In addition, we needed to update new control set points to the various PID loops on the Compact FieldPoint controller.

On most PLCs, such communication between the PLC controller and a PC is conducted through a proprietary communication protocol, such as Modbus or PROFIBUS, or through standards such as Ethernet. The PC commonly has a driver written to communicate with the PLC, or the user can incorporate a standard layer, such as OPC, to communicate with the PLC.  

On the Compact FieldPoint controller, there are several options for moving data to and from the PC. First, because LabVIEW Real-Time runs on the Compact FieldPoint controller, we could use various communication methods, including remote VI server, raw TCP/IP, and the FieldPoint tag I/O VIs used in conjunction with “memory” tags created with the ‘FP Publish.vi’ function. This VI automatically creates tags that appear in FieldPoint explorer.

We used the “memory” tags for performance and ease of programming. With this approach, we read the process variable values from Compact FieldPoint and wrote the new set points and PID coefficients.

Achieving Advanced Control Capabilities

The final solution used a single Compact FieldPoint controller to control seven parallel loops for PWM-based temperatures control, two parallel loops for continuous pressures monitoring, four parallel loops for discrete solenoid and sensor monitoring and control, and 15 parallel discrete safety loops.

Each control loop performs in a separate LabVIEW while loop. We programmed control loops of similar type into a single VI so we could tweak performance by placing the control VIs into separate threads.

The PWM control used inputs on the NI cFP-TC-120 module and outputs on the cFP-PWM-520 module. We used the LabVIEW PID and Fuzzy Logic Toolkit to perform the PID calculations. In addition, we incorporated some of the required advanced features by switching control methodology and PID coefficients based on system state. Each temperature loop was in a separate LabVIEW while loop. The PWM temperature PID loops ran with a 500 ms cycle. We coded all loops into a single VI that was set at “above normal” priority.

We also performed the pressure control within separate loops and programmed them similarly to the temperature loops. The inputs came from the NI cFP-AI-110 module and the NI cFP-AO-200 module drove the outputs. These loops ran at a 100 ms cycle. We coded them into a single VI set at “above normal” priority.

In addition, we coded the discrete control into a third VI. These loops monitored sensor input and reacted by closing or opening solenoids. We also switched solenoids based on thresholds on some analog levels. We used multiple DI-300 and DO-400 modules. These loops ran with a 25 ms cycle, and we coded the loops into a single VI set at “time-critical” priority. Finally, we set a VI at “normal” priority for communication with the PC.

Compact FieldPoint with LabVIEW Real-Time ran our custom control algorithms and surpassed the capabilities offered by standard PLCs.

Author Information:
Jim Campbell
Viewpoint Systems
800 W. Metro Park
Rochester, NY 14623-2708
United States
Tel: (585) 475-9555

Browse All Case Studies »

  Print