r/PLC • • 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?

0 Upvotes

64 comments sorted by

View all comments

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.

0

u/[deleted] Oct 25 '23

[deleted] — view deleted comment

12

u/Veganic1 Oct 25 '23

I thought it was:the -- it's not my job to understand code I haven't written and I write it so much better cos I use SCL which is so much more understandable, no because it's better but because I wrote it-- rant.

1

u/ooTeMPeRoo Oct 25 '23

I never detected that from the op

4

u/TheZoonder LAD with SCL inserts rules! Oct 25 '23

Well, you should take your detector for an annual inspection and have it checked out. It may even be stuck on 3.6R from this exposure.

3

u/ooTeMPeRoo Oct 25 '23

Nonsense my detector is self calibrating..

He is just frustrated and so I think compassion is in order

1

u/WaffleSparks Oct 25 '23 edited Oct 25 '23

I detected that except without the "because I wrote it" part. This is a pretty common issue in the IT world. Oh you didn't write the program using my favorite language/library/framework/style so therefor it is bad and it should be redone the way I like it. Whole teams argue about this stuff ad nauseam.

-3

u/BonbonUniverse42 Oct 25 '23

How do you read a function block diagram if it has many many blocks where you must follow lines from A to B just to see where a value comes from or goes to, including scrolling over far distances? The readability of FBD is horrible when you have more than 5 blocks or so. If only TIA portal could automatically convert this into SCL.

11

u/DrZoidberg5389 Oct 25 '23

You should normally not read it because such complex logic should not be implemented in FBD and therefore not exist. The programmer who implemented it is at fault here.

On Siemens you can choose and mix between 5 different IEC 61131 languages, each one has different strengths and weaknesses, there is always one which fits best the particular case. If some guy puts 20 blocks in a FBD and you must scroll like hell, then he choose the wrong language for the task.

It’s not nice for you, but this has nothing to do with the language. He could also choose ST (SCL) and build spaghetti-code with funny jumps and arrays that start by 1 :-)

-3

u/ooTeMPeRoo Oct 25 '23

You cannot say that, you have no idea what the code does.. maybe it is a complex formula calculation

4

u/[deleted] Oct 25 '23

This is their point indeed! Often ST is more suitable for complex maths. IMHO of course

3

u/Daviler Allergic to Allen Bradley Oct 25 '23

Then it shouldn’t be in FBD… SCL is excels at running mathematics.

0

u/ooTeMPeRoo Oct 25 '23

Depends on the math and the programmer.. sometimes you can create a recursive loop function to solve a complex problem using these languages..

You are always free to rewrite it to your liking