LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ahhh!!! Time on X-scale for Waveform Chart!! Please help

Okay, I've reached my limits.  I've followed the example given here to put the correct time on the X-scale during runtime.  Still not working.  I have my waveform chart in a separate while loop.  I "think" that is the problem but I don't know.  I tried putting it in the main While Loop and that didn't work either.  I've been working on this off and on for two days and it's the last part of this little program I need to get working.  Please help.  

Thanks,

D

 

0 Kudos
Message 1 of 18
(10,974 Views)

You've got many problems with your code.  Until you fix those, it's not worth trying to figure out the problem you think you're having.

 

First point is coding style.  Make sure every control and indicator has a label.  You have many that don't.  So I have no idea what the various terminals and property nodes actually connect to.  Make the labels on the terminals visible and give them meaningful names.  If you don't want the labels visible on the front panel, that's okay, just go to the front panel and make and turn off the visibility there.  But on the block diagram, they need to be visible.  You'd never write a text program using variables that had no text.  (Of course, a text program would never compile.)

 

Second, don't wire a constant 3 to a disabled property.  What does that 3 mean?  Delete it.  Write click on the property node and pick Create Constant.  It will give you an enum that has meaningful names.  And bonus, you get rid of the coercion dot.

 

Third, your "separate" while loop isn't actually separate.  It is dependent on the first while loop exiting.  And then it will only run once because the boolean wire that stops that loop has to be True in order for the first while loop to end.  It seems that you don't understand the concept of data flow.  I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

 

0 Kudos
Message 2 of 18
(10,958 Views)

Your chart belong into the main loop. Your little while loop will not start until the first loop stops, and at that point it will stop after one iteration, because the boolean in the wire is still true (else the big loop would still be running! Right?). It will only ever see the last cluster, nothing else.

 

Also placing the cart in the case structure, will not update it in certain cases, causing the time to shifct compared to the real elapsed time. You could feed it with NANs to create gaps if needed.

 

The use of dynamic intermediary data just to index out some elements is plain silly!

 

Please start with some simple tutorial about dataflow proper program design. Also never ever attach code that is set to scale the front panel elements. Since I have a smaller monitor than you, the front panel opens in a way that I cannot see the frame or the windows controls. It covers everything, including the taskbar. Annoying!

0 Kudos
Message 3 of 18
(10,956 Views)

You are correct that I'm obviously still hazy at times on how data flows in LV.  Knowing that the second While Loop is dependent on the first exiting, now the data flow makes sense and why my stuff isn't working as expected.  The outside While Loop where the chart is located on the block diagram needs to be in a separate thread....or task.... or whatever Labview likes to call it if this is to work like I want it.  I'll edit the code and see how that goes.   Thanks for the tip with showing the enums with meaningful names.  That works a lot better!!  

 

With that said, what should be simple (standard with charts and graphs in my opinion) functionality with time on the X-scale work like they show in the example link I posted, it should not require any coding on the block diagram.  It should work like their example shows straight out of the box, and then if the programmer wants to change it and how it functions they can.   I mean I have to do all of this on the block diagram....

chartWithTime2.jpg

 

Just to have time display on the chart on the front panel like this (a standard format on most software with charts and graphs I've seen).

chartWithTime.jpg

 

0 Kudos
Message 4 of 18
(10,924 Views)

I don't understand your 2nd paragraph.  You are expecting a program to do what a programmer wants without writing any program?

 

The closest thing that takes away programming from the programmer is to slap down a couple Express VI's.

0 Kudos
Message 5 of 18
(10,922 Views)

No, I'm expecting a Waveform Chart or Graph to work in a standard, default fashion right out of the box.  That default being that the X-scale shows correct system time when I make that selection in the chart properties for the X-scale.  

 

So, when I wire some data flow to a chart on the block diagram, it works as shown in the provided NI example, no additional coding required.  That should be the default way of it working.  What I don't get is that NI gives you the option to show absolute time and system time and format the X-scale like that in the Chart properties options.   Great, cool beans.  So, I get the chart properties all set up thinking, "Oh, nice, this will be easy".  It's supposed to be because after all, it is LabVIEW. Then I start my VI and yes, the time is formatted like I want it!  Great.  And.... the time is incrementing just as it should at both ends of the chart as the data is being streamed across the chart.  Nice!  Uh-oh.....but wait just a sec, there appears to be only one "little" problem.....the time is wrong!?!  So I think maybe I did something wrong being that I'm not a polished Labview guy.  So, I check the X-scale properties of the chart again (for the n-teenth time).  Yep, I've got it selected for absolute time, system date format.  What's the problem??  Why is the time on the X-scale displaying an incorrect time??  Reading further in the help files I learn. Oh, it will display the time on the X-scale in your selected format and it will even increment the time at a precision you choose, but.... you have to code the correct system time for it as it doesn't automatically show the correct system time.   And that coding involves what I posted in the picture above.  Smiley Frustrated  Ridiculous.  It shouldn't be that much for something as simple as that.

 

C'mon NI, if they're going to make it that much effort and coding just to set the time correct on a Chart, then I'll just go back to .NET.  

 

Are you referring to the Express VI's like the Elapsed Time Express VI??  The same "Express" VI that doesn't include a simple, standard "Start" or "Stop" boolean input?!  I've never seen a timer function block in any coding language not include a Start and Stop.  Is there a timer VI that includes these simple standard inputs in the Timing pallet?  Nope.  So I paid over $5k for a single seat license of LV that doesn't even have a simple timer that works like a real timer.  You press start, it starts incrementing time.  You press stop, it stops incrementing time but retains the time until reset.  Simple.  Oh, but after some searching I found that NI DOES have a simple timer like that.  It's included in their Real-Time Module add-on and that's an additional $2700.   I can go on and on....

 

Anyway, sorry for the rant.  Built up frustration from the growing pains of learning LV.  I'll get back to re-working the code as it's going to have to be a multi-task/thread program.  I'm going to try using simple local variables and pray, cross my fingers, whatever else it takes that it works first time.  Of course I know it won't.

 

 

0 Kudos
Message 6 of 18
(10,902 Views)

@busarider29 wrote:

No, I'm expecting a Waveform Chart or Graph to work in a standard, default fashion right out of the box.  That default being that the X-scale shows correct system time when I make that selection in the chart properties for the X-scale.   

Can you point to an internet document that defines these alleged "standards". (A misconception about how things work is not a standard). However, if you think that things should behave differently, feel free to formulate a concise proposed "standards document" and post it over in the LabVIEW ideas exchange for comments, votes, and reviews.

 

LabVIEW is a programming environment where time is a first class element (See e.g. here ).

 

Defining the time axis of a chart is not trivial. Typical chart data has no time information, so the axis needs to be defined with t0 and dt, assuming equal spacing between points. What should t0 be? The time the program is started? The time the first data point is acquired? The time the data point is first sent to the graph? The time the data point is read from an old file? What should happen if the points are not equally spaced? Should the time be absolute (zero is Jan 1 1904, allowing the display of the correct months and year, etc.) or relative (zero is a time value of 0).

 

If no assumption about the time can be made, you need to use an xy graph and carry the exact time data for each point along. LabVIEW has all the tools to do that. After all, it is a full featured programming environment, not some simple charting software included on a floppy with your DAQ board. 😄

 


@busarider29 wrote:

 I'm going to try using simple local variables and pray, cross my fingers, whatever else it takes that it works first time.  Of course I know it won't.

I have no idea what a "simple local variable" is, why you would need one, and what you are planning to do with it. Overuse of local variables is a serious problem, often seen in LabVIEW code written by text programmers.

 

At this point, the main problem is your (solid?) background in text based code, which often carries many misconception about graphical programming. It is important not o try to impose rules of text based code that are not applicable, but embrace the beauty of dataflow. (If you want to paint a nice landscape, you don't run for the typewriter! :D) You'll get there but it will take time. We are here to help, so please ask when you get stuck.

 

0 Kudos
Message 7 of 18
(10,878 Views)

altenbach wrote:

If no assumption about the time can be made, you need to use an xy graph and carry the exact time data for each point along.


Unless you use the Waveform data type, which carries with it the time stamp of the first sample and the sample rate.  Furthermore, it can be used with the chart to make sporadic waveforms.

 

I should state that 99% of the time when I deal with charts and graphs, it is with waveforms.  Therefore, almost all if these issues are taken care of.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 18
(10,873 Views)

@crossrulz wrote:

I should state that 99% of the time when I deal with charts and graphs, it is with waveforms.  Therefore, almost all if these issues are taken care of.


You did not quote my words "Typical chart data..." (as in scalars and arrays, etc., i.e. as used in the initial posted code here). Yes, some datatypes (waveform, dynamic) contain timing information and the OP is aware of them, because they are mentioned in the link he posted.

 

Each waveform assumes equal point spacing and that sporadic waveform (while it is nice that it works!) is a horrible kludge IMHO. If you look at the chart history, you can see that it is actually an array of single-point waveforms. If you would chart several channels, the chart data is an unwieldy 2D array of waveforms.

 

I stay away from waveforms, because my x-axis is very rarely time. Sometimes I use ancient waveforms, i.e.a bundle of (x0, dx, [Y]). 😄

0 Kudos
Message 9 of 18
(10,868 Views)

I would use Waveforms Graphs, but from my research of the forums, etc, stacked plots when using Waveforms is not possible, therefore, I'm using a chart with stacked plots.  Because I did originally want to use a Waveform Graph

0 Kudos
Message 10 of 18
(10,816 Views)