07-28-2019 12:43 PM
Hi everyone,
I'm transferring a Simulink controller model to LabVIEW to realize controller function on myRIO. The model of controller is just composed of some arrays and matrix. However, when I was programming on LabVIEW the same way as the Simulink model, all the value after the feedback loop turn to zero.
Please see the attached images and the vi. document is also attatched.
Thank you!
Kind Regards
Chenzhe Xiao
07-28-2019 03:14 PM - edited 07-28-2019 03:15 PM
Where do you see arrays turn to zero?
On your front panel image, I see 2 arrays that are empty.
I think the problem is you don't initialize your feedback node. So its default value is an empty array, and when you add an array to it, you wind up with an empty array.
Try something like this which will initialize the feedback node with an array of zeroes the same size as the array you are putting in.
07-28-2019 04:23 PM
... and please bring some sanity to your diagram!
You are building the same 1D array four different times from diagram constants. Wouldn't once be sufficient? You can use a single array diagram constant before the loop and branch to all the places it is needed.
Same for your two matrices. Just use two matrix diagram constants! (the two 2D matrices differ slightly. Is this as intended?)
Some of your code constructs are pretty silly, for example the following code produces quite predictable output, right?