This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

False alarm
#1
Good day,
I have a problem with false data, some time the inverter answer 768 in a modbus TCP register (inverter in foult) although it is not in this condiction then in the next reading after about one minute it answer again 20 (system ok). This register generates an event script to test the value and as you can see in the script it generates an alarm. My question: is it possible wait for example wait 2 minutes and check it again before generate the alarm?

Code:
evento = event.getvalue() -- scansione se in un inverter c'è l'allarme (check what kind of event value) data = grp.tag('Allarme') for i = 1, 18, 1 do     --log(data[i].value)   if data[i].value == 768 then     status = 'error'     log('Inverter in errore : ',data[i]) --who is     break     else     status = 'ok'   end end -- invio comando di chiamata (there is an error 768 so make a call with dealers) if status == 'error' then   grp.checkwrite('Uscite Combinatore - Relay 1',1,1,'Uscite Combinatore - Relay status 1')    log('un inverter è in blocco')   else   grp.checkwrite('Uscite Combinatore - Relay 1',0,1,'Uscite Combinatore - Relay status 1')     --log('tutto ok') end
I thougt to insert a delay and use first istance then check again the value. but I don't know if it is a good idea.
Thanks for any other suggest.
BR Cristian
Reply
#2
Use a scheduled script instead of event. Set it to run every one or two minutes. Error state will be set only if object has a fault value two times in a row:
Code:
objs = grp.tag('Allarme') key = 'errors' errors = storage.get(key, {}) err = false for i, obj in ipairs(objs) do   iserr = obj.value == 768   if iserr and errors[i] then     err = true     log('Inverter in errore : ', obj) --who is   end   errors[i] = iserr end storage.set(key, errors) grp.checkwrite('Uscite Combinatore - Relay 1', err, 1, 'Uscite Combinatore - Relay status 1')
Reply
#3
(28.07.2025, 07:40)admin Wrote: Use a scheduled script instead of event. Set it to run every one or two minutes. Error state will be set only if object has a fault value two times in a row:
Code:
objs = grp.tag('Allarme') key = 'errors' errors = storage.get(key, {}) err = false for i, obj in ipairs(objs) do   iserr = obj.value == 768   if iserr and errors[i] then     err = true     log('Inverter in errore : ', obj) --who is   end   errors[i] = iserr end storage.set(key, errors) grp.checkwrite('Uscite Combinatore - Relay 1', err, 1, 'Uscite Combinatore - Relay status 1')
Thanks admin
 I will load as fast as possible.
Reply


Forum Jump: