LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview storing value function

Solved!
Go to solution

Hi there! 

I'm looking for guidance on how to record a variable from time to time!

For eg. I have a value: current sensor value 1. From the time the labview program starts running, my program has to record the value of the curent sensor every min

say Minute 1: 5.46A
       Minute 2: 6.40A

Then the program will average out the values, as long the average value is not more than 7A, the programming will continue averaging out and comparing. eg (Minute 2+ 3) / 2 ...
(Minute 3+4)/2. 

Once it is more than 7A, a LED in the front panel will alert the user.

Thanks in advance!

 

0 Kudos
Message 1 of 7
(4,391 Views)

 

To store values, you could append them to an array in a shift register or stream them to disk.

To average adjacent value, use "mean ptbypt" with a sample lenght of two.

To check for a threshold, us a comparison operation.

 

THese are all very basic operations. What is giving you problems? Is this homework?

 

Message 2 of 7
(4,376 Views)

Hi jy,

 

sounds you need to use

- a WHILE loop

- a shift register

- an ADD and a DIVDE function

- a comparison function with a boolean indicator

 

See how far you get and then ask for specific problems. We will not do your homework for you!

Best regards,
GerdW


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

Hi there GerdW, 

I'm quite new to labview thus I'm unfamiliar with some of these functions. However, I'm a keen learner and I really appreciate your lending me a helping and I'll continue to learn and improve.

Back on task, I tried using the loops and functions you mentioned but I'm stuck as my program only uses the first value it gets and when i change the gauge value( substitute for current sensor), I'm unable to 'use' the second value to calculate its average with the first. 

jy1212

0 Kudos
Message 4 of 7
(4,311 Views)

Hi jy,

 

I'm stuck as my program only uses the first value it gets

That's how you programmed it!

You missed to THINK DATAFLOW! as it is described in the LabVIEW help and in all those free online courses for LabVIEW beginners.

Did you even try to debug using basic methods like highlighting? You would have noticed your problem…

 

Please learn LabVIEW basics before trying to program - with all those free resources offered by NI!

Use the example finder to learn from example VIs!

Use basic debugging tools to analyze your VI behaviour!

 

(And learn to avoid RubeGoldbergs as your case structure with a boolean and it's local…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 7
(4,286 Views)
Solution
Accepted by topic author jy1212

1. You should move the terminal for your gauge to be inside of the loop.  This way you are getting the latest value each loop iteration.

2. You should wire the value of the guage into the shift register so you can average it with the next value.

3. You should have the value in the shift register and the current guage value going into the Add function.

4. No need for the case structure.  Just wire straight to the boolean indicator.

5. Be sure to make your loop stop when your average is above 7.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 7
(4,259 Views)

When you enter the Forums, in the upper left corner there are some suggestions for learning LabVIEW.  If you look at some of the videos (which will probably take you only an hour or two), you should quickly see how to handle your current situation.

 

Bob Schor

0 Kudos
Message 7 of 7
(4,116 Views)