Home Computer Tutorials Computer Knowledge A guide to writing PLC programs

A guide to writing PLC programs

Jan 25, 2024 am 10:39 AM
plc design steps

A guide to writing PLC programs

How to write PLC program answer

Programming is the most critical issue in PLC applications.

The basic idea of ​​PLC programming is to design the logical relationship between input and output signals according to the requirements of the equipment to achieve the expected working process. In order to achieve this goal, there are several common methods that can be adopted. A simple and commonly used method is to target the process, analyze the starting conditions and limiting conditions of each process, and then write the corresponding PLC program based on these conditions. In this way, the PLC program for all processes can be completed step by step, thereby completing the design of the entire PLC program. Another commonly used method is the state transition method. By analyzing the state transition conditions of the equipment, each state transition is defined as a subroutine, and these subroutines are connected in a certain order to form the entire PLC program. Finally, another commonly used method is the event triggering method. According to the event triggering conditions of the equipment, each event is defined as a subroutine, and the corresponding PLC program is written according to the sequence of events. In this way, different working processes of the device when triggered by different events can be realized. To sum up, the basic idea of ​​PLC programming is to analyze the starting conditions and limiting conditions of the process according to the requirements of the equipment, and then choose the appropriate method to write the corresponding PLC program to achieve the expected work process.

There are many methods of programming, such as state table method, function diagram method, flow chart method and modern Petri net method. ①

The state table method is a method evolved from the traditional relay logic design method. With appropriate improvements, it is suitable for programmable controller ladder diagram design. However, the state table method is only suitable for the programming of single sequence problems, and is not suitable for problems with parallel sequence and selection sequence. Therefore, when designing complex programs, we need to adopt other suitable methods to solve parallel order and selection order problems.

The function diagram method is a method of expressing control requirements as a function diagram. The control functions that the programmable controller needs to complete can be clearly explained through the function diagram. On the basis of the function diagram, the corresponding logic equations can be derived, and further ladder diagrams can be drawn or instructions written. This approach can effectively help developers understand and design control systems.

③The flow chart method is a commonly used programming method by programmers who are familiar with high-level computer languages.

PLC design steps

1. Design topic

Design of PLC control system for thermostat box

2. Design purpose

a) Master the basic principles and applications of PLC through design, so that students can receive comprehensive training in PLC system design, master general methods and procedures, and improve their ability to use PLC for application system development.

b) Master the PID control method of temperature using PLC.

c) Cultivate students' ability to consult technical information, comprehensively apply the knowledge they have learned, and complete tasks independently based on actual practice.

d) Improve students’ basic qualities of being serious, responsible and meticulous in their work, being able to observe things with concentration, being brave in innovation, and brave in practice.

3. Equipment overview and data

1. Select Siemens S7200 programmable controller as the host machine

2. Main parameters

Temperature range: 200-1050℃

Control accuracy: ±1℃

Input voltage: AC200—240V

Power consumption: 2KW

Outline size: 40*45*45cm

3. System composition

Use a temperature sensor to detect the temperature value of the thermostat and convert it into a standard current (or voltage) signal, then send it to the A/D conversion module, and the converted digital signal is sent to the PLC host. The PLC host obtains a control quantity, and the size of the control quantity determines the conduction time of the relay controlled by the PLC output, thereby controlling the temperature value.

4. Control

Using PID control algorithm, the temperature change of the PLC-controlled thermostat can operate according to the given curve, as shown in the figure below.

4. Design tasks

1. Design the electrical control schematic diagram.

2. PLC selection and I/O allocation.

3. Select the required electrical components and list the detailed list of electrical components.

4. PLC control program design.

5. Reference materials

1. Automatic control principle and system

2, PLC and application

How to program PLC

PLC programming programming theory is important. Without theoretical preparation or guidance, just relying on groping in practice, simple problems are easy to solve, but complex ones are difficult to solve. Not only is there no way to start, but after spending time and energy, it is also difficult to program a program with higher efficiency and higher quality, often resulting in half the effort with half the effort.

However, the specific practice of PLC programming and the knowledge or skills gained in practice, that is, experience, are also important. Without experience and only theory, one cannot deeply understand the theory and cannot apply the theory flexibly. This is just like learning mathematics. If you only understand the theorems or memorize formulas without doing corresponding exercises, you will definitely not learn well. Not to mention, theories are just summaries of experience, and in the final analysis they all come from practice.

Experiences include others' and your own, both are important. The former requires careful study, and the latter requires careful accumulation, both of which require sufficient time and necessary energy. Other people's experiences have been published in books or magazines. Some of it is based on careful learning from others, but most of it is my own experience. All the examples have been tested by me and proven to be feasible in practice. I think the explanations in other books or magazines will be like this. It is necessary to learn from Yang Gong's experience. The experience of your colleagues is also worth learning from. This experience is very "close" to you and easy to learn from.

Your own experience is the most important. You must accumulate your own experience in your own practice. It is best to learn from other people's experiences and also do some tests yourself so that you can have similar experiences yourself and then make these experiences your own. This is also an important accumulation of one’s own experience. There are also experiences of failure, which are often not made public, but these experiences must be learned and accumulated. To accumulate experience, you must use your own brain to record it, and you must use a computer to record it. It is best to make some classifications and create a self-use library for easy reference at any time.

Experience still needs to be sublimated. There are three levels of sublimation: For Xiamen PLC training, look for Xiamen Chengyi Automation Skills Training!

The lowest level creates a typical program library for future reuse. If it is a program, you can also create function blocks or subroutines for later reference. Secondly, we must summarize effective algorithms. Such as single button start and stop program library, etc.

The highest level of sublimation is to elevate experience to the level of theory and contribute to enriching PLC programming theory. I think that with the popularization and improvement of PLC use, there will be more and more PLC programming theories that are sublimated from experience and can be used to guide practice.

Experience accumulation and experience sublimation are both applications.

There are three empirical applications:

Used as engineering design template. When designing a new system, select one or several successful projects that are similar to the current design project as a model for design. This can not only reduce the design workload, but also improve the design success rate. This is also a big benefit of information being reusable.

is used as a programming reference. When there is no successful project to serve as a model, there is still a considerable part of the control logic in the newly designed logic, and existing typical logic can be adopted or borrowed. This can also reduce the design workload and improve the design success rate.

is used as a reference for algorithm design. When there is no template to refer to and no typical model to adopt, successful algorithms from the past can also be used.

Experience is valuable, but experience, especially personal experience, is always limited. The application of experience must also be combined with programming theory. If previous experience cannot help you, then go to Xiamen Chengyi PLC training for practical and theoretical learning

Xiamen Skills Training Find Xiamen Chengyi Skills Training, Xiamen PLC Training Xiamen PLC Automation Training Xiamen Mitsubishi PLC Training Xiamen Siemens PLC Training Xiamen Omron PLC Training Xiamen Analog Module Training Xiamen Configuration Software Training Xiamen Touch Screen Training

The above is the detailed content of A guide to writing PLC programs. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1673
14
PHP Tutorial
1278
29
C# Tutorial
1257
24
Effortles Fixes for Black Screen After Installing a Graphics Driver Effortles Fixes for Black Screen After Installing a Graphics Driver Apr 15, 2025 am 12:11 AM

Have you ever encountered a black screen after installing a graphics driver like an Nvidia driver in Windows 10/11? Now in this post from php.cn, you can find a couple of worth trying solutions to the Nvidia driver update black screen.

KB2267602 Fails to Install: Here Is How to Fix It! KB2267602 Fails to Install: Here Is How to Fix It! Apr 15, 2025 am 12:48 AM

KB2267602 is a protection or definition update for Windows Defender designed to fix vulnerabilities and threats in Windows. Some users reported that they were unable to install KB2267602. This post from php.cn introduces how to fix the “KB2267602 fai

Difference Between RAID Recovery and Hard Drive Recovery Difference Between RAID Recovery and Hard Drive Recovery Apr 17, 2025 am 12:50 AM

Data recovery is always a heated topic. To successfully restore data from your device, you should know how it stores data. You can learn the difference between RAID recovery and hard drive recovery from this php.cn post.

How to Fix the File System Error (-1073741521) in Windows? - MiniTool How to Fix the File System Error (-1073741521) in Windows? - MiniTool Apr 16, 2025 am 12:37 AM

File system errors commonly happen on people’s computer and the error can trigger a series of linked malfunctions. This article on php.cn Website will give you a series of fixes to targeting the file system error (-1073741521). Please keep on with yo

Fix Security Tab Not showing in Folder Properties Windows 11 Fix Security Tab Not showing in Folder Properties Windows 11 Apr 17, 2025 am 12:36 AM

The Security tab in File Properties helps set different permissions for different groups and users to a file or folder. Some users find that Windows 11 Security tab missing from File Properties. This post from php.cn gives some methods to fix it.

Community Tips for Black Folder Background Windows 10/11 Community Tips for Black Folder Background Windows 10/11 Apr 15, 2025 am 12:40 AM

Seeing a black folder background Windows 10/11 when you open File Explorer? In this post from php.cn Solution, you will learn a couple of useful solutions to remove the black background in folders.

The File Can't Be Displayed in OneDrive - How to Resolve It? The File Can't Be Displayed in OneDrive - How to Resolve It? Apr 18, 2025 am 12:47 AM

Are you struggling with the “the file can’t be displayed” error when accessing the specific folder? Some users are complaining about this trouble and looking for useful measures. This article about the file can’t be displayed OneDrive from php.cn wil

Guide - How to Stop Expired Windows Server Auto-Shutdown? Guide - How to Stop Expired Windows Server Auto-Shutdown? Apr 18, 2025 am 12:48 AM

Some users report that they meet the Windows Server auto-shutdown issue after the license expires. This post from php.cn teaches you how to stop expired Windows Server auto-shutdown. Now, keep on your reading.

See all articles