How to handle multiinstance

Find and share HowTos to various installations / configurations!
Search

Post Reply
2 posts • Page 1 of 1
AdrianSan
Posts: 13
Joined: Thu Aug 27, 2020 5:17 pm

How to handle multiinstance

Post by AdrianSan »

Hello,

I have been working on some multiinstance related issue. My client's PLC writes alerts the following way:

They write the pending alerts of a PLC on a dyn_int DPE, where each value means alert code, so when the dyn_int changes I create by CTRL a multiinstance alert (in another DPE, typed INT) for each entry the array has.

When a change comes in the array of codes, I want to query the alarms in the multiinstance DPE, and then remove from there the alerts which are no longer in the array, or raise a new alert if it is in the array but not in the DPE:_alert_hdl.._alerts.

That is my intention but I am having troubles because I am not sure about what to put in the alertSet function. The 3rd and 4th are of course, DPE:_alert_hdl.2._event, DPATTR_ALERTEVENT_WENT (or CAME) but I do not know what to put in alertTime and count, in both cases, when it comes and when it goes.
I keep getting this error at the log 23, Setting/modifying attributes failed and I guess it is due to this alertTime and count.

Clarification: All the multiinstance thing is done by CTRL code, with nothing to do with the driver.

I am using the first version of 3.18. Any help is appreciated.

User avatar
leoknipp
Posts: 2926
Joined: Tue Aug 24, 2010 7:28 pm

Re: How to handle multiinstance

Post by leoknipp »

If you want to modify a pending alert instance using alertSet() you have to pass the alert time (time when the alert was raised) and the count information.
This information you can get by doing a dpQuery() with SELECT ALERT do get the current alarm information for a specific DP element.

Best Regards
Leopold Knipp
Senior Support Specialist

Post Reply
2 posts • Page 1 of 1