Configuring LOWIS to communicate with devices using OPC requires a series of configuration settings that have to be coordinated together for communications to actually succeed. These settings are placed in the appropriate OPC Manager, COM Port and Scan Task sections.
To start off, the COM Port needs to be created as (or converted to) an OPC Port type (within the COM Port the Port Type setting will be OPC if this is already set). Once this has been configured, the important configuration settings are OPCMGRS and the pair of OPC Server and OPC Server Name settings.
The OPCMGRS settings need to set to the section name of the OPC Manager process that will be responsible for processing requests that are meant for the OPC Server process that this COM Port is being configured to interact with. Despite the plurality implied by the name, this setting can only point at a single OPC Manager process.
The other key settings are the OPC Server and OPC Server Name settings. OPC Server needs to be set to the ProgID of the OPC Server process that needs to be connected to, and OPC Server Name is the name of the machine on which the OPC Server process is running. OPC Server Name can be skipped (unspecified) if the OPC Server process is running on the same machine where the OPC Manager process will be running.
OPC Manager settings are found in the Configuration section under Common->Server->Processors-OPC Manager Root, with there being one section for each OPC Manager configured on the system. The key settings in these sections are OPC Configs and Dbg Level. OPC Configs is a comma delimited list of COM Port sections that this OPC Manager is responsible for communicating with.
DBG Level is bit flag value that controls the diagnostic output that will be generated by this OPC Manager process. The flags are provided in a listbox, each with its own check box to enable/disable that particular flag. These flag values are detailed in the OPC Manager Debug Levels article.
Scan Tasks (Native)
For those scan tasks used for talking to non-OPC protocols being configured to talk OPC, there are some special settings that will need to be added when OPC is involved. The key setting that will need to be added is a setting for each COM Port (and named the name of the COM Port) that will be using OPC. The purpose of this setting is to specify the pattern that is to be used to generate the automatic tags for each register that is being requested. As an example, if we were trying to configure the SAMRPC scan task to talk to an OPC Server on com20 with the typical SAMRPC tag generation, a COM20 setting would be added to the SAMRPC scan task configuration with a value of LUFAUT.
There are 3 other settings that are specific to modbus devices and OPC. The first is OPC_RegOffset, which can be used to specify the register offset to be used just for OPC communications in case a different value is need than is needed for normal native communications (the default value for this setting is the RegOffset used for native communications).
The second setting is GenericIntegersAreUnsigned and requires a bit more explanation. The modbus specification doesn't really specify datatypes, and as such each modbus device has the option to have any datatype for each register as long as the software consuming it knows what that datatype is. For most of LOWIS's existance, 16 bit integers were just configured in LOWIS as shorts, whether the range of values were signed (-32767 to 32767) or unsigned (0 to 65535) was only considered within the context of the analog point the data was being placed into. With many OPC Servers not having built in register maps and relying on either the tag configuration to specify whether the value is signed/unsigned or requiring the OPC tag to specify this, it became necessary for LOWIS to now need to know whether these shorts are signed or unsigned. For newer modbus devices, care has been made to make sure that LOWIS's register map makes this distinction, but the older pre-OPC register maps have not be updated to have this distinction, so this GenericIntegersAreUnsigned setting was added to specify on tag creation that any registers not explicitly specified as signed or unsigned should be treated as signed (setting is 0) or unsigned (setting is 1). If only a few registers need this distinction it is often better to just update the register map for those few registers to be the correct designated sign type.
The third setting specific to modbus and OPC is GenerateModifiers. This setting (default is 0/off) is turned on when the OPC Server requires that the datatype of the register be included as part of the generated tag name so that it will know how to process the data out of the device's reply. There is also a COM##GenerateModifiers option available (where ## is the Com Port number associated with the OPC Server) to override this setting if a specific OPC Server instance needs a different setting than the others when more than one OPC Server provider is being used.
Currently, the following scan tasks support OPC communications:
Scan Tasks (OPC Specific)
Scan tasks that are just OPC only have an additional configuration requirement. Each OPC specific scan task can only be used to talk to a particular OPC Server instance, so like the COM Port configuration it needs to have a OPC Server and OPC Server Name set of settings. For communication to work properly though, there must also be a COM Port configured with the same OPC Server and OPC Server Name values (at a case sensitive matching level), and there can only be one such COM Port configured. This requirement is due to the fact that when requests are sent to an OPC Manager for processing they include the COM Port number that is associated with the OPC Server instance to be used. To figure out this COM Port number the OPC scan task will go through the list of all available configured COM Ports and try to identify the one COM Port that has matching OPC connection information. The COM Port section found also identifies which OPC Manager instance the request should be forwarded to for processing.