Signed up for your courses. I am chemical engineer and have experience in designing and operating experimental, pilot and industrial equipment. But I have experience in desining equipment based only on relay logic. Now I design much more complicated experimental equipment and I definitely need PLC programming skills. Thank you, RealPars!
Glad to hear that our courses are helpful to you! It's our pleasure, if you have any questions then please feel free to reach out to us at any time. Keep up the learning curve!
Best of both worlds is that can make abstractions with FB and FUNC using ST and then use those inside Ladder Logic. This way the code can be understandable by the operator without having to know what is happening behind those FB.
Another benefit is version control. Version control via git is easier to manage with text than gxworks project files. You can see the exact program changes each time. I have bkms to overcome this but it is a real issue for a lot of people. The exact changes are not often document between revisions and it sucks
Also, we can omit the second condition and write simple ELSE cause it is a complete negation of the first condition (IF Valve_Closed = false AND Valve_Opened = true).
Bad practice still. For boolean condition with no latching purposes people overcomplicate things. JUST WRITE : #pump_start := NOT #controlValve1_closed AND #controlValve1_open;
@@JADJuanan IMO variant with IF ELSE is more clear, while every time I'm looking at your variant I need to decode it to the IF ELSE chain in my mind anyway.
I don't know much about PLC programming, but I saw some ladder logic and function block logic made programs, and I thought they were really primitive in what they can do compared to C++. Now with structured texts available, I think that PLCs will be able to do way more than just reading sensors' data and activate actuators, or apply some sort of predefined controls. With this, maybe we can apply some machine learning algorithms, as now we can declare variables and do arithmetics, conditions and loops. What would be wonderful later on if PLC companies release compilers that work independently from the entire programming software, something like gcc that can run and compile C\C++ programs without having to install the big fat useless Microsoft Visual Studio.
Abdul, yes, the ladder logic and function block programming used by PLC's may seem primitive compared to higher level languages, but there are some marked advantages that ladder and function block (and structured text) offer. First, these languages in a PLC environment are typically interpreted languages, which allows for online modifications without having to stop the PLC or shutdown the process. Python, C++, Java, etc., are compiled, with requires the PLC processing to be halted when a change is made, since the entire program image must be re-downloaded. While you may think C++ can allow you do more as far as logic, I can honestly say in my 40 years of programming nearly every PLC model made, there has never been something I wanted to do that I could not do with ladder, function blocks, or structured text. One of the features of a PLC is its speed in processing I/O and executing the logic program. If the CPU has to compute complex equations, sort or store large amounts of data into or out of a database, etc., then its advantage of speed is lost. Doing a calculation in C++ and having it execute in 0.3 sec is an eternity to many PLC program requirements. With communication standards such as OPC, it is better to have an edge controller or CPU designed to execute more complex logic with higher level languages, and communicate the results to/from the PLC as required. One last item: you always need to consider who in the plant is going to support the programs. In most cases, it is I&C technicians who understand ladder and FB programming, but do not have skills in C++ or Java. As engineers, that doesn't seem like a big deal, but companies are not willing to pay engineer salaries for technician-level tasks. That may seem a little harsh, but it is reality. That is why supervisory processors, such as edge controllers will become more popular. They will allow more complex programs to be executed using C++ and Python without requiring a change in how machine control is executed and supported. Robots are an exception to what I just stated: they require complex controllers with their own language and advanced skillsets to program and support.
Some pretty complex functions can be accomplished in ladder and function blocks, though it is true that they can't do everything a normal high level language like C++ could. That said, I don't believe structured text really adds any functionality. Everything that can be done with structured text could probably already be done with ladder diagrams or function blocks, just in a format more suited to people without a programming background than those with one. The reason PLCs are programmed the way they are is because it suits their purposes very well, otherwise they would probably be much more similar to traditional programming.
There are quite a few of issues here. I don't know, if it is different in the States, but variables should be written in a specific manner. If a variable is a boolean then it should be 'bControlValve1_Closed' and not '#ControlValve1_Closed'. Writing ' = true' is unnecessary in most cases and often just makes the code less readable. It is also a good rule, if you have an 'OR' condition to do parenthesis, e.g.' ( bControlValve1_Closed OR NOT bControlValve1_open ) '. Helps to spot where it begins and ends. End_if does not need semicolon ( ; ). The comment should be simple and straight forward, and not ramble on about what, where and how, keep it simple. (* Start pump if control valve is open *) is sufficient. You don't need to explain every detail, if the code is very cut and dry. You will see it faster than you read and understand a "complex" sentence. But the major issue here is that an if statement should ALWAYS have the 'ELSE' specified. I would write this code as: (* Start pump if control valve is open *) IF ( bControlValve1_Open AND NOT bControlValve1_Closed ) THEN bStartPump := TRUE; ELSE bStartPump := FALSE; END_IF Keep it simple and clear.
Pekka, you are correct in your presentation of the SCL code structure for some controller manufacturers. SCL programming language in the Siemens S7 controllers follow the syntax as indicated in the video. Just like ladder diagram programming differences between vendors, SCL has variations between vendors as well. Unfortunately, for each of the IEC 61131-3 programming languages, there is no universal language syntax, but all versions have similar structures and syntax.
Sir, could you please upload more videos about structured text programing... I want to learn structured text programing. Your explanation is very good to understanding..
Yes sir Thanks a lot A very important a very much needed topic is given in this video But how can we learn from realpars sir Plz 🙏🙏🙏🙏 reply me back urgently required pls
Hi Fathama, Thanks for your kind comment! Great to hear that you are interested in joining our course library! You obtain full access to our complete course library (500+ video courses) by subscribing to either our monthly package for €24.99 a month or our yearly package for €179.99 You can subscribe through the following link learn.realpars.com/collections
Thank you for your videos. I just want to ask if what computer should I need to learn to master this STRUCTURED Text programming. I want to learn this because my Next work is not using Ladder programming anymore. They use FBD and STRUCTURED Text in SIEMENS and FUJI PLC. I want to learn it more before I start working there since my current company only used LADDER PROGRAMMING which is easy for me.
I enjoy and like most of videos you produce but this one missed the mark. I've been programming PLC's for 40 years starting with Gould Modicon to the most recent AB Micro800. ST has it's place but trouble shooting a PLC programmed in ST is a nightmare. In my experience ST is great for putting in large formulas but not much more. And my clients in most cases will ask for ladder or function block. A picture is worth a thousand words.
John, I have a similar background, being "forced" to learn Modicon 384 programming in a week in 1981. And like you, I have programmed innumerable PLC models since then. So, I think you and I think quite a lot alike. We essentially came from the generation of ladder programmers who also knew computer programming (many chemical plant programs were written in Assembly Language) but preferred the straightforward way ladder could re-represent the logic that was in our heads. Later, I saw the benefits of function blocks as a shorthand for operations like analog scaling or temperature conversions, and with ISA-88, sequential function blocks were a life-saver. These three modes of programming have served the industry well and were embedded into the IEC 61131-3 sets of languages. Notice I have left two languages within IEC 61131-3 out: structured text and instruction list. I know both of those languages well (Realpars.com has a whole course on ST), but I have always found translating logic into the other 3 languages to be faster and definitely easier to troubleshoot. The current generation of control engineers wants a more programming-like language available, as many were trained on mechatronics systems using Python, C++, and Java. And that is why the IEC had the smarts to include ST and IL in the 61131-3 standard. And in practice, except in protected, compiled code embedded in vendor equipment, ST and IL are beneficial (in my opinion) for repetitive mathematical operations and those functions that are easier to visualize with CASE statements. Apart from that, we as control engineers need to realize that we can program a masterpiece in C++, but need to construct the code in a way plant technicians can support and troubleshoot using that code. Thank you for your comment, as it highlights that not every tool is right for every job.
@@pekka1900 I've been programming PLCs for 40 years across most of the major brands and in most types of industry. The only time l use structure text is for large formulas. It saves time in putting the math in and that's about it. There are no significant memory savings and when trouble shooting problems ST is just no good. ST is great to have for some stuff but it will never replace ladder or function block.
you can study electric engineering, computer science etc, or anything that gets you familiar with sensors, transmitters, code etc. The majority or skills you'll usually learn on the job once you start.
Yes, we have just begun to release the first videos in our Introduction to SCL Programming course at Realpars.com. SCL is Siemens structured text programming language I hope you will enroll! We also have many entire course series on PLC programming, including our popular PLC Programming Made Easy Level 1 through Level 4. We do not yet have courses on robotics, but we are always working to plan additional quality training on automation topics that are relevant and current.
Good explanation but AWFUL practice. 1. #pump_start := #controlValve1_open AND NOT #controlValve1_close; This example is much more clear, faster and smaller. 2. It’s better practice to use // (C like) instead of (* *) (PASCAL like) comments when your goal is single line comment.
Signed up for your courses. I am chemical engineer and have experience in designing and operating experimental, pilot and industrial equipment. But I have experience in desining equipment based only on relay logic.
Now I design much more complicated experimental equipment and I definitely need PLC programming skills.
Thank you, RealPars!
Glad to hear that our courses are helpful to you! It's our pleasure, if you have any questions then please feel free to reach out to us at any time.
Keep up the learning curve!
Wish I had teachers like you guys .
Thank you, Dulal!
Structured Text, for those who can't let Pascal die... :)
Still, it's another useful tool in the toolbox.
Best of both worlds is that can make abstractions with FB and FUNC using ST and then use those inside Ladder Logic. This way the code can be understandable by the operator without having to know what is happening behind those FB.
Thank you for great teaching...please include pointer and area register in the series
You're very welcome! Thanks for your feedback and suggestion, I will happily pass this on to our course developers.
Another benefit is version control. Version control via git is easier to manage with text than gxworks project files. You can see the exact program changes each time. I have bkms to overcome this but it is a real issue for a lot of people. The exact changes are not often document between revisions and it sucks
Nice video! Btw at 4:45 I think you should have said "if the control valve is *NOT* closed" since you had the closed status equal to false :)
I think you are correct. If the control valve is closed, ControlValve1_Closed should be true.
Also, we can omit the second condition and write simple ELSE cause it is a complete negation of the first condition (IF Valve_Closed = false AND Valve_Opened = true).
Bad practice still. For boolean condition with no latching purposes people overcomplicate things. JUST WRITE :
#pump_start := NOT #controlValve1_closed AND #controlValve1_open;
@@JADJuanan IMO variant with IF ELSE is more clear, while every time I'm looking at your variant I need to decode it to the IF ELSE chain in my mind anyway.
The example was for learning purposes and to be easy to understand for beginners, not for to be the best and optimized code.
I come from a microcontroller background. Can someone explain why a valve that is not closed, is not opened? I assume it's a solenoid valve.
I don't know much about PLC programming, but I saw some ladder logic and function block logic made programs, and I thought they were really primitive in what they can do compared to C++. Now with structured texts available, I think that PLCs will be able to do way more than just reading sensors' data and activate actuators, or apply some sort of predefined controls. With this, maybe we can apply some machine learning algorithms, as now we can declare variables and do arithmetics, conditions and loops.
What would be wonderful later on if PLC companies release compilers that work independently from the entire programming software, something like gcc that can run and compile C\C++ programs without having to install the big fat useless Microsoft Visual Studio.
Abdul, yes, the ladder logic and function block programming used by PLC's may seem primitive compared to higher level languages, but there are some marked advantages that ladder and function block (and structured text) offer. First, these languages in a PLC environment are typically interpreted languages, which allows for online modifications without having to stop the PLC or shutdown the process. Python, C++, Java, etc., are compiled, with requires the PLC processing to be halted when a change is made, since the entire program image must be re-downloaded. While you may think C++ can allow you do more as far as logic, I can honestly say in my 40 years of programming nearly every PLC model made, there has never been something I wanted to do that I could not do with ladder, function blocks, or structured text. One of the features of a PLC is its speed in processing I/O and executing the logic program. If the CPU has to compute complex equations, sort or store large amounts of data into or out of a database, etc., then its advantage of speed is lost. Doing a calculation in C++ and having it execute in 0.3 sec is an eternity to many PLC program requirements. With communication standards such as OPC, it is better to have an edge controller or CPU designed to execute more complex logic with higher level languages, and communicate the results to/from the PLC as required. One last item: you always need to consider who in the plant is going to support the programs. In most cases, it is I&C technicians who understand ladder and FB programming, but do not have skills in C++ or Java. As engineers, that doesn't seem like a big deal, but companies are not willing to pay engineer salaries for technician-level tasks. That may seem a little harsh, but it is reality. That is why supervisory processors, such as edge controllers will become more popular. They will allow more complex programs to be executed using C++ and Python without requiring a change in how machine control is executed and supported. Robots are an exception to what I just stated: they require complex controllers with their own language and advanced skillsets to program and support.
Some pretty complex functions can be accomplished in ladder and function blocks, though it is true that they can't do everything a normal high level language like C++ could. That said, I don't believe structured text really adds any functionality. Everything that can be done with structured text could probably already be done with ladder diagrams or function blocks, just in a format more suited to people without a programming background than those with one. The reason PLCs are programmed the way they are is because it suits their purposes very well, otherwise they would probably be much more similar to traditional programming.
Lets see you trouble shoot ST ... its a pain.
Thanks RealPars for another fantastic video yet again.
Glad you enjoyed it!
Very Helpful and easily Understood
Glad to hear that, Arslan! Happy learning
Does realpars have a STL course, from basic to advanced?
There are quite a few of issues here. I don't know, if it is different in the States, but variables should be written in a specific manner.
If a variable is a boolean then it should be 'bControlValve1_Closed' and not '#ControlValve1_Closed'.
Writing ' = true' is unnecessary in most cases and often just makes the code less readable.
It is also a good rule, if you have an 'OR' condition to do parenthesis, e.g.' ( bControlValve1_Closed OR NOT bControlValve1_open ) '. Helps to spot where it begins and ends.
End_if does not need semicolon ( ; ).
The comment should be simple and straight forward, and not ramble on about what, where and how, keep it simple. (* Start pump if control valve is open *) is sufficient. You don't need to explain every detail, if the code is very cut and dry. You will see it faster than you read and understand a "complex" sentence.
But the major issue here is that an if statement should ALWAYS have the 'ELSE' specified.
I would write this code as:
(* Start pump if control valve is open *)
IF ( bControlValve1_Open AND NOT bControlValve1_Closed ) THEN
bStartPump := TRUE;
ELSE
bStartPump := FALSE;
END_IF
Keep it simple and clear.
Pekka, you are correct in your presentation of the SCL code structure for some controller manufacturers. SCL programming language in the Siemens S7 controllers follow the syntax as indicated in the video. Just like ladder diagram programming differences between vendors, SCL has variations between vendors as well. Unfortunately, for each of the IEC 61131-3 programming languages, there is no universal language syntax, but all versions have similar structures and syntax.
Thanks for a video which I always thought of tough one.. Thanks again guys.
Happy to help!
Great explanation sir ...👍
Thank you, Sachin!
Thank you again for that interesting information
You're very welcome!
Thank you for your help
Happy to help!
Thank you for your good explanation
Glad it was helpful!
Sir, could you please upload more videos about structured text programing...
I want to learn structured text programing. Your explanation is very good to understanding..
Thanks for your topic suggestion! I will happily go ahead and pass this on to our course developers.
Yes sir
Thanks a lot
A very important a very much needed topic is given in this video
But how can we learn from realpars sir
Plz 🙏🙏🙏🙏 reply me back urgently required pls
Hi Fathama,
Thanks for your kind comment!
Great to hear that you are interested in joining our course library!
You obtain full access to our complete course library (500+ video courses) by subscribing to either our monthly package for €24.99 a month or our yearly package for €179.99
You can subscribe through the following link learn.realpars.com/collections
Thank you for your videos. I just want to ask if what computer should I need to learn to master this STRUCTURED Text programming. I want to learn this because my Next work is not using Ladder programming anymore. They use FBD and STRUCTURED Text in SIEMENS and FUJI PLC.
I want to learn it more before I start working there since my current company only used LADDER PROGRAMMING which is easy for me.
please can you make explicit videos for a full course on structure text. thanks so much for the explanation.
Thanks for your feedback and suggestion, John! I will be happy to forward that to our course developers.
Thank u very much...
You are most welcome!
Sir great video.... I don't understand ladderlogic. Please post tank level control analog structured text program video
Thanks for your suggestion! I will happily pass this on to our course developers.
I enjoy and like most of videos you produce but this one missed the mark. I've been programming PLC's for 40 years starting with Gould Modicon to the most recent AB Micro800. ST has it's place but trouble shooting a PLC programmed in ST is a nightmare. In my experience ST is great for putting in large formulas but not much more. And my clients in most cases will ask for ladder or function block. A picture is worth a thousand words.
John, I have a similar background, being "forced" to learn Modicon 384 programming in a week in 1981. And like you, I have programmed innumerable PLC models since then. So, I think you and I think quite a lot alike. We essentially came from the generation of ladder programmers who also knew computer programming (many chemical plant programs were written in Assembly Language) but preferred the straightforward way ladder could re-represent the logic that was in our heads. Later, I saw the benefits of function blocks as a shorthand for operations like analog scaling or temperature conversions, and with ISA-88, sequential function blocks were a life-saver. These three modes of programming have served the industry well and were embedded into the IEC 61131-3 sets of languages. Notice I have left two languages within IEC 61131-3 out: structured text and instruction list. I know both of those languages well (Realpars.com has a whole course on ST), but I have always found translating logic into the other 3 languages to be faster and definitely easier to troubleshoot. The current generation of control engineers wants a more programming-like language available, as many were trained on mechatronics systems using Python, C++, and Java. And that is why the IEC had the smarts to include ST and IL in the 61131-3 standard. And in practice, except in protected, compiled code embedded in vendor equipment, ST and IL are beneficial (in my opinion) for repetitive mathematical operations and those functions that are easier to visualize with CASE statements. Apart from that, we as control engineers need to realize that we can program a masterpiece in C++, but need to construct the code in a way plant technicians can support and troubleshoot using that code. Thank you for your comment, as it highlights that not every tool is right for every job.
@@realparsBeautiful response. I love it.
You are the best
Thank you!
Excellent video. Why ST language is not so popular?
Thanks.
According to whom it's not popular? I come across mostly ST or FBD in the industry.
@@pekka1900 I've been programming PLCs for 40 years across most of the major brands and in most types of industry. The only time l use structure text is for large formulas. It saves time in putting the math in and that's about it. There are no significant memory savings and when trouble shooting problems ST is just no good. ST is great to have for some stuff but it will never replace ladder or function block.
Hi RealPars! Thank you for another great video. I found them very useful and informative.
Glad you like them! Thanks for your support, Denis!
What college degree can I get in order to work with PLCs and programming?
You can study Automation Engineering
@@animechannelhd2475 Thank you! :)
you can study electric engineering, computer science etc, or anything that gets you familiar with sensors, transmitters, code etc. The majority or skills you'll usually learn on the job once you start.
Mechatronics Engineering
Thanks for you support, Pls could you give instructions for Honeywell DCS system
Hi Laith!
Thanks for your comment and your suggestion. I will pass this on to our course developers!
Thanks for sharing and happy learning!
Nice !
Do you have a course on Structured Programming?
Also what about robotics and PLC course?
Yes, we have just begun to release the first videos in our Introduction to SCL Programming course at Realpars.com. SCL is Siemens structured text programming language I hope you will enroll!
We also have many entire course series on PLC programming, including our popular PLC Programming Made Easy Level 1 through Level 4. We do not yet have courses on robotics, but we are always working to plan additional quality training on automation topics that are relevant and current.
👍
Make more contain this STL example program
Thanks for your comment and feedback!
🔥🔥🔥
Good explanation but AWFUL practice.
1. #pump_start := #controlValve1_open AND NOT #controlValve1_close;
This example is much more clear, faster and smaller.
2. It’s better practice to use // (C like) instead of (* *) (PASCAL like) comments when your goal is single line comment.