LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving Date/Time to Second in LabView

Hi all, I have a question about saving date in LabView. For HIL testing, I have to save the date in .csv file or .txt file. My scenario is based on recording the current time and date when it falls below a certain voltage. Where do I mistake? Any feedback will help me a lot.

     saved data.png

 

0 Kudos
Message 1 of 17
(2,324 Views)

Hi ikeser,

 


ilkerksr35@gmail.com wrote:

Hi all, I have a question about saving date in LabView. For HIL testing, I have to save the date in .csv file or .txt file. My scenario is based on recording the current time and date when it falls below a certain voltage. Where do I mistake? Any feedback will help me a lot.


  • You don't save any data to a file (in the shown code).
  • You use an Express VI where you could use plain functions.
  • You wire a DDT wire to the FormatDateTimeString function - for which reason?
  • I don't see where you intend to save the measurement data…
  • You convert those date/time strings to integers to select a listbox item - atleast that is what you have programmed… (To set listbox items you need to use a property node!)

 

Best regards,
GerdW


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

There are a few things missing and wrong.

 

This is not the function you need. Try to read the help to understand what it does.

LLindenbauer_2-1701255774695.png

Try to avoid the big blue blocks and blue wires when possible.

LLindenbauer_1-1701255424175.png

 

Try this and see if you like it.

 

LLindenbauer_3-1701255972103.png

 

 

 

 

Message 3 of 17
(2,292 Views)

Thanks for your feedback. I aimed two analog input's values to compare with constant value. If analog input's values are less than constant value, save the date in to the .txt or .xlsx file.  Actually I send wrong pictures to you. Sorry about that. My system are shown below:

tüm sistem.png

 

0 Kudos
Message 4 of 17
(2,260 Views)

Delete the local variable "Data". Connect "Data" directly.

 

This is a Race Condition.

LLindenbauer_0-1701270011284.png

 

Message 5 of 17
(2,245 Views)

Yeah, I have notice yet. Thank you. I have created .xlsx file but data wasn't saved. How can I fix this issue?

0 Kudos
Message 6 of 17
(2,235 Views)

ilkerksr35@gmail.com wrote:

Yeah, I have notice yet. Thank you. I have created .xlsx file but data wasn't saved. How can I fix this issue?


Refer to my previous answer.

To start fixing the issue, don't use express VI. Use "Write to Text File".

 

LLindenbauer_0-1701272079859.png

 

0 Kudos
Message 7 of 17
(2,227 Views)

I don't understand your question.  The Time functions in LabVIEW can certainly tell you the time as monitored by your PC (which, in principle, could have its clock synchronized with a Time Standard) reported to the nearest second (and even fractions of a second).  NI provides a number of functions to acquire Time and express it in a variety of format to suit your needs.  So precisely what do you need?

 

Bob Schor

0 Kudos
Message 8 of 17
(2,141 Views)

Actually I want to use in real time project, but it doesn't work in real time project. My diagram is shown below.

real time date save.png

 

When I run, calendar does not see the true history. Also, file doesn't occur. How can I solve these problems?

0 Kudos
Message 9 of 17
(2,091 Views)

Now we are getting somewhere (because you are supplying necessary information).  If you use "Get Date/Time in Seconds" on a PC, it uses the Windows clock (which gets synchronized as to the Date and Time by functions buried in Windows (the OS) and in the PC hardware (like a battery that keeps a "clock" ticking even when you turn the power off on the PC).

 

Real-Time OS's don't usually have this functionality.  The Controller in the PXI probably has a "clock", but (a) might not have a battery to keep the clock running when power is cut off, and (b) doesn't have the sophistication to "search the Web for a Time Server to set Date and Time on startup" (actually, I'm not sure that Windows will "auto-set" itself, though it does know about Standard vs Daylight Saving time).

 

Once the PXI is powered up (and kept powered up), you can use MAX to set its date and time.  It is also possible when the PXI is powered up and running connected to a PC that can serve as a "Time Standard" for the PC to "set" the PXI's clock (using, of course, the time retrieved from "Get Date/Time" in (Host) LabVIEW.

 

Bob Schor

Message 10 of 17
(2,049 Views)