05-26-2019 05:35 PM
Hi
I am using Functional Global Variable in Real time cRIO, during run sometime the FGV is giving null output or empty array for a some iteration.
I am positive the null data is not written to the FGV, I have tried writing constant value and tried reading, still the issue persist.
Please give your suggestions if the similar issue is faced.
Thanks in advance.
05-26-2019 06:27 PM
Do you have any example code that shows the issue? My guess is you did something wrong. But impossible for us to say until we can dig around your code.
05-26-2019 07:11 PM
Yeah. Kind of difficult to help troubleshoot something when you don't attach any code.
I going to take a WAG that you forgot to wire through from shift register to shift register on at least one of your cases in the FGV.
05-27-2019 08:36 AM
Hi,
i have attached snippet of FGV.
the null value is generated in random iteration, the FGV logic I have checked.
I am unable to find the cause, please give your suggestions.
05-27-2019 10:34 AM
There is nothing obviously wrong with that FGV (other than I saw you spelled "safety" wrong).
If you are getting default zero values, that tells me you are using it properly and failed to Write to whatever parameter you are reading that didn't give you the answer you expected.
That data structure is very large. Are you sure all of those items belong together in one super-cluster like you have? There are so many things stored in there, you had to create a huge number of cases to be able to set them all. My guess is that you forgot to write to one or more of those cases with data.
Make your cluster on the front panel large enough so you can see everything in it. Then use the debugging tools available to you like viewing that front panel, highlight execution, pause and breakpoints, to see if the cluster actually contains the data you think it does.
05-27-2019 07:41 PM - edited 05-27-2019 08:01 PM
Hi Thanks for the review,
I checked on the cases, all are linked to the super cluster.
The issue I am facing is not only getting zero, but instead I am getting null/empty values for array.
Is this due to cluster size or the number of execution could cause the issue?
Should I change the VI execution property? I have configured as high priority now.
05-27-2019 09:20 PM - edited 05-27-2019 09:30 PM
The problem is in your larger application. Are you sure you are putting values into that array?
Something that tells me your cluster is way too big is that because you didn't include all the typedef's, I have to click IgnoreAll or Stop every time it looks for a typedef. I had to click probably 50 times to get through it.
Other issues "common" not "comman".
Your "Vibration" element is in the "Vibration Raw" case and your "Vibration Raw" element is in your "vibration" case.
You are packing to much data into a single cluster. And you are using the mega-cluster as an input when you want to just change one element, which means you have to bundle your element into the mega-cluster. You'd be better off if your input was a variant, and used Variant to Data in each case to convert to the correct datatype you want to bundle in.
But really, you need to make a much more manageable-sized cluster.
No, don't use special subVI priorities. Just use the standard one.
05-28-2019 05:47 AM
@RavensFan wrote:
But really, you need to make a much more manageable-sized cluster.
Personally, I'm not even seeing a reason for this FGV. It could be managed just a easily (maybe even more simply) with Global Variables or keeping the megacluster on the top-level state machine. Hard to say which is better without seeing the architecture of the application.
05-28-2019 08:33 AM
In my Nugget about Action Engines (see here) I make a distinction between FGVs and Action Engines pointing out that FGV can suffer from race conditions just like global variables since In the case of FGVs changes to the contained data is made OUTSIDE the FGV while in the case of an Action Engine, the data is encapsulated and all interaction with the encapsulated data is done inside the AE and protected from Race conditions.
What may help trace down where the issue may be hidden, is to set break points in the FGV and monitor when the data is being stepped on. The drop-down that is normally the font drop-down turns into a call chain indicator when the break point fires. Using the breakpoint and the drop down will let you discover WHEN the data is being stepped on and knowing the call chain WHO is stepping on the data.
Just trying to help,
Ben
05-28-2019 01:59 PM
What Ben said. The possibility of adding debug breakpoints and probes inside an FGV is a valuable (but oft-overlooked) advantage over regular globals. (And is similarly helpful in Action Engines).
- Kevin P