Developer Portal Community

    Showing results for 
    Search instead for 
    Did you mean: 

    Add-on instances on Sub-trees

    Add-on instances on Sub-trees



    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?

    4 REPLIES 4

    Community Moderator
    Community Moderator

    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.

    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

    Community Moderator
    Community Moderator

    @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
      MySubtreeInstIdx.Loc121: ...
      MySubtreeInstIdx.Loc122: ...
      MySubtreeInstIdx.Loc123: ...
      ELSE ...


    FOR _idx := 1 TO MySubtreeInstIdx_MAX
       MySubtree.WorkPos := 20 + _idx;





    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.