LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading data every minute.

Solved!
Go to solution

Hi, I have some Simple Vi which mimics instrument reading. I am reading every second but in the array like after loop completes, I want every minute data should store not every second.

I have attached the Vi.

Set the time target Like For example 180sec for 3min or 600 sec for 10min.

 

example if you set time target for 600 sec means 10 min it should only store data in array 10 reading that is every minute.

 

I have tried to use case structure and Quotient & Remainder. It stores value for every minute but not continuously store the data in array. 

like

1min value stored

2min value stored

 

but in-between these minutes empty values are stored. I don't want that.

 

Please someone guide me.

 

SUMMARY: I want to read every second but log data every minute. 

 

If I give wait ms in while loop 60000 it reads every minute and logs every minute. But when you try to stop it, it will stop after 1minute not sudden stop.

0 Kudos
Message 1 of 6
(334 Views)

Hi Basavaraj,

 


@Basavaraj093 wrote:

SUMMARY: I want to read every second but log data every minute. 


Have your loop iterate once per second to read a new value, but save the data only on each 60th iteration…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(320 Views)

Not current Vi but, previous Vi did store the value at every min(60sec) but in-between these numbers it stores the empty value. (String Array)

 

I have attached how it looks like image, (String Array) not an actually reading but how its look like.

 

if I start it reads first reading at 0 sec i.e.10:00 AM

next reading is at 10:01 AM after 1min.

but in-between its empty that I don't want.

0 Kudos
Message 3 of 6
(276 Views)

Here is the Updated Vi.

 

I have Run it for 3min i.e. 180sec.

 

I don't know why it is storing empty values.

 

0 Kudos
Message 4 of 6
(270 Views)
Solution
Accepted by topic author Basavaraj093

Hi Basavaraj,

 


@Basavaraj093 wrote:

I don't know why it is storing empty values.


Because you aren't able to debug your own VI!?

Just watch it working with highlight execution mode!

 

The generic answer is simply "THINK DATAFLOW!"

 

Code analysis:

  • Your while loop has some autoindexing output tunnels, so it WILL create a new output value with EACH iteration.
  • The case structure has output tunnels, so it WILL create a new output value with EACH call.

Both items are dictated by "THINK DATAFLOW!" - the very basic LabVIEW mantra. (You should say it loud whenever you have problems understanding how your own code works.)

 

Suggestion:

Build the data array inside the case structure and use shift register(s) at the while loop to hold the array data. This is very basic LabVIEW stuff, and you should be able to implement it after the very first lessons of the LabVIEW beginner courses...

 

P.S.:

  • Why do you handle all the integer data with orange wires? You really should think about using proper datatypes for your algorithm!
  • Why do you create timestamp strings in such a convoluted way? What about using one (1) FormatIntoString with a "%<>t" format code? Please read the LabVIEW help on those format code!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 6
(262 Views)

The reason the while loop waits 1 min to stop is because you place the wait function in the loop. 

It runs the loop one time then freezes until 1 min passes. 

 

If you want to have the front panel active, you need a different architecture. 

for example using  tick count function. when the time lapsed is over the 1 min, then it calls the function to the instrument and reads the data, before that, the loops keeps running and you can stop it 

Message 6 of 6
(234 Views)