How to organize your project for better reading and changing?

Kandid

Member
Join Date
Mar 2022
Location
Mozyr
Posts
3
I am beginner in B&R Automation Studio and TIA Portal. Have an experience in electrical part of PLC cabinets. Now its time to get a new skills. First of all I want to create good template for all projects. I find this tutorial which tells about Abstraction, Modularity, Interfaces (https://youtu.be/MAJOn1VAguo?list=PLcTp_342hzaCYPOqmG70UUPANYE95s5vW&t=1098). It's like object oriented programming, but without classes.
I created interface for managing servo drive (https://imgur.com/a/syzBW61). Then I can create variables for each servo drives, mapping them outputs and inputs but...

What should the project look like in general? Main.st with sequence via SWITCH CASE for auto mode and manual mode of technological process with catch the errors? I am looking for best practice in PLC programming.
Its rude to ask but could someone share completed template or explain how better to do it?
P.S: Sorry for my English. Its not my native language.
 
What is your definition of structured and OOP?

Why do you want your project/system to be programmed using structured method?


There some resource that you may want to look at for guides, PLCOpen have a few publications describing good program.

They many many guides. Siemens has their own programming style guide.


There are many methods to make your program structured,readable,maintainable, easy to debug, reusable....etc.
How you name your variables, FBs, Interface. How much detail you expose at a certain level (abstraction), the higher structures have less detail, lower ones have more detail.
Do not repeat your code. an FB/FC "should" should (specialize in) do one task very well.

These and many more are concepts of system design. They are not ridged step by step methods but a catalogue from which you few, some of all of the methods that are best for a specific project.

The stakeholders requirement influence you program to some degree or another.


B&R, CodeSys and those base on it including TwinCat3 make it considerably easier to "structure" a program.
Look for blogs, tutorials and project examples on Siemens support, github and search the web.

Look at systems engineering (some terms to look for MBSE, SysML, OPM) tutorials specially for embedded systems and take from that which could apply to industrial automation.
 
What is your definition of structured and OOP?
I was talking about abstraction, encapsulation and etc. There is a good metodology in C++, Java and other OOP languages. And I found that structers are good for implement an abstraction. I wanna to write nice code in ST, SFC, FBD where I can realyze, scalability, good readability and support. And now I am looking for nice tips of programming.
Why do you want your project/system to be programmed using structured method?
I think that in ST I can make general intefraces for realyze good abstraction and reading. ST is not have classes.
Well, I know that I can use ST and FBD together. ST is good when you need loops and Math, on the other hand FBD is good for simple control, changing and reading DI and DQ... Its all as I understand :D

Thank you very much for links and explanations. I will read it and will find examples of good code.
 
I am looking for TwinCAT and its seems interesting. Does it often used in automation?
 
Last edited:
The key is to spend more time on the front end architecting code and then less time writing it. State diagrams are a necessity for work in any PLC language.

I get nervous around people that immediately sit down and start frantically punching keys. Don't hire a guy who does not have a pen in his pocket...

There's a PLC class outline download at corsairhmi.com that has notes on a wide variety of things - including some on program organization.
 
I am looking for TwinCAT and its seems interesting. Does it often used in automation?


They just announce their revenues for 2021of something just over a billion dollar and stated that it was the largest growth they ever had, year over year.
 

Similar Topics

I just about have my siemens project wrapped up, and all my DB, FC, and FB numbers are all over the place. Is there a simple way to organize...
Replies
5
Views
2,094
Hi I've sucefully implemented the data logging function with the s7-1200 1212C, but when i open the data log file in .csv excel format it shows...
Replies
2
Views
4,975
Hello I need to organize data exchange between Siemens S7-400 and Schneider M340 PLC via ethernet. I created a connection between S7-400 CPU and...
Replies
1
Views
2,340
I am trying to get RSView to display and print selected alarms. What I would like to be able to do is select a start date and end date for a...
Replies
2
Views
2,564
Hi All, Someone at work has put a PLC system on my desk, that's just been taken off an idle production line. He said "It's an S7 PLC. We don't...
Replies
10
Views
250
Back
Top Bottom