annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

Help with multiple plots on XY Graphs depending on certain conditions

Résolu !
Accéder à la solution

Hi, I have a question about manipulating an XY Graph.

 

1) Everytime the plot crosses the x-axis for y-value going upwards, I want the plot to change color, until it crosses the 0 again going upwards, and I want that specific portion to have a different color. It is really hard to explain this so I'm going to post a picture: 

 

[URL=http://img691.imageshack.us/i/xygraphexample.jpg/][IMG]http://img691.imageshack.us/img691/4540/xygraphexample.jpg[/IMG][/URL]

 

As you can see, if the graph crosses the x-axis while decreasing, it shouldn't change colour. Only increasing.

 

I cannot figure out how to do this. I know it will require multiple plots, but how would I randomly change the color as well as detect if its crossing it going upwards or not.

 

Any help would be appreciated.

 

Thanks

0 Compliments
Message 1 sur 10
4 497 Visites

Hi Bilal,

 

you can attach pictures here in the forum directly, even embed them in the text. No need for 3rd party servers as they might even be blocked for other users...

 

How to check for positive crossing x axis?

Simply check for "x(t-1)<0 AND x(t)>=0" to detect such an event.

 

How to add plots?

You need an array of plots. So you have to split your data into several subarrays, arrange the subarrays to plots, then build an array of plots. It's much easier when you first collect all data, then search the interesting crossing points to analyze the data Smiley clignant de l'œil

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Compliments
Message 2 sur 10
4 488 Visites

You can use the trigger and gate express VI to quickly find all rising zero crossings.

 

Initialize an array of NaN that is the same size as your original data.

 

Then drop in the triggered sections

 

here is a quick example I cobbled together - you should get the basic idea

 

fp.jpg

 

 

bd.JPG

0 Compliments
Message 3 sur 10
4 473 Visites

Hi.

 

Do you think you could post that VI file.

 

Also, what if my x-axis is not at 0, and is user configurable?

0 Compliments
Message 4 sur 10
4 455 Visites

sorry - I didn't save the VI that I made - you should be able to duplicate what's shown in the jpg.

 

For the false case, when no more triggers are detected, just take the remaining portion of the original array.

 

And yes, the trigger level can be user configurable - just make a control and pass it into the trigger and gate function for the "Threshold"

0 Compliments
Message 5 sur 10
4 436 Visites

Hey, thanks it works now.

 

One problem is that there is a gap between the first triggered set of data and the second. It gets cut off at the x-axis, and the next point is like 0.12 or something, so it starts off a bit above the axis so there is empty space between the two triggered plots.

 

Is there any way of avoiding that?

0 Compliments
Message 6 sur 10
4 433 Visites

Also, I can't seem to find a "Threshold" terminal. All I see is an option for having a manual trigger, but nowhere to configure it.

I never use express VIs so sorry if the question sounds dumb.

0 Compliments
Message 7 sur 10
4 432 Visites
Solution
Accepté par l'auteur du sujet Bilal_J

OK - lucky I'm not too busy today ....

I usually don't use express VIs either, but was just looking for a quick solution for you.

here is the sample done with just the basic trigger function - no express VI.

Also added a user selectable threshold.

 

 

Next,  regarding the space between plots, if there is no data in the original, there will be no data in the colors either.

see second attachment

 

Tout télécharger
Message 8 sur 10
4 417 Visites

sorry the jpg had only the false case shown - here is an image of the true case also

 

0 Compliments
Message 9 sur 10
4 415 Visites
Thanks a lot. It worked perfectly!
Message 10 sur 10
4 386 Visites