Hey there!
I’m running Visual Components 4.3 connected to TwinCAT via OPC-UA & can’t seem to change signals or make them change server variables.
I’m basically sending a request from TwinCAT to Visual Components and would like to receive a confirmation from Visual Components.
My request signal is (Server to Simulation, reading from TwinCAT):
ACKNOWLEDGE_REQUEST = comp.findBehaviour("ACKNOWLEDGE_REQUEST")
My confirmation signal is (Simulation to Server, sent from Visual Components):
ACKNOWLEDGE_CONFIRM = comp.findBehaviour("ACKNOWLEDGE_CONFIRM")
My issue is that, if I simply write:
def OnRun():
app = getApplication():
while app.Simulation.IsRunning:
if ACKNOWLEDGE_REQUEST.Value == True
ACKNOWLEDGE_CONFIRM.Value = True
if ACKNOWLEDGE_CONFIRM.Value == True
print "ACKN!"
OR:
def acknowledge():
print '-'*99 # print a line
print '- ACKNOWLEDGE_REQUEST value:',ACKNOWLEDGE_REQUEST.Value
triggerCondition(lambda : ACKNOWLEDGE_REQUEST.Value == True)
if ACKNOWLEDGE_REQUEST.Value == True:
print '- ACKNOWLEDGE_REQUEST value:',ACKNOWLEDGE_REQUEST.Value
delay(1)
ACKNOWLEDGE_CONFIRM.Value = True
print '- ACKNOWLEDGE_CONFIRM value:',ACKNOWLEDGE_CONFIRM.Value
delay(1)
return True
in a python script, I can see prints as well as changed signal values just fine.
In “CONNECTIVITY” I also see the variables in “Server to Simulation” change values.
But “Simulation to server” stays on false, and won’t change in TwinCAT either.
Any idea what I’m missing is much appreciated
Thanks and have a nice day!
BR Klaus