Provides a data source PLC Siemens by means of Hilscher CIF cards, by using the MPI protocol, and LibnoDave library, or self, for the rest.
License:
GPL
Introduction
The primary aim of creating the module is to provide support for industrial controllers of firm Siemens of series S7(S7-200,300,400). Historically, access to the controllers of the firm in the ProfiBus network is made only through its own communication processor (CP5412, CP5613, etc.) and the protocol S7. These communications processors and API to the protocol S7 are rather expensive, in addition to the drivers for the communication processors and S7 API are closed and are only available for the platform Intel + MS Windows (I met the information on opportunities to buy for Linux).
As an alternative to communication processors of the company Siemens, which allows you to fully work with the controllers of Siemens, is the range of communication products of firm Hilscher(http://hilscher.com), through the communications processors CIF of series PB(Profibus) and the library LibnoDave (http://libnodave.sourceforge.net).
Feature of the Hilscher products is completely open specification of the protocol of exchange with the communication processor, the unified driver for all cards CIF, the availability of drivers for many common operating systems(OS) and openness of the driver for OS Linux(GPL).
The basis of the module is the driver of version 2.621 of Hilsher, kindly provided by Hilsher in the face of Devid Tsaava for the 2.6 series kernels of OS Linux. Everything needed files to building are included in the module and it is don't needed to satisfy any special dependencies. The driver version 2.621 for the CIF cards is available for download cif2621.tgz.
The range of boards of CIF family of firm Hilsher and unified driver supports the widest range of equipment. To lay support all these features in this module without having all the equipment on hands, it is not possible. Therefore, the support of the equipment will be added on demand and availability of the equipment. As of version 2.0.0 module provides support for data sources on the network via ProfiBus or MPI by means of MPI protocol at the network speed of 9600Bod to 12MBod. In particular, supported and it is carried out check on the controllers of the Siemens company of family S7 (S7-200,300,400).
Library LibnoDave is an implementation of the MPI, S7, ISO-TSAP and others protocols by means of revers-engineering, that are used in interaction with the controllers of Siemens. The library supports many MPI and USB adapters, as well as ProfiNet. Communication processors firm Siemens, on platforms other than MS Windows, the library doesn't support. At this stage, module support the protocol ISO-TSAP (ProfiNet) through the library LibnoDave. Library LibnoDave fully incorporated in this module and does not require a special permit of any dependencies during building and in the performance.
Into the library LibnoDave presents hard-catches errors, which at all reproduced on a high loading, that causes to the process memory corruption and crashes into unexpected points. By this reason from version 2 of the module a process was started to rewrite need functions, and for now the ISO-TCP code rewrote and ready to use.
Also, the module implements the functions of the horizontal redundancy, working in conjunction with the remote station of the same level. In addition to the synchronization of the archives of values and archives of attributes of parameters the module implements synchronization of computational templates, in order to shockless catch of the algorithms.
1. Communication controllers CIF
CIF family card driver supports the ability to install up to 4 CIF boards. In order to control the availability of cards in the system and their possible configurations, the module provides a form of control and configuration of the CIF-cards(Fig. 1).
Fig.1. Configuration tab of CIF-boards.
Using this form you can verify the existence of communication processors and their configuration, and configure the network settings of PB ProfiBus in the form of addresses of communication processor and speeds of bus ProfiBus. In the other tab of the module(Fig.2) you can verify the presence of various stations in the network ProfiBus.
Fig.2. Monitoring tab of ProfiBus network.
2. Object of controller of the data source
To add a data source it is created and configured an object of controller in the system OpenSCADA. Example of the configuration tab of the object controller of this type is shown in Figure 3.
Fig.3. Configuration tab of the controller.
Using this tab you can set:
The state of the controller, as follows: State, "Enable", "Run" and the name of the database containing the configuration.
Id, name and description of the controller.
The state, in which the controller must be translated at boot: "Enable" and "Run".
Name of table to store the configuration of the parameters of the controller.
The acquisition schedule policy and the priority of the task of data acquisition.
Restore timeout, in seconds, after the connection lost.
Mode of asynchronous recording in the remote controllers.
Connection type. Supported:
CIF_PB — connection to controllers series S7, by firm Siemens, by communication unit CIF-50PB or like;
ISO_TCP, ISO_TCP243 — connection to controllers series S7, by firm Siemens, by Ethernet network (TCP243 by CP243);
ADS — TwinCAT ADS/AMS protocol for connection to controllers firm Beckhoff.
Remote controller address. For connections:
CIF_PB — controller address in "ProfiBus" network, digit 0-255;
ISO_TCP, ISO_TCP243 — IP-address into Ethernet network;
ADS — Network identifier and port for target and source stations, in view {Target_AMSNetId}:{Target_AMSPort}|{Source_AMSNetId}:{Source_AMSPort} (for example: "192.168.0.1.1.1:801|82.207.88.73.1.1:801"), where:
AMSNetId — network identifier, write into six digits 0-255, for example: "192.168.0.1.1.1";
AMSPort — port, write into one digit 0-65535.
Slot CPU in which the central processor of the controller is placed.
CIF card used for access to the industrial controller through CIF communication processors.
Output transport OpenSCADA, used by protocol "ADS" (port 48898, 801 for AMS) and "ISO_TCP" (port 102) for requests transmission.
3. Object of parameter of the data source
Given the high intellectuality of data sources in the face of industrial controllers of Siemens S7-200,300,400, the objects of parameter are executed on the basis of templates. This approach allows us to go beyond a rigid list of types of parameters, which limits the possibilities of the controllers, and provide users with the ability to build the necessary types of parameters independently or use the library of already been developed types of parameters (templates).
Accordingly, the module provides only one type of parameters — "Logical". Additional configuration fields of the parameters of the module (Figure 4) is the fields of selected template of the parameter.
Fig.4. Configuration tab of the object of parameter.
To configure a template of parameter it is made the appropriate tab. The contents of this tab is defined by the configuration of the template that is the corresponding link fields and fields of setting the constants are formed.
Types of links depend on the type of parameter in the template (boolean, integer, real and string) and the definition of link value(for the group of links). Definition of the group link in the template is written in the format: "{Name of the link}|{Offset in the database}|{Size of the value}", where:
Name of the link — Name of the group link. All links with the same name are grouped and shown as a link to the database or database with the specified offset. Offset in the database — Name of the offset in the data block (DB). If only database in the configuration of the template is specified the offset will be specified for the parameter, but if in the configuration of the template the offset will be specified too, the both offsets are summarized together. This approach allows to access a variety of structures in single data block. DB number and offset you can set into decimal (3245) and hexadecimal forms (0xCAD). Size of the value — Optional field that specifies a custom size of the value in the controller. The following sizes of types of values are provided:
Integer: — 1 byte(signed), 2 byte(signed by default) and 4 byte(signed). Real: — 4 byte(float by default), 8 byte(double). Boolean: — always one byte (with a bit through the point - DB1.10.1). String: — 10 byte(by default) and 1-200 can be set.
An illustrative example of the overall process of the configuration of parameter form the template and to the values is shown in Figures from 5 to 8.
Fig.5. Example of the template with grouping.
Fig.6. Configuration tab of the template of parameter
Fig.7. Configuration tab of template of the parameter with an indication of the parameters separately.
Fig.8. Values of the parameter.
Module supports only the data blocks(DB) of the controllers addressing.
The module provides a special treatment of a number of attributes of the template:
f_frq — Frequency computation the procedure template, or time after a last calculation, the negative, in seconds, for scheduling by CRON, read-only.
f_start — First calculate of the template's procedure, like start, read-only.
f_stop — Last calculate of the template's procedure, like stop, read-only.
f_err — Parameter error, full access. Value of the attribute is set to the parameter's error attribute "err".
SHIFR — Parameter code, read-only.
NAME — Parameter name, read-only.
DESCR — Parameter description, read-only.
this — Parameter object, allow access to attributes of the parameter, for example to their archives access.
4. Asynchronous recording mode
Standard recording mode for SCADA-systems interacting with the PLC, is the synchronous, because it allows to control the correctness of the conclusion of the record operation. However, in cases of recording multiple parameters at once and often, this approach is not justified in view of sending a multitude of small requests to the controller that overrides the PLC and has a large time interval. The solution is asynchronous recording of an adjacent values by means of the single block. This is supported by this module and it allows you to record all parameters immediately by the adjacent blocks of 240 byte. Read and write in this mode is performed by adjacent blocks with periodicity of survey of the controller.
5. Comments
After a targeted search was found a few solutions of the problem of communication with industrial controllers of firm Siemens through various communication interfaces: