LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for a goodway to store sensordata after an if-Statement is true

Solved!
Go to solution

Hey Guys, 

for an Universityproject i have to store a sensoroutput in a variable to use it afterwards in my Labviewprogram.

The data is a voltage from a DAQ-Device. Once the Sensordata is above a certain threshhold e.g. 5 Volts the actual voltage, e.g. 5.05V should be stored after a certain time (3000ms) in a variable. I wrote a VI for that but i think its not the best way to solve this problem. My Solution is attached. Do you have any ideas how i can make this more practically and fancier? Maybe even without putting and indicator on the front panel? Thaks for your help!

0 Kudos
Message 1 of 6
(1,665 Views)

Start with the training resources listed at the top of the forum. Seems you are a text programmer and you seem to program LabVIEW like text based code (local variables as variables, etc.)

 

All you need is a simple state machine. You don't need any local variables! Don't use long waits, just keep track of time!

 

Please also explain what you mean by "store". What should be displayed before the condition occurs?

0 Kudos
Message 2 of 6
(1,652 Views)

When i start the program the "stored" value should always be 0, since i know that the voltage is going up from 0. once the value passed the threshhold from 5V the actual sensoroutput (which should be very close over 5V) should be stored. For example 5.1 V. Then my programm should add +1 to the stored Value. In the example case it would be 6.1V. Then the program should run until the sensordata reaches this new value (6.1V in this example) and then turn itself off. Since the stored that isnt always 5.1 i cant use a constant.

I hope this explains my goals a little bit more.

0 Kudos
Message 3 of 6
(1,644 Views)

@overhandshuffle wrote:

 

I hope this explains my goals a little bit more.


Did the requirements change? You are no longer mentioning the 3s. By "turn itself off", do you mean "stop the loop"? In a state machine you never stop the loop, just go back to an idle state until you want to close the program.

0 Kudos
Message 4 of 6
(1,627 Views)
Solution
Accepted by topic author overhandshuffle

Here's a very simple draft that randomly increments a reading, stores the first value that exceeds a threshold as setpoint and increments the setpoint to define a new threshold, and repeats forever. Maybe it can give you some ideas.

 

 

0 Kudos
Message 5 of 6
(1,607 Views)

Sorry for tooking so long to answer, but since im a new member i am not allowed to post often yet.

The VI u sent me answered all my open questions. Thank you very much!

0 Kudos
Message 6 of 6
(1,535 Views)