LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

graph clear problem

Hi,

I have a problem whereby my graph (Model+Data) is plotted ok but it then clears (disappears).  I am guessing that it is receiving null data and clears within the While loop ???  But my knowledge of LabVIEW is extremely limited.  I have tried numerous ways to try to solve this issue (i.e. putting the graph function in a single For Loop, putting all the code in a single For Loop activated by button Read Data) all without success.  It would be greatly appreciated if anyone could help me with this problem.  I have attached my VI.

 

I am new to LabVIEW and have spent an inordinate amount of time and a huge amount of frustration just getting my VI to its current state.  I have searched through the forums and help topics for the past couple of days and cannot find anything similar to my problem.

 

Regards,

0 Kudos
Message 1 of 9
(3,148 Views)

Could you save in LV2009 (Edit>>Save for previous version)?

0 Kudos
Message 2 of 9
(3,144 Views)

Jean-Marc,

Please find attached LV2009 version file for your info.

Regards,

Download All
0 Kudos
Message 3 of 9
(3,132 Views)

Your basic problem is that you have a race condition. LabVIEW does not execute code left to right or top to bottom. The "Read From Measurement File" VI can execute before you've actually written to the file. Thus, you could be reading an empty file, or stale data. You do not have the error out from the Nonlinear Curve Fit function wired, so you have no way of knowing if that VI is throwing an error. Why do you need to read the file when the data is directly available on the block diagram? The wire that is coming out of the Trigger and Gate VI is the data that you are writing to file, so just branch the wire down to the rest of your code. It's pointless to read it from disk.

 

Also, this

 

 

is simply silly. Think about it.

0 Kudos
Message 4 of 9
(3,122 Views)

Smercurio_fc,

Thanks for your comments although they haven't really addressed my original problem.  FYI.. the data must be written to a measurement file since I need to use it in another package and I also use this facility to check what is going on in LabVIEW (due to my limited understanding of LabVIEW).  If you have any suggestions concerning my original problem they would appreciated.

 

Regards,

0 Kudos
Message 5 of 9
(3,114 Views)

Please re-read my response. I didn't tell you to get rid of the Write to Measurement File. What I told you was that you have a race condition. You can write to the file all you want. My point is that it's pointless to read from the file when the data is already available on the block diagram as the wire that comes out of the trigger VI.  And ignoring errors coming out of VIs that have error clusters for a reason simply makes it more difficult for you to figure out what's wrong. How do you know that the problem isn't simply that the Nonlinear Curve Fit is throwing an error, thereby giving you an empty array as its output? If you wire an empty array to a graph, then the expected result is a clearing of the graph.

0 Kudos
Message 6 of 9
(3,109 Views)

Smercurio_fc,

I know that the Nonlinear curve fit is working ok since I can see both the measured data plot and the nonlinear curve plot on the graph for a short period of time after which the graph is cleared, also the a,b,c coefficients and actual data are temporarily flashed up on the Front panel before being cleared back to zero values.  I understand your comment about the race condition however this is not the issue here.  When I'm running the VI I know that data is captured since I can see the instantaneous temperature value hence I know when the thresholds are activated (this all works ok).  I will only press the 'Read Data' button when I'm satisfied with the captured data (that I look at via MS-Excel).  As stated in my original message the problem is that the graph (once its plotted correctly) clears and this is the problem that I'm trying to solve.  I believe that I may need to enclose the graph component in some form of structure however I have tried various ways to do this without any success.

Regards,

 

0 Kudos
Message 7 of 9
(3,091 Views)

Bunny,

 

Unless you are constantly reading data from your measurement file then the graph will clear. You are inputting data into the graph every iteration whether that data be good data or blank. When you press 'Read' You will see the data in the graph whilst data is coming from your measurement file, as soon as all the data has read then on the next iteration you will be outputting blank data from your for loop to the rest of the program. I can see that you are still writing to your measurement file whilst reading from it, unless you are writing data at the same rate you are reading it you are always going too get to a point where you are outputting nothing, as soon as this happens your graph will blank. I actually dont know what happens when you get to the EOF of a read vi and then a write vi adds more data, will it continue on the next iteration? I dont know this as i never have (nor ever will) Read from a file i am writing to in the same iteration.

 

As Smercio has pointed out though, reading the data from the measurement file that you have just written too in the same loop is a bit lot silly. The data you need is right there, why dont you just grab the data you need within the loop and graph it?? All you will be displaying in a graph is the last segment of data you write to it as it does not keep history like a chart. If all you want to do is graph the last captured transient data that you save at the top of your vi why don't you stick the lower part of your vi (Minus the read vi) into the TRUE case at the top where you are capturing this data. As the graph will only get updated when that case is TRUE and there is new data it will not blank.

 

 

Rgs,

 

Lucither.

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 8 of 9
(3,074 Views)

Bunny,

 

As has been pointed out to you really you need to re-write this vi more logically. As i said in the previous post once you get to your EOF on the read vi your graph will blank. To stop your graph blanking a quick fix could be:

 

Update graph only when data.png

 

This will at least stop your graph from blanking when no data has been read. This is a bit like sticking a plaster on broken leg though. Im still not sure what would happen when your reach your EOF but then you write some more data to the file, will it then resume reading, i dont know, something for you to check.

 

As i said before though, the whole reading from a file you are writing too is silly. The data is already there, use it.

 

Rgs,

 

Lucither.

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 9 of 9
(3,072 Views)