3.1.2. Class Scripts Definition

Because class scripts will be used for more than one object, the script will require the flexibility to call fully instantiated points that have different names.

An extension in the CIMPLICITY Basic script, CimEMEvent (object) , enables the script to access the object that represents the selected event.

One of the attributes is the object that triggered this event.

That way you can make the fully qualified point ID???s with the object ID as the prefix to the point ID.

Sample Script

The script below demonstrates how to identify the name of the object that is being used for an event.

As a result, that object ID can be used to construct the object's point ID???s for which script is running.

Sub Main()
Dim event As CimEMEvent
Set event = CimGetEMEvent()
Dim pointEvent As CimEMPointEvent
Set pointEvent = event.PointEvent()
Dim ObjectID As String
ObjectID = event.ObjectID
Dim ptValue As Integer
Dim ptValueExpected As Integer
Dim ptCtrlPending As Boolean
ptValue = pointEvent.Value
??
ptCtrlPending = PointGet(ObjectID & ".AT")
If ptCtrlPending Then
ptValueExpected = PointGet(ObjectID & ".DO.$RAW_VALUE")
If ptValue = ptValueExpected Then
'Indicate that a control is complete
PointSet ObjectID & ".AT", 0
End If
Else
'Enable the alarm on the digital indicator
PointSet ObjectID & ".DI.QUALITY.ALARMS_ENABLED", 1
End If
End Sub