Skip to main content

Example: Proxy

Product: CODESYS Application Composer

This example shows how to use proxies. Proxies make it possible for module instances to communicate with each other. The parts of applications are on different controllers.

Description

The modules of this example describe a building and a shed, each of which has its own controller and therefore each runs on physically separated hardware.

In the building, the shed is referenced via a "shed proxy", which has been created specifically for the shed module for when communication is necessary. Via the "shed proxy", the controller of the building can exchange (send and receive) information with the controller of the shed.

Communication beyond the controller limits takes place by means of network variable lists which are created and configured automatically by the CODESYS Application Composer if necessary. The proxy is not implemented by means of "MirrorVars". There is no communication via the prepared "RMP".

_ex_ac_img_proxy1.png

For more information, see: Proxies section.

Additional information

In order to run this example, you need to use two controllers which are connected in the same network. After you have created both applications using the CODESYS Application Composer, downloaded them to the controller, and started them, you can use the existing visualizations to observe and test them.

For example, a controller running on CODESYS Control Win can be used as a second controller on a configured virtual machine.

All function blocks which should be used as proxies must itself extend the AC.ProxyInstance function block or implement the AC.IProxyInstance interface. The proxy function blocks often also implement the same interface as the module for communication to take place.

_ex_ac_img_proxy2.png

If "MirrorVar" variables are used, then the variables which are transferred or mirrored from the module to the proxy must be available in the function blocks of both applications with the same name and type. This can be specified in the module declaration.

In addition to mirrored variables, communication can also take place via RMP. This is done in the main parts of the proxy instances and one of the cyclically called methods of the module function block. A 64-byte array is available for this purpose with read and write access for each instance.

System requirements and restrictions

Programming system

CODESYS Development System (version 3.5.17.0 or higher)

Runtime system

CODESYS Control Win (version 3.5.17.0)

Add-on components

CODESYS Application Composer

Note

_example_icon.png DOWNLOAD Projects