LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lock time on waveform graph

Solved!
Go to solution

Hi guys,

I am struggling with time displays on my waveform chart.

You may or may not like the code I have done but I was told not to use DAQ assistant or waveform data wire, so this is the result 😁

In "labview hard coded time.png" you can see, the chart starts at 14:46:00.000 and ends at 14:48:00.000

However, in "labview time changed.png" you can see the time is now 14:47:08.030 and ends at 14:49:08.030 

 

Clearly, there is a 2 minute difference with both the hard coded time, and the 'changed time' picture. However, the 2 minute time window has shifted, as the time in real life passed 14:48:00.000. It will constantly update the graph, but keep a 2 minute window.

Is there anyway to hard code it so that it NEVER changes the time, i.e. it stays at 14:46:00.000 - 14:48:00.000 ? But the date will change each day?

0 Kudos
Message 1 of 12
(448 Views)

We are missing all your subVIs and cannot tell what happens in there.

 

If you want a fixed x axis, you should not use a chart at all. A chart has a history buffer (in your case 100 points) and once you run out ,the oldest points get discarded but the time t0 is still based on the first point.

0 Kudos
Message 2 of 12
(439 Views)

@altenbach wrote:

We are missing all your subVIs and cannot tell what happens in there.

 

If you want a fixed x axis, you should not use a chart at all. A chart has a history buffer (in your case 100 points) and once you run out ,the oldest points get discarded but the time t0 is still based on the first point.


Hi Altenbach,

I have attached all the VIs now. I had issues saving them and opening them on a Labview 2010 PC, as they are labview 8.5 but saving all individually as opposed to the 'save hierarchy' now works hopefully..

 

Ok so with a chart, it will start plotting 100 based on t0, then after 100, it will use like the 1st point t0 and point 101, and then 2nd point t0 with 102, etc?

How can I just lock the graph so that it only stays at that X value range

0 Kudos
Message 3 of 12
(429 Views)
Solution
Accepted by topic author lorc34

As altenbach suggested, you should not use a chart. Use a graph instead.

You can use a shift register or a feedback node to store the data. LabVIEW 8.5 is too old. My LabIEW crashed when trying to save as 8.5

I can only provide my implementation as images.

ZYOng_0-1726621413507.png

ZYOng_2-1726621538433.png

 

 

-------------------------------------------------------
Applications Engineer | TME Systems
0 Kudos
Message 4 of 12
(378 Views)

Hi Zyong, I have implemented your code. It is nice that it can wipe the graph clear.

However, the times are not correct. Despite wiring a single waveform to the graph, the time on the graph is 00:00:00 01/01/1904. Then, it works from there, and future times will be e.g. 00:00:01 01/01/1904 ..... 

 

despite that, the waveform when broken down, shows a t0 accurate to the real time (12:55 18/09/2024)

0 Kudos
Message 5 of 12
(353 Views)

@lorc34 wrote:

Hi Zyong, I have implemented your code. It is nice that it can wipe the graph clear.

However, the times are not correct. Despite wiring a single waveform to the graph, the time on the graph is 00:00:00 01/01/1904. Then, it works from there, and future times will be e.g. 00:00:01 01/01/1904 ..... 

 

despite that, the waveform when broken down, shows a t0 accurate to the real time (12:55 18/09/2024)


If you have implemented code and it does not work as expected, you need to attach it again.

 

How do you define the formatting of the time axis (absolute? relative?) and is "ignore waveform timestamp checked or not?

0 Kudos
Message 6 of 12
(344 Views)

Hi Altenbach,

Thank you, ignore time stamp was not clicked.

I appear to have the correct behaviour working now using waveform graph and shift register as Zy showed in pictures. Thank you

0 Kudos
Message 7 of 12
(334 Views)

Hi guys,

 

Unfortunately I never attached my solution here, and also, the PC i was using has had a hard drive failure.

 

I have the main VI, but the implementation where I fixed the chart, and changed to a graph instead, and implemented Zyorg solution, is gone

 

Can you tell me why my new VI is not working? I am trying to get the implementation working again.

 

When I turn on the lightbulb thing, it shows that data is not entering the for loop?

0 Kudos
Message 8 of 12
(148 Views)

Hi lorc,

 


@lorc34 wrote:

When I turn on the lightbulb thing, it shows that data is not entering the for loop?


Simple answer!

It's because you try to index an empty array - which results in a "zero iteration loop"…

 

Solution:

  • Handle an empty array correctly.
  • Do initialize that array before the first execution of the FOR loop…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 12
(142 Views)

Thanks Gerd, 

 

I will try understand what you've said..

 

Not quite sure how the  for loop works to be honest when theres two data wires being wired into it ... like if you put a 1D array of DBL in, and its 1 2 3 4 5 etc. up to 10 it will iterate through each one. But what happens when you put a second array in, i guess it has to be the same length array? So in this case both arrays are empty?

 

It does appear to be identical code to Zyorg, so not sure whats different but obviously something is lol

0 Kudos
Message 10 of 12
(138 Views)