Policy assisted actions in EVA ICS

I was given by one of our team members of the link to the article, where the joined team of engineers from 3 USA universities reviewed industrial and home automation systems, including EVA ICS. First of all, I must say I am proud and impressed that our platform becomes more and more popular in IoT world, second – I am happy EVA ICS shown the best results in tests, third – I would like to ask the article authors to review EVA ICS 3.3.x, which has got, in comparison to 3.2.x, more improved asynchronous core, which gives huge speed and memory advantages.

However, it was mentioned, EVA ICS has no policy-based actions, which is incorrect, and let me explain how to use them in the real production:

If there is necessary to execute policy-based actions in EVA ICS, the first rule is – do not execute them directly on the unit. For the security purposes it is even better to completely block read-write access to the desired unit for users, using API key ACL policies, leaving only read-only state access.

Instead of calling the unit actions directly, use EVA ICS LM PLC and create a macro. E.g. let us create a macro, which opens the door “unit:zone1/door1”, but only if a security sensor “sensor:zone1/security1” has the value “1”:

eva lm macro create zone1/door_opener -y
eva lm macro edit zone1/door_opener

Put the following code in the macro body:

if value('sensor:zone1/security1') == 1:
    out = action('unit:zone1/door1', status=1)
else:
    out = None

After execution the “out” variable will contain either “None” (null) if the macro failed to open the door, or the serialized unit action result, which can be used later by HMI or 3rd-party applications to obtain action status by its uuid.

Pretty simple, isn’t it? Well, let us review a more complicated example from the real production.

Condition:

There is dangerous electrical equipment “unit:zone1/u1” installed, which should be turned on only if there was no motion in the dangerous zone for the last 30 seconds. There is a PIR-sensor “sensor:zone1/motion” installed in the zone, which gives value “1” when the motion is detected.

First step: create an access timer and the rule to reset it every time when motion is detected:

eva lm create lvar:zone1/motion_timer -y
eva lm config set lvar:zone1/motion_timer expires 30 -y
eva lm rule create if sensor:zone1/motion.value = 1 then @reset\('lvar:zone1/motion_timer'\) -yE

The timer logical variable will have the status “1” for 30 seconds, after the motion is detected and the status “-1” if there was no motion and the timer is expired. The logical variable will have status “0” if the timer is stopped by a system operator, which should also allow running the electrical equipment.

Second step: create a macro with the following code:

if status('lvar:zone1/motion_timer') == 1:
    # motion detected, refuse actions
    out = None
else:
    # no motion or the timer is stopped by the operator
    out = action('unit:zone1/u1', status=1)

That is it. Just again – do not directly control unit:zone1/u1, use the macro only instead.

EVA ICS is highly flexible and customizable industrial automation platform, which can solve a lot of tasks just out-of-the-box. But remember: if the programmed logic prevents threats to health or life, it is highly recommended either to use hardware-based PLCs in the middle and control equipment with EVA ICS or any other software indirectly, or carefully test and certify your EVA ICS setup with the local authorities.