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

instantiate variable comments in Twincat 3?

2019-11-05
2019-11-12
  • Optimizer3000 - 2019-11-05

    Hi!

    I'm trying to figure out if there's any way to instantiate variable comments in Twincat 3. As seen in my example below i have created two variables of the same type. They don't have the same purpose though (one is for showing temperature and the other one is for pressure).

    I would like to have individual description of the two instances output in an ads (preferred) or opc ua list.

    I have seen the opc ua attribute below but i don't think it's possible to change a description of a variable inside a functionblock?

    Zitat:
    Data Access (DA)
    {attribute 'OPC.UA.DA.Description' := 'x'}
    Name: OPC.UA.DA.Description
    Value: see right column
    Sets a text for the OPC UA attribute "Description".

    https://infosys.beckhoff.com/english.ph ... 1.html&id=

    Any of you who have an idea?

    Best Regards Optimizer3000

    IMG: Anteckning 2019

     
  • dFx

    dFx - 2019-11-08

    just declare your instance with a comment

    VAR
    Temperature: fbFunctionBlock; // This is pressure
    Pressure: fbFunctionBlock; // This is pressure
    END_VAR
    
     
  • Optimizer3000 - 2019-11-09

    dFx hat geschrieben:
    just declare your instance with a comment

    VAR
    Temperature: fbFunctionBlock; // This is pressure
    Pressure: fbFunctionBlock; // This is pressure
    END_VAR
    

    Hi!

    Thanks for your answer!

    I want to have an individual comment of "rOutput" of each instance, not a comment of the instances of the functionblocks it self. I'm going to put information like description, unit, format and so on and use it to generate a CSV-taglist for a scada-system.

    One "solution" that i'm using today is to make functionblock for pressure and one for temperature, but since the logic is identical it feels stubbornly to create multiple functionblocks just to hold a comment...

    Best Regards Optimizer3000

     
  • dFx

    dFx - 2019-11-12

    This is the point of hierarchical comments.
    If you correctly declare your variables inside namespaces / GVLs / FBs, you can trace the functionnal description of your tag, using each level description.

     

Log in to post a comment.