Developer Portal Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    24 tips (Advent calendar) for Control plus programmers

    24 tips (Advent calendar) for Control plus programmers

    SteffenR-
    Community Moderator
    Community Moderator

    Hey, it’s december. The time when the day starts with opening a door of an Advent calendar.

    Check out the official BCI Advent calendar on LinkedIn with some interesting piece of information every day.

    But just these days I noticed in a discussion that there are so many small improvements from Control plus bundle V1.0 to V2.3 that some of you maybe missed. What would be more obvious than showing you a tip every day ...

    #01  #02  #03  #04  #05  #06
    #07  #08  #09  #10  #11  #12
    #13  #14  #15  #16  #17  #18
    #19  #20  #21  #22  #23  #24

    24 REPLIES 24

    SteffenR-
    Community Moderator
    Community Moderator

    Do you know that the Object Browser can not only update your Std, but also clean up your Std?

    The clean up function deletes all unused objects/peripherals.

    SteffenR_0-1638779383342.png

     

    SteffenR-
    Community Moderator
    Community Moderator

    You can add external tools or batch files to the Control plus Studio menu bar:

    SteffenR_0-1638779456971.png

    1. Tools > External tools > Add
    2. Insert title
    3. Choose EXE or BAT file via […]
    4. Close everything with OK
    5. Tools > Customize
    6. Add new toolbar and add your EXE/BAT from commands via drag & drop

     

    In the attachment you can find an example batch file to clean up the station folder (batch file must be placed in station folder).

    SteffenR-
    Community Moderator
    Community Moderator

    By default objects and add-ons do not have an output for any active error number, but they provide an array with all active events. By checking for an specific event you can program a specific behaviour.

    This is how to realize it in an application:

    Declaration:

    SteffenR_0-1638866579547.png

     

    Implementation in an waiting step after command execution:

    SteffenR_1-1638866579550.png

     

    PS: If the object or add-on do not provide a special functionality it is not possible to "mute" specific events or acknowledge them automatically.

     

     

    Source code for copying:

    VAR
      /// temporary FB instance with list of currently active events
      _eventQuery : OpconEventQuery;
      /// flag if a special event is currently active (found in query)
      _eventFound : BOOL;
      /// temporary counter of FOR loop
      _i : DINT;
      /// compared OOIDs are equal
      _equalOoids : BOOL;
    END_VAR

    --------------------------------------------------------------

    IF( Station.PcdAccess.ExecState = OpconExecState.DONE )
    THEN
      Station.PcdAccess.Execute := FALSE;
      _retVal := OK;
     
    ELSIF( Station.PcdAccess.ExecState = OpconExecState.ERROR )
    THEN
      Station.PcdAccess.Execute := FALSE;
     
      // get currently active errors
      Station.PcdAccess.GetPendingEvents(OpconEventQueryType.ERROR, _eventQuery);
        
      // search for error "unkown identifier"
      _eventFound := FALSE;
      FOR _i := 1 TO _eventQuery.UsedEntries
      DO
        IF( _eventQuery.Entry[_i].Number = PcdAccessServerEvents.ERR_UNKOWN_ID )
        THEN
          // OOID must also be compared because event numbers are not unique
          _equalOoids := OpconObjectIdIsEqual(_eventQuery.Entry[_i].ObjectId, PcdAccessConstants.OOID);
          
          IF( _equalOoids )
          THEN
            _eventFound := TRUE;
            EXIT;
          END_IF
          
        END_IF
      END_FOR
     
      IF( _eventFound )
      THEN
        // create new part if it doesn't exist on PCD server
        _retVal := JUMP1;
      ELSE
        // any other error -> stop automatic chain
        _env.ChainControl := OpconChainControl.ERROR;
        END_IF
    END_IF   

     

    SteffenR-
    Community Moderator
    Community Moderator

    The BasMove object is a really powerful object. "BasMove" is the abbreviation for basic movement. It can be used for any use case with digital in-/outputs, for example belt motor, fan motor, hydraulic power pack, electrical cylinders and of course pneumatic cylinders.

    The parameters for the object are maybe as complicated as powerful the object is. Therefore a short guide for the parameters for the default case of a pneumatic cylinder:

    1. Set the parameter ValvePreset if you have a pneumatic cylinder without special requirements.
      This parameter hides all parameters that need not to be parametrized for the selected valve (e.g. 5/3 directional valve).
      SteffenR_0-1638958111737.png
    2. Set the parameter OutputResetOnCancel to choose the behaviour in case of a cancel (operation mode change, emergency stop, control off, opening/closing doors). If the cylinder can stop its movement YES_IF_NOT_IN_POS is recommended. If it is a gripper or can't stop its movement (for example 5/2 directional valve) the value NO is recommended.
      SteffenR_1-1638958390103.png
    3. If the supply power (= compressed air for pneumatic cylinders) is switched off in some cases you should set the parameter SupplyState.
      By setting this parameter the outputs will be reset if the SupplyState input has a falling edge and the outputs will be initialized according to the inputs (InBasePos, InWorkPos) everytime the SupplyState input has a rising edge.
      SteffenR_2-1638958753443.png
    4. In the PLC code use the object output OutImm.IsInBasPos / IsInWrkPos for calculating the home position etc. This output is only TRUE if both the output and the input are TRUE.
      SteffenR_3-1638958920445.png
    5. In the chains always set the command parameters PreStartCheck and OutputPulsing.
      SteffenR_4-1638959094568.png

      or

      SteffenR_5-1638959251046.png

    SteffenR-
    Community Moderator
    Community Moderator

    Once again a topic about the BasMove object for pneumatic cylinders:

    The BasMove object has two commands, one for each end position. But there is also a method to set the outputs without any command. This can be used for special purposes, special initialization/cancel behaviour, etc.

    The method needs to be called only once, not cyclically, for example:

    // fill both sides with compressed air
    Loc103K201_PressCylinder.Unit.SetOutputs(BasMoveSetOutputMode.ALL_TRUE);

    SteffenR_2-1639039373822.png

     

    To prevent hard hitting of the end in case of empty compressed air lines there is also another solution for the homing:

    With the parameter ParCmd.OutputPulsing:=TRUE the valve output(s) will be pulsed if the cylinder is not in any end position. This is helpful for 5/3 or 2x 3/2 directional valves, for 5/2 directional valves it is useless. With the pulses the compressed air lines will be filled with compressed air slowly. It prevents that the cylinder hits the end hard because of missing counterpressure.

    It should work for almost all cylinder sizes without changing the pulse parameters in ParCmd structure.

    SteffenR_5-1639039703827.png

    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