General driver

The general driver is a collection of classes, covering the functional range that every driver in WinCC OA should possess. It also defines an interface to the hardware-specific part. The general driver includes the following functionality:

  • Initialization of the data point type and data point container
  • Conversion of the internal data point names to DP identifiers (via data manager)

    The conversion of a DpIdentifier to a string with unknown DP returns the number of the DpIdentifier.

  • Registration with the event manager for the data points (or peripheral addresses), which are configured for outlet
  • Registration with the Event Manager for driver-internal data points
  • Assignment of peripheral addresses to hardware addresses, and vice versa
  • Connect mechanism (Event manager registers for attributes with the driver)
  • Request handling (Handling queries of attributes of configs that are administered by the driver)
  • Polling (Cyclic queries of input values)
  • Transformation (HW data formats to WinCC OA data formats and vice versa)
  • Command or message conversion and smoothing
  • Reconnect in case of event manager failure
  • Monitoring of connection(s) to hardware components (Alive mechanism)

This functionality is implemented as far as possible using virtual functions in such a way that by deriving a separate class and defining separate functions, the processing can be modified. Naturally, only the special cases should lead to this treatment: in the normal case, the methods of the base class should be called up for processing.

The (software) interface to the hardware was implemented as an empty class, which must naturally be derived and implemented for every real driver (HWService!).

If more than three drivers are used and consequently new data point of the type _DriverCommon are created, they also have to be considered in the config file config.redu.


The general driver executes the following phases (these correspond to the routines used):

  • init()
  • connectToData()
  • HWService.initialize()
  • connectToEvent()
  • HWService.start()
  • mainLoop()
  • HWService.stop()

After the start, the various driver modules are initialized (using init()). The methods available for this are:

  • install_DpContainer(): Initialization and linking of the data point container
  • install_DpConfigManager(): Initialization of the driver-internal config manager
  • install_HWMapper(): Installs the assignment table between hardware objects and data points
  • install_HWService(): The HWService handler is the interface to the hardware and contains all methods of communication with the hardware. This part is always derived.
  • install_PollGroupList(): Management of the data points that are queried cyclically using poll groups.
  • install_PollList(): Management of the data points to be cyclically polled using poll list. As of 3.0 only required for compatibility reasons.
  • install_IOTransCont(): Management of transactions of I/O addresses.
  • set_DpConfigInitList(): Sets pointer to list of the config types, which the data manager should send after a connection is set up.

After this initialization, the connection to the data manager is set up (connectToData()) and the configs for the driver are sent by the data manager. The HWService Object is then initialized (HWService.initialize()). The connection to the event manager is established (connectToEvent()). The communication of the hardware-specific part of the driver is started (HWService.start()). Communication with the periphery is usually also established at the same time. The driver then runs in a loop, in which it waits for messages, checks whether data points of peripherals should be polled, and cyclically calls a work procedure (workProc()) of the HWService object, which handles and processes data coming from peripherals, sending responses as necessary. Messages that concern the driver's internal data points are passed on to the HWService object.

If any peripheral address is set to polling, the HWService::singleQuery() is called at the configured times, to retrieve the value. In addition to this, the spontaneous messages are processed in the HWService::workProc(). Value message are processed in the HWService Object by calling the toDp() function of the Drv manager. This accepts a hardware object, performs a low-level old-new comparison as necessary (can be configured, based on a byte-wise comparison of the hardware object data buffer), converts it into a WinCC OA internal data format (with a suitable transformation dependent on the data format), performs conversion and smoothing as necessary and sends it (if it was not smoothed away in the previous steps) to the event manager.

In the command direction the function toHW() looks after the conversion of WinCC OA data points into hardware objects, which are then sent to the peripherals by the method HWService::writeDate(). Data that is handled by the communication protocol as a unit (these usually belong together logically too) must also be configured as a group (in the peripheral address config). These are then also automatically registered by the general driver as a group, so that for every data change by a user, the event manager sends the entire group to the driver together. This already collects the data as a package in the routine toHW(), and it is transferred to writeData() as a single hardware object.

Before the driver is terminated, the function HWService.stop() is also executed, to handle a regulated disconnection with the peripherals.

Chapter Description
Basics General Driver General overview and links to the chapters
Classes Introduction to the classes.
DrvManager The DrvManager is the manager class of the driver. It is itself derived from the base class manager.
DrvRsce The class DrvRsrce represents the interface to the resources (the configuration file).
DrvDpCont This class - derived from DpContainer - implements the special features of the driver data point container such as conversion or smoothing configs, which can also be defined at nodes in the data point and apply for elements at a lower level.
DrvDpConfMan DrvDpConfMan is a manager for the driver's configs.
HWMapper This class is used for the mapping of periphery to hardware addresses and vice versa.
Transformation Transformations describe the relationship between the hardware object and the representation in WinCC OA.
HWMapDpPa This class establishes the connection between peripheral address config and DP identifier.
HWObject HWObject is the base class for a hardware object.
HWService This class contains the interface between the general driver and the hardware-specific part.
DrvAlive Forms the base class for the implementation of an Alive mechanism for a physical connection.
PollGroupList Is a dynamic list of poll groups that contain the addresses to be polled. The poll group list is sorted by the poll time.
PollGroup Are the individual entries of the PollGroupList.
Implementation For the implementation of your own driver, new classes must be derived from the classes defined in the general driver: