Switch to desktop version  
Switch output at alarm - 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: Switch output at alarm (/thread-1085.html)



Switch output at alarm - Richard - 07-11-2019

Hi,
Did anyone already made a script for switching one of the outputs of the FLX3401 IO extension?
I want to switch an output when there is an alarm so peple will also see it physically on location when an alarm occurs.


RE: Switch output at alarm - ziozetti - 08-11-2019

If I remember well you can change state of DO0, DO1 and DO2 via BASIC.

Define in ewon tags digital tag DIGITAL1@ with server EWON, address DO1 and type boolean. > https://hmsnetworks.blob.core.windows.net/www/docs/librariesprovider10/downloads-monitored/manuals/reference-guide/rg-0007-00-en-reference-guide-io-servers.pdf?sfvrsn=70bd4ad7_12 (chapter 9)

Then in Basic make a script with an ONALARM command > https://developer.ewon.biz/system/files_force/rg-0006-01-en-basic-programming.pdf (Chapter 3.56.1)
ONALARM "TagInAlarm", "GOTO DigitalOnAlarm"

DigitalOnAlarm:
DIGITAL1@ = 1

About FLX 3401/2 card: https://hmsnetworks.blob.core.windows.net/www/docs/librariesprovider10/downloads-monitored/manuals/installation-guides/ig-0030-00-flx-3402-io-8di-4ai-2do-extension-card.pdf


RE: Switch output at alarm - Richard - 08-11-2019

Thanks for your clear explanation Ziozetti!
I also found this post to get a tag when one or more alarms will be be active. 
https://techforum.ewon.biz/thread-440.html
This works but I do not see it switch off when the alarms are gone.
Do you know if I need to make some kind of setting to make it switch on and off fast when there is an alarm or not?
thanks


RE: Switch output at alarm - ziozetti - 08-11-2019

My fault, you can use ALSTAT function; considering that you are monitoring the alarm of tag named LEVEL:

DigitalOnAlarm:

%alm = ALSTAT "LEVEL@"

If %alm = 2 OR %alm = 3
THEN
DIGITAL1@ = 1
ELSE
DIGITAL1@ = 0

PS: I'm not sure about IF syntax (I always mess with IF+OR/AND) but it should work with minor corrections.


RE: Switch output at alarm - Richard - 08-11-2019

Thanks!
I will try this out!
gr
Richard