03-24-2023 11:33 AM
Hello,
We use quite a lot the sub-trees approach in order to control different modules with the same PLC and take advantage of instantiation.
My question here is regarding the Add-on which are not instantiable inside the sub-trees elements.
For example, if I want to use a DDL event for each sub-tree element (Command handler for instance) it is not possible.
Any plan to solve this?
Solved! Go to Solution.
03-24-2023 01:26 PM
Is your question about the DDL event (which is indeed a bit special) or about add-ons in general? Other add-ons behave just the same as "normal" objects inside subtrees.
About the DDL event: It is possible to use the DDL event inside a subtree, but you cannot configure it separately for each subtree instance. Instead, you have to define the variables that are sent to (or received from) MES inside your subtree. That way, every variable you configure will be an array at runtime, containing one variable for each subtree instance. The DDL event add-on of each subtree instance will automatically send the variable at the array index corresponding to the instance.
The location variables are also handled in a special way when inside subtrees: If you use the first element of your InstIdx enumeration as location variable (no matter if Fu or Wp), it will be replaced with the corresponding InstIdx element at each subtree instance.
I hope this helps! To answer your question: There are no plans to change anything about this.
06-30-2023 02:18 PM
I have additional question to that. I just tried to use InstIdx for Work position in event header. It works as you described, so it assigns 1, 2, 3 to the instances. Problem is my WP is 21, 22, 23.
Should I put something like that into Init method?
_tmpHead_Loc12x_NestLeakageAdBlueInstIdx_InstLoc121 := _tmpHead_Loc12x_NestLeakageAdBlueInstIdx_InstLoc121 + 20
_tmpHead_Loc12x_NestLeakageAdBlueInstIdx_InstLoc122 := _tmpHead_Loc12x_NestLeakageAdBlueInstIdx_InstLoc122 + 20
_tmpHead_Loc12x_NestLeakageAdBlueInstIdx_InstLoc123 := _tmpHead_Loc12x_NestLeakageAdBlueInstIdx_InstLoc123 + 20
07-03-2023 12:38 PM
@maj9bj_cz : This is possible, but if you have to modify the variable, there is finally no advantage of using the InstIdx. I would create a new global variable on the subtree, then assign the correct value, either by
CASE InstIdx
OF
MySubtreeInstIdx.Loc121: ...
MySubtreeInstIdx.Loc122: ...
MySubtreeInstIdx.Loc123: ...
ELSE ...
END_CASE
or
FOR _idx := 1 TO MySubtreeInstIdx_MAX
DO
MySubtree.WorkPos := 20 + _idx;
END_IF
07-19-2023 02:19 PM
This is exactly what I needed to know 👍. My previous solution was working fine until I created new event for work position 1. Then OES started throwing an error the WP index is the same for more partProcessed events, because WorkPosEnum.WP101 with value 1 was the same like MySubtreeIndex.InstLoc101.