Disruption in the Automation World, and a practical PLC Code Generator to get started

I don't think a practical PLC code generator will ever exist. There are too many options or variations. The problem is people, not technology. The other problem is lack of standardized PLC code. Each PLC manufacturer has a different way of implementing ladder.

I really don't do much PLC coding. I avoid it if possible because it is painful. It is like trying pain a Rembrandt given only 3 colors red, green and blue. Choices are simple as there are only 3 colors. This is like art class in kindergarten or primary school. Remember finger painting anyone? However, the simplicity doesn't make painting a Rembrandt any easier. The other problem is that it doesn't make any difference how many colors I have on my palette. I could never duplicate a Rembrandt. That is the people problem.
 
It's not an IDE, but rather an API.
It is both open and customizable.
Do you have to learn the API to use it? Yes, but everything is switching to API's nowadays. I never heard anybody complain about having to learn an API of a valuable service.

While the API concept has a lot of strengths like standard interface to the blocks and the number of hours that those blocks ran in 100's of applications without issues, it is nevertheless not something developed in house and therefore the company that integrates it is not adding as much value.

Another issue with the API is that it can get clunky to create some logic... or some blocks not being supported or needing a struct instead of a bool variable.

In IT no one complains about learning an API, because knowing the API is a gateway to access another company's services. No one complains about learning the Amazon API, because otherwise they don't get their services.

The time it takes me to learn the API for a Valve or Motor block is roughly the same that it would take me to code that Valve or Motor block. So there is a bit of a conflict there when deciding which way to go. Obviously, the standardization on the interface will make learning easier as the signals will have the same meaning on all blocks.

Also, once you use that API, you are tied down to them. If for some reason you want to use other controllers, you'll have to recreate the whole thing again.

I'm now using Siemens APL, which is similar to what you described... and apart from having the icons thrown in a SCADA page, I don't really like it.
 
I'm now using Siemens APL, which is similar to what you described... and apart from having the icons thrown in a SCADA page, I don't really like it.

You mean you're using PCS7.
It is indeed being sold like what I described, but it is not.
You still have to program most of the logic by yourselves. It's actually even worse. For a decent size application you'll spend most of your time drawing connections and compiling.

They actually built a pretty good marketing story around it. I've seen expert teams of Siemens getting run into the ground on their own projects because of the limitations it poses.
 
Yes... but I can also use PCS7 without APL... Not that I would want to, but I can. Likewise, Siemens also sells more libraries such as the Industrial Library and another for Power generation/Distribution Industry.

To be honest... I've given up on doing logic in CFC charts. It's useless to drag these things around (along with structs instead of signals) to create some sort of functionality. If it involves more than one logic (AND or OR) block, I'll be writing a function in STL of SCL to perform that bit of the program and just link it to the larger bits.

In my perspective, the PCS7/APL is bad enough for me to look into anything other than me being in charge of everything.

Another thing that really annoys me is the bloat that the APL creates. The process being controlled in our plants could easily be done with a S7-319 programmed "as usual". But the PCS7 program can't fit into a S7416 so we have to use additional RAM instead of EPROM.

When I think of all the useless code that is added like all the possible simulation modes, etc... it makes a pretty strong case for being a way for Siemens to flog away their 400 CPU's.

I love Siemens stuff for Automation in General, but this PCS7 is not for me (and definitely not for the size of the company I work for... but they had chemists deciding what control system to use).
 
Haha totally agree with you there.

Too bad that this leads to you not looking at other options.

PCS7 is a move towards a more closed system. What I'm advocating is a more open system.

You mention the Chemists decided: is it because they have Batch running on top of it?
 
Don't get me wrong... I will look at other options if available. As I said some of the features in PCS7 are not bad and will speed up the creation of the control system. But at the end of the day, there's plenty of nuances and it sucks having to go around something like you are saying to implement some new functionality.
This being said, PCS7 is powerful if you're looking at complex systems where you use more than one PLC and a full on Siemens package.

Another thing that annoys me in PCS7 (and possibly your system) is that I am no longer in charge of the memory allocation (within reason). If I wanted to use servicelab to log some variables, I would have to dig down into cmopiler generated DB's to find the signals I want.

In your system, can I move tomorrow from a Siemens to Schneider/AB system?

No, there's no batch or route or even safety matrix used. As I said, the top of the line S7-300 could control the process.
They went that way because:

- They think they are better/bigger than they are.
- They know nothing of control systems.
- They think the control system is a headache they have to deal with to get output from the plant.
- They know little of leverage and negotiation.
- They listened to Siemens story about how great PCS7 is.

And again, don't get me wrong. PCS7 is powerful but it only makes sense for large systems.
 
Ed, the way you describe the tool, it is clear that you have a DCS style task in mind.
I have no experience with DCS, so your tool could be useful but I wouldnt know. But for my task which is complex machinery in small to medium plants, a DCS way of solving the task would be a disaster. What I mean is that the tool you suggest could be disruptive in certain areas of the automation universe, but not for everything.

And for the open-source controller, just forget it.
1. It is far more important that we can get support and spares worldwide 24/7. Open source means we would be on our own. The actual cost of the PLC hardware is maybe 2-5% of the total cost of our projects.
2. Who certifies the open source PLC ? Who can give me a signed Declaration of Conformity to EC standards ? Without that, I cannot make a signed Declaration of Conformity for the machines and plants that we hand over to our customers.
3. Safety PLC ? If so, double down on point 2.
4. Redundancy ? Good luck with developing an open-source redundant PLC that is so thoroughly tested that profit and people can rely on it with assurance. Take a look at how the biggest automation vendor (Siemens) still only offer the previous generation PLC (S7-400) when you want a solution with redundancy.

A small simple open source PLC could be possible. An open source PLC on DCS scale is IMO impossible.
 
Fascinating project and discussion. Market forces will end up dictating the evolution of projects like this. If there is demand or a vacuum to fill it stands a chance. And if it lives/thrives, the result is nothing like what the originators dreamed of.
 
Another thing that annoys me in PCS7 (and possibly your system) is that I am no longer in charge of the memory allocation (within reason). If I wanted to use servicelab to log some variables, I would have to dig down into cmopiler generated DB's to find the signals I want.

In your system, can I move tomorrow from a Siemens to Schneider/AB system?

Yes I can build in the option to define your own DB numbers. I had this in originally but temporary dropped the feature to come to a working product as fast as possible.

And yes you can indeed move between systems, it's just a matter of switching templates. Actually the example is generating for both Siemens and Bedrock/CoDeSys at the same time.
 
Ed, the way you describe the tool, it is clear that you have a DCS style task in mind.
I have no experience with DCS, so your tool could be useful but I wouldnt know. But for my task which is complex machinery in small to medium plants, a DCS way of solving the task would be a disaster. What I mean is that the tool you suggest could be disruptive in certain areas of the automation universe, but not for everything.

Actually my background if for a big part PLC-based, mostly Batch-processes (not necessarily with batch application on top). I know it works there, and that there's a lot of value.

A DCS is probably easier, especially for continuous processes. That's not taking into consideration that DCS systems are more closed.

I have the least experience in machine automation. Certainly interested in the methods and approach you use there.
 
I have the least experience in machine automation. Certainly interested in the methods and approach you use there.
It is a mix of logic control and special control loops.
For the logic part, if it is simple with just a few logical states with some timers thrown in, I just write it in plain Ladder.
If the logic is anywhere complex I use a state machine (not same as SFC). I have made my own state machine since there is no canned one from Siemens (they used to have something called HiGraph, but they have cancelled it).
For the control loops and other more complex stuff I use Stuctured Text.

My wish would be to have a more unified PLC and HMI solution.
I gnash my teeth by having to create alarms one-by-one and link them to my code and hmi (again Siemens have something called PDiag which handles alarming and messaging in a centralised manner, but is works mostly with SFC, and I am not even sure if it is still supported in their latest software - TIA).
Same with operator input and status information. Why cannot this be generated automatically by the HMI/PLC software ? I dream of a setting for each variable that I setup in the PLC that I just have to activate a switch "give access for operator to view" or "give access for the operator for input", and then the HMI is automagically generated for all the objects I have created in my project (which there may be hundreds and hundreds of).
Since all my variables are organised in a structured way, the HMI could be generated by the same structure, so I dont have to do the same job twice.
 
Actually my background if for a big part PLC-based, mostly Batch-processes (not necessarily with batch application on top). I know it works there, and that there's a lot of value.

A DCS is probably easier, especially for continuous processes. That's not taking into consideration that DCS systems are more closed.

I have the least experience in machine automation. Certainly interested in the methods and approach you use there.

For machine control (which is what I prefer), it is more of a series of steps than keeping a process functioning correctly. You have a series of mechanical components that need to do the right thing at the right time. Most of the more complex machinery I have dealt with has been packaging machinery. At this step, there is a part or isn't a part, if there is do this, if not do this, move to the next step. With each step you then decide what can go wrong. Is this a quality issue or a safety issue, safety issues always taking priority. I prefer to build safety alarms as I go in each step and the step itself is is in my head and I'm thinking through it and build the alarms as a single routine.

That being said, there is also state-based machine programming which I have not had to deal much with as I always dealt with linear processes. That being the case, it is useful to have libraries for how, for instance, a cylinder should function, but machine safety is highly situational and depends on many different mechanical variables based on the machine, the tooling, guarding in place, etc. I see an algorithm that can handle that to be years in the making, and a bug in that algorithm that only appears in a very specific situation could easily cost someone their life.

In my experience, no two machines are ever the same. Even two identical machines made in exactly the same way will have some small mechanical variance that may require some fine-tuning, and for this reason every single machine I have ever worked on has had a way of adjusting various components, either mechanically or electronically.

For the same reason PID controllers have offsets in place. I used to work on water heating PID's and the factory-calibrated controllers were all ~ 5 degress F off. We had to compare measurements with other precise tools and properly set the offset to get the controller to the proper reading, however they were all equally precise in their measurements.

This is just an example where automatically generated code can go awry. How much time is saved generating a code for something so situational vs the time it takes to examine that code and make sure everything is the way it should be? How much is lost in the way of readability via comments as the programmer writes the code?

Will machines be doing the troubleshooting on the system when a component fails? This is why ladder is so frequently used. It doesn't matter what platform that ladder is on, with some basic documentation I can read a ladder from one platform to the next easily and quickly to figure out what is happening and determine why based on the machine's symptoms. So can just about every other industrial electrician I have worked with.

IT requires a large amount of logical knowledge in the form of reading code and being able to see what is happening in your head. Mechanics tend to be very visual creatures as that is what they work with. I'm loving this thread.
 
1. It is far more important that we can get support and spares worldwide 24/7. Open source means we would be on our own. The actual cost of the PLC hardware is maybe 2-5% of the total cost of our projects.
The company would sell these controllers for probably the same price as a normal controller. Maybe more.
2. Who certifies the open source PLC ? Who can give me a signed Declaration of Conformity to EC standards ? Without that, I cannot make a signed Declaration of Conformity for the machines and plants that we hand over to our customers.
The company would undergo the same EC testing that existing PLC manufacturers do. Don't buy it/licence it from the company? You will have to either do the tests yourself, or buy from a third party that does the tests.
3. Safety PLC ? If so, double down on point 2.
Using the safety PLC to get PLe? I'd definitely buy it from the company licencing the open source safety PLC, to get the EC and liability I need.
4. Redundancy ? Good luck with developing an open-source redundant PLC that is so thoroughly tested that profit and people can rely on it with assurance. Take a look at how the biggest automation vendor (Siemens) still only offer the previous generation PLC (S7-400) when you want a solution with redundancy.
It's tough, but someone's done it before.

For such a venture to be successful, I think the trick would be to be the best, and be able to backup your claims with hard data.
 
Not sure how automatic code generation can be more prone to errors, once the generator and template have been validated. Humans can program something 1000 times correctly, and then make a mistake on the 1001th. The generator never fails if the first time is correct.

...

It's not really code, it's rather a convention of how to describe actions, transitions, ... . The people using it are actually happy of having a convention because often they have no manual about how something like this should be written.

What you are proposing is taking a two step process (write a software spec / code the software) and turning it into one step (code the software while describing what the software must do).

Writing a spec in the correct format for interpretation by your compiler is the equivalent of writing in python and compiling to C++ code. Sure the syntax is a little easier and more forgiving, but you are still coding.

The steps 1 through 7 of the V model are intended to be performed by people so they can raise flags along the way when they spot errors. "hey, I was trying to write an Software spec from your FDS. You didn't say that this needs a whatsit, and from experience we need a whatsit."

I don't think "Write your Software Design Spec in python and I'll compile it to C++ and run an automated test to make sure I have done what I have been programmed to do," satisfies the requirements of the V model.

If you look at the reliability diagram of steps 3,4,5, using some example failure rates your method is five times more likely to fail.

Code:
SDS                               Coding                             Validation                                                Failure
Error that compiles          1%                                                              NOT OK        1.000000%        }        
Error that doesn't compile   9%                                                              OK                             }   1.000%
No Error                    90%                                                              OK                             }        
                                                                                        
                                                                 {  NotDetect     10%        Not OK        0.100000%        }        
                         {        Not Detected               10% {                                                          }        
                         {                                       {  Detect        90%        OK                             }        
                         {                                                                                                  }        
                         {                                       {  NotDetect     10%        Not OK        0.010000%        }        
Errors   10%             {        New error                  1%  {                                                          }        
                         {                                       {  Detect        90%        OK                             }        
                         {                                                                                                  }   0.200%
                         {        New Error doesn't compile  9%                              OK                             }        
                         {        Detected                  80%                              OK                             }        
                                                                                                                            }        
                                                                 {  NotDetect     10%        Not OK        0.090000%        }        
                         {        Error                      1%  {                                                          }        
                         {                                       {  Detect        90%        OK                             }        
No Error 90%             {                                                                                                  }        
                         {        New Error doesn't compile  9%                              OK                             }        
                         {        No Error                  99%                              OK                             }
 

Similar Topics

I noticed in Rockwell AOIs, they add a BOOL Output parameter at the end of the "Parameters" list of each AOI that carries the same name as the...
Replies
1
Views
39
I have Allen Bradley plcs, I have had Circuit breakers and other automation equipment in the past. There's no solid buyers local. How much do you...
Replies
2
Views
190
Hello, I have an automation direct d2 262 plc and C-more HMI EA9T6CL-R. I need to prepare a program, scheduled to be performed on a future date. I...
Replies
1
Views
114
Hello all- I have a unique challenge using a customers Direct logic 06 PLC. This customer has a DC motor operating at 10 RPM which is turning a...
Replies
1
Views
129
Hi, I have been trying to run drive via Sysmac studio. I can ping the drive. I can see the logic bits going on/off as per command. But, drive is...
Replies
21
Views
544
Back
Top Bottom