Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Triggered event w/ multiple triggers
#1
Dean, is there a way to identify which field triggered an event, that has multiple triggers configured from different fields, configured to trigger when one or more are true?
Reply
#2
Read the docs, just to be able to claim that I did :-)

In the TrigEvent Action Target list there is

Code:
IsFldChangeEvFor(fldname)  

fldname:  The name of the field to test for
This command will return a True status if the action was triggered by a field change trigger for the indicated field name.

which seems to do what I need, but in my action editor cannot find it?
CQC version 5.2.11 the 8 "Get*something" targets listed in the docs are there, but the 7 "Is*something" are missing
Reply
#3
You would still want to do a basic filter of course, to prevent every single trigger from running the action. So try to limit it as much as possible with a filter. Then use the TrigEvent target to get information about the trigger. What kind is it? Is is just a generic field change type that you have configured on some fields? If so, there is a 'GetFldChangeInfo' command that will get information about a field change type trigger. It'll give you the field name and the value that caused the trigger.
Dean Roddey
Software Geek Extraordinaire
Reply
#4
That command is a conditional. It only makes sense to call in an If or If/Else block. So it doesn't show up under the Cmd button. Hit the If button.
Dean Roddey
Software Geek Extraordinaire
Reply
#5
(06-04-2018, 05:31 PM)Dean Roddey Wrote: That command is a conditional. It only makes sense to call in an If or If/Else block. So it doesn't show up under the Cmd button. Hit the If button.

at time is difficult to see the forest due to the tree in front of me...
thanks!
Reply
#6
If all of the triggers are field change triggers, and you can't filter it down any more than that, at least use the IsFldChange() filter so it only gets kicked off for field change triggers and not all of the standard ones. If the ones you care about are from one (or maybe two) devices, add one or two IsFromSource filters to limit it further to field changes from those devices.
Dean Roddey
Software Geek Extraordinaire
Reply
#7
(06-04-2018, 05:29 PM)Dean Roddey Wrote: You would still want to do a basic filter of course, to prevent every single trigger from running the action. So try to limit it as much as possible with a filter. Then use the TrigEvent target to get information about the trigger. What kind is it? Is is just a generic field change type that you have configured on some fields? If so, there is a 'GetFldChangeInfo' command that will get information about a field change type trigger. It'll give you the field name and the value that caused the trigger.

You must have been reading my mind...

I am trying to synchronize 2 fields with each other. Both can change, thus trigger.
Having separate actions results in many read/writes, such as field1 triggers, its value converted to field2 and written, in return field2 triggers a change and compares value, since the conversion and rounding will not exactly equal, thus write back to field1...

With IsFldChangeEventFor  I can separate and identify what triggered and write the other, but the trigger storm still happening.
Any strategy how to do this?

Trying to sync 2 different volume fields, that are of different scales
Device1Z1.Volume  0-50
Device2Z1.Volume 0-100

Trying to make sure that volumes are the same on both, both can change individually.
I also have an issue, where if I keep pushing the volume up/down on one devices, the other is overwhelmed and disconnects, probably due to the storm of triggers and writes.
Reply
#8
Set two different IsFldChangeFor triggers, one for the first field and one for the second, so that you know you only get invoked for those two fields.

But you are going to have a problem with the circularity issue. Most likely you will have to use a global variable to remember the last value you calculated for each field (and then wrote out.) When you see a new value, see if it is within one in either direction of the previously written value. I so, don't do anything. That way you won't get hit with rounding issues.

So first check if the global variable exists. If not, create it with a value out of the range for that field. The calculate the new value, store it to the global variable and write to the field. When you see another change, create values one above and one below the new value and see if the new value falls within that range. If so, do nothing.
Dean Roddey
Software Geek Extraordinaire
Reply
#9
Thanks, I was trying to make something similar you described above.
Any ideas on how to limit writes per second? What I had worked just fine, until one leaned on the volume up or down button. After about 2-3 seconds, the driver is overwhelmed...
It is a serial port that is on the Global Cache ip2serial gizmo, and modified driver to connect to socket.
Reply
#10
There wouldn't be a very easy way to do that. Well, you could but you'd always risk missing the last few or so. Just create a time variable and use it to calculate how long since you last wrote to each field. There are action commands to get now and calculate the offset between now and the previous time stamp. Just ignore any that come in until that time has expired. But any that come in during that last chunk will get ignored. There's no easily way to know that they've stopped and do a last write.

That sort of thing would require some more elaborate mechanism. There are a number of things of this sort that really need for a 'Rules Engine' type capability that supports standard rules like this one, or PID algorithms and that sort of thing. You can do it with an event monitor, but that means writing some CML. Event monitors aren't really much used. Actually I don't know if anyone has ever used one since I created them.
Dean Roddey
Software Geek Extraordinaire
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Event entry not responding! Deane Johnson 4 498 12-11-2017, 02:10 PM
Last Post: Dean Roddey
  Writing to an external file from trigger event Ira 21 2,768 11-13-2017, 02:08 PM
Last Post: znelbok
  High Level Triggers and Action rules admin screen kfly 1 401 11-01-2017, 05:21 PM
Last Post: Dean Roddey
  Motion Event Running Twice? zra 2 786 07-31-2017, 08:15 PM
Last Post: zra
  are triggers reliable? indygreg 4 1,030 06-29-2017, 11:52 AM
Last Post: Dean Roddey
  COuld not update triggers znelbok 11 1,950 06-08-2017, 03:55 PM
Last Post: znelbok
  EVent Server Monitor znelbok 1 687 06-07-2017, 12:36 PM
Last Post: Dean Roddey
  Problem with Triggers pjgregory 11 2,627 05-11-2017, 11:36 PM
Last Post: pjgregory
  I have an event that I want to happen 5 hours after sunset. ghurty 8 1,838 03-24-2017, 08:40 AM
Last Post: Dean Roddey
  Scheduled Event - Yearly Basis Bugman 2 812 11-07-2016, 04:44 PM
Last Post: Dean Roddey

Forum Jump:


Users browsing this thread: 1 Guest(s)