Image variable / invisible - not boolean variable (expression)

mjuzwiak
2019-02-12
2019-02-15
  • mjuzwiak - 2019-02-12

    Hi,

    Using Codesys V3.5 SP10 Patch 3+
    It is possible to (and how to) use expression in 'invisible' or 'variable' field for Image/Frame on Visualisation?

    What I want to do, is make LED (simple light indicator) connected to variable of custom type (ENUM) eg:

    TYPE t_ECODE :
    (
    Β  Β NO_ERROR := 0,
    Β  Β E_SUPPLY_FAULT,
    Β  Β E_ANALOG_INPUT_FAULT
    )BYTE;
    END_TYPE
    

    I need LED (indicator) switched off at NO_ERROR and switched on at any other value.

    What I tried already:
    1. Set 'variable' field of standard lamp to ' myVar <> t_ECODE.NO_ERROR '
    2. Put two images one on top of each other, one with LED on, second with LED off, set 'Invisible' field to ' myVar <> t_ECODE.NO_ERROR ', second to ' myVar = t_ECODE.NO_ERROR '

    Any of these methods is not working, I get invalid referece error or other errors.

    Is there any solution other than dedicated program that will evaluate booleans from ENUM variables? It will make my code very hard to use, as I then cannot pass whole structures to visualisations...

     
  • e.kislov - 2019-02-13

    Hi.
    I use CODESYS V3.5 SP11 Patch 5 and it works for me.
    Maybe you forgot about namespaces?

    You should use it like:

    PLC_PRG.myVar <> t_ECODE.NO_ERROR

     
  • mjuzwiak - 2019-02-14

    Hi,

    Thanks! I checked that, and You are right, it's working, but only until t_ECODE is declared in project or library with not required qualified access.
    If t_ECODE is declared in library with qualified access only, it's not working any longer... Can You check that? If Project Information in included library have property 'LanguageModelAttribute' with value 'qualified-access-only' it's not working any longer (always evaluated to FALSE).

    I tried assigning to variable with and without library prefix:

    PLC_PRG.myVar <> MyLib.t_ECODE.NO_ERROR

    and

    PLC_PRG.myVar <> t_ECODE.NO_ERROR

     
  • e.kislov - 2019-02-15

    Hi. I check it and it works for me.

    I add in my library property LanguageModelAttribute with value qualified-access-only and I can use enums of library as part of expression in visu elements.

    Seems like you get a bug which fixed in SP11:

    IMG: 15

     
  • mjuzwiak - 2019-02-15

    Thank You,

    We're switching to newest codesys in this case

    Topic can be closed

     

Log in to post a comment.