LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Update wavechart dynamically

Hello,

 

Here is modelisation of my real case.

Here are key points:

  • horizontal axis - variable iteration (integer) that increments in time
  • vertical axis - 3 variables X, Y and Z
  • these variables aren't updated at the same time ... first X, then (after a certain delay) Y and finally (also after delay) Z
  • I want that wavechart updates a particular curve when corresponding variable changes, i.e. when X changes, X curve is updated, but Y and Z remains intact.

Actually this code doesn't work - wavechart isn't updated at all.

Also additional problem - stop button doesn't work.

 

Thanks in advance.

 

 

dynamical_update_wavechart (0).png

0 Kudos
Message 1 of 8
(4,232 Views)

It is a BAD BAD BAD idea to have multiple event structures in the same loop.  If any of those events are set to lock the front panel until the event completes, then I guarantee you are locking up your VI cold unless your user is able to execute a very precise series of events.

 

Read Caveats and Recommendations when Using Events in LabVIEW - LabVIEW 2015 Help

0 Kudos
Message 2 of 8
(4,227 Views)

Hi Pavel,

 

Actually this code doesn't work - wavechart isn't updated at all.

Yes.

Because you only update the chart in case of an event. And that event never fires…

 Additionally: when you want to have things happen in parallel you need to program them in parallel structures!

 

Also additional problem - stop button doesn't work.

Yes.

Because the loop waits for an event, but there is none…

 

Your VI shows you don't understand to THINK DATAFLOW! (After all this time you are asking questions here you should have learned that!)

 

And as said before: don't use multiple event structures in one VI (or even one loop) for no good reason!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 8
(4,222 Views)

Ok, thanks for suggestions.

Here both event structures are removed.

How to modify this case in order it runs according with my scenario (actually X/Y/Z are updated at the same time).

Thanks.

 

P.S. Also chart isn't erased on start.

 

 

 

dynamical_update_wavechart (1).png

 

dynamic_wavechart_running (0).JPG

0 Kudos
Message 4 of 8
(4,213 Views)

Well, your X Y and Z will never fire a value change event because they are indicators.  (Unless you write new values to them using a Value (Signalling) property node, which I do not see in your code.

 


@Pavel_47 wrote:

Ok, thanks for suggestions.

Here both event structures are removed.

How to modify this case in order it runs according with my scenario (actually X/Y/Z are updated at the same time).

 

What do you mean by this?  What is your scenario?

 

Thanks.

 

P.S. Also chart isn't erased on start.

 

 Write an empty array to the "History Data" property node of the chart.  But your reinit to default should do it as well.

 

Why do you have that code in a while loop?  The way you have it programmed, it will run twice  (once and then when first call is true, the loop will iterate and run once more.)  Just wire the error wires to the border of your main while loop and that will guarantee they all run before the main loop.

 

dynamical_update_wavechart (1).png

 

 


 

Message 5 of 8
(4,206 Views)

What do you mean by this?  What is your scenario?

 

The variables X, Y, Z are updated consequently.

So once a new iteration starts, new poit on X axis appears.

Then on X update new point on X curve appears

Then on Y update new point on Y curve appears

Then on Z update new point on Z curve appears

Is such scenario realisable ?

 

Chart erase still doesn't work

 

dynamical_update_wavechart (2).png

0 Kudos
Message 6 of 8
(4,199 Views)

With history data erase works.

dynamical_update_wavechart (3).png

0 Kudos
Message 7 of 8
(4,192 Views)

@Pavel_47 wrote:

What do you mean by this?  What is your scenario?

 

The variables X, Y, Z are updated consequently.

So once a new iteration starts, new poit on X axis appears.

Then on X update new point on X curve appears

Then on Y update new point on Y curve appears

Then on Z update new point on Z curve appears

Is such scenario realizable ?

I think  you'll need to use a waveform graph set up to take an array of waveforms.  Each time you add a point to one waveform, you'll add it to the array for that waveform and Build all 3 together into an Array.  But you'll have to use shift registers to maintain your own history of the points that occurred before.

 

Chart erase still doesn't work

You're right taht reinit to Default doesn't clear it.  I must have remembered things incorrectly.  Glad to hear the writing the empty array to History works for you.

 

dynamical_update_wavechart (2).png


 

0 Kudos
Message 8 of 8
(4,167 Views)