Coming up..
JBOSS Drool Complex Event Processing for Alarms Management
Most building mediator does not support alarms correlation and for generating alarms if the certain condition remain true over time. This can easily achieved by using Drool Complex Event capabilities.
Check this simple rule, which is If DG set fails to start even after five minutes (In actual this will be combined with some other condition as well)
This rule can be fired on a JSM Queue on which device data is being posted and a stateful session is being maintained.
rule "Generate Alarm"
when
$devpoint: PointValueEvent ( locationId == 11 && deviceTypeId == 16 )
from entry-point DevicePointStream
PointNameValue ( controlParameter == 'FailToStart' && value ==1) from $devpoint.points
$devpoint1: PointValueEvent ( locationId ==$devpoint.locationId && deviceTypeId ==$devpoint.deviceTypeId , this after[5m,*] $devpoint ) from entry-point DevicePointStream
PointNameValue ( controlParameter == 'FailToStart' && value ==1) from $devpoint1.points
then
alarm(kcontext, $devpoint);
retract($devpoint);
retract($devpoint1);
end
Check this simple rule, which is If DG set fails to start even after five minutes (In actual this will be combined with some other condition as well)
This rule can be fired on a JSM Queue on which device data is being posted and a stateful session is being maintained.
rule "Generate Alarm"
when
$devpoint: PointValueEvent ( locationId == 11 && deviceTypeId == 16 )
from entry-point DevicePointStream
PointNameValue ( controlParameter == 'FailToStart' && value ==1) from $devpoint.points
$devpoint1: PointValueEvent ( locationId ==$devpoint.locationId && deviceTypeId ==$devpoint.deviceTypeId , this after[5m,*] $devpoint ) from entry-point DevicePointStream
PointNameValue ( controlParameter == 'FailToStart' && value ==1) from $devpoint1.points
then
alarm(kcontext, $devpoint);
retract($devpoint);
retract($devpoint1);
end
One of the problem faced in building management system is, how to constraint the creation of schedules for certain location/devices/time/device properties etc. One can use JBOSS Drool to achieve this. I am using this by in process deployment of JBOSS Drool.
One sample rule for a invalid location and a device type
rule "Invalid Location and Device Type"
when
$schedule: Schedule ( locationId == 11 && deviceTypeId == 32 )
then
error(kcontext, $schedule);
end
Other Major problem while creating schedules because user might end up creating conflicting schedules. One simple matching rule can address this problem. This rule will take care that A is never matched with A itself and you do not get A= B and B = A
rule "matchingSchedules"
when
$s1: Schedule($id1:identifier, $locId:locationId, $devTypeId:deviceTypeId, $devId: deviceId, $fDate: fromDate, $tDate: toDate)
$s2: Schedule(identifier != $id1 , locationId == $locId, deviceTypeId == $devTypeId, deviceId == $devId, fromDate == $fDate, toDate == $tDate, eval($s1 != $s2))
then
matching(kcontext,$s1, $s2);
end
Subscribe to:
Posts (Atom)