LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

on the fly signal conditioning

I am using conditioned output in the loop and condition is when it is bigger than zero then pass the data and plot....correct me if that is wrong ...

0 Kudos
Message 11 of 19
(565 Views)

Hi Joan,

 


@Joan80 wrote:

I am using conditioned output in the loop and condition is when it is bigger than zero then pass the data and plot....correct me if that is wrong ...


Two points:

  1. As has been said before: you are using scalar values! A wire holding a scalar datatype will ALWAYS have a value!
  2. You write that value to your chart IN EACH ITERATION of your outer loop - even though you wrote you only want to plot the value when it is "in range"! You did not program the algorithm in the same way as you described the algorithm…

IF-THEN-ELSE usually is a case structure in LabVIEW:

(You might replace the value by NaN to get an invisble point in your chart -  this might be an option depending on your requirements…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 19
(563 Views)

Thank you Gerd, that did the job 🙂 my misconception on conditional for...thanks again

0 Kudos
Message 13 of 19
(552 Views)

hi, sorry, I tested it again and my enthusiasm was premature, there are -4 vals again after the while loop... but it is to do with asking the loop for 'false'  to do nothing (do not pass any vals) rather than use default and pass the values. I have to say that I cannot replace these vals with anything as I do not want to introduce artefacts to the data...any suggestions how to code the loop to skip this vals?

0 Kudos
Message 14 of 19
(536 Views)

Hi Joan,

 


@Joan80 wrote:

my enthusiasm was premature, there are -4 vals again after the while loop... but it is to do with asking the loop for 'false'  to do nothing


The usual reply is:

Attach your code so we can tell you what you did wrong and suggest improvements…

 

(And please attach real code this time and not just images of code!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 19
(527 Views)
0 Kudos
Message 16 of 19
(517 Views)

A few thoughts (numbered for reference, not importance, to make easier to reply etc):

  1. Your boolean "Start Scan" won't do what you want it to. The condition in a While loop always controls when the loop stops, not when it starts. Even if you have it set to the "Continue when True" mode (as in your code), this just means the condition is inverted. So your loop will stop immediately (after the first iteration), because the boolean is false when you start the VI. 
  2. You're using Initialize Array inside the loop. Probably this should be outside, and you won't want it to be reinitialized every time. However, unless you're chasing performance problems, you'd have an easier time removing it entirely and just using something like Build Array (if using a Graph, here you have a Chart, more below)
  3. The array you initialize will be longer each iteration (assuming you fix the loop condition). So then you'll be inserting more blank points. If you want to Select between two options based on a boolean condition (e.g. > 300) then there's a node for that: Select 
  4. Since you're using a Chart, you don't need (at least for the content shown) to store history. The Chart will do this for you. So you can remove all array operations.
    • If you used a Graph instead, you have to 'manually' keep track of your history that you want to show. This often involves the use of a Shift Register and Build Array.
  5. Your reading delay isn't doing anything... Probably you want to connect this to some sort of Timing function, probably "Wait (ms)" or similar?

Hopefully these can get you moving through some of these problems.


GCentral
0 Kudos
Message 17 of 19
(504 Views)

hi, 

cheers,

does anyone knows about practical solution to skip data vals that are outside the range of interest in labview in a simple and concise manner? (topic of this post). 

Preferentially not involving loops as loops require vals even in case of unmet condition (unwired terminals) which introduces artefact to the data

0 Kudos
Message 18 of 19
(499 Views)

A combination of the previously mentioned In Range or Coerce function and the Case Structure would do what you want:
Example_VI.png

Here the first Chart has no gaps, but as a result the X axis doesn't really give "time" (or sample number, more accurately) anymore.

In the second, only the points between 0.5 and 1 are plotted, but the points that are below that are replaced with NaN (so gaps).

 

You can choose based on whichever suits your needs better.


GCentral
0 Kudos
Message 19 of 19
(493 Views)