First, the definition and classification of PLC
PLC is based on microprocessors, a combination of computer technology, automatic control technology and communications technology, with user-oriented control process-oriented "natural language" programming, adapted to industrial environments, simple and easy to understand, easy to operate, high reliability of a new generation of general industrial control devices.
PLC is a microprocessor-based general-purpose automatic control device developed on the basis of relay sequence control.
1 Definition of PLC
Programmable logic controller is a digital algorithmic operation electronic system designed for application in industrial environments.
It employs a programmable memory for storing instructions within it to perform operations such as logic operations, sequence control, timing, counting, and arithmetic operations, and to control various types of machinery or production processes through digital and analog inputs and outputs.
Programmable controller and its related peripherals, should be easy to form a whole with the industrial control system, easy to expand its function of the principle of design.
2 PLC classification
PLC product variety, its specifications and performance are different. For PLC, usually based on its different structural forms, functional differences and the number of I / O points, etc. for general classification.
2.1 Classification by structural form
According to the structural form of PLC, PLCs can be categorized into two types: integral and modular.
(1) Integral PLCs
Integral PLC is the power supply, CPU, I/O interfaces and other components are centrally mounted in a chassis, with a compact structure, small size, low price. Small PLC generally use this integral structure.
Integral PLC by different I / O points of the basic unit (also known as the host) and the expansion unit consists of a basic unit of the CPU, I / O interface, and I / O expansion unit connected to the expansion port and the programmer or EPROM writer connected to the interface, etc.; expansion unit only I / O and power supply, etc., and there is no CPU.
Between the basic unit and the expansion unit is generally connected with a flat cable. Integral PLC can also be equipped with special function units, such as analog units, position control units, etc., so that its functions can be extended.

(2) Modular PLCs
Modular PLC will be the PLC components are made into a number of separate modules, such as CPU modules, I / O modules, power supply modules (some contained in the CPU module) and a variety of functional modules. The modular PLC consists of a frame or substrate and various modules, which are mounted on the sockets of the frame or substrate, as shown in the figure.
This modular PLC is characterized by flexible configuration, according to the need to select a different size of the system, and easy to assemble, easy to expand and maintain. Large and medium-sized PLCs generally use a modular structure.

There are also PLCs that combine the characteristics of the monolithic and modular types to form so-called stacked PLCs.
Stacked PLC CPU, power supply, I / O interfaces, etc. are also independent modules, but they are connected by the cable, and the modules can be stacked layer by layer. In this way, not only can the system be flexibly configured, but also can be made compact.
2.2 Classification by function
According to the different functions of PLC, PLC can be divided into three categories: low-grade, mid-grade and high-grade.
(1) low-grade PLC
Low-grade PLC with logic operations, timing, counting, shifting and self-diagnostics, monitoring and other basic functions, but also a small amount of analog input/output, arithmetic operations, data transfer and comparison and communication functions, mainly for logic control, sequence control or a small amount of analog control of the stand-alone control system.
(2) Mid-range PLC
Mid-range PLC in addition to low-grade PLC functions, but also has a strong analog input / output, arithmetic operations, data transfer and comparison, digital conversion, remote I / O, subroutines and communication networking and other functions; some can also be added to interrupt the control, PID control and other functions, suitable for complex control systems.
(3) High-grade PLC
High-grade PLC in addition to the functions of mid-range PLC, but also increased the sign of arithmetic operations, matrix operations, bit logic operations, square root operations and other special functions such as arithmetic, tabulation and form transfer functions.
High-grade PLC has stronger communication and networking functions, which can be used for large-scale process control or distributed network control system, thus realizing factory automation.
2.3 Classification according to the number of I/O points
According to the number of I / O points PLC, PLC can be divided into small, medium and large three categories.
(1) Small PLCs
Small PLCs have less than 256 I/O points, a single CPU and an 8-bit or 16-bit processor, and a user memory capacity of 4KB or less.
(2) Medium-sized PLCs
Medium-sized PLCs have 256 to 2048 I/O points, dual CPUs, and 2 to 8 KB of user memory.
(3) Large PLCs
Large-sized PLCs have more than 2048 I/O points, multiple CPUs and 16-bit or 32-bit processors, and a user memory capacity of 8 to 16 KB.
In the world, PLC products can be geographically divided into three major schools, a school of American products, a school of European products, a school of Japanese products.
The PLC technology of the United States and Europe is researched and developed independently in isolation from each other, so there is a clear difference between the PLC products of the United States and Europe.
While Japan's PLC technology was introduced by the United States, the United States of America's PLC products have a certain inheritance, but Japan's main products are positioned in the small PLC. The United States and Europe are known for large and medium-sized PLCs, while Japan is known for small PLCs.
Second, the function and application areas of PLC
PLC is a synthesis of the advantages of relay contactor control and computer flexibility, convenience and the advantages of the design and manufacture and development, which makes the PLC has many other controllers can not be compared to the characteristics.
1 PLC function
PLC is a microprocessor as the core, a combination of computer technology, automatic control technology and communication technology developed a general industrial automatic control device, with high reliability, small size, strong functionality, simple programming, flexible and universal and easy maintenance and a series of advantages, and therefore has a wide range of applications in the fields of metallurgy, energy, chemical industry, transportation, electric power, etc., and has become the modern industrial control of the One of the three pillars (PLC, robotics and CAD/CAM) of modern industrial control. According to the characteristics of PLC, its functional form can be summarized in the following types.
(1) switching logic control
PLC has a powerful logic operation capability, and can realize a variety of simple and complex logic control. This is the most basic and widespread application area of PLC, which replaces the traditional relay contactor control.
(2) Analog control
PLC is equipped with A/D and D / A conversion module, A/D module can be the site of the temperature, pressure, flow, speed and other analog conversion into digital quantities, and then by the PLC microprocessor processing (microprocessor processing can only be digital quantities), and then control; or by the D / A module converted to digital quantities, and then control; or by the D / A module converted to digital quantities.
Or converted by the D / A module into analog, and then control the controlled object, so that the PLC can be realized on the analog control.
(3) process control
Modern large and medium-sized PLC are generally equipped with a PID control module, can be closed-loop process control. When a deviation of a variable in the control process, the PLC can calculate the correct output according to the PID algorithm, and then control and adjust the production process to keep the variable at the set value. At present, many small PLC also has PID control function.
(4) Timing and counting control
PLC has a strong timing and counting functions, it can provide users with dozens or even hundreds, thousands of timers and counters.
Its timing time and counting value can be set arbitrarily by the user when writing user programs, and can also be set by the operator in the industrial field through the programmer, thus realizing the control of timing and counting. If users need to count signals with higher frequency, they can choose high-speed counting module.
(5) Sequence control
In industrial control, PLC step instruction programming or programming with shift registers can be used to realize sequence control.
(6) Data processing
Modern PLC is not only capable of arithmetic operations, data transfer, sorting and table lookup, but also capable of data comparison, data conversion, data communication, data display and printing, etc. It has strong data processing capability.
(7) Communication and networking
Most of the modern PLC adopts communication and networking technology, with RS-232 or RS-485 interface for remote I/O control.
Multiple PLCs can be networked and communicated with each other, and program and data exchanges can be realized between external devices and signal processing units of one or more programmable controllers, such as program transfer, data file transfer, monitoring and diagnostics. Communication interface or communication processor according to the standard hardware interface or proprietary communication protocol to complete the program and data transfer.
2 Application areas of PLC
At present, PLC has been widely used at home and abroad in various industries such as iron and steel, petroleum, chemical, electric power, building materials, machinery manufacturing, automotive, textile, transportation, environmental protection and culture and entertainment, etc., the use of which can be roughly summarized in the following categories.
(1) switching logic control
This is the most basic PLC, but also the most extensive application areas, it replaces the traditional relay circuit to achieve logic control, sequence control; both for single equipment control.
Can be used for single equipment control, but also for multi-machine group control and automation lines, such as injection molding machines, printing machines, stapling machinery, combined machine tools, grinding machines, packaging lines and plating lines.
(2) Analog control
In the industrial production process, there are many continuously changing quantities, such as temperature, pressure, flow, level and speed are analog. In order to make the PLC to deal with analog quantities, must realize the analog and digital quantities between the A/D conversion and D / A conversion. PLC manufacturers are producing supporting A/D and D / A conversion module, so that the PLC for analog control.
(3) Motion Control
PLC can be used for circular motion or linear motion control. From the control mechanism configuration, early directly for switching I / O module connected to the position sensor and the actuator, and now generally use a dedicated motion control module that can drive stepper motors or servo motors single-axis or multi-axis position control module.
The products of the world's major PLC manufacturers almost all have motion control functions, widely used in a variety of machinery, machine tools, robots, elevators and other occasions.
(4) process control
Process control refers to the closed-loop control of temperature, pressure, flow and other analog quantities, in metallurgy, chemical industry, heat treatment, boiler control and other occasions have a very wide range of applications. As an industrial control computer, PLC can program a variety of control algorithms to complete closed-loop control.
PID regulation is generally used in closed-loop control system more regulation, large and medium-sized PLC have PID module, many small PLC also has this function module.PID processing is generally run a special PID subroutine.
(5) data processing
Modern PLC with mathematical operations (including matrix operations, function operations, logical operations), data transfer, data conversion, sorting, table and bit operations, etc., can complete the data acquisition, analysis and processing. These data can be stored in memory with the reference value comparison, and then complete certain control operations; can also use the communication function to other intelligent devices, or print them tab.
Data processing is generally used for large-scale control systems, such as unmanned flexible manufacturing system; can also be used for process control systems, such as paper, metallurgy, food industry, some large-scale control systems.
(6) communication and networking
PLC communication contains PLC communication and communication between PLC and other intelligent devices. With the development of computer control, factory automation network development is very fast, the PLC manufacturers attach great importance to the communication function of the PLC, have introduced their own network system. Newly produced PLCs have communication interfaces, communication is very convenient.
Third, the basic structure and working principle of PLC
As an industrial control computer, PLC and ordinary computers have a similar structure; but due to the use of different occasions and purposes, there are some differences in the structure.
1 PLC hardware composition
The mainframe of a PLC consists of a CPU, memory (EPROM, RAM), input/output units, peripheral I/O interfaces, communication interfaces, and power supply. For integral PLCs, these components are all in the same housing.
For modular PLCs, on the other hand, each part is independently encapsulated and called a module, and the modules are connected together by racks and cables.
Each part within the host are connected through the power bus, control bus, address bus and data bus, according to the actual control object needs to be equipped with certain external equipment, constituting a different PLC control system.
Commonly used external devices are programmers, printers, EPROM writers, etc. PLC can be configured to communicate with the host computer and other PLC communication module, constituting a PLC distributed control system.
The following is a description of each component of the PLC and its role, so that users can further understand the control principle and working process of the PLC.
(1) CPU
CPU is the control center of the PLC, PLC under the control of the CPU to coordinate the work in an orderly manner, so as to achieve the control of various devices on the scene. CPU consists of microprocessors and controllers, which can realize the logic and mathematical operations, and to coordinate the control system within the work of the various parts of the system.
The role of the controller is to control the entire microprocessor components to work in an organized manner, its basic function is to read instructions from the memory and execute instructions.
(2) Memory
PLC is equipped with two types of memory, namely, system memory and user memory. System memory is used to store the system management program, the user can not access and modify the contents of this part of the memory.
The user memory is used to store the programmed application program and the working data state. The part of the user memory that stores the working data state is also called the data storage area, which includes the input/output data image area, the data area for the timer/counter preset number and current value, and the buffer area for storing the intermediate results.
The memory of PLC mainly includes the following.
(1) read-only memory
(2) programmable read-only memory
(3) erasable programmable read-only memory
(4) electrically erasable programmable read-only memory
(5) Random access memory
(3) Input/Output (I/O) modules
①Switching input module
The switching input devices are various switches, buttons, sensors, etc. The input types of PLC can usually be DC, AC and AC/DC. The power supply for the input circuit can be supplied externally or internally by the PLC.
②Switching Output Module
The function of the output module is to convert the TTL level control signals output by the CPU executing the user program into the signals required at the production site, which can drive specific devices to drive the action of the actuator.
(4) Programmer
Programmer is an important external device of PLC, using the programmer can be sent to the user program into the user program memory of the PLC, debugging the program, monitoring the program execution process. Programmers can be structurally divided into the following three types.
(1) Simple programmer
(2) Graphic programmer
(3) General-purpose computer programmer
(5) Power supply
The function of the power supply unit is to convert the external power supply (220V AC power) into the internal operating voltage. The externally connected power supply, through the PLC is equipped with a special internal switching regulator power supply, AC / DC power supply into the PLC internal circuitry required for the work of the power supply (DC 5V, ± 12V, 24V), and for the external input components (such as proximity switches) to provide a 24V DC power supply (only for the use of the input endpoints). The power supply to drive the PLC loads is provided by the user.
(6) Peripheral Interface
The peripheral interface circuit is used to connect the handheld programmer or other graphic programmer, text display, and can form a PLC control network through the peripheral interface.PLC uses PC/PPI cable or MPI card to connect to the computer through the RS-485 interface, which can realize the functions of programming, monitoring and networking.
2 PLC software components
PLC software consists of system programs and user programs.
System program designed and written by the PLC manufacturer, and stored in the PLC system memory, the user can not directly read and write and change. System programs generally include system diagnostic procedures, input processing programs, compilation programs, information transfer programs and monitoring programs.
PLC user program is the user to use the PLC programming language, according to the control requirements of the program. In the application of PLC, the most important thing is to write the user program with PLC programming language to realize the control purpose.
As PLC is a device developed specifically for industrial control, its main users are the majority of electrical technicians, in order to meet their traditional habits and mastery of the ability to use the main programming language of PLC than the computer language is relatively simple, easy to understand, image of the special language.
1. Graphical instruction structure
2. Clear variable constants
3. Simplified program structure
4. Simplified application software generation process
5. Enhanced debugging tools
3 The basic working principle of PLC
PLC scanning works in three main phases, namely the input sampling phase, the user program execution phase and the output refresh phase.
1. Input sampling stage
In the input sampling stage, the PLC reads in all the input states and data sequentially in a scanning manner and stores them in the corresponding units in the I/O image area. After the input sampling is finished, it moves to the user program execution and output refreshing phase. During these two phases, even if the input states and data change, the states and data of the corresponding cells in the I/O image area do not change.
Therefore, if the input is a pulse signal, the width of the pulse signal must be greater than one scanning cycle to ensure that the input can be read in under any circumstances.
2. User program execution phase
In the user program execution phase, the PLC always scans the user program (ladder diagram) in sequence from top to bottom. In scanning each ladder diagram, and always first scan the left side of the ladder diagram by the contacts constitute the control line, and according to the first left and then right, first up and then down the order of the contacts constitute the control line for logical operations; and then according to the results of the logical operations, refresh the logic coil in the system RAM storage area in the state of the corresponding bit, or refresh the output coil in the I/O image area in the state of the corresponding bit, or determine whether to execute the ladder diagram of the corresponding bit. The user program executes the special function instruction specified in the ladder diagram.
That is, during the execution of the user program, only the state and data of the input points in the I/O image area will not change, while the state and data of the other output points and the soft devices in the I/O image area or the system RAM memory area may change, and the ladder diagrams lined up on top of the ladder diagrams, the results of the execution of the program will act on the ladder diagrams lined up below that use these coils or data; on the contrary, the ladder diagrams lined up on the bottom of the ladder diagrams, the result of the program execution will be the ladder diagrams lined up on the bottom of the ladder diagrams. On the contrary, the ladder below, the state or data of the logic coil that is refreshed can only work on the ladder above it until the next scan cycle.
3. Output Refresh Phase
When the user program scan is finished, the PLC enters the output refresh phase. During this period, the CPU in accordance with the corresponding state of the I / O image area and data refresh all the output latch circuit, and then through the output circuit to drive the corresponding peripheral. At this point, the real output of the PLC.
Input / output lag phenomenon
From the working process of PLC, the following conclusions can be summarized:
1, to scan the way to execute the program, the logical relationship between its input / output signals there is a principle of hysteresis. The longer the scanning cycle, the more serious the hysteresis.
2, the scanning cycle includes the time occupied by the three main working phases, namely, input sampling phase, user program execution phase, and output refreshing phase, in addition to the time occupied by the system management operation. Among them, the time for program execution is related to the length of the program and the complexity of the command operation, while others remain basically unchanged. The scanning period is generally of the order of milliseconds.
3, the nth scan to execute the program, based on the input data is the scanning cycle in the sampling phase of the scanning value X based on the output data have the output value of the last scan Y (n-1), but also the output value of the current Yn; n sent to the output terminal of the signal, that is, the implementation of all the calculations of the final result of the Yn.
4, input/output response hysteresis is not only related to the scanning method, but also with the program design arrangements.




