11-04-2005 02:55 AM
I am trending historical data by reading the traces of Tags in the DSC module. I am trending 6 different plots but I would like to have one graph that trends one plot depending on the plot I select in my ring control (like a pick list). This will save having to show 6 different graphs on my front panel. I would also like to show the max, min, and average of the plots I selected for analysis. I have attached my vi which shows clearly what I’m trying to do.
I’m having trouble using the ring control to properly select my plots and analyse my data: Error 1077 at Property Node – invalid property value! If anyone can see a quick fix to this problem, I would be very grateful.
Thanks for the help,
Stuart
11-04-2005 04:59 AM
11-04-2005 06:24 AM
11-04-2005 08:04 AM
11-04-2005 09:09 AM
11-04-2005 10:49 AM
@stuart wrote:
... I am trending historical data by reading the traces of Tags in the DSC module. I am trending 6 different plots but I would like to have one graph that trends one plot depending on the plot I select in my ring control (like a pick list). This will save having to show 6 different graphs on my front panel. I would also like to show the max, min, and average of the plots I selected for analysis. ...
Stuart,
If you are interested in only plotting one trace at a time (without the option of adding an overlay), why read all 5 or 6 traces with Read Traces.vi and pick out the one ? Why not just read the 1 trace that is selected using Read Trace.vi. To do this, you'd just use the value of the ring selector to index out the tag of interest from your tag array. No need for the For loop, no need for a legend with 5 or 6 plots. The ring indicates what is plotted.
If you are actually interested in plotting one trace, but have the ability to add other traces, you're better off expanding on unclebump's example.
Other things:
1. The indicators for the max, min and mean have Datasocket connections to tags. That means they're getting values from two places. That can lead to confusion.
2. If your computer is ever going to be on continuously for 50 days, your use of Tick Count (ms) will lead to problems (it rolls over back to zero, check the detailed help).
3. With the code as is, it looks like every 5 seconds it's reading the Citadel database for a bunch of data. I don't know how much data is associated with your tags, don't know how fast a computer you have and Citadel may have improved in terms of speed of getting data between v6.1 and v7.1, but if you notice slowness with your HMI when this code is running you may want to do something like the following:
Do a full read from Start Tme to End Time only when either of "Select History to Plot" or "Show Previous x Days" changes value. Keep the last value of End Time in a shift register. Use that value as the Start Time for your next read. Concatenate the new times and data with the previously read. Occasionally slough off old times and data from the beginning.
11-06-2005 11:17 AM
11-07-2005 07:12 AM
Stuart wrote:
... my tag array has ouput only, so too does my ring control, therefore how is this all wired together?
Hi Stuart,
Use the 'Index Array' function with the value of the ring used as the index as per attached cheap mockup.
On a side note, I'm making some assumptions about how you're doing these "Day Avg" tags, but the following may apply:
"Get Trace Stats.vi" isn't always the best/correct choice to get the mean value of a trace. Read the detailed help for the VI. It may have changed in v7.1, but in 6.1 "the average and standard deviation are weighted according to the time duration of each valid input point. The last point in the historical trend is not included in the average ...". Very useful for some traces but not for others (e.g. if you have one Day Avg value per day for a Mon-Fri operation and get the average for 30 days, values for Fridays will be overweighted). Sometimes it's better just to unbundle the data array from the trace cluster and use 'Mean.vi'.