Ewon TechForum
Providing technical solutions to technical requests


Assign alarms to booleans
Francesco Offline
Junior Member
#1
Hi,
how could I split into different booleans (internal MEM tags) the alarms of an analog tag?
I would use internal Alarm setup: the activation or return of every alarm (Low, LowLow, High, HighHigh) must set or reset 4 different booleans.


And how can assign the value of an internal MEM tag to a setpoint (or activation delay, or deadband) in Alarm setup of a tag?

Thank you in advance for your help.
Reply

simon Offline
eWON Support
#2
Hi Francesco,

For this, you need to use the BASIC Scripting.

1.  To extract bits from an analog Tag, you have to use the # function.


Code:
REM : Extract bit 1 (starts at 0)
MEMbit@ = MEMAna@#1

See Basic Scripting manual on https://developer.ewon.biz/content/basic-1

2.  To change the configuration of a Tag through script. You must use the functions GETSYS and SETSYS.
Here is an example for changing the Alarm level of a Tag using another Tag value (to paste in the init section) :

Code:
ONCHANGE "AlarmLowLevel_PLC","GOTO AlarmLowLevel_PLC_Change"
ONCHANGE "AlarmHighLevel_PLC","GOTO AlarmHighLevel_PLC_Change"
REM : AlarmLowLevel_PLC tag is defined as an IOserver tag in order to read Alarm Low level tag value from PLC
REM : AlarmHighLevel_PLC tag is defined as an IOserver tag in order to read Alarm High level tag value from PLC

END

AlarmLowLevel_PLC_Change:

 SETSYS TAG, "LOAD", "MyProcessTag"
 SETSYS TAG, "AlLow", AlarmLowLevel_PLC@
 SETSYS TAG, "SAVE"
 
END

AlarmHighLevel_PLC_Change:

 SETSYS TAG, "LOAD", "MyProcessTag"
 SETSYS TAG, "AlHigh", AlarmHighLevel_PLC@
 SETSYS TAG, "SAVE"
 
END

The different field name of the Tag ( SETSYS TAG, "AlLow", AlarmLowLevel_PLC@) are defined at the page 120-121-122 of the RG-006 Document
Reply

Francesco Offline
Junior Member
#3
Thank you very much for your answer!
But about the first question: I would like to assign the 4 alarms of a tag to 4 different booleans tags, not to spilt the tag value.
Is there a way to do that?
Reply

simon Offline
eWON Support
#4
You can get the Alarm type by using the Script code :
Code:
SETSYS TAG, "LOAD", "MyTag"
AlarmType$ = GETSYS TAG, "AlType"

IF AlarmType$ = "1" THEN
   BoolTagOHi@ = 1
ELSE
   BoolTagOHi@ = 0
ENDIF
...

  1. "MyTag" is the TagName
  2. The value is returned as a string (AlarmType$ is a string variable)
  3. Here are the different values that you can get :
               0 : Ok
               1 : High
               2 : Low
               3 : Level
               4 : LowLow
               5 : HighHigh
Reply

Francesco Offline
Junior Member
#5
Very good! Thank you again!
Reply

simon Offline
eWON Support
#6
You are welcome.

Just one more thing I did not mention -> You can easily get a script executed when an alarm occurs in the eWON using the event "ONALARM".
Check the BASIC doc for more details.
Reply



Possibly Related Threads…
  Enable/disable alarms Started by hjl
0 Replies - 25 Views
02-07-2020, 09:56 AM
Last Post: hjl



Users browsing this thread:
1 Guest(s)



Theme © Ewon 2019 - Forum software by © MyBB - Cookie policy