Assign alarms to booleans - Printable Version +- Ewon Technical Forum (https://techforum.ewon.biz) +-- Forum: Development (https://techforum.ewon.biz/forum-50.html) +--- Forum: BASIC Script (https://techforum.ewon.biz/forum-52.html) +--- Thread: Assign alarms to booleans (/thread-165.html) |
Assign alarms to booleans - Francesco - 03-11-2016 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. RE: Assign alarms to booleans - simon - 03-11-2016 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) 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" 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 RE: Assign alarms to booleans - Francesco - 03-11-2016 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? RE: Assign alarms to booleans - simon - 03-11-2016 You can get the Alarm type by using the Script code : Code: SETSYS TAG, "LOAD", "MyTag"
1 : High 2 : Low 3 : Level 4 : LowLow 5 : HighHigh RE: Assign alarms to booleans - Francesco - 03-11-2016 Very good! Thank you again! RE: Assign alarms to booleans - simon - 03-11-2016 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. |