Hi everyone.
I am very new to TIA Portal, and I come mostly from the Rockwell world.
I have a question regarding program structure. For some reason the "everything is an FB" concept confuses me.
I am mapping I/O to FBs representing diverse equipment modules (motors, valves, transmitters, etc, let's say the motor FB is FB1).
In Rockwell, I would either create the AOIs as controller scoped and alias them inside relevant programs where I need them or create them as local scope inside the relevant program (equipment section like a silo, would have a section where the AOIs for the valves, mixer, transmitters, etc would be called, as well as an interface for other programs to access in order for all the logic to stay in one place and be more portable).
I'm looking for best practices to use the module FBs I/O inside subsequent sequence or machine logic FBs.
While playing around with the software, having no idea what I'm doing, I've created IO mapping FBs (call them FB10, etc) per module type that call the individual module FBs as multi-instance (instances are created as "static" inside FB10). I then have a bunch of calls to FB1 inside FB10. The IO mapping FBs are then called in an IO FB (FB100) as multi-instance (instances are created as "static"), which is in turn called in OB1 as single-instance FB (which created a DB for it - DB100). I've then created a "test" FB (FB200) called in OB1 that has this last IO FB as an InOut parameter, which also created a DB200 for it, but it only contains the InOut reference.
I thought that "Static" variables were local to the DB but retentive as opposed to "Temporary" which are local but the memory space isn't retained between FB calls. But it seems from the IO mapping FB10, I can access static variables inside every FB1 instance. From FB100, I can access all instances of FB1 as well as all their static tags. And from FB200, I can still access everything down to static variables inside every FB1 instance made in FB10. This doesn't seem like good practice. I would like only the I/O of the FB1 calls to be accessible to "upper level" FBs.
It seems that even if I were to mimic what I do in Rockwell and multi-instance call the FB1 modules directly inside an equipment FB (or "program"), I would end up being able to access its static variables from inside the equipment FB. I had a clue that I should be able to access the FB1 instances inside FB10 for example, but I'm surprised I can even reach the static variables inside FB1.
My question is why does this happen? Is it because of the DB100 created when I finally called a FB as a single instance, everything is in the same DB so "legal" to access, and I get access to everything from FB200 due to the InOut call to DB100?
Would it be better to create a global IO DB and have the FB1 calls read from and write to UDTs contained inside, and pass that to the "machine logic" blocks? Or maybe attach I/O to the IO mapping blocks representing the inputs and outputs of all the module blocks I need the other FBs to have access to?
Thanks for the help.
I am very new to TIA Portal, and I come mostly from the Rockwell world.
I have a question regarding program structure. For some reason the "everything is an FB" concept confuses me.
I am mapping I/O to FBs representing diverse equipment modules (motors, valves, transmitters, etc, let's say the motor FB is FB1).
In Rockwell, I would either create the AOIs as controller scoped and alias them inside relevant programs where I need them or create them as local scope inside the relevant program (equipment section like a silo, would have a section where the AOIs for the valves, mixer, transmitters, etc would be called, as well as an interface for other programs to access in order for all the logic to stay in one place and be more portable).
I'm looking for best practices to use the module FBs I/O inside subsequent sequence or machine logic FBs.
While playing around with the software, having no idea what I'm doing, I've created IO mapping FBs (call them FB10, etc) per module type that call the individual module FBs as multi-instance (instances are created as "static" inside FB10). I then have a bunch of calls to FB1 inside FB10. The IO mapping FBs are then called in an IO FB (FB100) as multi-instance (instances are created as "static"), which is in turn called in OB1 as single-instance FB (which created a DB for it - DB100). I've then created a "test" FB (FB200) called in OB1 that has this last IO FB as an InOut parameter, which also created a DB200 for it, but it only contains the InOut reference.
I thought that "Static" variables were local to the DB but retentive as opposed to "Temporary" which are local but the memory space isn't retained between FB calls. But it seems from the IO mapping FB10, I can access static variables inside every FB1 instance. From FB100, I can access all instances of FB1 as well as all their static tags. And from FB200, I can still access everything down to static variables inside every FB1 instance made in FB10. This doesn't seem like good practice. I would like only the I/O of the FB1 calls to be accessible to "upper level" FBs.
It seems that even if I were to mimic what I do in Rockwell and multi-instance call the FB1 modules directly inside an equipment FB (or "program"), I would end up being able to access its static variables from inside the equipment FB. I had a clue that I should be able to access the FB1 instances inside FB10 for example, but I'm surprised I can even reach the static variables inside FB1.
My question is why does this happen? Is it because of the DB100 created when I finally called a FB as a single instance, everything is in the same DB so "legal" to access, and I get access to everything from FB200 due to the InOut call to DB100?
Would it be better to create a global IO DB and have the FB1 calls read from and write to UDTs contained inside, and pass that to the "machine logic" blocks? Or maybe attach I/O to the IO mapping blocks representing the inputs and outputs of all the module blocks I need the other FBs to have access to?
Thanks for the help.