wlederer

What is the benefit of using Structured programming?

30 posts in this topic

Dear colleagues, several years I programmed Mitsubishi FX using ladder (Simple project in GX Works2). A couple a year ago started to use Structured programming. Sometimes I ask myself: "What is this all headache for?". There is a lot of function blocks, but many of them do not work. Why they are being kept? Periodically, You get some strange compilation errors, You never heard before. Simple task: divide something by something is not as simple by structured project.

Now You have to clear PLC memory, each time, before downloading program, because  automatic assignment can do anything. Two projects for FX3u were compared, the same task, one made with ladder, another with structured programming. The last one run about 40% slower and demanded more PLC memory.

In theory, the structured programming should save developing time. But, does it really happen?  One Mitsubishi PLC programming trainer told me, that in Japan they don't use the structured. Is it true?

What is Your opinion?

Share this post


Link to post
Share on other sites

I never program any Mitsubishi PLC, but just to give my perspective on the comparison since Omron also migrating to structured programming (let me short it as SP) :
 

  1. SP do save development time. A lot of it, since you don't need to debug any miss-addressing, and all the FBs are there to help you do the job you need. As long as the FBs are well documented, there shouldn't be an issue to use them
     
  2. For a same task SP does consume more memory compared to mnemonic programming. That's for sure since the language kind of translated twice during compilation.
     
  3. I don't about SP being slower. In my case the SP is introduced on the newer PLC models which is developed only to use SP. The specs also upgraded to a faster CPU and larger memory. We don't use SP in the old models. Since you are comparing mnemonic and SP in FX-Series which is developed during mnemonic era, and also considering it is the low-end model, I doubt it has the capability to run SP smoothly. That might explain also why lots of your Function Blocks didn't work.
     
  4. In the end the compiler also matters. Typically there are compile optimizations options that we can choose. Too much optimization sometimes results into weird behavior of the program. Also we will never know how good is the design of the compiler
     
  5. In my case even in Japan we are migrating fast into SP usage, leaving the mnemonic ones. But I do know that many Japanese engineers (typically the older ones) avoid to use SP. It's kind of a trend in Japanese engineers to not use something that they don't know what's inside (things like Function Blocks), to which I disagree. Using standard FBs provided by your product vendor shouldn't be an issue since they guarantees the use.
1 person likes this

Share this post


Link to post
Share on other sites

I have dabbled with the structured programming. However for me the ladder programming is more easy to read and follow. Of course that is how I was taught and what I have done for the last 20 years so I suppose if I had learned the structured I would be more comfortable using it.

Share this post


Link to post
Share on other sites

We've been forced into structured due to one of our machine builders losing/gaining a PLC programmer. The way we describe it to our management is we know English, this is in French. It's that different; in my opinion.

We are doing the Mitsi training course on structured in November in Hatfield, so looking forward to that. At the moment, simple changes are taking hours....

 

1 person likes this

Share this post


Link to post
Share on other sites

I taught myself structured programming after reading 'once you have mastered it you will never go back to plain ladder'

They were wrong! Maybe it's my brain, but I can visualize ladder - I can see what will happen and write what I want to happen.

I don't need to compile or keep testing it until I have finished. My errors can be quickly rectified 'oops M54 not M45 etc'

I felt as though I was falling behind - not learning the latest language.... Nah, I can still program anything you want me to do.

2 people like this

Share this post


Link to post
Share on other sites

We completed the Mitsubishi training last week, and it was VERY much worthwhile. Me and my colleague both came away with the full intent to use it in the future.

There are loads of little extras to standard ladder, especially when drawing lines etc. And then the function blocks are handy for mass repeat of certain sections of ladder. It's very user friendly, but has subtle differences which we wouldn't have known without doing the course. I have no doubt someone could sit and learn structured from ladder, but you'll need to apply a lot of time and manual reading - that is a luxury we don't have where I work.  

Anyone UK based, I FULL recommend the 2 day structured course which is based in the Mitsi Electrics Euro Headquarters in Hatfield.

1 person likes this

Share this post


Link to post
Share on other sites

At the end of the day, it's in the programmer to know what he will use and where he will be comfortable in terms of PLC language. I suggest learning Structured Programming, especially for standardization(some free time or training may do).

Share this post


Link to post
Share on other sites

I went to Hatfield a good few years ago for a course on advanced programming.

It was so that I would be a certified Mitsubishi engineer and have my own exclusive area for Mitsubishi.

It cost me a fortune to be part of their 3 diamond service package and I never came close to recouping my costs.

 

Not only that, they told me - because I didn't pay my next annual fee, I could not call myself a Certified Mitsubishi Engineer any more.

1 person likes this

Share this post


Link to post
Share on other sites
9 hours ago, Ron_S said:

I went to Hatfield a good few years ago for a course on advanced programming.

It was so that I would be a certified Mitsubishi engineer and have my own exclusive area for Mitsubishi.

It cost me a fortune to be part of their 3 diamond service package and I never came close to recouping my costs.

 

Not only that, they told me - because I didn't pay my next annual fee, I could not call myself a Certified Mitsubishi Engineer any more.

Last I knew of that program you agreed to all of that when you signed up.  But I also don't recall the program ever having any exclusive area criteria.  And the points for the tests expired after 2 years to make sure engineers stayed current. 

I looked into it many years ago but Mitsubishi US said they did not participate in the program.

Share this post


Link to post
Share on other sites

It was 15/20 years ago but there was an exclusive area.

To be paid, you had to invoice Mitsubishi, not the customer.

They took at least 3 months to pay and charged the customer double your fee.

And, there were very few calls from them and most were middle of the night.

Share this post


Link to post
Share on other sites

The courses are very good, I can't comment on 15/20 years ago.. but all support is free (24 hours) as long as you have a licenced bit of software.

Also, once you complete all courses, or fancy your chances, you have the option for £85 one off payment to do a 'Certified Engineer Exam' which by the sounds of it, is a 1 off payment.

I wasn't made away of any yearly packages after that, however certified engineer status isn't really a benefit for me.

 

Edited by Stuart_Wales

Share this post


Link to post
Share on other sites

I agree, it was a very good course. (very expensive for a one man band though) but 20 years ago there was not many freelance programmers and I wanted to get my name out there.

As it happened, customers found me.

I don't know if Mitsi still do a 1. 2. 3 diamond service for customers - where 3 diamond meant guaranteed engineer within 2 hours, 24 hours a day anywhere in the country (hence an exclusive area)

I do remember though - during the course, about 3 or 4 left after the first day. They admitted they didn't understand a thing that was going on.

Share this post


Link to post
Share on other sites
6 hours ago, Ron_S said:

I do remember though - during the course, about 3 or 4 left after the first day. They admitted they didn't understand a thing that was going on.

Weeding out the rookies huh?  Or scaring them off?

Share this post


Link to post
Share on other sites
On 18/10/2017 at 0:33 PM, wlederer said:

What is Your opinion?

Speaking as an electrician that spent the vast majority of his career troubleshooting with simple ladder on multiple platforms, I can say that structured programming is simply the write way to develop code, IMHO.

I made a career move a couple of years ago and shifted into the world of controls.  The dept. I'm now in develops our projects in roughly 90% structured text with the remainder in ladder.  The small portion of ladder that is produced, is what we deem to be client level troubleshooting code, so it's done in a format that's more comfortable for them.

It took me a short while to grow accustomed to the structured method, but it is far superior.  Pages of ladder can be condensed into a few paragraphs if done efficiently.

Give it some time.  You'll grow to love it.  I don't think I'd ever go back to simple ladder again.  Unless of course a client demanded it.

As far as the benefits are concerned:

-cross platform usage: Other than altering syntax. a cut/paste of code across unrelated platforms is an massive perk.

-The 'FOR' loop:  Read up on it.  Massive time saver there.  By simply increasing the loop count you can perform what would be countless similar tasks.

-CASE sequences: Although completely doable in ladder.  CASE sequences in structured text are far easier to develop, augment, and troubleshoot.

that's just to list a few

Edited by Linear_Guy

Share this post


Link to post
Share on other sites

I started programming Mitsubishi's back in the days before the PC had been invented, using a plug in programmer and a cassette tape recorder to store the programmes on (or maybe not in a few cases)

The arrival of a laptop and DOS Medoc transformed the whole situation and I found that I always programmed in Instruction Mode (text commands) because it was much quicker, but often checked the ladder option and usually monitored in ladder, and the ability to work in either mode was a huge advantage.

I never liked the early Windows versions of GX Developer and remained faithful to DOS Medoc which seemed to do everything  better and faster.

About twenty years ago, I was dragged screaming and kicking into the world of structured ladder in Medoc +, which eventually evolved into IEC Developer V7.04 and is still there in GS Works I believe, though I've yet to give up on IEC Developer.

Initially I hated structured ladder, but now I would never use anything else, the main reasons being the flexibility, ease of use, and crucially the ability to design the ladder so that when monitoring, all the relevant components can be grouped together in one or two rungs so that everything relevant can be seen on the laptop screen at once.

As my programmes kept getting bigger (some are in excess of 30k lines now), this has proved invaluable many times.

I also love the "system variables" approach when doing complex calculations in the PLC, as I'm not forced to specify an address for each stage of the calculations, meaning that complex calculations can easily be done in one rung which is easy to monitor.

Interestingly, I taught IEC Developer structured ladder to my "young apprentice" and he then went on a Mitsubishi programming course that taught simple ladder (GX Developer) and he is of the same opinion as me.

Have never used the structured text option, mainly because in most industries, maintenance electricians can readily understand and monitor ladder (it's so similar to a wiring diagram) but very few will know how to use or read structured text.  

I realise I'm probably in the minority, but I guess it's what suits you best ...........

 

1 person likes this

Share this post


Link to post
Share on other sites
On 22/02/2018 at 5:38 AM, Colin Carpenter said:

Have never used the structured text option, mainly because in most industries, maintenance electricians can readily understand and monitor ladder (it's so similar to a wiring diagram) but very few will know how to use or read structured text.

I was one of those maintenance electricians that didn't know how to navigate around ST.  The "unfriendly" nature (if you will) of ST for maintenance and/or facility engineers is a beneficial byproduct of using it for complex operations in my opinion.

Some things shouldn't be tinkered with, and being intimated by whatever that "thing" is, is better than simply being told not to touch it...lol.  We utilize structured ladder as an interface for maintenance troubleshooting but it doesn't go any further than that.

I guess that approach could seem inappropriate to some, but the benefits of ST in terms stream lining advanced processes out weighs the inability of the regular maintenance guy of being able to play around with code that they shouldn't be altering in the first place.

Many ways to skin a cat as they say.  Personally, I would probably quit rather than attempt to rewrite our ST routines in ladder...lol

 

Share this post


Link to post
Share on other sites

Dear colleagues, thank You for the responses to this topic. More than 9 months left and I want to add more. 

1. I never met situations where Structured programming in comparison with ladder, potentially could make benefit.

2. In cases when I used the Structured programming result was negative. Instead of reducing programming time, there was increasing, PLC run slower and demanded more memory. You, may,  have to choose a stronger PLC for Your task.

3. Every new compilation can change the local variables address.You need to clear PLC memory every time before download. It's most annoying.  After that all registers used have to be set again to their values.

Conclusion: Use ladder. 

For discussion: If we avoid using local variables in the Structured project (make all global), is it still necessary to clear PLC memory before download?

Share this post


Link to post
Share on other sites

wlederer, your conclusions are very and very strange. Everything is exactly the opposite.

Share this post


Link to post
Share on other sites

Self-preferences aside, in the end it's about choosing the right tool for the right job.

For example, playing with sequences and interlocks are easier using ladder.
Doing Maths and data shifting are easier using structured text.

16 hours ago, wlederer said:

3. Every new compilation can change the local variables address.You need to clear PLC memory every time before download. It's most annoying.  After that all registers used have to be set again to their values.

Most PLC with Structured Text functionality enables you to set specific address to be used for the local variables, also enables you to set initial values of those variables via the variable table. Aside from that you can set settings in the programmer so that only certain interval of variable addresses are allowed to be used for variables. I believe Mitsubishi's should be the same.

Share this post


Link to post
Share on other sites
On 7/31/2018 at 4:49 PM, Inntele said:

wlederer, your conclusions are very and very strange. Everything is exactly the opposite.

Dear Inntele, thank You for the response. Please, explain, what everything?

Do You mean, if structured programming would be chosen, the PLC will run quicker and demand less resources?

1 person likes this

Share this post


Link to post
Share on other sites
3 hours ago, wlederer said:

Dear Inntele, thank You for the response. Please, explain, what everything?

Do You mean, if structured programming would be chosen, the PLC will run quicker and demand less resources?

Dear wlederer,

Yes, absolutely.

The single thing, I don't understand how I can able to help you to estimate all advantages. It looks very difficult, in particulary if to take into account that my spoken English is not so good(

Share this post


Link to post
Share on other sites

Much better than my Russian Inntele

спасибо

Share this post


Link to post
Share on other sites

Heh, Ron_S,

It's funny. But for me it is so melancholy....

Share this post


Link to post
Share on other sites
On 31/07/2018 at 4:40 PM, wlederer said:

Dear colleagues, thank You for the responses to this topic. More than 9 months left and I want to add more. 

1. I never met situations where Structured programming in comparison with ladder, potentially could make benefit.

2. In cases when I used the Structured programming result was negative. Instead of reducing programming time, there was increasing, PLC run slower and demanded more memory. You, may,  have to choose a stronger PLC for Your task.

3. Every new compilation can change the local variables address.You need to clear PLC memory every time before download. It's most annoying.  After that all registers used have to be set again to their values.

Conclusion: Use ladder. 

For discussion: If we avoid using local variables in the Structured project (make all global), is it still necessary to clear PLC memory before download?

I think this is a problem specific to Mitsubishi, confirming my opinion that it should be thrown in the bin.

Share this post


Link to post
Share on other sites
5 hours ago, ParaffinPower said:

I think this is a problem specific to Mitsubishi, confirming my opinion that it should be thrown in the bin.

Hi ParaffinPower,

Mitsu manufactures products that are quite reliable... in a technicial plane. The issue is a stupid management and bad documentations, a cheesy software. If to say about the management, I know two people (in Europe), which are qualified specialists and good guys. However they are workinkg under a very stupid leadership. I'm very, very angry to Mitsu management for a lot of issues, they created and continues to create. I'd with a great pleasant thrown the Mitsu to a bin, but I spent about 20 years of my life using this equipment.

Edited by Inntele
2 people like this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now