LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extra Data written to file with time equal to zero

Solved!
Go to solution
Highlighted

I am new to labview. I am writing flow rate data to file using a while loop. My sample rate is 0.25 (I read one sample every 4 seconds) and I don't have any timing vi in the while loop. When I stop my program, my output file contains many data beyond the stop time. The time value reads 0 for all the data logged after the stop time but the channel values contain valid data. What could be wrong please? I have screenshots attached. The extra data read is sometimes more than the main data read during the program execution.

 

0 Kudos
Message 1 of 12
(308 Views)
Highlighted
Solution
Accepted by topic author mikeOLU
  • Get rid of the dynamic data sections. Nobody here wants to see that. Learn about proper array operations instead.
  • Get rid of all these local variables and their race conditions (You read from local variables and write to local variables of the same terminal in parallel. No way telling what happens first. e.g. your "time array" local variable gets read most likely before the terminal receives a new value, etc. etc.). None, or (almost none) of your locals are necessary. Get rid of them!
  • Initialize all your shift registers! The ones that are not initialized will retain data between calls, growing arrays forever.
  • Wouldn't it be sufficient to have one shift register with a 2D array than dozens of 1D arrays of the same length(?)?
  • Architect a state machine. Currently you would lose all data if the loop stops and there is a problem with writing to the file.
  • Please don't maximize the diagram and front panel to the screen. You need to be able to also look at the help windows at the same time.

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 2 of 12
(290 Views)
Highlighted

 

Thanks for the response. I actually used this project to learn labview so I have further questions please. What do I use in replacement for the dynamic data sections. I had to use them because I used one create channel vi to read all my 26 channels.

 

I think I can remove the time array local variables, however, in the two inner loops I have, I don't know how I can use the loops without using local variables, any suggestion on that will be appreciated.

Thanks.

0 Kudos
Message 3 of 12
(275 Views)
Highlighted

@mikeOLU wrote:

What do I use in replacement for the dynamic data sections. I had to use them because I used one create channel vi to read all my 26 channels.


You have mostly orange, then merge and split via dynamic data. Most likely "built array" and "index array" will to exactly the same thing.

 

Dynamic data is very dangerous because they can contain a wide variety of data types and there is no way to tell by looking at the wire. 

 


@mikeOLU wrote:

I think I can remove the time array local variables, however, in the two inner loops I have, I don't know how I can use the loops without using local variables, any suggestion on that will be appreciated.


Can you point to the "inner loops"? I can't find them. I only see a single loop. Did you attach the correct VI?

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 4 of 12
(263 Views)
Highlighted

@altenbach wrote:
Can you point to the "inner loops"? I can't find them. I only see a single loop. Did you attach the correct VI?

 


If you are talking about the case structure stack, ask yourself the question how many times do you need to calculate e.g. CTD - TD (Or the related TD - CTD) nanoseconds apart? Once before the loop is sufficient, then wire to the places where the value is needed. Also, the terminal should be outside the case.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 5 of 12
(252 Views)
Highlighted

@altenbach wrote:

@mikeOLU wrote:

What do I use in replacement for the dynamic data sections. I had to use them because I used one create channel vi to read all my 26 channels.


You have mostly orange, then merge and split via dynamic data. Most likely "built array" and "index array" will to exactly the same thing.

 

Dynamic data is very dangerous because they can contain a wide variety of data types and there is no way to tell by looking at the wire. 

 


@mikeOLU wrote:

I think I can remove the time array local variables, however, in the two inner loops I have, I don't know how I can use the loops without using local variables, any suggestion on that will be appreciated.


Can you point to the "inner loops"? I can't find them. I only see a single loop. Did you attach the correct VI?

 


I have attached a new image marking the inner loop. It is in the same VI.
I removed the local variable for the time array and the extra zero data don't appear anymore. Thank you so much.

However I want to also get to the root of the many local variables and the dynamic data.

0 Kudos
Message 6 of 12
(251 Views)
Highlighted

Oh, I meant case structure, not loop.

0 Kudos
Message 7 of 12
(248 Views)
Highlighted

@mikeOLU wrote:
I have attached a new image marking the inner loop. It is in the same VI.

My suspicion was right, these case structures are NOT loops! 😄


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 8 of 12
(247 Views)
Highlighted

Two versions of you stack of case structures. I have the suspicion it could be dramatically simplified. This is currently a literal translation.

 

altenbach_0-1596733545736.png

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 9 of 12
(232 Views)
Highlighted

 


@altenbach wrote:

Two versions of you stack of case structures. I have the suspicion it could be dramatically simplified. This is currently a literal translation.

 

altenbach_0-1596733545736.png

 


I thought case structure was a loop as well. Thanks for this. Do you mind uploading the VI you just updated? and any suggestion on replacing my dynamic data may be included too. Thanks.

0 Kudos
Message 10 of 12
(196 Views)