From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to new file at midnight but record data constantly

Solved!
Go to solution

this hint....

compare.png

 

with a simple statemachine  Smiley Wink

0 Kudos
Message 11 of 37
(987 Views)

@Atwalsh wrote:

I'm also having the same problem with writing to a file at midnight. However, I cannot open the VI you uploaded due to my LV version being older than version 13. Could you possibly explain how to modify my VI so that it writes to a new file at midnight?

 

Thanks,

 

Walsh


As Apok hinted you need to modify your code to use a simple state machine format. Have a seperate state for writing your data to a file. Each time you write to file, check the "Day of year" to see if it has changed from last time you wrote to the file. If it has changed close you current file and open a new one. If no change then witre to the alredy open file.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 12 of 37
(979 Views)

I'm starting to understand some of the logic behind the state machine, but the way the code is written in the image posted by apok, it doesn't seem that there is any writing of data to a file between the creating and closing of the file. That I think I can modify, but more importantly, how do I find that function, "day of  year", attached to seconds to Date/Time function? 

0 Kudos
Message 13 of 37
(938 Views)
That is an Unbundle by Name.
Message 14 of 37
(932 Views)

Or just use the write to measurment file express vi configure the darn thing to start a new file at 00:00 daily.


"Should be" isn't "Is" -Jay
0 Kudos
Message 15 of 37
(926 Views)

Thanks Dennis,

 

What about the functions that are attached at various shift registers that have the ability to "wait" and "newfile"? Sorry, I just don't know the name of these functions and can't download the example vi due to my older version of LV.

 

Example_VI_BD.png

0 Kudos
Message 16 of 37
(920 Views)
I'm not sure which functions you are referring to. You have constants (integer, path, enum) and some functions from the file I/O palette. Why don't you request a down conversion? The link is at the top of the page.
0 Kudos
Message 17 of 37
(908 Views)

Nevermind, I found they were enum constants from the numeric pallete. 

 

Could someone explain if the picture above is actually writing data to the file or if that is something that I need to add in? Also, I'm not sure what is attached to the "strip path" function. I've pretty much written out the entire code minus the data generator because I have my own data source.

0 Kudos
Message 18 of 37
(907 Views)

Here's my new code. I'm getting an error message saying that the case structure selector values have the wrong type. Any ideas on how to have the values read eachother/match up?

0 Kudos
Message 19 of 37
(898 Views)

You have different enum constants.  One has a value of 0 for wait, and nothing else.  Another has a  value of 0 for New File, and nothing else.

 

You need a single enum that has two values of Wait and New File.  Then you should make that enum a typedef control so that if you go and add more states later, all instances will be automatically updated.  Change all of your existing enum constants to a constant copied from the typedef control.

Message 20 of 37
(890 Views)