09-30-2015 11:21 PM
Hello everyone.
I tried a lot of diferent solutions to implement my State-Space Controller but they don't seem to work - my Controller Action just explodes and my Labview crashes and I can't discover the reason why it happens.
I'm working on a Multivariable Plant that has two manipulated variables and two controlled variables.
Manipulated Variables (Plant Inputs): Fan Power 0-100% 0-10V; Heater Power 0-100% 0-10V. Both 10% per Volt
Controlled Variables (Plant Outputs): Air-mass Flow (nonlinear, though i have the Volt-kg/h Curve) ; Temperature Volts (10°C/V) (NiCr-Ni detector)
The plant consists of a fan that provides an airstream along a tube. The heating element feeds heat into the airstream.
The PC communicates to the Plant via a Humusoft Multifunction I/O Card (MF614), using DLL VIs in Labview that are already working perfectly.
The desired project is at the first attachment (Desired Project)
My current Labview Project is at the second attachment (Labview Control Project)
I designed the State-Space Model through Step-Response, that resulted in a three-TFs system in a 9x9 State-Space Matrix A, 9x2 B and 2x9 C.
Sample time - 1ms.
Summing up, my questions are "am i doing something wrong?", "any missing blocks or structures?", "any MV State-Space Controller example project available?", "am i obligated to use the Labview Simulation Loop or Mathscript?"
Please I need some help in this subject, since I started working in Labview this year, so i'm not very advanced yet. Maybe some basic info i don't know is causing these errors.
10-01-2015 01:17 AM - edited 10-01-2015 01:17 AM
The information you have given us is insufficient to troubleshoot the problem, but looking at your diagram, it is full of race conditions (mostly due to overuse of local variables).
For example your code marked in read runs in parallel to other code in the loop and the local variables "fan power" and "heater power" are read well before their respective terminals get update values from their wire.
"Index array" is resizeable, so you would only need one instance to get these two values, you could even just wire the array to the upper for loop on the right (instead if rebuilding the array from the two locals).
Where are the controls for the local variables that you read? There are some similar named terminals, impairing the code readability.
What is the data coming out of the FOR loop on the left and why does it need to be converted to DBL? If you have to convert, do it once on the array!
Looking at your error handling, I don't think you have a grasp on autoindexing and tunnel types for various scenarios.
You are trying to tun the timed loop at 1KHz. Are you sure it can complete all the code in that time?
Anyway, from the small and limited glimpse at your code fragment, I am not willing to trust any of your code. Feel free to attach the actual VI for possible more detailed help.
10-01-2015 02:25 PM
About the race conditions that you told about, can I solve it with a Flat Sequence inside the Timed Loop? (First Attachment - Labview Control)
About the global code, it's on the first image i've attached.
The little blue squares represents DLL instructions to access my Controlled Plant.
First: Configuration
Second: System Outputs Reading
Third: System Input Control
Fourth: Close Device
About the 1kHz timed loop, I'm pretty sure it can run at 0,1kHz, and when I do it, no difference at all.
My question is really about how is the correct way to implement this kind of Controller, andwhat's possible wrong with my code.
Thanks for your attention and help!
Now waiting for your reply.
10-01-2015 03:08 PM - edited 10-01-2015 03:09 PM
@luizbapmarques wrote:
About the race conditions that you told about, can I solve it with a Flat Sequence inside the Timed Loop? (First Attachment - Labview Control)
No, the right way is to eliminate the local variables and wire things up. No need for sequence structures! Here's a quick & ugly rewrite (since you did not attach the VI, just a picture).
red: what to delete:
oranges: wires to add.
(same for the 2D arrays A, B, C, D etc.)