Jump to content

SGL Array values currupted to 0 in read-modify-write structure


KoBe

Recommended Posts

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

Link to comment

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

Link to comment

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"?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.