09-08-2010 03:30 AM
Dear all,
I'm working with some new Model predictive control algorithms (MPC) and I want to test them in a real setup. This setup (a transformed hairdryer so it becomes a MISO system) is connected to a compactRIO. A NI 9505 module is employed to vary the speed of the fan and and analog output on a 9269 module is used to manipulate a solid state relays. Two temperature sensors are connected to a 9217 module for temperature measurement. As there is no can interface for the NI 9505 module, a VI on the FPGA is used to communicate with the CPU in the 9024. An update of the motor speed other in/outputs is done at a rate of 100 ms.
The MPC algorithms are written in c/c++. To run these, a library (out file for vxworks) is compiled and runs on the 9024. Due to the slow process, this library only need to run once every second. When running the code in a timed loop, the iteration duration seem around 6 ms and at maximum 10 ms.
Now I have two problems:
1) Even though the library runs only for 10 ms and the communication with the FPGA is at a rate up 100ms, it seems to be very hard to run the two VI's (one for input output control and the other with the "Call library function node" parallel to each other. In the help I found that library call cannot be interrupted, but even then, there seems to be more than enough time to run the library code. Is There a way to make sure the vi's do not disturb each other? Currently I made a "small" controller, but I need to increase the controller and that will make the library run for 200 ms or more. Can this be done, or will this be impossible?
2) the MPC algorithm is generated automatically and can be adapted. If a adapt the control horizon in a way that the generated code end up at 20000 lines, the gcc compiler is able to compile the code, but when the code is called and run the CompacRIO 9024 loses the connection and seems to crash. Does anyone know the limits of the size of code to be compiled for the gcc compiler for VXworks?
kind regards,
Bart Huyck