LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Elapsed Time Text function not returning a non-zero value in excel file

I've attached a copy of my VI. 

 

The data is recorded to an excel file which I've also attached. One of the columns in the excel file should be elapsed time. However, that column only returns 0 seconds as the elapsed time which isn't true because the front panel is showing how much time has elapsed since the start of the experiment. 

 

Any help would be greatly appreciated!

 

Best,

M

Download All
0 Kudos
Message 1 of 8
(3,500 Views)

Hi ms,

 

two points:

- why do you convert your time string to an integer number?

- why don't you use the numeric DBL time value provided by ElapsedTime??? Why going the long way with using the string at all?

 

The rest of the VI is also very convoluted:

- why set the value labels in each iteration when you already set the labels in the DAQAssistent?

- why not use arrays and a FOR loop?

- why use ExpressVIs at all?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 8
(3,488 Views)

You will be pleased to know that your code is working (???) perfectly -- the "Untitled" column in your Excel Measurement File is correctly reporting the number of days (which is what you asked it to do) since you took the previous sample.

 

If you really want to learn LabVIEW, start by spending time with the Tutorials.  Learn to use the basic LabVIEW functions -- whereever possible, do not use Express VIs (such as DAQ Assistant, Elapsed Time, and Write to Measurement File), do not use Dynamic Wires.  Instead, think about what you want to do and then write code that does it.  Think about loops -- what do you want inside a loop, what do you want outside.  Think about Data Flow -- the Loop can only run as fast as the slowest component inside the loop.

 

Did you notice that you specified a sampling rate of 500 Hz (or 2 milliseconds/sample), yet the Time column of your Excel file increments by >200 milliseconds, i.e. your loop is more than 100 times slower than you want it to be?  Does this bother you?  Did you even notice it?

 

This is fixable, but not without learning more about LabVIEW.  The tutorials will help, but you need to study them in detail.

 

Bob Schor

Message 3 of 8
(3,484 Views)

In reply to your points:

 

1) I was under the impression that that the "Time Elapsed Text" function needs to be converted to a number from a string. Hence, the conversion block.

2) Good point! So, if I use your method will the elapsed time be recorded to the Excel file. This number is important to calculate transient heat conduction.

 

I know the VI is clunky. Actually, this is the first VI I have ever built. I'm basically teaching myself, via Youtube tutorials and this amazing forum!

 

In reply to your next set of points:

1) Will the Excel output file pick up on the labels via the DAQAssistant? Physically, my first temperature probe (T1) is connected to Channel 0. I thought since it was connected to channel 0, it would read it as channel 0 on the output file...

2) Still unclear on how to use arrays and FOR loops. As mentioned above, this is the first VI I've ever built. And my background is in chemical engineering.

3) What could I use in place of the ExpressVIs? Or should I just do away with them completely?

 

Thank you for the input

M

0 Kudos
Message 4 of 8
(3,461 Views)

This is the first VI I've ever built and my background is in chemical engineering. i'm essentially teaching myself via Youtube videos and this amazing forum.

 

Are there other ways to achieve my intended outcome without using Express VIs? Could you provide an example for something like Write to Measurement File. I understand your last statement about the Loop only running as fast as the slowest component inside the loop. With time, I'll be able to fix this.

 

And yest I did notice the sampling rate. I fixed that value after I submitted the file. Thank you for the input.

 

I'm aware that I'm shaky on LabVIEW fundamentals. Do you have any resources available which you think might be useful in helping me?

 

Thank you for the input!

M

0 Kudos
Message 5 of 8
(3,456 Views)

Hi M.,

 

you will find a lot of FREE online resources at ni.com! (www.learnni.com and others)!

No need to look for tutorials on Youtube…

 

And yes, there always is a way to solve your problems without ExpressVIs! 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 8
(3,429 Views)

I've cribbed this list from James Wilson, who may have cribbed it from Hooovahh...

 

If you are starting out in LabVIEW, there are free training tools.

"Give me six hours to chop down a tree and I will spend the first four sharpening the axe."  - Abraham Lincoln

Here are some free training tools primarily focused on LabVIEW and NI hardware to help get started.

NI Learning Center

NI Getting Started

-Hardware Basics

-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide

Learn NI Training Resource Videos

3 Hour LabVIEW Introduction

6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training

 

To replace the DAQ Assistant, read this excellent White Paper from NI.  I've referred to this so often that to find it, I simply Google "Learn 10 " and up it pops.

 

As for replacing Write to Measurement File, the first thing to think about is what do you want to write.  LabVIEW has a rich set of File I/O functions, including formatted text, "Configuration" (.ini) files, XML, Excel, Word, HTML, TDMS, binary, etc.  There are, of course, tradeoffs based on I/O speed, readability (are they "human-readable" or do you need a program), structure, etc.  There's a discussion of this somewhere, but I'm having trouble finding it (try LabVIEW Help).

 

Bob Schor

0 Kudos
Message 7 of 8
(3,405 Views)

Yup those training links along with some other certification material, and general help on the forums can be found here:

 

https://decibel.ni.com/content/docs/DOC-40451

 

Glad you find the forums helpful.

0 Kudos
Message 8 of 8
(3,381 Views)