Developer Portal Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    Add-on instances on Sub-trees

    Add-on instances on Sub-trees

    TiagoMoura
    Member

    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?

    4 REPLIES 4

    nexidator
    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

    SteffenR-
    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
    OF
      MySubtreeInstIdx.Loc121: ...
      MySubtreeInstIdx.Loc122: ...
      MySubtreeInstIdx.Loc123: ...
      ELSE ...
    END_CASE

    or

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

    SteffenR_1-1688380670706.png

     

     

     

    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.

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist