RevPi 7 is a service that can exchange data between a Siemens S7 controller and the RevPi. By using the Step7 protocol, requests are sent cyclically to the S7. These contain requests to write or read the global memory areas (inputs, outputs, flags and data blocks). The Siemens control responds to these requests with an acknowledgement or with the requested data.

RevPi7 is created in PiCtory as a virtual module in the device catalog and is also configured there.

The STEP7 protocol is provided via the SNAP7 library and a Python wrapper. The service is implemented via a Python script, which imports the SNAP7 library. When the PiControl driver is started/reset, the Python script reads the _config.rsc file to determine the configuration data.

Several instances of the service can run or several virtual RevPi7 modules can be processed in one instance. 128 bytes input and 128 bytes output are reserved in the PI for each virtual RevPi7 module. If necessary, modules with 512 and 1024 bytes per direction are provided.

Implementation of the RevPi7 service

The RevPi7 service is divided into several tasks. One task is responsible for accessing the process image and clearing the error status. All other tasks write and read values exclusively via this task.

Each job from the list is converted into a separate task with timer. These tasks each use blocking calls to the SNAP7 library for the job. Returned error codes are written to the corresponding status bytes in the PI. A separate task monitors the reset of PiControl and in such an event terminates the job tasks in order to reset them in accordance with _config.rsc. This task is also started after the service is initialized.

Log entries are only written if the service was started with a switch -d (debug).

The service does not terminate itself if a connection cannot be established, but attempts to establish the connection periodically. Should communication problems occur later, the connection will also right itself (e.g. RJ45 connector temporarily disconnected).

The error statuses remain permanently stored in the process image and are only reset when the reset flag is set in the PI.