Logic Manager

EVA Logic Manager (LM PLC) - is a programmable logic controller.

This subsystem is designed to automatically manage hardware and decision-making
process when the metrics are changed. Unlike standard PL controllers, LM PLC is
a network-based controller, its mission is to control equipment in local
networks and work as cloud controller via the Internet.

LM PLC operations can be event-based, cycle-based, and called manually by used.

LM PLC is customized and controlled via LM EI web interface or
eva lm (lm-cmd) console application. It can also be integrated
into other subsystems and third-party programs using LM API.

LM PLC additionally introduces one more control and monitoring item:
logic variable (lvar). Logic variables are used to save and
exchange system status data as well as function as flags and timers for
organizing production cycles.

Any change in the status of units, sensors or logic
variables is analyzed by the decision-making matrix of
a certain LM controller. In case the rule conditions match, the controller
calls the indicated macro that performs the specified actions.

Logic variables statuses are stored in the local database and can be accessed
via LM API by other subsystems or third-party programs. Status
changes are sent via notification system. To let LM PLC
operate with the items of UCs in real time, it should be
connected to MQTT server.

Since LM PLC is a part of EVA platform, its operating principles, settings, and
configuration files generally match the other components.

runtime/lm_cvars.json variables file

Variables can be changed while the server is running via SYS API as
well as eva lmcvar get and cvar set commands.

etc/lm_apikeys.ini API keys file

API access keys are stored into etc/lm_apikeys.ini file. At least one full
access key named masterkey should be present for proper functioning.
Important: with master key and API anyone can receive full access to the system
similar to root user (or the user LM is run under), that is why it is
recommended to use this key only in supervisory networks or even restrict its
usage to local host only.

Connecting UC controllers

Prior to UC connection, it is necessary to connect LM PLC to MQTT
server, where other controllers will send the events. Logic Manager
reads the list of items and their initial status from the connected
controllers; further status monitoring is performed via MQTT. In case MQTT
server is inaccessible or has data exchange problems, states of the items are
updated on every remote controller reload (reload_interval prop).

When connecting, it is necessary to indicate minimum URI of the connected
controller and API KEY functioning either as a master key or the key with
access to certain items. If Logic Manager and UC keys are the same, the key can
be set as $key (\$key in the command line). In this case, LM will use the
local key of its own configuration.

eva lm controller append http://localhost:8812 -a secretkey -y

Configurations of connected controllers are stored in the following folder:
runtime/lm_remote_uc.d/

Items from remote controllers are loaded at the LM PLC start and then refreshed
with reload_interval frequency set individually for each connected
controller. If LM PLC fails to get the item list during loading, it will use
the existing one.

To control the list of the received items you can use eva lm or
LM API function list_remote:

eva lm remote -p unit
eva lm remote -p sensor

All connected controllers have the following properties that can be changed
while LM PLC is running:

When managing the connected controllers, ID can be either the controller ID
only or the full ID in the following format: controller_type/ID (i.e.
uc/controller1).

Macro execution queues

Prior to execution, the macros are put into global queue. The
macros are executed progressively without waiting for the completion of the
previous macro. The queue is used for reporting only and reserved for some
internal functions. If a macro is required to block execution of the other
ones, one should use lock and
unlock macro functions operating similarly to
SYS API locking.