OPC Device Support |
last Modified: by winkler |
• Author : Kuner, Winkler
• Data conversion for all integer and float data types - array support is not yet implemented.
• 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.
• Setup 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\ unins000.dat unins000.exe bin\ asHost.dll asIoc.dll ca.dll ca_test.dll caget.exe cainfo.exe camonitor.exe caput.exe caRepeater.exe cas.dll Com.dll dbIoc.dll dbStaticHost.dll dbStaticIoc.dll dbtoolsIoc.dll gdd.dll iocsh.dll miscIoc.dll opcIocShell.exe opcSupport.dll recIoc.dll registryIoc.dll rsrvIoc.dll SOCltad.DLL SOCmnad.DLL SODaCad.DLL softDevIoc.dll testDevIoc.dll dbd\ opcIoc.dbd demo\ DemoRecord1.db DemoRecord2.db st.cmd startDemo.bat src\ res\ icon3.ico OpcIocShell.ico uninstall.ico ait.h devOpc.c devOpc.h drvOpc.cpp drvOpc.h installationNotes.html iocShellMain.cpp Opc.cpp Opc.h opcApp.rc opcApp.sln opcApp.vcproj opcSupport.dbd opcSupport.sln opcSupport.suo opcSupport.vcproj opcToEpics.h recProp.h resource.h softing.h
The opcIocShell_3_3.exe will install the precompiled iocShell and its .dll's in a proper way.
For recompilation of the opcIocShell the OPC Toolkit from Softing is neccessary. We use OPC Toolkit version 3.01. To run the example, "MMI OPC" OPC-server simulator should be installed. It comes with the "OPC Explorer" from MMI OPC .
Create a report of all records that use OPC device support. Output format:
epicsName, Record Type, Dtype, opcName, opcFullName
opcIor
• Example : of an st.cmd that shows the OPC client setup:
iocShell_registerRecordDeviceDriver(pdbbase) opcSetNames("../names.txt") opcSetServer("localhost","MMIOPC.Simulator") opcSetGroup("myGroup3seconds","3000") dbLoadRecords("./DemoRecord1.db") opcSetGroup("myGroup6seconds","6000") dbLoadRecords("./DemoRecord2.db") iocShell_registerRecordDeviceDriver(pdbbase) iocInit()
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.
opcSetServer("hostName", "serverName")
opcSetGroup("groupName","n_scanRate")
Used only in st.cmd, not from the command line. It sets the file for name mapping.
This example shows how to set up an IOC
# Make sure that the dbd contains the lines for "opc" and "opcRaw" dbLoadDatabase("./iocShell.dbd",0,0) iocShell_registerRecordDeviceDriver(pdbbase) # registerRecordDeviceDriver(pdbbase) <= old command, won't work with epics base 3.14.6 and higher!!! # # Name mapping is not required here # opcSetNames("../names.txt") # # This example uses the "MMI OPC" OPC-server simulator at local host opcSetServer("localhost","MMIOPC.Simulator") # very slow group, scanning every 3 seconds opcSetGroup("myGroup3seconds","3000") dbLoadRecords("./DemoRecord1.db") # # very slow group, scanning every 6 seconds opcSetGroup("myGroup6seconds","6000") dbLoadRecords("./DemoRecord2.db") # iocInit()
• This is a behaviour due to the opc-server and PLC, no bug in the EPICS device support.
For the analog records ai and ao the LINR field determines the data conversion.
Record | DTYP | Conversion | ||
---|---|---|---|---|
ai | opc | no conversion: LINR="NO CONVERSION" (record default) | ||
ao | opc | no conversion: LINR="NO CONVERSION" (record default) | ||
bi | opc | no conversion, VAL may be any value | ||
bi | opcRaw | conversion: RVAL=0 -> VAL=0, RVAL>0 -> VAL=1 | ||
bo | opc | conversion: VAL=0 -> RVAL=0, VAL>0 -> RVAL=1 send RVAL to the hardware | ||
mbbi | opc | for VAL=0..15 record is set to the according state. NOBT, SHFT ignored | ||
mbbi | opcRaw | if RVAL=xxVL record is set to state xxST. NOBT, SHFT processed | ||
mbbo | opc | ? | ||
mbbo | opcRaw | ? further experimets will give new and exciting information, | ||
mbbiDirect | opc | ? what this records does! See next version. | ||
mbbiDirect | opcRaw | ? mbboDirect | opc | ? |
longin | opc | no conversion | ||
longout | opc | no conversion | ||
stringin | opc | no conversion stringout | opc | no conversion |
waveform | opc | no conversion |
If you run opcIocShell.exe at a hyperthreaded system,
application dies after some hours with any system warning.
Solution: append /ONECPU in your boot.ini at [operating systems]
If there are more than ca. 1800 PVs running on an iocShell following occures:
It seams to be a problem of the Windows task priorities.
see section "Record scanning " - Out Records