Idea: Put all of the logic for a PLC program in a function block.

The most stupid thing I have ever seen was a specification that required ALL program to be in an FB. This meant that the programmer had to write an FB for 2 contacts in parallel driving an output! Absolute stupidity! And he had to write it in ST for heavens sake!

Just use an OR function block?

As someone who writes logic for water utility assets with several hundred / thousand I/O, I find FBD far superior to ladder for process control.

However when i write code for something like a small machine then ladder is fine.

Horses for courses.

Unity Pro FBD is also much nicer than their ladder editor. Studio 5000's FBD is a bit clunky i think, but maybe I just don't use it enough.
 
Yep - Unity Pro ladder is not good. I use Omron and their ladder is brilliant. I can write a program much faster in ladder and it is easy to commission and trouble shoot.
FB is really good if you have re-usable code - I do not - every job and even motor control is totally different I do use an FB for scaling and also use FBs for doing floating point calculations for information extracted from diesel engines for generators. J1939 is a pain! Modbus interface and you have to do all the work! Have a set of standard FBs - have a look at what is in the engine controller - delete what is not - really good for that.
Yes, horses for courses.
I have been doing a heap of software here in Oz for NASA - all online programming - all on a live installation including 8 diesel generators, a site wide UPS, a rotary converter (2400V 50hz to 2400V 60hz) without having to turn the PLC into program mode to fiddle about with inserting new FBs. Also control of all HV and LV circuit breakers, soft transfer the generators across the rotary converter and/or the site wide UPS and lots of other stuff.
The engineer prefers FBs and when I told him I would have to turn the PLCs off to insert FBs into the PLC and send the site black he suddenly realised ladder was good! Funny that.
Huge amount of programming in 11 PLCs, heaps of remote I/O programming as well - the only time I have ever had to turn the PLCs off is to insert new remote I/O cards, comms cards and the like - everything else done online on a live site. Those occasions are pre-organised with NASA months before hand as there has to be a global shut down of their radio telescopes to do that type of work.
There is also a quite large SCADA system as well reading from and writing to the PLCs - that has all been done live as well.
The project is still growing and I have been working on it on and off for over 5 years now.
Have never inadvertently turned the site black either - pretty proud of that.
Ladder rules!!!
By the way, the man landing on the moon was controlled from this site and another that now does not exist.
Mars rovers have been landed and commissioned from the site.
the first pics from the Pluto Explorer were also received at this site - plenty more - interesting site - extraordinarily difficult at times and interesting work.
Has been hard sometimes - getting old now - 73 this month. 24-36 hour stints doing complex software and commissioning/testing a whole heap of new stuff keeps me going full belt - adrenaline - it finishes - adrenaline keeps going for 4-8 hours - and then in the can to sleep for quite a while.
I would find it impossible to have to turn the PLCs off doing this type of work to fiddle about with FBs - ladder allows me to do what I want.
 
I think the term "Function Block" means something differently dependently who writes. Maybe depending on the platform.
To me a function block is a block of code with its own assigned variables, and each call to the FB means that it must have a set of variable data assigned to it, aka "instance". And the FB can be programmed in any language, incl. Ladder.
 
The most stupid thing I have ever seen was a specification that required ALL program to be in an FB. This meant that the programmer had to write an FB for 2 contacts in parallel driving an output! Absolute stupidity! And he had to write it in ST for heavens sake!
Well that is way over kill, but what's wrong with ST? I love it, much cleaner for writing math and complex logic.

I think the term "Function Block" means something differently dependently who writes. Maybe depending on the platform.
To me a function block is a block of code with its own assigned variables, and each call to the FB means that it must have a set of variable data assigned to it, aka "instance". And the FB can be programmed in any language, incl. Ladder.
Yes a function block is an object, a function on the other hand is not, as it does not maintain it's own state, which is reset for each call.
 
The most stupid thing I have ever seen was a specification that required ALL program to be in an FB. This meant that the programmer had to write an FB for 2 contacts in parallel driving an output! Absolute stupidity! And he had to write it in ST for heavens sake!


when you have people making decisions for these types of things who don't have a clue, this is what you get. I see it and have to fix it , a lot of it all the time.
 
I was referring to a function block with assigned variables and not a function.
ST is OK for complex maths but not simple ladder.
Still not a fan of ST when ladder will do - very hard trying to describe how to read ST inside an FB to an electrician who knows a fair bit of ladder 1 1/2 days way by plane and the power station has gone down and the island is black except for the emergency generator in the power station. At least he can follow ladder - that is my major issue with it - no other issue.
 
Well that is way over kill, but what's wrong with ST? I love it, much cleaner for writing math and complex logic.

Yes a function block is an object, a function on the other hand is not, as it does not maintain it's own state, which is reset for each call.


Structure text is clean and easy to write but can be a nightmare for commissioning and troubleshooting , for machine cycle use ladder, why over complicate things when there is no need, when plc's started to appear almost 40 years ago there intention using ladder was so that someone who could understand wired relay logic , with limited plc skills could troubleshoot a machine , you shouldn't have to be a computer science major to troubleshoot machinery with a plc. programmers have to understand the perfect code doesn't always remain so, as parts wear, break ,human error , etc.
 
As JesperMP was pointing out, many modern PLC programming environments let you create your own function blocks. That function block could be written in any available language(even ladder). The function block could then be used in most of the available languages.
 
Structure text is clean and easy to write but can be a nightmare for commissioning and troubleshooting , for machine cycle use ladder, why over complicate things when there is no need, when plc's started to appear almost 40 years ago there intention using ladder was so that someone who could understand wired relay logic , with limited plc skills could troubleshoot a machine , you shouldn't have to be a computer science major to troubleshoot machinery with a plc. programmers have to understand the perfect code doesn't always remain so, as parts wear, break ,human error , etc.
That's why I only use it for certain things. Ladder is much easier for basic machine logic, but it gets clunky really fast when manipulating data, doing math, working with strings etc.
 
Last edited:
Use the logic itself as a "Function Block" to make a "master" program..
Add subroutines for mapping digital and analog IO to logic.
Once the "master program" is proven...then all you have to edit on each new job is the I/O map and it is also easy to edit the "master program".

In my map...I am usually programming GE which uses "I" for inputs and "Q" for outputs. In my map "I" also map to another "I" for an input or "Q" for output. for example I1 (real world) is mapped to I201 (an input well above real world).
Then..... in my master program when I see an "I" or "Q", then I know it is part of mapped I/O and is real world related..
 
Last edited:

Similar Topics

Hello, Concept: Input should remain for a given time so as for the PLC to look into. What to do if my input can change its value, which is...
Replies
7
Views
2,494
A repeated theme that I see on this board is always talking about documentation. Last year for the final for my class, the students paired up and...
Replies
19
Views
6,200
I am trying to create an agnostic product queue builder using PLC ladder logic. I have a pallet conveyor and would like to be able to use a NO or...
Replies
18
Views
2,230
Hi all, I have been working on a tool for my company that handles a specific task our company runs into often related to PLC's. This is a tool I...
Replies
15
Views
2,884
I asked this question briefly in my previous post long post, I'm asking again here as the main point so it doesn't get buried. I am pretty new at...
Replies
3
Views
1,521
Back
Top Bottom