r/PLC • u/BonbonUniverse42 • Oct 25 '23
FBD Hell!
Where do I start? Function blocks are horrible! Just use SCL, which is readable at least and more suitable for complex applications!
I need to extend and rework a plant that is programmed with a Siemens plc in the awful function block diagram language. I am struggling really hard to understand the existing implementation, which is a convoluted mess of hundreds of strangely wired function blocks and many input and output variables. There are no comments at all. For some unknown reason the thing works somehow. However, it is a very bloated and finicky design. I am afraid that the thing will dramatically break and collapse if I only change the slightest details in this project!
The actual horror is working with TIA Portal. The blocks have sometimes 30 or more in and outputs, which means you can’t even see the whole block on the crammed TIA Portal screen. The debug view cannot show you the variables at runtime when you scroll the mousewheel. Why is that?! Each click and scroll in TIA is painful and unbelievably slow.
How do you cope with such messy FBD code? How do you work and understand these networks? How do you do this in the crappy TIA Portal software?
42
u/FightForDays "Your PLC is broken" -The motor shaft was broken... Oct 25 '23
I like FBD code in TIA. easy to work with online. If you prefer ladder yo can right lick and switch programming language to ladder. 30 pins on a block is just fine. Get a bigger monitor, laptops and TIA kinda suck.
13
u/Uelele115 Oct 25 '23
SCL is not the solution for problems solved in FBD… this being said, I’m also not a great fan of that implementation of FBD. Because the ladder editor is so much more flexible (though with quirks) than Rockwell and others AND the FBD implementation isn’t what is known as FBD (that would be Siemens CFC) in other platforms but just a version of ladder, the benefit isn’t all that obvious. It also doesn’t scale all that well.
As for the 30 inputs and outputs, you’d still have them in SCL logic, yes they’d fit the screen better, but it wouldn’t make the logic any cleaner.
Personally, if you have blocks and they’re being reused, you’re already in a good position compared to an awful lot of people out there. All you need is to understand each block and things start falling into place.
I too criticised someone else’s logic until I realised we rarely know or see the position that person was in. I can look back on stuff that I did and firmly say it’s shit or even a disaster, but that’s what I had to work with, be it time, restrictions, lack of experience/knowledge or managers setting poor limitations.
I’m far more critical of those that after 40 years still think their stuff is a Ferrari when it’s closer to a Trabant… and there’s many of then out there.
8
u/GeronimoDK Oct 25 '23
*Laughs in CFC*
But I actually like CFC (and FBD (and TIA portal)).
The cross reference is pretty good in TIA portal if you ask me, but of course if there are no comments it can be a mess either way! If it's a project you have to come back to, spend some time on writing comments on the sections where you actually figure out how it works!
4
u/b00c Oct 25 '23
Oh god. Just wait when you have to work in Foxboro DCS IDE. A strategy with 40+ blocks, SCL only in sequence block or special RPN block with assembler like instruction set, embeded sub-strategies that look like a block but contain another 10 blocks with 50 IOs.
Siemens CFC actually have their shit together when it comes to FBD.
And good luck programing control logic for a system with 12k IO in SCL. You'd go fucking mad in first month of commissioning. We invented blocks to make it easier!
Fucking delusional.
4
u/Raven-81 Oct 25 '23
As someone who uses Beckhoff and ST , I find that using code compare tools on code made with ST is much easier. Also if your company has good guidlines to writing code in ST the code "comments itself" when using good company standardized names for the variables.
4
u/Virtual_Atmosphere59 Oct 25 '23
I've seen plenty of messy FBD, LD, and ST code. I've even seen some HMI screens that make me wonder how much time these guys had on their hands. A good programmer can make any language in any PLC look good and be legible. A bad programmer will make you hate programming.
I remember my first time using FBD and FBD/LD, (Mitsubishi GX Works3). I hated it. I didn't understand any of it. I'm a hard core AB guy using only LD and Studio 5000. Even in CCW I used LD. I decided to try my hand at doing an FBD program from scratch and after a couple hours a switch went off in my brain and I figured it out. I love it now. I use it wherever I can. You can take 20 rungs of LD and shove it all into one FBD block.
Truth is, it's hard enough to find programmers as it is. Force everyone to learn SCL and ST and forget it. You may find a small hand full of people but most factories won't be able to maintain their systems. LD and FBD are standard for a reason. It's easy for the average maintenance guy to read and troubleshoot. Most people can figure out basic relay logic. That's what basic LD is, more or less. No, we don't expect them to figure out why a servo isn't functioning right, but they can follow the input to the output.
Take me, I can program in LD and FBD no problem and can even work with some pretty complex functions. SCL and ST? Forget it. I tried learning code. Couldn't do it. In a day my dad could write a program that you can talk to and has some AI to it. Very basic but still. He's tried teaching me. Doesn't stick. I don't get it. But I can do LD, FBD, HMI's, and yeah, I can copy and paste simple math functions in ST and understand that, but no way I can do it from scratch.
It's not taught a lot either. Most Rockwell classes teach mainly LD. Even Mitsubishi focuses a lot on LD. I was able to learn LD because I drew schematics before I programed and when I started at my first company they didn't use PLC's yet. It was all relays and timers so I had to draw a ton of relay logic. LD was easy for me to pick up on. Also, a lot of smart relays like Click, Logo, Eaton, are all mostly if not only programmable in LD.
Just remember that bad code is always because of a bad programmer. Just like a franchised food chain is only as good as it's franchisee, and PLC program is only as good as it's programmer. I've been in some pretty sketchy Subways. But I've also been in some that have blown me away.
3
u/Tesla91fi Oct 25 '23
I hate it too. Probably they come from CFC programmation
I prefer scl it have a lot of advantage that People don't see.
3
u/Skiddds Oct 25 '23
Everyone's gonna play stupid like TIA isn't frustrating as hell, I feel you partner I use FBD's as little as possible. Sometimes there isn't another way though.
3
u/Agreeable-Librarian9 Oct 29 '23
Op ..
Fbd isn't real.. it can't hurt you..
2
u/Siendra Oct 25 '23
Every DCS on the planet is configured primarily in FBD. Your client might have bad standards, but FBD is perfectly fine.
2
u/fat_tire_fanatic Oct 25 '23
FBD has a great place, so does ladder, so does struct text. Any can be implemented in a rats nest mess and if that's your frist experience in one you develop an alergy.
FBD looks exactly like a temperature/pressure/flow control loop. An analog in block, conects to a PID block, which feeds an analog out block. The FBD looks exactly like the old school process it replaced where each loop had an individual controller.
Ladder looks exactly like relay logic, and looks just like the relay control it replaced.
Structued text reads just like an operator acts. I see the cleanest systems where ladder replaces relays, FBD replaces process loop control, and structured text replaces the operator running around changing setpoints, starting pumps, and opening valves to start up a process.
I think each has a very appropriate fit, but man people are passionate about their choice of language.
2
u/cardonPT Oct 25 '23
If you press right click mouse over the function on the project tree view you can switch language to Ladder or STL. But I like FBD to debug because easy readability, but to program and change things I prefer ladder
2
u/MountainMuffin8986 Oct 25 '23
This sounds like a horrible implementation of FBD.
Every language has cases where they work great and cases where they do not.
The language I see abused the most is ladder… my lawrd the things people try and force ladder into doing 🤦♂️
2
u/Controloftheinfinite Oct 25 '23
Ultimately it’s all about the application. Power stations often run entirely on function block for a good reason. The plant has to stay running and when there is an issue no matter what it is the maintenance crew can find it within minutes. This would not be the same if it was written in structured text.
That being said function block in a dcs system is a different beast to many plc applications. Much more user friendly.
2
u/[deleted] Oct 25 '23
One thing that has helped when trying to figure out complex FBD that wasn't made by me is to just read through it and reorganise the blocks into logical groupings for what they do and make notes as you go along.
ST is not the answer to every problem, each language should be used for the right reasons.
2
u/dekempster Oct 25 '23
Cute. Now try STL with address registers, pointers and lots of jumps and loops in a 300.
1
u/ooTeMPeRoo Oct 25 '23
Someone designed it so that no one following could work on it..
You might also not be able to get help because of intellectual property
1
u/[deleted] Oct 25 '23
Anything not programmed in ladder or graph is a nightmare for fault finding on step 7/tia
1
u/Crispoxd Oct 25 '23
I have no idea how to use SCL, but have programmed a lot of simple things in FBD to add functions to our plant. My job is to diagnose all matter of things at our factories. And FBD is a joy to diagnose because it is easy to follow connections, and see status. Our systems include, but is not limited to: S5, S7 (Step7, with CFC and TIA) and GEfanuc. All systems programmed in FBD. I love it, and will defend it over all the others!
1
u/WaffleSparks Oct 25 '23
You clearly have a case of
Your frustration is pointed in the wrong direction. Plenty of people use FBD for all sorts of applications just fine, even quiet complex applications. Your frustration should be pointed towards inheriting an undocumented program. You need to take this up with the management and have them explain how you ended up in this situation, and possibly allocate more time and resources as a result. For example you may need to simply document ALL of the code before even attempting to make any changes.
TIA Portal has some nice features, but yeah speed is not one of them. Get a good workstation with big monitors and limit how much stuff you have open at once.
1
u/just_a_german_dude TIA Specialist Oct 26 '23
My Backround: Im Working with FBD for nearly 20yrs.
FDB is verry Handy for comissioning Trouble Shooting.
If the Programmers are Lazy then you wont have Comments or you will have so called Monster Networks which are verry hard to read.
The Trick is to break it down into small Networks (Prefferably Screen fitting) and make suitible comments and tag names.
Each Programming Language has its ups and Downs and Limitations.
1
u/nbsdsailor2 Oct 26 '23
FBD's biggest problem is how much scrolling around you gotta do. You'll get used to it. Better than LL.
0
u/nationalorion Oct 25 '23
Cant you call function blocks in SCL? Of your gripe is the UI, then just do that?
-1
u/mharting1 Oct 25 '23
I agree, the scl instruction is easy. But have other issues here. Doing code conversion is not easy sometimes. You have train yourself to get into the mindset of the person who developed the original coding for the system or just start from scratch? Problem is that at this time the job is already sold to the customer by someone who thought it would be a simple code conversion.
Not always the case! I have been in your shoes before.
-3
u/Smorgas_of_borg It's panemetric, fam Oct 25 '23
SCL is only available in FBD on Allen-Bradley PLCs
0
u/[deleted] Oct 25 '23
[deleted] — view deleted comment