{}

Merkene våre

Impact-Company-Logo-English Black-01-177x54

Velkommen til nettstedet til Schneider Electric

Velkommen til nettstedet vårt.
Søk i ofte stilte spørsmål (FAQ)
Example of creating Ad Hoc trend by selecting point from embedded list

This sample program is intended to demonstrate one or more programming functions or methods and is presented as programming example only. Schneider Electric assumes no liability for the use or application of this example program or any portion thereof.


This example shows how to use TrendSpec to trend a point selected from an embedded list.

In this example, an embedded list named "PointList" is located on a mimic layer named "Layer1" and displays a list of all Advanced Analog Modbus points with Historic enabled. The embedded list is configured to use the following SQL query:

SELECT ID, FULLNAME FROM CADVMODBUSANALOG WHERE ( "Historic" = TRUE ) ORDER BY "FullName" ASC

The below mimic script is on the same mimic and runs from a Script Pick Action configured for the embedded list. The script reads the value of the selected row in the embedded list, retrieves the information about the point in the selected row and uses TrendSpec to create an Ad Hoc trend for the selected point.
Sub AdHocTrendExample
Dim showTrend, sTrendProperties, sTraces, sYAxis, sXAxis, sTrend
Dim RowID, RowValue, SQLQuery, SQLQueryRow
showTrend = False
'Get the Object ID of the selected point from the embedded list. 
RowID = (Mimic.Layers("Layer1").Item("PointList").CurrentRowID)

'Get the full name of the selected point from the database based on the Object ID of the selected point.
Set SQLQuery = Server.Query("SELECT FullName FROM CDBPOINT WHERE ID = " & RowID)
'Assign RowValue to hold the full name of the selected point. This variable is going to be used later in the code.
If Not (SQLQuery.Error) Then
SQLQueryRow = SQLQuery.Rows
RowValue = SQLQueryRow(0,0)
Else
msgbox ("Error retrieving the value")
End If

'Let the user know the full name of the selected point. This line is optional.
msgbox ("You have selected " & RowValue & " to trend")
'Use TrendSpec to generate an Ad Hoc trend. The value of the RowValue variable is used to pass the selected point's full name.
sTrend = "SCX:////Trend/TREND("
sTrendProperties = "Title = '" & RowValue & "',"
sTrendProperties = sTrendProperties & "TitleColour = RGB(50,50,50),"
sTrendProperties = sTrendProperties & "TitleFontStyle = FontStyleBold),"
sXAxis = "XAXIS(RelativeNow, Position=Bottom,"
sXAxis = sXAxis & "Colour = RGB(50,50,50)),"
sTraces = "TRACE(ProcessedHistoric,'Y Axis 1',"
sTraces = sTraces & "SOURCE('" & RowValue & "',XOffset = 0,"
sTraces = sTraces & "YOffset = 0, Multiplier = 1),"
sTraces = sTraces & "Label = '" & RowValue & "',TraceStyle = TraceLine,"
sTraces = sTraces & "Interval = 200, PointLimit = 50,"
sTraces = sTraces & "ExtendToNow = True,"
sTraces = sTraces & "LineColour = RGB(50,50,50),"
sTraces = sTraces & "LineStyle = DashSolid," 
sTraces = sTraces & "LineWidth = 4, MarkerStyle = Diamond,"
sTraces = sTraces & "MarkerLimit = 250, MarkerSize = 2),"
sYAxis = "YAXIS('Y Axis 1',Label = 'Point Value',"
sYAxis = sYAxis & "LabelPos = Centre,LabelStyle = Normal,"
sYAxis = sYAxis & "Position = Left,ScaleType = Range,"
sYAxis = sYAxis & "Invert = False,ShowGrid = True,"
sYAxis = sYAxis & "Format = '%23%23.%23%23%23',"
sYAxis = sYAxis & "Colour = RGB(50,50,50)),"
'Display the Ad Hoc trend by setting the showTrend flag to True
showTrend = True
If showTrend = True Then
sTrend = sTrend & sTraces
sTrend = sTrend & sYAxis
sTrend = sTrend & sXAxis
sTrend = sTrend & sTrendProperties 
Mimic.OpenInset(sTrend),10,10,80,80 
End If
End Sub

Schneider Electric Norway

Finn ut mer
Rekkevidde:
Artikler som kan være nyttige
Finn ut mer
Rekkevidde: