KoBe Posted July 13, 2012 Report Share Posted July 13, 2012 Hi, I have a strange problem in one of my variables. I use that variable to store data which are displayed on a Wfm-Graph. One VI inserts new data into the variable and writes the changed value to the variable. Everything works fine most of the time, but sometimes certian values change their value to 0. My target is a Win-7 PC The data type is: Chart_XY_Signals (1-D array of) XY_Signal (cluster of 2 elements) Name (string) XY_Data (cluster of 2 elements) X (1-D array of) X-Value (SGL) Y (1-D array of) Y-Value (SGL) A new value-pair consists of a monotony increasing X-Value ( 1,2,3..........) and a data value for Y-Value. In additional information is used to state the signal, in which the data has to be stored (index of Chart_XY_Signals). I use following steps in a loop, which gets new values from a queue: 1) Read Variable - loop for all new values comming in 2) Index Array Element of Charts_XY_Signals 3) Unbundle X and Y of XY_Data of XY_Signal 4) Append X-Value and Y-Value to the arrays X and Y 5) Replace new X and Y with Bundle by Name in XY_Signal 6) Replace new XY Signal in the Chart_XY_Signals array - end of loop 7) Write Variable The error is following: sometimes the data structure gets corrupted: Assume 4000 value-pairs for each signal (about 40) are stored in that structure, it happens that some old Y-Value or X-Values are unintentionally changed to 0. In my WfmGraph this makes horizontal lines to X=0 or vertical lines to Y=0 which looks ugly and must be resolved before delivery of the project. I checked my code and debugged it and came to the conclusion, that the error can not be a programming error, because: The first time, a 0 value is detected after point 3) !!!! That means somewhere in Read / Index Array and Unbunble the data is corrupted. Writing new data at point 7) makes the old value lost forever. The other possibility: The error occurs somewhere in Bundle / Replace Array element an Write. I thought this parts would never fail an therefore i never cross-checked the whole bundled data before Write. The variable can't be the problem. I used: 1) Global Variable 2) Data Value Reference 3) Functional Global Variable (FGV) As index/replace and bundle/unbundle is used both, nested in place structures and normal style. Can't understand where the problem comes from. Has anyone experienced similar problems or has an idea why I'm running into that s***? KoBe Quote Link to comment
Ton Plomp Posted July 13, 2012 Report Share Posted July 13, 2012 You could insert an 'Always copy' primitive.. But without the code it's hard to tell. Make sure you sent the VI to NI to debug (it might be a compiler error). And force a recompile of the VI (if it's a VI without code delete the object cache). Ton Quote Link to comment
ShaunR Posted July 13, 2012 Report Share Posted July 13, 2012 Check your array index. I the index is -1 or greater than the elements in the array the output will be the default (0 for numeric, empty string for strings). Quote Link to comment
KoBe Posted July 13, 2012 Author Report Share Posted July 13, 2012 You could insert an 'Always copy' primitive.. But without the code it's hard to tell. Make sure you sent the VI to NI to debug (it might be a compiler error). And force a recompile of the VI (if it's a VI without code delete the object cache). Ton Acutally I'm using separation of compiled code, I'll give it a try an delete my object cache before restarting my programm. Where would you use the "Always copy"? Quote Link to comment
Aristos Queue Posted July 14, 2012 Report Share Posted July 14, 2012 You say you don't detect the zero until after point 3... does that mean that you probed the cluster coming out of step 2 and in that probe you see data but you probe the values coming out of the Unbundle node and you see zeros? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.