OPC Device Support |
last Modified: by winkler
|
• Author: Winkler, Kuner
The OPC device driver provides direct access for EPICS records to items located on an OPC server. It has the following features:
• Data conversion for all integer and float data types.
• Out-records become bidirectional In/Out-records. The EPICS Out-record will be updated if the OPC item is written by another device (e.g. PLC).
• Support for the following record types:
• The data conversion capabilities of the binary records (bi, bo, mbbi, mbbo, mbbiDirect, mbboDirect) are supported with two dtypes "OPC" and "opcRaw" as described in the Record Reference Manual for the "Soft Channel" and "Raw Soft Channel" types.
• Timestamp is generated by OPC server or EPICS (source is determined by the record's TSE field).
• OPC quality is mapped to record's STAT/SEVR fields.
• Configure the OPC client with special features:
• Available console commands for debugging purposes:
• The windows installable will install these files (full installation):
C:\Program Files\OpcIocShell\ copyright_en.txt readme.html unins000.dat unins000.exe bin\ asHost.dll asIoc.dll ca.dll caget.exe cainfo.exe camonitor.exe caput.exe caRepeater.exe cas.dll ca_test.dll Com.dll dbIoc.dll dbStaticHost.dll dbStaticIoc.dll dbtoolsIoc.dll gdd.dll iocLogServer.exe miscIoc.dll opcClient.dll opcIocShell.exe opcSupport.dll OTB.DLL recIoc.dll registryIoc.dll rsrvIoc.dll softDevIoc.dll TBCVS2017.DLL testDevIoc.dll VC_redist.x86.exe (This file can be deleted without risk.) dbd\ opcDev.dbd demo\ DemoRecord1.db DemoRecord2.db st.cmd startDemo.bat
The opcIocShell_4_1_0_2.exe will install iocShell and its .dll's in a proper way.
It will also install Visual Studio 2017 runtime libraries (needed for OPC libs)
and service opcEnum (needed for discovering of OPC servers).
Creates a report of all records that use OPC device support. Output format:
epicsName, Record Type, Dtype, opcName, opcFullName
• Syntax: opcIor nameFilter typeFilter OpcNameFilter
List of connected OPC servers, groups and number of items per group
• Syntax: opcGroupList
There is a special way to add groups and items to an OPC server. The st.cmd file is more than the commands of the iocShell. It is also parsed by the OPC interface routine! The idea is to have one file to setup the iocShell and also the opcClient. See the example:
• Example : of an st.cmd that shows the OPC client configuration:
dbLoadDatabase "../dbd/opcDev.dbd"
opc_registerRecordDeviceDriver pdbbase
# OPC server MMIOPC.Simulator has instance ID 1
# OPC server MMIOPC.Simulator has class id (CLSID) {c0a8e7e6-0846-476d-9bc5-44e047e003e4}
opcSetServer("1","opcda:///MMIOPC.Simulator/{c0a8e7e6-0846-476d-9bc5-44e047e003e4}")
# OpcGroup#1 has instance ID 11
# OpcGroup#1 has update rate of 2000 milliseconds
# OpcGroup#1 is connected to server instance with ID 1
opcSetGroup("11","OpcGroup#1","2000", "1")
&nbstp;
# OpcGroup#2 has instance ID 12
# OpcGroup#2 has update rate of 1000 milliseconds
# OpcGroup#2 is connected to server instance with ID 1
opcSetGroup("12","OpcGroup#2","1000", "1")
# OpcGroup#2 has instance ID 13
# OpcGroup#2 has update rate of 200 milliseconds
# OpcGroup#2 is connected to server instance with "ID 1"
opcSetGroup("13","OpcGroup#2","200", "1")
dbLoadRecords("./DemoRecord1.db")
dbLoadRecords("./DemoRecord2.db")
iocInit()
record(ai,"TEST:sinus") {
field(DESC,"my sinus")
field(SCAN,"I/O Intr")
field(DTYP,"opc")
#OPC variable Simulator.SinDouble is connected to OPC group with ID 11
field(INP,"11 Simulator.SinDouble")
field(TSE,"0")
#TSE=0 => EPICSTIME=SYSTEMTIME
#TSE=-2 => EPICSTIME=OPC-SERVER-TIME
field(PREC,"6")
field(EGU,"rad")
#PINI=0 UDF INVALID until OPC server updates value
#PINI=1 value will be read and UDF gets VALID
field(PINI,"1")
}
record(ai,"TEST:sinusInt") {
field(DESC,"my sinus as integer")
field(SCAN,"I/O Intr")
field(DTYP,"opc")
#OPC variable Simulator.SinInt is connected to OPC group with ID 12
field(INP,"12 Simulator.SinInt")
field(TSE,"0")
#TSE=0 => EPICSTIME=SYSTEMTIME
#TSE=-2 => EPICSTIME=OPC-SERVER-TIME
field(PREC,"6")
field(EGU,"rad")
#PINI=0 UDF INVALID until OPC server updates value
#PINI=1 value will be read and UDF gets VALID
field(PINI,"1")
}
record(ai,"TEST:RampInt") {
field(DESC,"integer")
field(SCAN,"I/O Intr")
field(DTYP,"opc")
#OPC variable Simulator.RampInt is connected to OPC group with ID 13
field(INP,"13 Simulator.RampInt")
field(TSE,"0")
#TSE=0 => EPICSTIME=SYSTEMTIME
#TSE=-2 => EPICSTIME=OPC-SERVER-TIME
#field(TSE,"-2")
field(PREC,"6")
field(EGU,"%")
#PINI=0 UDF INVALID until OPC server updates value
#PINI=1 value will be read and UDF gets VALID
field(PINI,"1")
}
Used only in st.cmd, not from the command line. It configures iocShell for connecting to OPC server.
It's possible to connect iocShell to miscellaneous OPC servers.
• Syntax:
opcSetServer("serverID", "hostName", "serverName")
• Parameters:
Used only in st.cmd, not from the command line. It creates a new OPC item group at current OPC server. It's possible to create miscellaneous groups with several update rates at same server. According to the OPC "Data Access" specification it is mandatory to define at least one group.
• Syntax:
opcSetGroup("groupID", "groupName", "scanRate", "serverID")
• Parameters: