AggreGate Agent

Top  Previous  Next

AggreGate Agent Plugin is a Data Transfer/Device Plugin that allows LinkServer to interact with Agent. Technically, Agent is a BASIC application that creates and maintains a Context Tree with a node for each physical Device (piece of hardware) connected to it. Actually, a Device may also be implemented by custom code that is a part of Agent. The variables of each Device context correspond to the Device's settings. Each such context also has functions which let you perform some operations with the Device, and events which are used to monitor the Device's state and changes in its operating conditions. LinkServer uses the AggreGate Communications Protocol to communicate with Agent.

Global Settings

Use Common Tables as master value of Device settings. Enables of disables synchronization with Common Data feature.
Synchronization Interval. Default is 60 seconds. Defines how often the plugin synchronizes Agent and LinkServer.
Command Timeout. Default is 20 seconds. This timeout may be increased if connection between LinkServer and Agent is very slow.

Synchronization

Agent plugin performs synchronization of LinkServer and Devices provided by Agent according to the following algorithm:

1. Reads the list of available contexts and their parent-child relationship from the Agent.
2. Creates a server context for every context found in Agent. This context allows AggreGate users to interact with Agent directly or through a variable cache.
3. Synchronizing Agent's internal real-time clock with the time on the server. Time is converted to the time zone specified for the Device Server.
4. Reads definitions of variables, functions and events from every context available in Agent. It doesn't read the values contained within these Data Tables yet -- just their format. More about variable definitions here.
5. Finds common tables that may be used as a "master values" for variables found in Agent (such as Device settings).
6. Creates a property cache (if this is the first time this Device Server is connecting) or updates it according to variable definitions read on the previous step. Only variables that belong to the group named default are synchronized with the server and available for editing by users. The property cache is created only in server contexts corresponding to Device contexts in Agent. Variables corresponding to internal Agent settings are modified by the server directly, without a cache.
7. Sets up a Configure Device action in every context corresponding to a Device context in Agent.
8. Creates an appropriate action for every Device context function within the default group. Such an action allows users to call the Agent function, specify its parameters and view its output.
9. Sets up a Monitor Related Events action in every context corresponding to a Device context in Agent to show all events arriving from Agent which belong to the default group.
10. Synchronizes variable values between the server cache and Agent for every context corresponding to a Device context in Agent.

note_further-wt

The exact structure of communications between Agent and LinkServer during synchronization is described under Communications Between Agent and LinkServer.

Device Contexts Provided By Agent Plugin

As stated above, the Agent plugin creates LinkServer contexts to map contexts provided by Agent hardware:

Data Terminals context, providing access to the settings, operations and events provided by Agent itself, that are common to all Devices connected to it. This context is created under the Device Server context for the Device Server emulated by Agent BASIC application.
Data Terminal contexts for Devices connected to Agent. These contexts reside "below" the Devices context.

This is what Agent contexts look like in AggreGate Client:

ls_agent_contexts

Additional Actions of Agent's Devices Context

Devices Context provided by Agent can have several additional actions. Most of them are defined by a custom Agent BASIC application. For example, if Agent works with some sensors of terminals that are connected to its serial ports, there may be a Detect Devices action causing Agent to rescan its serial ports, find out which devices are currently connected and update list of provided Device Contexts.

There are two additional actions of Devices Context that are always provided by Agent:

Configure Agent

This Configure action is used to configure Agent itself, i.e. set parameters of defining how Agent communicates with hardware devices connected to it, how it converts the native protocol of these devices to AggreGate Communications Protocol and what variables, functions and events are provided by Agent in Device contexts corresponding to these devices.

Reboot Agent

This action reboots programmable module that runs the Agent BASIC application. Technically, this is a Call Function action that calls reboot function from Agent's root context.