LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic save and create new file everyday

Solved!
Go to solution

It's not silly if you want a day's worth of data in each file.

 

I had the subtraction backwards. So just switch the terminals. Of course, there could be other bugs, but you need to learn to debug the program. Specifically, you need to use the probe window. There is a bit on debugging

 

http://www.ni.com/getting-started/labview-basics/debug

and

http://zone.ni.com/reference/en-XX/help/371361K-01/lvhowto/using_the_probe_tool/

 

The VI the other poster is using is called Seconds to Date/Time. You can then us Unbundle By Name to get the day. Then, instead of using the last time in seconds, you remember the day. When the days aren't equal (not equal vi), then you can update the file and remember the new date of month.

 

- Chris

0 Kudos
Message 11 of 19
(3,380 Views)

@nafisnuzrin wrote:

@RTSLVU wrote:

DON'T count the number of seconds for an entire day, that's just silly.

 

Keep track of the Day of The Year.

doy.png

Close the current file and make a new one when the Day of The Year changes (is NOT equal)

 


I really dont know how to adjust it, ???


Well I hate to say it but you really should start over, your program should not be "one big loop" to begin with, you should be using a simple State Machine architecture. 

 

 this might work...

doy2.png

 

When the day changed (at midnight)  a new file will be created, if the program is stopped and restarted the the same day file will be used.

 EDT: I just saw a mistake I made so I am reattaching the vi.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 12 of 19
(3,376 Views)

Here is a ready-to-use subVI.  You only need to wire in the data values, a save folder and a boolean value when the time interval has passed.  There is no reason to use TDMS files and there is no reason to open the file for the whole duration of the test routine.  Open it, write the data and close it.  

Write Values to File_BD.png

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 13 of 19
(3,370 Views)
@nafisnuzrin wrote:

@aputman wrote:

Use the current date as the filename (20170406.tdms for example).  If file exists, append the data.  If it doesn't exist, create a new file.


As you see my code already implement that one u mention, file name will be save according to date. But like I want the automatically write new file without deleting previous one. 


I cannot open your code as I am still on 2012 but I don't know why this would delete the previous one.  Nowhere did I say delete.  As long as the date is still 20170406, the file will be appended.  If the date is 20170407, a new file will be created.  Nothing deleted.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 14 of 19
(3,364 Views)

@RTSLVU wrote:

@nafisnuzrin wrote:

@RTSLVU wrote:

DON'T count the number of seconds for an entire day, that's just silly.

 

Keep track of the Day of The Year.

doy.png

Close the current file and make a new one when the Day of The Year changes (is NOT equal)

 


I really dont know how to adjust it, ???


Well I hate to say it but you really should start over, your program should not be "one big loop" to begin with, you should be using a simple State Machine architecture. 

 

 this might work...

doy2.png

 

When the day changed (at midnight)  a new file will be created, if the program is stopped and restarted the the same day file will be used.

 EDT: I just saw a mistake I made so I am reattaching the vi.


Sorry mate, I cannot open the VI u attached. Im using LabVIEW 2013, can u save previous 2013 version so i able to open it. Since the condition u state is enough to my condition.

0 Kudos
Message 15 of 19
(3,353 Views)

@aputman wrote:

Here is a ready-to-use subVI.  You only need to wire in the data values, a save folder and a boolean value when the time interval has passed.  There is no reason to use TDMS files and there is no reason to open the file for the whole duration of the test routine.  Open it, write the data and close it.  

Write Values to File_BD.png


thanks mate, I try it later. I give u the feedback 🙂 , im just asking at part where should I wire the "boolean value when the time interval has passed" as u mention above

0 Kudos
Message 16 of 19
(3,350 Views)

@nafisnuzrin wrote:

@aputman wrote:

Here is a ready-to-use subVI.  You only need to wire in the data values, a save folder and a boolean value when the time interval has passed.  There is no reason to use TDMS files and there is no reason to open the file for the whole duration of the test routine.  Open it, write the data and close it.  

 


thanks mate, I try it later. I give u the feedback 🙂 , im just asking at part where should I wire the "boolean value when the time interval has passed" as u mention above


He is right about not needing a TDMS file but wrong about opening and closing a file every time you write to it.

 

Open the file ONCE

Pass the file reference around your program with a shift register.

Close the file ONCE

Doing this makes it so you can view the file and LabVIEW can write to it at the same time

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 17 of 19
(3,347 Views)
Solution
Accepted by topic author nafisnuzrin

nafisnuzrin wrote:Sorry mate, I cannot open the VI u attached. Im using LabVIEW 2013, can u save previous 2013 version so i able to open it. Since the condition u state is enough to my condition.

Here you go... Saved to LV 2013

 

But you really need to start over on this. Looking at your program, you have a tab for a "Login Interface".

 

How do you plan on implementing this login interface when your program is "one big loop"?

 

It's going to be next to impossible.

 

If your program was using a proper architecture like a state machine, adding this and the other changes you need would be a lot easier.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 18 of 19
(3,341 Views)

@RTSLVU wrote:

nafisnuzrin wrote:Sorry mate, I cannot open the VI u attached. Im using LabVIEW 2013, can u save previous 2013 version so i able to open it. Since the condition u state is enough to my condition.

Here you go... Saved to LV 2013

 

But you really need to start over on this. Looking at your program, you have a tab for a "Login Interface".

 

How do you plan on implementing this login interface when your program is "one big loop"?

 

It's going to be next to impossible.

 

If your program was using a proper architecture like a state machine, adding this and the other changes you need would be a lot easier.


Thanks , your code is working like the condition I want. For the login interface I just want to make user enter "username" and "password" then user able to access the monitoring tab. But since u state it was impossible to do that due my "BIG LOOP" , I think I gonna remove that. 

 

Actually this is my first project using the labview, Im just learning about it. Thats why all of u can see my program just like complex because im combining to many example VI.  Thanks again to all for helping me. 🙂

0 Kudos
Message 19 of 19
(3,320 Views)