A guide to writing PLC programs

WBOY
Release: 2024-01-25 10:39:19
forward
709 people have browsed it

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!

Related labels:
source:docexcel.net
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!