Expression Tag that Writes to OPC Address (PLC)

Also, diffSetpoint is not defined, so you’ll need to either assign a value, or hard code a value

diffSetpoint = 100
if newValue.getValue() > diffSetpoint:

or

if newValue.getValue() > 100:

Edit: just thinking through this a bit. If the tag that is triggering this event is an expression tag which results in a bool value then your script can be simplified

if you only want to write to the tag on a true value:

if newValue.getValue():
    system.tag.writeBlocking(['[default]_Rkn031_900_/Atomizer/Atomizer_Open'],[newValue.getValue()])

if you want it to write for both then omit the if statement

system.tag.writeBlocking(['[default]_Rkn031_900_/Atomizer/Atomizer_Open'],[newValue.getValue()])

If the tag is a numeric value then you’ll need what you have.

1 Like