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

Objects architecture

krakers
2017-08-08
2017-08-18
  • krakers - 2017-08-08

    Hi everyone. An "architecture" question about how to organize the program.

    After debouncing etc., the value of each input is assigned to individual "objects" that represent the function of the input ("valve x closed" etc) that are used further in the program. It can be hundreds of objects.

    Should these objects be defined in a Global Variable List or should it be a VAR in the "Main" PRG POU? I mean, they should probably be accesible throughout the program since each object may be used by different program parts?

    Every suggestion and input regarding how to structure the program architecture (also in general) is welcome!

    Thanks

     
  • josepmariarams - 2017-08-08

    There are some topics talking about that.

    See l viewtopic.php?t=7917 l

     
  • krakers - 2017-08-15

    Thank you Joseph for the link, I have read it now.

    I'm still not 100% sure about my core concern thouch: Should these "debounced objects" be defined in a Global Variable List or should it be a VAR in the "Main" PRG POU? I mean, they should probably be accesible throughout the program since each object may be used by different program parts?

    Maybe I'm on the wrong track here

    Thanks

     
  • josepmariarams - 2017-08-15

    Hi

    The question is why you have to use in any part of your program valb_closed. From my point of view you have to make an fb which contols all together the valb and the cillinder inputs.

    In some part of your program you do valb_set_open and wait since limit switch goes on, and every time you want to use the cillinder you have to actuate valb and see limit switch.

    Instead of that, why not make an fb with all cillinder functionalty and launch orders from the program to the cillinder fb (using blocks with execute flange input).

    In that case, the inouts are instantiated, normally, inside basic users.

    I see a control program as a tree. The root node could be an cfc with big machine parts. And normaly, the lasts nodes are inouts.

    You can use Codesys as a traditional plc program using contact logic, or use all his power.

     
  • krakers - 2017-08-16

    The problem is more complicated, the signal valve_closed needs to go to several other subsystems/FB's, it can be for example interface FB for scada or maybe some other FB handling sum alarms etc, etc

     
  • josepmariarams - 2017-08-18

    Hi.

    See for example how a cnc axe works.

    It has an fb which runs every cycle in background mking pid and path generator. It gives to the world as an output nqmed axisRef which has all the information about the axe. Status orders... There are some fb which has as a varinout an axisref. Via this axisref you can know the state of the axis and can give orders to him (mcmoveabsolute mc_error....).

    Alll dios and nios are hidden, but you can know all information of the axis via this fbs.

    You can have one fb connected to axis ref which gives to you all the information needed for hmi, another for error....

    It hides dios and nios

     

Log in to post a comment.