Skip to content

C++ Driver for communication between Siemens S7200 devices and the WinCCOA environment

License

Notifications You must be signed in to change notification settings

cern-hse-computing/WinCCOA-S7200

Repository files navigation

CERN HSE Computing (HSE-TS-CS)

Contact email: hse-cen-co@cern.ch

WinCC OA S7200 Driver

Table of contents

  1. Description

  2. Libraries

  3. Compilation

    3.1. To build the driver

    3.2. To Install

    3.3. Run

  4. Config file

  5. WinCC OA Installation

  6. S7200 Driver Technical Documentation

    6.1. Main entry points

    6.2. Addressing DPEs with the S7200 driverl

    6.3 Driver configuration

    6.4 Activity diagram

1. Description

This WinCC OA driver enables bidirectional data transfer between S7200 devices and the WinCCOA environment, with support for multiple polling intervals and consolidated write functions.

Additionally, the driver offers compatibility with multiple IP addresses, making it a versatile and reliable tool for data integration.

2. Libraries

  • C++11 STL
  • WinCC OA API libraries
  • Snap7

3. Compilation:

Project has a Makefile. Note that you can also set the PVSS_PROJ_PATH environment variable beforehand.

3.1 To build the driver

make

3.2 To install

make install PVSS_PROJ_PATH=<path_to_pvss_project_bin_folder>

3.3 Run

It can be run from the WinCCOA Console or from command line and it will require the config.S7200 file:

./WINCCOAS7200Drv -num <driver_number> -proj <project_name> +config config.S7200

4. Config file

The config.S7200 file has to be present under the WinCCOA project folder config.

When configuring the file, it is necessary to specify the local and remote TSAP ports, as well as the minimum polling interval required for seamless communication between the WinCCOA environment and external devices or systems.

Here is an example config file:

[S7200]
# Define local TSAP port 
localTSAP = 0x1401

# Define remote TSAP port 
remoteTSAP = 0x1400

# Define polling Interval (Utilized if it exceeds the interval specified in the variable address)
pollingInterval = 3

5. WinCC OA Installation

Under the winccoa folder you will find the following files that you need to copy to your project in the corresponding paths:

  • dplist/S7200_driver_config.dpl : it contains internal driver & CONFIG_S7200 DPs. Once you've successfully launched the driver in the WinCC project manangement, you can import it via the ASCII Manager(refer to the official WinCC OA Documentation).

Notes:

* This is a specific dump of the REMUS redundant project DPs 
* The internal driver number in the dump is 14. If it's unavailable to you, try to modify the dump file directly. 

See 6.3 Driver configuration section for a brief descprition of relevant CONFIG_S7200 DPEs.

6. S7200 Driver Technical Documentation

6.1 Main entry points

After the driver startup, the main entry points in the driver are:

  • S7200HwService::writeData() -> WinCC to Driver communication

    This is how the variables with IN/OUT or OUT mode are pushed to S7200. Thanks to the addressing <IP>$<ADDRESS>, the driver will be able to write at the appropriate memory location.

  • S7200HwService::workProc() -> Driver to WinCC communication

    This is how we push data to WinCC from S7200. Thanks to the addressing <IP>$<ADDRESS>,the driver will be able to map the data ingested from the respective S7200 memory location to the WinCC DPE.

Please refer to the WinCC documentation for more information on the WinCC OA API.

6.2 Addressing DPEs with the S7200 driver

6.2.1 Data Types

When the S7200 driver pushes a DPE value to WinCC, a transformation takes place. See Transformations folder. We are currently supporting the following data types for the periphery address:


WinCC DataType Transformation class Periphery data type value
bool S7200BoolTrans.cxx 1000 (TransUserType def in WinCC OA API)
uint8 S7200Uint8Trans.cxx 1001 (TransUserType + 1)
int32 S7200Int32Trans.cxx 1002 (TransUserType + 2)
int64 S7200Int64Trans.cxx 1003 (TransUserType + 3)
float S7200FloatTrans.cxx 1004 (TransUserType + 4)
string S7200StringTrans.cxx 1005 (TransUserType + 5)

6.2.2 Adding a new transformation

To add a new transformation you need to do the following:

  • create a define in S7200HWMappeer.hxx

      #define S7200DrvDoubleTransType (TransUserType + 7)
    
  • handle the new transformation type in S7200HWMapper::addDpPa()

  • implement the transformation type class. The important functions here are

    • ::toPeriph(...) for WinCC OA to S7200 driver transformation
    • ::toVar(...) for S7200 driver to WinCC OA transformation

6.3 Driver Configuration

Available via the WinCC OA CONFIG_S7200 DataPoint, we have the following

Config DPE Direction Addressing Type Description
DebugLvl OUT DEBUGLVL INT32 Debug Level for logging. You can use this to debug issues. (default 1)
Driver Version IN VERSION STRING The driver version

6.4 Activity Diagram

About

C++ Driver for communication between Siemens S7200 devices and the WinCCOA environment

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published