LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

get image invoke method does not alway return image 8.2.1

Hi,

 

 

I am using the "get image invoke method"  in a subVI in  in order to capture  a chart waveform and save it to a jpeg image,  the subVI receives a reference to the chart

 

the chart waveform has 2 superimposed plots,  temperature and  RSL    Vs loop count as shown below, temperature is double , and RSL is double

 

 

I have tested my subVI on its own, and I know that it works fine on its own,  when I embed it in my application  that has other similar subVIs that capture chart waveforms,

 

the result I get is usually an Image with a blank chart, I look at the front panel object, and it is perfectly plotted as expected. why is there a difference ?  I have had similiar random problems with  capturing a front panel table image,  at random sometimes it works and sometimes it doesnt.

 

 

 

what is wrong here ?

 

please see attachment for the function "updateRSLChartsForRBERClient.vi"

 

 

in summary this function does the following

 

1. read a CSV file, 

 

2. take the last line of the CSV file

 

4.  extracts values in this last line then adds  4 points to 2 charts

 

5. captures an image of the 2 charts

 

6. saves that image in a jpeg

 

 

 

 

snap1.JPG

 

 

 I am using 8.2.1, but I recompiled in 8.5 and it does the same thing

 

 

 any help would be greatly appreciated

 

thanks

JS

Download All
0 Kudos
Message 1 of 13
(4,071 Views)

Hi JS,

did you see any error messages if you have no image from your chart? What do you mean with " the charts have identical references"? If you have only one FP element, then you can have only one refnum.

 

Mike

0 Kudos
Message 2 of 13
(4,062 Views)

no error messages

 

identical references :   from the block diagram,  the "value property node" receives a reference to a chart (blue wire),  and the "get image invoke method"  also receives a referenceto a chart (blue wire)

 

both receive a reference to the same chart

 

 

thanks

 

JS

0 Kudos
Message 3 of 13
(4,046 Views)

All of the typedefs are not included, so we can't run your code. I also don't understand why you're trying to use 2 different references for the same chart. The reference is for the control, not the individual plots. I don't know how you're calling this VI, but you should be aware that if the front panel is not visible then LabVIEW will not update the chart's UI in order for the image capture to be successul. This is by design. If the front panel is visible then I would suggest you pare down your example so it's manageable and others can try to reproduce the issue, if there is one.

 

Code comments:

  • You said that you are reading a CSV file and then taking the last line. In this case you readTextFile is way more complicated than it needs to be. In fact, you don't even need it. Use the Read From Spreadsheet File VI. A standard CSV file uses commas for column delimiters and the EOL for row delimiters. That's all you're doing in your code. You can eliminate the readTextFile VI and even the loops in your main VI where you parse out the columns.
  • Instead of the gymnastics that you're doing with the generation of the file for the image, use Strip Path and Build Path.
  • Do you really need to use such a behemoth typedef? You should only pass the required information into a subVI. Based on what I see the subVI only needs a few of those inner typedefs.
0 Kudos
Message 4 of 13
(4,045 Views)

thanks for the advice, I will use spreadsheet subVIs next time.

 

please note: I have 2 references for 2 charts,   I am plotting  2 independant charts, and capturing the images of 2 independant charts

 

 

attached  please find a version of the subVI without the FSM state cluster,  this should be executable standalone.

 

 

thanks

JS

Download All
0 Kudos
Message 5 of 13
(4,035 Views)

one more hint that might be helpful in getting to the root of this problem:

 

in my top level application,  I get images of 6 charts in total  using 3 subVIs that are similar to the problem subVI that I have here

 

the 1st subVI always produces the correct charts  (1st 2 charts)

the 2nd and 3rd subVIs  usually produce incorrect charts  2nd and 3rd pair of charts

 

 

all 3 subVIs are practically copy-paste except for minor modifications due to the differences between the data types being charted

 

1st 2 charts plot  double and uint64  (temperature and block errors Vs time)

2nd  2charts plot  double and double  (temperature and received signal level Vs time)<-------- this is the subject of this thread

3rd 2 charts  plot  double and uint64  (temperature and packet loss Vs time)

0 Kudos
Message 6 of 13
(4,027 Views)

Hi Joe,

 

Have you tried probing the Image Date wire from the invoke node to see what information is being passed to the Write jpeg File VI? Is there no information or is there data but it's not being recognized by the Write JPEG File VI?

 

0 Kudos
Message 7 of 13
(3,983 Views)

Hi,

 

I have tried probing the Image data wire before in a similar application that has a similar problem to this (blank image) and the behaviour of the probe was as follows

 

 

run first time = you get image

run second time = black

run more time, at random sometime black sometimes the image

 

this is how I narrowed down my problem to the get image invoke method and not the jpeg write.

 

 thanks

JS

0 Kudos
Message 8 of 13
(3,968 Views)

Couple of thoughts that may help out...

 

Have you tried setting the Charts as Syncronous?

 

The updates may be getting applied to the first and the screen updates for the subsequent fight for the UI thread ...

 

There have been issues with chart updates on tab pages ....

 

Hiding and showing the graph sometimes helps. Defer FP updates to freeze the UI updates, hide the chart, show the chart, undefer FP updates*... then get image.

 

Can you demo this with a way dumbed down working version that demos the issue?

 

If so please post so we can poke at it.

 

Ben

 

* I call this "jiggling the handle"

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 9 of 13
(3,947 Views)

I am using tabs, and the 6 charts are on three pages of a tab, 2 per page,   I forgot to mention this detail

 

and this problem is like the fridge light every time I test the subVI on its own, it works perfect from both IDE and  executable,  it is just when  I put it in my application that it works randomly. most of the time I get 2 images, coincidentally the 2 on the 1st page of the tab,  sometime I get 4 images and rarely do I get  all 6.

 

thanks for  you response, I will find out what  synchronous means, and will read up on it tommorrow, also FP updates, never heard of that either

 

is there any cure also for tables ?   I have a similar problem with  multiple tables on different pages of a tab.

 

 

I am going to make a simplified version tommorrow complete with the tab and see if I can post it

 

thank you all for your help

 

regards

JS

0 Kudos
Message 10 of 13
(3,924 Views)