10-27-2015 01:38 AM
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!
Solved! Go to Solution.
10-27-2015 01:53 AM
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?
10-27-2015 01:56 AM
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!
10-27-2015 09:53 PM
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
10-28-2015 01:02 AM
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…)
10-28-2015 06:47 AM
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.
10-28-2015 07:39 AM
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