opcua icon indicating copy to clipboard operation
opcua copied to clipboard

Writing to unmonitored structures sends invalid data

Open ralphlange opened this issue 3 years ago • 0 comments

Reported by Mikel Rojo:

I have this db:

record (opcuaItem,"CBS:IN-OPCUA-STRUCT"){
    field(INP, "@PLC0 ns=3;s=\"SimInputs\".\"Inputs\".\"P101\" monitor=n")
    field(DEFACTN, "write")
    field(WOC, "immediate")
}
record (ao,"CBS:VAR1"){
    field(DTYP, "OPCUA")
    field(OUT, "@CBS:IN-OPCUA-STRUCT element=PG1.variable1 monitor=n")
}
record (ao,"CBS:VAR2"){
    field(DTYP, "OPCUA")
    field(OUT, "@CBS:IN-OPCUA-STRUCT element=PG1.variable2 monitor=n")
}

With the following initial setup, this is what occurs: CBS:VAR1=0 #in IOC CBS:VAR2=0 #in IOC PG1.variable1=0 #in PLC PG1.variable2=0 #in PLC $caput CBS:VAR1 1 #old value=0; new value=1 CBS:VAR1=1 #in IOC CBS:VAR2=0 #in IOC PG1.variable1=1 #in PLC PG1.variable2=0 #in PLC $caput CBS:VAR2 2 #old value=0; new value=2 CBS:VAR1=1 #in IOC CBS:VAR2=2 #in IOC PG1.variable1=0 #in PLC, value reverted back!! PG1.variable2=2 #in PLC $caput CBS:VAR1 1 #old value=1; new value=1 CBS:VAR1=1 #in IOC CBS:VAR2=2 #in IOC PG1.variable1=1 #in PLC PG1.variable2=0 #in PLC, value reverted back!!

Whenever I write a new value to a variable, the other variables get reset to their previous value on the PLC. This happens with more than 2 variables too, if I write to a third variable, the other two will also get reset back to 0.

ralphlange avatar Jan 26 '22 16:01 ralphlange