0% found this document useful (0 votes)
27 views6 pages

VB Script2

The document provides a scripting example that demonstrates performance optimization techniques for handling alarm states in analog points. It details various alarm types, configurations, and properties for analog points, including PV limit alarms, unreasonable value alarms, and user-defined alarms. Additionally, it explains how to create alarm details and insert alarm state icons for visual representation in the system.

Uploaded by

Gbenga Asafa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views6 pages

VB Script2

The document provides a scripting example that demonstrates performance optimization techniques for handling alarm states in analog points. It details various alarm types, configurations, and properties for analog points, including PV limit alarms, unreasonable value alarms, and user-defined alarms. Additionally, it explains how to create alarm details and insert alarm state icons for visual representation in the system.

Uploaded by

Gbenga Asafa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Sample Script

Following is a scripting example that demonstrates some of the performance


optimization techniques.

'This code is attached to a filled Text object. The display

'has three inline parameters:

' point [ex) lcn.a100 ]

' param [ex) PV ]

' format [ex) ##0.00 ] #'s for digits,

' 0's for placeholders

'

'Inline parameters use the following:

' \pe() gives lcn name form [lcn.a100 becomes a100]

' \p() allows use within strings

' otherwise the parameter is directly substituted

'

Sub OnDataChange()

' Store ackstat in a local variable because it is

' referenced repeatedly

dim almstat as string

'Use an error handler instead of reading .status

'explicitly

On Error Goto ODC_error

'Make sure format isn't empty

If "-\p(format)-" = "--" Then

fmt = "###0.0"

else

fmt ="\p(format)"

end If

'Check the alarm status of the point


almstat = collector("ackstat(\pe(point))")

if almstat = "NOALARM" Then

me.blink = false

me.visible = true

'Implement color scheme

If UCase$("\p(param)") = "OP" Then

me.textcolor = makecolor(253,253,128)

me.fillcolor = makecolor(0,0,0)

Else

me.textcolor = makecolor(0,255,255)

me.fillcolor = makecolor(0,0,0)

End If

elseif almstat = "UNAKALRM" Then

me.textcolor = makecolor(0,255,255)

me.fillcolor = tdc_red

me.blink = true

elseif almstat = "AKDALRM" Then

me.textcolor = makecolor(0,255,255)

me.fillcolor = tdc_red

me.blink = false

me.visible = true

end if

me.text = Format$(point.param,fmt)

Exit Sub

ODC_error:

'Change contents based on error number

select case err.number

case HOPC_COMMUNICATION_ERROR
Me.text = "@@@@@@"

case else

'Use this for debugging

'Msgbox Err.Description + " Error Number is "

'+CStr(Err.Number)

me.text = "---"

me.fillcolor = makecolor(226,0,255)

me.textcolor = makecolor(0,0,0)

end select

End Sub

Analog point alarms


This topic describes alarm properties for analog points.

PV limit alarms for analog points


You can configure up to eight alarms for each analog point to indicate when the PV
goes beyond the limit you specify. You can also define the same types of alarms for
accumulator points.

The types of PV limit alarms for analog points are:

PV High

PV High High

PV Low

PV Low Low

Deviation High and Deviation Low (Note that Deviation Low must be a negative value,
for example, -5.)

Rate Of Change

Transmitter Low

Transmitter High

Attention
When a point is off scan you can manually change the PV. However:

You cannot set a value that is higher than the PV High limit.
You cannot set a value that is lower than the PV Low limit.

As a result, you cannot enter a PV value outside of the alarm limits that would
cause an alarm.

See Quick Builder's help for descriptions of these alarm types.

For each alarm, you can also specify the alarm priority, sub-priority and the
specific limit.

Unreasonable low and unreasonable high alarms for analog points


In addition to the previous alarm types, you can also configure a pair of alarms
for an unreasonable high value and an unreasonable low value for the PV of an
analog point. This one pair of alarms apply to all the analog points in the server.

Unreasonable low and unreasonable high alarms appear as RSLO and RSHI alarms in the
Alarm Summary.

To define these alarms you define the:

Unreasonable high and unreasonable low limit values (Point Processing tab of the
Alarm & Point Processing display). The default values are 110% and -10%.

Alarm priority and sub-priority for unreasonable values for each point (Analog
Point Alarms tab) when you build the point.

Alarm deadband for analog points


When defining your analog point in Quick Builder you can specify an alarm deadband
so that an analog value that is oscillating around an alarm limit will not generate
unwanted alarms.

To define a deadband, select a percentage value from the Alarm Deadband list.

External change alarms for analog points


An external change is a change in the value of a parameter that is not caused
directly by an operator control issued through the server. An alarm is issued when
the value referenced by the parameter is changed in the field device.

For analog points, you can configure alarms for external changes in PV, OP, MD, and
SP.

User alarms for analog points


If you have applications such as OPC Integrator, or if you use server scripting,
you can generate additional alarms for your analog points. Analog points have
parameters InUserAlarm1, InUserAlarm2, InUserAlarm3, InUserAlarm4 which are used to
generate alarms.

When the InUserAlarm parameter value is set to 1, an alarm is generated. The


default priority of the user alarm is urgent.

The default alarm condition text that appears in the alarm summary is User1. To
change the condition text, you change acronyms 143 to 146 as shown in the following
table:

Parameter
Acronym
Default value

InUserAlarm1
143
User1

InUserAlarm2
144
User2

InUserAlarm3
145
User3

InUserAlarm4
146
User4

Related concepts

Demand scanning
Status point alarms
Related tasks

Configuring system alarm priorities


Defining informational messages for standard points
Customizing alarm behavior for Process alarms
Disabling alarming
Related reference

Accumulator point alarms


Example scenario: Audible annunciations
Related topics

Configuring alarms

Example
This example creates an AlarmDetails object called 'AlmDtls', defines its
properties, and then raises (generates) the alarm.

Sub Tank5_OnTimer()
Dim AlmDtls
'Check whether tank level is too low.
If ... Then
'Level is low, so create, define and generate alarm.
Set AlmDtls = Server.CreateAlarmDetails
AlmDtls.Name = "Tank5"
AlmDtls.Description = "Tank 5 level is too low"
AlmDtls.Priority = hscHigh
AlmDtls.Area = "Basement"
AlmDtls.Value = 20
AlmDtls.Units = "litres"
Server.GenerateAlarm AlmDtls
End If
End Sub
Inserting an alarm state icon
You can use an alarm state icon in two ways:

To show the alarm state of the associated point (this is the way in which the icon
is normally used)

To show an 'alarm state' that is controlled by a script

Note that, at runtime, an alarm state icon is invisible if there is no alarm and
the point is not disabled.

To insert an alarm state icon that shows a point's alarm state


Click on the Toolbox toolbar.
Open the Properties Window and click the Data tab.
In the Type of database link list, click Point/Parameter.
In the Point box either type the name of the point or click and search for the
point using the Point Browser.
If you want the alarm state icon to show 'point disabled' status:
Using the following table, type the name of the appropriate parameter in Parameter
box.
For this point type
Type this parameter name

Standard
ALARMDISABLED

Process
ALMENBSTATE

TPS
ALENBST

Click the Details tab and select the Show point disabled icon.
Configure the icon's other properties as appropriate.
To insert an alarm state icon that is controlled by a script
Click on the Toolbox toolbar.
Open the Properties Window and click the Data tab.
In the Type of database link list, click None.
Set the icon's default values (the values used before they are changed by the
script). For example, if you want the default priority to be low, select Low.

You might also like