Values in the 12.3 button on the drawing toolbar.
To calculate my availability figure for a trend, I use the traces of a trend in a display. Simply the sum of them divided by the count :
Code:Dim TheTrend As Trend
Set TheTrend = ThisDisplay.Symbols("Trend1")
Dim iTrace As Integer, iTraceValue As Integer
ReDim lgSum(TheTrend.TraceCount)
For iTrace = 1 To TheTrend.TraceCount
TheTrend.CurrentTrace = iTrace
lgSum(iTrace) = 0
For iTraceValue = 1 To TheTrend.TraceValuesCount
Dim vValue As Variant, vTime As Variant, vStatus As Variant
vValue = TheTrend.GetTraceValue(iTraceValue, vTime, vStatus)
lgSum(iTrace) = lgSum(iTrace) + vValue
Next iTraceValue
If TheTrend.TraceValuesCount > 0 Then lgSum(iTrace) = CLng(lgSum(iTrace) / _ TheTrend.TraceValuesCount) Else lgSum(iTrace) = -1
'Debug.Print TheTrend.GetTagName(iTrace); " Avail " & lgSum(iTrace)
Next iTrace
Set TheTrend = Nothing
The traces are PI Equations are typically like the following :
Code:if ('643PMP016' = "START") then 100 else 0
I change the time range of the trends and values using :
Code:
ThisDisplay.Trend1.SetStartAndEndTime StartTime, EndTime
ThisDisplay.Value1.SetStartAndEndTime StartTime, EndTime
It work for the Trends, but it does not change the value of the values at all. So I end up wit a trend showing data of a different time frame than the values.
For a two out of three system the equations become messy :
Code:If ((if ('643PMP016' = "START") then 1 else 0) + (if ('643PMP017' = "START") then 1 else 0
) + (if ('643PMP018' = "START") then 1 else 0)) > 1 then 100 else 0
That is on the lower level, two or three levels up it really becomes ….stringy
If I could add a trace in a reverse way of the GetTraceValue, I could just calculate the trace average instead of the longer growing PI Equations. It also allows me to declare extra variable, and simplify calculation. Or of cause any other beter way....