As an update if anyones curious,
I did end up using the Microsoft IoT Edge OPC UA PLC image that I mentioned before, and it works fairly well. For rapid reuse I find it best to provide it a server certificate instead of letting it generate one so that you dont have to go back and re-trust it on your gateway every time you recreate the container from a backup. I also planned on making an adjustment to kcollinsโ ignition dockerfile to automatically put the certificate you give the OPC server into the \Ignition\data\opcua\client\security\pki\trusted\certs
folder
I also created a script that will go through any of your tags and accordingly change them to point to the default fake simulated tags
import random
ints = ["ns=2;s=PositiveTrendData", "ns=2;s=NegativeTrendData", "ns=2;s=SpikeData", "ns=2;s=StepUp", "ns=2;s=DipData"]
bools = ["ns=2;s=AlternatingBoolean"]
def updateConfig(udtPath, config):
for item in config['tags']:
try:
if str(item["tagType"]) in ["UdtType", "Folder", "UdtInstance"]:
updateConfig(udtPath + "/" + str(item["path"]), item)
else:
itemPath = udtPath + "/" + str(item["path"])
if str(item["valueSource"]) == "opc":
dataType = str(system.tag.read(itemPath + ".dataType").value)
if dataType in ["Int2", "Int4", "Int6"]:
demoPath = ints[random.randint(0,len(ints) - 1)]
elif dataType in ["Boolean"]:
demoPath = ints[random.randint(0,len(ints) - 1)]
else:
demoPath = ints[random.randint(0,len(ints) - 1)]
system.tag.write(itemPath + ".OpcItemPath", demoPath)
system.tag.write(itemPath + ".OpcServer", "OPC_Demo")
except:
nil = 1
defaultPath = "[default]_types_"
config = system.tag.getConfiguration(defaultPath, True)[0]
updateConfig(defaultPath, config)
But in the future I think it would be better if I could write a script to not only iterate through all of my OPC tags, but define a json document like the following that will allow me to simulate all of the OPC tags with the same OpcItemPaths that they are in the production environment. If I can determine where tags are stored in the gateway backups, then I could probably create these tags on startup for the OPC server dockerfile and provide it a copy of the gateway backup as a source.
{
"Folder": "MyOpcFolder",
"NodeList": [
{
"NodeId": 1023,
"Name": "ActualSpeed",
"Description": "Rotational speed"
},
{
"NodeId": "aRMS"
},
{
"NodeId": "1025",
"Name": "DKW",
"DataType": "Float",
"ValueRank": -1,
"AccessLevel": "CurrentReadOrWrite",
"Description": "Diagnostic characteristic value"
}
]
}
This is definitely some big-nerd stuff, but I can see it making it much simpler to create a digital twin of your production environment for development purposes.