LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What would be the best type of chart/graph to use?

Solved!
Go to solution

I am testing a grid tie inverter system. For the grid side I need to provide a chart/graph that has:

 

X axis: Fixed, starting at 00:00 (midnight) and ending at 23:59  

Y axis: Last watts measurment buying and selling 

 

The chart/graph needs to be cleared at midnight every night

Measurements are taken at 10 second intervals.

 

This program will be running non-stop for extended periods (months at a time) 

 

I am leaning towards an X-Y graph as the program may be started and stopped at anytime and that is the only way I can think of to make sure the measurnents line up properly on the X axis. 

 

But I am worried that since the entire XY graph is held in RAM (each line has it's own shift register) and measurment being taken at 10 second intervals.

 

That is going to add up quickly as the days go by eventually running out of memory and crashing.

 

Also I can not figure out how to clear the graph daily do avoid said memory leak.

 

To make matters worse I also require an identical chart/graph for the load output, batteries, and solar array.

 

Here is my Grid Buy/Sell sub-vi that I call after each measurment is taken and output a status message and graph to the main program.

 

BuySell.png

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 1 of 7
(4,499 Views)

First, I would separate data buffering and storage from the display. With 10 second data collection intervals you have 8640 data points per day.  That is probably 3 or 4 times the number of pixels in the display assuming the graph covers the full width of a good sized screen.

 

I would set up two or more buffers each containing the data for one day. This is not a lot of data for today's computers. Initialize the arrays to 8640 points and use Replace Array Subset each time new data is received.  By using two buffers it will be easy for the user to look at the previous day's data for comparison or to look at what happened just before midnight. If you calculate the index for the replace operations based on the number of seconds in the day, the data will be time coordinated automatically. Depending on how the data will be used, initialize with NaN or zeros.

 

With the data in the buffers you can also develop complete control over zooming and on how the data points will be processed to determine pixels in the graph.  For many purposes averaging several adjacent points is good but minimum, maximum, or median values might be better for others. If you feed all the data to the graph you have to accept whatever LV does internally.  For a porcess like this I would write a display subVI which outputs only as many points as the graph has pixels. It would handle the data reduction along with any zoom, scroll, or other desired UI functions.

 

I think the waveform graph is the indicator I would choose. Display subVI can either use property nodes to adjust scales as needed or can create a waveform datatype to wire to the graph.  By changing t0 and dt appropriately the time axis on the graph will display according to the data.

 

Lynn

0 Kudos
Message 2 of 7
(4,491 Views)

I would follow Lynn's advice and handle each days worth of data as a separate array of data.  So don't grow multiple days' worth of data in a single array.  Move it out to another storage system such as to file, and clear the array and start fresh at midnight.

 

But I think they XY graph is the better display for all the reasons you listed like the discontinuous data.

0 Kudos
Message 3 of 7
(4,483 Views)

That sound like a good idea.

 

 "If you calculate the index for the replace operations based on the number of seconds in the day, the data will be time coordinated automatically."

 

How do I get the number of seconds since Midnight? 

 

 

Bare with me here... The "Waveform graph" has been my nemesis for a very long time and I have never understood how to use it. 

 

So I really do not know what you mean by "By changing t0 and dt appropriately the time axis on the graph will display according to the data."

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 7
(4,475 Views)

I will try to post an example later today or sometime tomorrow.

 

Lynn

0 Kudos
Message 5 of 7
(4,471 Views)
Solution
Accepted by RTSLVU

@RavensFan wrote:

I would follow Lynn's advice and handle each days worth of data as a separate array of data.  So don't grow multiple days' worth of data in a single array.  Move it out to another storage system such as to file, and clear the array and start fresh at midnight.

 

But I think they XY graph is the better display for all the reasons you listed like the discontinuous data.


Yes I am still going with the XY graph as we are still in the early part of the development cycle and it is possible the unit could be stopped and started several times during the day and I don't want the graphs to get all out of whack.

 

But looking at my sub-vi it dawned on me to treat it like an action engine or functional global and put a initialize state it in I can call at midnight to clear the shift registers.

 

 

BuySell2.png

 

As for going back a day or more, that might be something I work on later. Each day's data will be saved locally in a separate file and using the XLR8 toolkit I am going to roll seven daily files into a weekly Excel workbook for further analysis.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 7
(4,459 Views)

Here is an example I put together. On the block diagram upper left corner is a signal generation section. The signal consists of one cycle of a sine wave spread over the entire "day" or 8640 samples. It has superimposed on it a triangular pulse starting at sample 1065 and lasting 120 samples and a square pulse starting at sample 4260 and also lasting 120 samples.

 

Two slightly different "consumers" of the data are included. Both use autoindexing for loops with 1 ms Waits so they consume a day's worth of data in ~8.64 seconds.  Each of them only shows one day's worth of data. A second shift register could be added to keep the previous day's data readily available.

 

The upper for loop just uses "i" as a timer and indexer for the Replace Array Subset. The array is initialized with NaN so poinst not yet received do not show on the plot. The inner for loop reduces the data for display. The output of this loop has the same number of elements as the width of the plot area. (Actually I copied the graph and did not change the property node so it really is looking at the width of the wrong graph). This loop has two data reduction options - mean and peak. Notice that mean hides the presence of the square pulse.

 

The lower loop demonstrates how to use time of day for indexing the Replace Array Subset. In the lower left corner is code to determine the number of seconds in the timestamp for midnight of the current day. Because of the accelerated simulation, the lower for loop uses a current timestamp as its starting point and has a multiplier of 1000 to account for the Wait 1 ms delay in the loop. It also has a Pause button which shows how the acquisition could be interrupted and the display restored when the acquisition resumes. Pause button mechanical action is Switch Until Released.

 

This code (saved for LV 2011) is not fully developed and may have bugs. I think you have enough experience to pick up the concepts.

 

Lynn

0 Kudos
Message 7 of 7
(4,418 Views)