FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
04-13-2023 09:24 PM
Hi, I am wondering if someone knows if there its possibility to change the PLC identifier of a variable via script. I.e. I would like the variable bellow to a different address in the PLC
PLC identifier:
|var|CODESYS Control Win V3 x64.Application.GVL.astItem[0].iStatus
New identifier
|var|CODESYS Control Win V3 x64.Application.GVL.Robot[1].iStatus
Solved! Go to Solution.
04-14-2023 09:47 AM
Instead of changing the Opc UA address on client side, you can solve this in the PLC with a variable of type:
iStatusRef: REFERENCE TO INT:=iStatus1;
Variable definition of referenced variables.
{attribute 'global_init_slot' := '1000'} // defines initialization order. A lower value means an earlier initialization
VAR_GLOBAL
{attribute 'symbol' := 'none'}
iStatus1: INT:=100;
{attribute 'symbol' := 'none'}
iStatus2: INT:=200;
END_VAR
Variable definition of OpcUa variable
{attribute 'symbol' := 'readwrite'}
{attribute 'global_init_slot' := '2000'} // defines initialization order. A lower value means an earlier initialization
// https://docs.automation.boschrexroth.com/doc/3513354743/attribute-global-init-slot/6-06/en/
VAR_GLOBAL
// reference must be initialized
iStatusRef: REFERENCE TO INT:=iStatus1;
END_VAR
PLC example program which changes the reference
IF (iSelect=1) THEN
iStatusRef REF= iStatus1;
ELSE
iStatusRef REF= iStatus2;
END_IF
04-17-2023 08:11 AM
WebIQ does not currently support this. The solution from @HmiGuide looks like a great way.
"You cannot change the HMI from the HMI" - with some exceptions like users, recipes, recorder data etc.,, but not the HMI configuration itself.