|
|
|
|
Home
Systems Engineering Process Engineering Subsea Control Systems Software Development
Products and Applications
Tech Info
Contacts & Key Personnel |
OPC Simulation Server
Introduction
The OPC Simulation Server allows the user to define an OPC tag database using a comma separated (CSV) file, and to simulate a process by changing tag values. The Simulation Server provides two ways of simulating data:
An overall master switch for the simulation is turned on or off using the Simulate dropdown from the Options menu. Configuration The OpcSim.INI file is the main configuration file, a sample of which is shown below: [OPC Simulation Server] LicenseKey=Demo ActiveConfig = 2 [Config 1] Database=TpnServer.csv Simulate=True Scripts=0 [Config 2] Database=Loopsim.csv Simulate=True Scripts=1 Script1=Scripts\LoopSim.vbs Main1=LoopSim [Config 3] Database=ZCalc.csv Simulate=True Scripts=0 [Config 4] Database=WellTest.csv Simulate=True Scripts=1 Script1=Scripts\WellTest.vbs ScriptExecInterval1 = 5 Main1=WellTest License Key ActiveConfig [Config N] Database Database=ZCalc.csv A typical CSV file is shown below: |
|
Simulate The simulation switch can be set on from the main menu of the OPC Sim Server. Scripts ScriptX (X=1,2,3...) Script1=Scripts\LoopSim.vbs Script2=Scripts\PlantSim.vbs MainX (X=1,2,3...) ScriptExecIntervalX (X=1,2,3...) Operation Startup Simulation
The OPC values can be set manually by simply typing in a new value. Individual items may be given a Bad status by ticking the Bad checkbox. OPC Writes Note that this requirement to enable writes only applies to the OPC interface - it is always possible to manually enter a value into the OPC server. Scripting The script can reference the OPC Server tag database, through the following properties of the Sim object:
Option Explicit
'--------------
Sub LoopSim()
'--------------
' Calling a subroutine, and using an Alias
' ----------------------------------------
Sim.TagVal("23FC0020.PV") = 0.6*Sim.TagVal("23FC0020.PV") + 0.4*(Sim.TagVal("23FC0020.OP")) + Sim.Rand
call PID("Loop 1")
End Sub
'---------------
Sub PID(strLoop)
'---------------
' A very crude PID controller
' In fact it is really just using a bit of integral action
dim rError
rError = 0.01*(Sim.AliasVal(strLoop,"SP") - Sim.AliasVal(strLoop,"PV"))
dim rOpCalc, K
K = Sim.AliasVal(strLoop,"K")
rOpCalc = Sim.AliasVal(strLoop,"OP") + Csng(K*rError)
if rOpCalc > 100 then
rOpCalc = 100
elseif rOpCalc < 0 then
rOpCalc = 0
end if
Sim.AliasVal(strLoop,"OP") = rOpCalc
End Sub
Download Purchase a License
Norwegian Customers Only Includes 25% Norwegian MVA
|