Embedded Model Control and LabVIEW Real-time
Author(s):
E. Canuto - POLITECNICO DI TORINO
F. Musso - POLITECNICO DI TORINO
D. Quagliotti - POLITECNICO DI TORINO
Industry:
Research
Products:
FPGA Module, LabVIEW, PXI/CompactPCI, Reconfigurable I/O
The Challenge:
To develop and operate an Embedded Model Control (EMC) simple but fine application within LabVIEW Real-time. Control sampling frequency must be 10 kHz and ADC/DAC resolution must be 16 bit at least. The EMC code should be the same developed on a proprietary C++ simulation environment.
The Solution:
The real-time EMC code has been developed as a Dynamic Linking Library (DLL) and included within a LAbVIEW while loop. User interface, control configuration, data acquisition, dispatching and logging have been developed within LabVIEW RT. A simple but fine thermal regulation tested and demonstrated the approach.
"EMC development under LabVIEW has been appreciated: user interface can be easily developed, acquisition board programming is immediate and efficient as register programming, DLL inclusion is effective apart the aforementioned debugging issues, sampling frequencies up to 20 kHz seem reachable by standard EMC modules. "
Short Summary
The Embedded Model Control (EMC) is a design and implementation technology centered on a state equation image of plant and disturbances: the Embedded Model. Depending on applications, model updating rates shorter than 0.1 ms are needed to provide accurate commands. The search for a platform where to develop and operate demanding EMC ended after some trial and errors to LabVIEW RT. Some key issues are still open, but a simple although fine thermal regulation confirms LabVIEW RT potentialities.
Article
What is Embedded Model Control?
Embedded Model Control (EMC) is a technology centered and taking advantage of a state equation image of plant and its environment: the Embedded Model (Figure 1). The image is embedded in the control unit and real-time driven by commands and estimated disturbances to yield a copy of the plant measurements: the model output. Discrepancies between plant and image are revealed by the difference between measurements and their copy - the model error - and constitute the sufficient source of feedback algorithms.
The feedback goal is to extract, from model error, the innovation capable of predicting the estimated disturbances. In this way, the disturbance status is always kept alive and ready to be counteracted by commands dispatched to plant. When measurements include operator requests, they are real-time converted into desired trajectories which the Embedded Model can repeat for satisfying operator.
The essential EMC architecture includes:
• the Embedded Model acting as a real-time simulator in parallel to plant+environment,
• the Measurement Law driven by ADC measurements and operator requests,
• the Command Law driven by Embedded Model predictions and dispatching commands to DAC.
As the algorithms of the Measurement and Command Laws directly descend from the Embedded Model, only their parameters have to be tuned. Tuning may start from computational procedures and then proceed through in-house simulation and in-field tests.
Why LabVIEW Real-Time?
Several trials have been made to find a platform which is suitable for developing and hosting EMC code, whichever be application from industrial apparatus to space breadboards and scientific instruments. Real-time EMC asks for:
• repeatable time units shorter than 0.1ms (10kHz sampling frequency) guaranteeing secure run of EMC modules,
• transfer of Embedded Model status to host computer and to mass memory each time unit: 100 Bytes in simple applications corresponding to 10 Mb/s,
• accurate, multi-channel ADC and DAC better than 16/18 bits,
• development system capable of compiling and linking C++ code and of step-by-step debugging target code,
• attractive user interface development system,
• platform compatible to industrial standards,
• university compatible prices.
LaBVIEW appears to meet most of the above requirements and to move toward full compliance. Compliance was tested and open issues were revealed through simple, but fine, EMC applications.
EMC and LabVIEW RT: what has been done and open issues
The real-time processor (NIPXI8186, the target) and the relevant acquisition board (NIPXI6289M) are hosted in a NI PXI 1042. The EMC code and interfaces have been developed or linked to LabVIEW, installed on a PC under MS XP (the host). Specifically:
• The user interface, running on the host, has been developed within LabVIEW: it allows acquisition and tracing of EMC variables, asynchronous dispatching of operator requests to EMC and configuration functionalities.
• All EMC modules have been developed under MS Visual C++ as a Dynamic Linking Library (DLL) to be called and executed at any time unit from a LabVIEW While Loop.
• The time unit is triggered by the ADC data being available at the function DAQmx Read. Time unit repeatability is ensured by the ‘Sample Clock’ of the acquisition board 6289M.
• The EMC code, developed on the host, is then loaded to the target and run under ‘embedded’ mode.
The target code has the following simple sequential architecture partly shown in Figure 2.
• Configuration DLL: it runs once for initializing EMC parameters to be passed to EMC DLL as entries of a double-precision or long–integer vector.
• While Loop starts with a pair of LabVIEW functions, DAQmx Read, waiting for ADC acquisition and therefore defining time unit start, and DAQmx Write, dispatching previous computed commands to DAC.
• While Loop continues by running the EMC DLL,
• While Loop ends by transmitting EMC status, i.e. a finite number of single-precision variables, to target mass memory or to the host.
The critical issue of the above architecture is the need for linking EMC modules to LabVIEW as a DLL. In alternative, one may suggest to directly develop EMC modules within LabVIEW, by assembling suitable primitives. It could be a future development, but since EMC has to be fully tested on and then extracted from a proprietary C++ simulation environment, it would require either to include or develop the entire simulation package within LabVIEW. An intermediate way could be offered by DLL disassembling facilities, lacking at present in LabVIEW. Whichever be future developments, on-target DLL debugging appears imperative as DLLs look unavoidable and parameter passing to DLL can only be debugged under LabVIEW.
A simple application: fine thermal control
The plant is an aluminium plate to be thermally stabilized in air between 10°C and 40°C. The temperature is measured by a single thermistor. The plate can be heated or cooled by three Thermo-Electric Coolers (TEC) mounted between the plate and an aluminium column acting as thermal sink. The plate is carrying a body which may be affected by variable thermal loads.
Two control time units have been adopted: each 0.1ms the thermistor output is measured and then averaged to eliminate measurement noise from control loop, the averaged measure is then decimated each 0.1s and elaborated by the EMC modules up to dispatching commands to TECs. Varying the faster time unit allows to test LabVIEW frequency limits. The slower time unit was imposed by Embedded Model dynamics. Figure 3 shows the actual 0.1s-average temperature profile and its deviation with respect to desired trajectory (<2 mK).
Conclusions
EMC development under LabVIEW has been appreciated: user interface can be easily developed, acquisition board programming is immediate and efficient as register programming, DLL inclusion is effective apart the aforementioned debugging issues, sampling frequencies up to 20 kHz seem reachable by standard EMC modules. Direct development of EMC modules under LabVIEW is the next task.
|
|

