方法二:
Using a digital input block reading a hardware register, the A_cualm field will be utilized. Chain the DI block to an event action block to a digital output tag using the SIM driver. In the event action block use the following script:
IF the A_cualm =com
Then set DO =1
Else set the DO=0
A data link can be made to the Sim block. The value of this block will determine the status of the communcation.
方法三:
The Scheduler can be used to trigger a script on loss of connection to a device.
Create tags for each device (which has no activity behind it in the PLC) and monitor it for a COMM alarm. Create an On-True event in the scheduler that watches the F_NALM field (new alarm) to be 1, and have it run a script like the following:
dim strAlmType as String
strAlmType = ReadValue("Fix32.Node.Tag.A_CUALM")
If InStr (1, strAlmType, "COMM") Then
MsgBox "Connection Was Lost!" ‘ your real code would go here, but this will test the concept
EndIf
Because most A_fields are padded with spaces you would not fire an event directly off of the A_CUALM = "COMM" because it would not be translated correctly. The method used here will work well and be immune to the padded space problem. It will also only fire once per unacknowledged alarm (F_NALM will be reset to 0 on ack).