LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph of Timebased event

Solved!
Go to solution

I have what I think should be a fairly simple problem to solve, but I just can' t work out where to begin.

 

I have an "Event" - not a LabVIEW event, but a thing that happens. I measure when it starts happening and when it stops happening and record the value of the timestamp at those times. - Simplest way to demo this would be to record the timestamp every time a boolen changes state (I've simplified my problem a bit for this).

 

The Event occurs over an unknown duration - could be 3 days of more, chaning state every 60 - 2 mins.

 

I want to plot a graph of the event history.

1) in real time

2) from the log file I have made (should/could be the same code)

 

I basically want to turn a set of n data points, at different times into a square wave graph with a timestamp as the base. The data points are not equally spaced.

 

How would anyone set about this?

 

Cheers

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 1 of 12
(3,722 Views)

Ben?

Altenbach?

smercurio?

Coq Rouge?

muks?

Ray?

 

ANYONE???

 

I'm running out of time get a labour contraction logger writtenSmiley Sad

 

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 2 of 12
(3,708 Views)

James W wrote:

I have what I think should be a fairly simple problem to solve, but I just can' t work out where to begin.

 

I have an "Event" - not a LabVIEW event, but a thing that happens. I measure when it starts happening and when it stops happening and record the value of the timestamp at those times. - Simplest way to demo this would be to record the timestamp every time a boolen changes state (I've simplified my problem a bit for this).

 

The Event occurs over an unknown duration - could be 3 days of more, chaning state every 60 - 2 mins.

 

I want to plot a graph of the event history.

1) in real time

2) from the log file I have made (should/could be the same code)

 

I basically want to turn a set of n data points, at different times into a square wave graph with a timestamp as the base. The data points are not equally spaced.

 

How would anyone set about this?

 

Cheers

 

James


 A chart that uses a Waveform data type (uncheck ignore attributes) will plot the data based on "t0" in the waveform. This thread reply #8 has code i posted that does this;

 

 

 

As you can see there are different numbers of "events" ploted for each plot.

 

If you don't have any data for one of the plots at the moment but need to update the other, then make sure the "Y" array is empty.

 

See that thread for other notes.

 

Does that help or what did I miss?

 

Ben

 

 

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 12
(3,698 Views)
Solution
Accepted by James_W

Hi James,

 

Didnt want to post this as not completely happy with it but it may give you something to look at:

 

Timestamp graph snippet.png

 

Had to set the scale with a property node as for some reason when auto scaling it left all the data in the middle with big gaps either end.

 

Graph jpeg.JPG

 

Does not actually look as bad as this. The data now fills the whole graph. Dont know why but when i copied into 'Paint' it reverted back to data in the middle with gaps either side.

 

Hope it helps.

 

Rgs,

 

Lucither

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
Message 4 of 12
(3,693 Views)

The graph will actually look like this:

 

Graph 2.JPG

 

Obviously needs some work on. Would be better if the x axis showed more time points.

 

Rgs,

 

Lucither

Message Edited by Lucither on 05-07-2010 10:50 AM
------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
Message 5 of 12
(3,692 Views)

Hi Ben,

 

Thanks for the reply, it's always nice to be reminded of things lurking at the back of your mind.

 

I'll try and explain again.

 

I have an cluster array of timestamps and booleans- these are the times when an event change occured (and what the state was). What I want to do is change these into a square wave.

e.g.

10:40:10 (TRUE)

10:40:30 (FALSE)

10:45:20 (TRUE)

10:45:21 (FALSE)

11:50:10 (TRUE)

11:52:00 (FALSE)

 

basically I only have 1 array (Time) - I would like this on the X axis and the boolean state (1 or 0) on the Y axis.

 

As you can see, although I have T0, dt is irregular, so I can't build a waveform from this data. - What can I do to plot this on a chart/graph?

 

Cheers

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 6 of 12
(3,688 Views)

Genius,

 

That's just what I wanted to do Lucither.

 

You understood the problem exactly (and I had most of the code in place already).

 

Now I just to remember how to get X in time not DBLSmiley Very Happy - I'm too full of adrenaline.

 

(I just wish I could get snippets to work for me)

 

Thanks

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 7 of 12
(3,676 Views)

Chart.PNG

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 8 of 12
(3,668 Views)

Ahh,

 

I've finally worked out what you are doing there Ben.

 

There's more than 1 way to skin a cat!

 

Which is better over a long time period?

 

(Should I really be asking if you would post inferior code?Smiley Tongue)

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 9 of 12
(3,651 Views)

James W wrote:

Ahh,

 

I've finally worked out what you are doing there Ben.

 

There's more than 1 way to skin a cat!

 

Which is better over a long time period?

 

(Should I really be asking if you would post inferior code?Smiley Tongue)

 

James


 

I gave Lucither a Kudos as a preventative action.

 

Draw-backs with my version:

 

1) The Chart history (set at development time) will determine the number of events you can plot. If you set it too small you may have old data drop of the plot that you wanted to keep.

 

2) It is a chart so no cursors (but same will work with graphs)

 

3) Can not go back in time (plot values earlier than what is already plotted)

 

 

Advantage of my version:

1) No need to set properties since chart handle that

 

2) No need to maintain the history

 

3) UI Thread not needed because no property node.

 

 

While responding I just now noticed (yelled out the bull-pen and it turns out all of the Certified Instructors knew) in Lucither's image that we can show the index on the plot legend, and use horizontal plot legends!

 

Now that is Cool!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 10 of 12
(3,647 Views)