Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Common Behaviour Model problems extending lacking docs?

2020-02-23
2021-11-24
  • hence.persson - 2020-02-23

    When I extend for example the ETrig block I have to manually add the method _Execute(); in my implementation.
    This isnt explained good enough in the help documentation..

    In the online help for example:
    https://help.codesys.com/webapp/yZZoqaS ... n=3.5.15.0
    Under the bold text: Using inheritance for creating a new function block MC_MoveAbsolute extending CBML.ETrig

    As many PLC programmers is lacking OO skills I think its important that this documentation is updated with a clearer example.

     
  • alejho

    alejho - 2020-02-25

    Hi,
    I think it's because it's not mandatory to create an _Execute() method..it's just a pratice to encapsulate the body of the base FB.
    You can get the same result by calling SUPER^() in the FB that extends the base FB.
    Actually is what you find in the "template FB" if you create a library!

    IMG: library_CODESYS.png

     
  • hence.persson - 2020-02-25

    That was nice when creating a library.. But if you just want to take benefit of the CBML in your regular program I still think it should be explained more clearly in the docs so that a PLC programmer lacking basic OO skills still can take benefit of these blocks as they are really useful.

    All that is really needed is to make the code snippet in the example larger so one could se the call of the SUPER^() and a short text explaining why.

     
  • Fil - 2021-11-24

    I couldn't agree more.
    As a suggestion; maybe it would be possible to automatically add the SUPER^() call with a short comment when extending a CBML block? This would even save dredging through the documentation.
    Best regards from Emden
    Fil

     

Log in to post a comment.