PLC technology foundation

The first lecture: The basic concept of PLC The Programmable Controller is a member of the computer family and is designed and manufactured for industrial control applications. Early programmable controllers were called programmable logic controllers (PLCs), and they were mainly used to implement logic control instead of relays. With the development of technology, the function of this device has greatly exceeded the scope of logic control. Therefore, this type of device is called a programmable controller, or PC for short. However, in order to avoid confusion with the short name of personal computer (PC), the programmable controller is abbreviated as PLC.
A. The origin of PLC In the 60's, the auto control system of the automobile production line basically consisted of relay control devices. Every modification of the car at that time directly led to the redesign and installation of the relay control device. With the development of production, the cycle of updating the vehicle model is getting shorter and shorter. In this way, the relay control device needs to be frequently redesigned and installed, which is time-consuming, time-consuming, wasteful, and even hinders the shortening of the update cycle. In order to change this situation, US General Motors Corporation publicly invited tenders in 1969 to replace the relay control devices with new control devices and put forward ten bidding criteria, namely:
1. Programming is convenient, and the program can be modified on site;
2. It is easy to maintain and adopts a modular structure;
3. The reliability is higher than the relay control device;
4. The volume is smaller than the relay control device;
5. Data can be sent directly to the management computer;
6. The cost can compete with the relay control device;
7. The input can be AC ​​115V;
8. The output is AC 115V, more than 2A, can directly drive the solenoid valve, contactor, etc.;
9. In the expansion, the original system as long as a very small change;
10. The user program memory capacity can be expanded to at least 4K.
In 1969, the United States Digital Equipment Corporation (DEC) developed the first PLC, which was successfully tested on the American General Motors automatic assembly line.
This new type of industrial control device is simple and easy to understand, easy to operate, high reliability, versatile and flexible, small size, long service life and a series of advantages, quickly promoted to other industrial fields in the United States in 1971, has been successful Used in food, beverage, metallurgy, papermaking and other industries.
The appearance of this new type of industrial control device has also been highly valued by other countries in the world. 1971
Japan introduced this new technology from the United States and soon developed the first PLC in Japan. In 1973, Western European countries also developed their first PLC. My country began to develop in 1974. Industrial application started in 1977.
Second, the definition of PLC
Since the advent of PLC, although it has not been long, it has developed rapidly. In order to standardize its production and development, the National Electrical Equipment Association NEMA (National Electrical and Mechanical Manufactory? Association) after four years of investigation work, in 1984 it was first officially named PC (Programmable? Controller), and to the PC Made the following definition:
"PC is a digital electronic device that uses programmable memory storage instructions to perform functions such as logic, sequencing, timing, counting, and calculus, and through digital or similar input/output modules. Controlling various kinds of machinery or working procedures.A digital electronic computer is also regarded as a PC if it is engaged in the function of executing a PC, but does not include a drum type or similar mechanical sequential controller."
In the future, the International Electrotechnical Commission (IEC) successively issued the first and second drafts of the PLC standard.
And in February 1987 passed its definition:
"Programmable controller is a digital operation of the electronic system, designed specifically for use in industrial environments. It uses a class of programmable memory for its internal stored procedures, perform logic operations,
Sequential control, timing, counting and arithmetic operations and other user-oriented instructions, and control various types of mechanical or production processes through digital or analog input/output. Programmable controllers and their associated external devices are designed in such a way that they are easily integrated with industrial control systems and are easy to expand. ”
In short, the programmable controller is a computer, which is designed and manufactured for industrial environment applications. It has a rich input/output interface and has a strong drive capability. But the programmable controller products are not aimed at a specific industrial application. In actual application, the hardware needs to be selected and configured according to actual needs, and the software needs to be designed according to the control requirements.
III. Features of PLC 1. Main features of PLC
(a) high reliability
1. All I/O interface circuits use optical isolation to electrically isolate the external circuits of the industrial site from the PLC internal circuits.
2. Each input uses RC filter, and its filtering time constant is generally 10~20ms.
3. Each module is shielded to prevent radiation interference.
4. Use a good switching power supply.
5. Strict screening of the devices used.
6. Good self-diagnosis function, once the power or other hardware and software abnormalities occur, the CPU immediately adopts effective measures to prevent the expansion of the fault.
7. The large-scale PLC can also adopt a double CPU to constitute a redundant system or a triple CPU to form a voting system, so as to further improve the reliability.
(II) Rich I/O Interface Module
PLC targets different industrial field signals such as:
· AC or DC;
·Switch or analog
Voltage or current
Pulse or potential;
Strong or weak electricity.
Corresponding I/O modules and industrial field devices or devices, such as:
· Buttons, limit switches, proximity switches, sensors, transmitters, solenoids, and control valves are directly connected. In addition, in order to improve the operating performance, it also has a variety of human-machine dialogue interface modules; In order to form an industrial local network, it also has a variety of communication networking interface modules, and so on.

(III) Modular structure In order to adapt to various industrial control needs, most PLCs use a modular structure, in addition to the small unit-type PLC. All parts of the PLC, including CPU, power supply, and I/O, are modularly designed. Each module is connected by a rack and a cable. The size and function of the system can be combined according to the needs of users.
(d) programming is easy to learn
PLC programming mostly uses ladder diagrams similar to relay control circuits. It does not require the computer's expertise for users, so it is easy for general engineering and technical personnel to understand and master.
(five) simple installation and easy maintenance
PLC does not require a dedicated machine room and can operate directly in various industrial environments. When you use it, you only need to connect the various devices on the site with the corresponding I/O terminals of the PLC to be put into operation. There are running and fault indication devices on various modules to make it easier for the user to understand the operation and find faults.
Due to the modular structure, once a module fails, the user can quickly restore the system by replacing the module.
II. Functions of PLC
(a) Logical control
(B) timing control
(III) Counting Control
(four) step (sequential) control
(five) PID control
(6) Data Control
PLC has data processing capabilities.
(VII) Communication and Networking
(8) Others
PLC also has many special function modules, suitable for various special control requirements, such as: positioning control module, CRT module.
IV. The development stage of PLC Although the PLC was not available for a long time, but with the advent of microprocessors, the rapid development of large-scale, VLSI technology and the continuous advancement of data communication technology, PLC has also developed rapidly, and its development process is roughly It can be divided into three phases:
I. Early PLC (from the late 1960s to the mid-1970s)
Early PLCs were generally called programmable logic controllers. At this time, the PLC is somewhat replaced by the meaning of the relay control device, and its main function is only to perform the sequence control, timing, etc. originally performed by the relay. It appeared on the hardware in the form of a quasi-computer and was modified on the I/O interface circuit to meet the requirements of the industrial control site. The device in the device mainly uses discrete components and small and medium scale integrated circuits, and the memory uses magnetic core memory. In addition, some measures have been taken to improve its anti-jamming capability. In software programming, the relay control circuit is familiar with the use of electrical engineering and technical personnel - ladder diagram. Therefore, the performance of the early PLC is better than the relay control device. Its advantages include simple and easy to understand, easy to install, small size, low energy consumption, faulty instructions, and repeated use. One of PLC's unique programming languages, the ladder diagram, has been used up to now.
II. Medium-term PLC (mid-70's to mid-80's)
In the 70s, the emergence of microprocessors made a great change in the PLC. Some manufacturers, such as the United States, Japan, and Germany, have started to use microprocessors as the central processing unit (CPU) of the PLC.
In this way, the functionality of the PLC is greatly enhanced. In terms of software, in addition to maintaining its original logic operations, timing, counting and other functions, it also adds functions such as arithmetic operations, data processing and transmission, communication, and self-diagnosis. In terms of hardware, in addition to maintaining its original switch module, analog modules, remote I/O modules, and various special function modules have also been added. The memory capacity has been expanded, the number of various logic coils has been increased, and a certain number of data registers have been provided, which has expanded the scope of application of PLCs.
III. Recent PLCs (middle and late in the 80s)
In the middle and late 1980s, due to the rapid development of ultra-large-scale integrated circuit technology, the market price of microprocessors fell drastically, making microprocessors used in various types of PLCs generally improve. Moreover, in order to further improve the processing speed of the PLC, various manufacturers have also developed a dedicated logic processing chip. This has made great changes in the PLC software and hardware functions.
V. Classification of PLC
(a) Small PLC
The I/O points of small-scale PLC are generally below 128 points. Its characteristic is small size, compact structure, the whole hardware is integrated, in addition to the switch I/O, it can also connect analog I/O and other special functions. Module. It can perform logic operations, timing, counting, arithmetic operations, data processing and transmission, communication networking, and various application instructions.
(II) Medium PLC
The medium-sized PLC adopts a modular structure, and its I/O points are generally between 256 and 1024 points. In addition to the general PLC scan processing method, the I/O processing method can also use a direct processing method. That is, during the process of scanning the user program, the input is directly read and the output is refreshed. It can connect various special function modules,
The communication networking function is stronger, the instruction system is more abundant, the memory capacity is larger, and the scanning speed is faster.
(III) Large PLC
General I/O points above 1024 are called large PLCs. Large-scale PLC's software and hardware features are extremely strong. Has a very strong self-diagnosis function. The communication networking function is strong, and there are various communication networking modules that can constitute a three-level communication network to automate factory production management. Large-scale PLC can also adopt three CPUs to form a voting system, so that the reliability of the machine is higher.
The basic structure of PLC
PLC is essentially a computer dedicated to industrial control. Its hardware structure is basically the same as the microcomputer, as shown in the figure:

A. Central Processing Unit (CPU)
The central processing unit (CPU) is the control hub of the PLC. It receives and stores the user program and data typed from the programmer according to the functions assigned to the PLC system program; checks the status of the power supply, memory, I/O, and watchdog timer, and can diagnose syntax errors in the user program. When the PLC is put into operation, it firstly receives the status and data of the input devices in the field by scanning, and stores them in the I/O mapping area respectively. Then the user program is read one by one from the user program memory, and is pressed after the command is interpreted. The specified instruction execution logic or arithmetic operation results in the I/O image area or data register. After all the user programs have been executed, the output status of the I/O image area or the data in the output register is finally transmitted to the corresponding output device, and the cycle is repeated until it stops operating.
In order to further improve the reliability of the PLC, in recent years, large PLCs have also used dual CPUs to form redundant systems or three-CPU voting systems. In this way, even if a CPU fails, the entire system can still operate normally.
II. Memory The memory for storing system software is called system program memory.
The memory for storing application software is called user program memory.
(A) PLC commonly used memory types
1. RAM (Random?Assess?Memory)?
This is a read/write memory (random memory) with the fastest access speed supported by a lithium battery.
2. EPROM (Erasable? Programmable? Read? Only? Memory)
This is an erasable read-only memory. In the event of a power failure, everything in memory remains unchanged. (The memory content can be erased by continuous exposure to ultraviolet light).
3.EEPROM (Electrical? Erasable? Programmable? Read? Only? Memory)
This is an electrically erasable read-only memory. Using the programmer can easily modify the contents of its storage.
(B) the allocation of PLC storage space Although the maximum address space of the various PLC's CPU is different, but according to the working principle of PLC, its storage space generally includes the following three areas:
System Program Memory System RAM storage area (including I/O image area, system software, etc.)
User program memory area
1. System program memory area A system program equivalent to a computer operating system is stored in the system program memory area. Including monitoring procedures, management procedures, command interpreters, function subroutines, system diagnostics subroutines. It is cured by the manufacturer in the EPROM and cannot be directly accessed by the user. Together with the hardware, it determines the performance of the PLC.
2. System RAM Memory The system RAM memory area includes the I/O image area and various types of software devices, such as:
The logic coil data register timer counter indexes the memory such as the register accumulator.
(1) I/O image area: Since the PLC is put into operation, it only reads in each input state and data in the input sampling stage, and then outputs the output state and data to the corresponding peripherals in the output refresh stage.
Therefore, it requires a certain number of memory units (RAM) to store the state and data of the I/O. These units are called I/O image areas.
One switch I/O occupies one bit in the memory cell, and one analog I/O occupies one word (16 bits) in the memory cell. So the entire I/O image area can be seen as two parts:
Switch I/O Map Area Analog I/O Map Area
(2) System software device storage area In addition to the I/O image area area, the system RAM storage area also includes various types of software devices (logic coils, timers, counters, data registers, accumulators, etc.) in the PLC. The storage area is divided into a storage area with power-off retention and a storage area without power failure. The former is powered by an internal lithium battery when the PLC is powered off, and the data is not lost; the latter is when the PLC is powered off. Cleared to zero.
1) The logic coil is the same as the switch output. Each logic coil occupies one bit in the system RAM memory area, but it cannot directly drive peripherals. It is only used by the user in programming, and its function is similar to the relay in the electrical control circuit. In addition, different PLCs also provide a different number of special logic coils with different functions.

2) Data Registers
• Like analog I/O, each data register occupies one word (16?bits) in the system's RAM memory area. In addition, PLC also provides a special number of special data registers, with different functions.
3) Timer
4) Counter
3. User program storage area The user program storage area stores the user program created by the user. Different types of PLCs have different storage capacities.
Three. Power
The power supply of the PLC plays an important role in the entire system. If not a good one,
The reliable power supply system cannot work normally, so the manufacturer of the PLC pays great attention to the design and manufacture of the power supply.
Normal AC voltage fluctuations are within +10% (+15%), and PLCs can be connected directly to the AC power network without taking other measures.

VII. The working principle of PLC The PLC originally developed and produced is mainly used to replace the traditional control device composed of relay contactors, but the operating modes of the two are not the same:
The relay control device adopts the hard logic parallel operation mode. That is, if the coil of this relay is energized or de-energized, all the contacts (including its normally open or normally closed contacts) of the relay will immediately be at the position of the relay control circuit. action.
The PLC's CPU then uses sequential logic to scan the user program's operation mode. If an output coil or logic coil is turned on or off, all contacts of the coil (including its normally open or normally closed contacts) will not be immediately activated. , must wait until the contact is scanned.
In order to eliminate the difference between the two due to different operating modes, taking into account the relay control device contact time is generally more than 100ms, while the PLC scan user program time is generally less than 100ms, so the PLC uses a This is different from the general micro-computer operating mode - scanning technology. In this case, there is no difference between the processing results of the PLC and the relay control device in the case where the request for I/O response is not high.
I. Scanning technology
When the PLC is put into operation, its working process is generally divided into three stages, namely input sampling, user program execution and output refresh. The completion of the above three phases is called a scan cycle. During the entire operation, the PLC's CPU repeatedly performs the above three phases at a certain scanning speed.
(I) Input sampling phase In the input sampling phase, the PLC sequentially reads all input states and data in scan mode and stores them in corresponding units in the I/O image area. After the input sampling ends, it goes to the user program execution and output refresh phase. During these two phases, even if the input status and data change, the status and data of the corresponding unit in the I/O map area will not change. Therefore, if the input is a pulse signal, the width of the pulse signal must be greater than one scan cycle to ensure that the input can be read in any case.
(B) The user program execution phase In the user program execution phase, the PLC always scans the user program (ladder) in order from top to bottom. When scanning each ladder diagram, it is always to scan the control circuit formed by each contact on the left side of the ladder diagram, and logically operate the control circuit formed by the contacts in the order of left, right, first, upper, and lower. Then, according to the result of the logic operation, the state of the corresponding bit in the system RAM memory area of ​​the logic coil is refreshed; or the status of the corresponding bit in the I/O image area is refreshed; or it is determined whether to execute the ladder diagram. Specified special function instructions.
That is, during the execution of the user program, only the state and data of the input point in the I/O image area will not change, and other output points and software devices are in the I/O image area or system RAM memory area. Both the status and the data may be changed, and the ladder diagram above is listed. The result of the program execution will act on the ladder diagram below which all these coils or data are used. On the contrary, the ladder diagram below is The state or data of the logic coil being refreshed can only go to the next scan cycle to work on the program that is on top of it.
(III) Output refresh phase When the scanning user program ends, the PLC enters the output refresh phase. During this period, the CPU refreshes all of the output latch circuits according to the corresponding status and data in the I/O map area, and drives the corresponding peripherals through the output circuit. At this time, it is the true output of the PLC.

The results of running the scanning user program in parallel with the hard logic of the relay control device are different. Of course, if the scan cycle time is negligible for the entire run, there is no difference between the two.
In general, the PLC scan cycle includes self-diagnosis, communication, etc., as shown in the figure below, that is, one scan cycle is equal to the sum of all the time such as self-diagnosis, communication, input sampling, user program execution, and output refresh.
II. PLC I/O response time In order to enhance the PLC's anti-interference ability and improve its reliability, PLC's each switch input uses optical isolation and other technologies.
In order to realize the hard logic parallel control of the relay control circuit, the PLC adopts a different operating mode (scanning technology) than the general microcomputer.
The above two main reasons make the I/O response of the PLC much fuller than that of an industrial control system formed by a general microcomputer. The response time is at least equal to one scan cycle, and is generally greater than one scan cycle or even longer.
The so-called I/O response time refers to the time required from the change of one input signal of the PLC to the change of the system-related output signal. Its shortest I/O response time and longest I/O response time are shown in the figure:
The shortest I/O response time:

Longest I/O response time:

Eight PLC I/O System I. I/O Addressing Mode
PLC's hardware structure is mainly divided into two kinds of modular and modular. The former installs the main part of the PLC (including the I/O system and power supply) in a single chassis. The latter will make the main hardware part of the PLC into modules, and then the user will insert the selected modules into the slots on the PLC rack as required to form a PLC system.
Regardless of which hardware structure is adopted, the correspondence between the various input/output points used to connect the industrial site and the I/O image area of ​​the PLC must be established, that is, each input/output point is established with a clear address. The way this correspondence is used is called I/O addressing.
There are three types of I/O addressing methods:
Fixed I/O Addressing Mode This I/O addressing mode is determined by the PLC manufacturer during the design and production of the PLC. Each input/output point has a specific, fixed address. In general, the unit type PLC uses this I/O addressing mode.
I/O Addressing Mode for Switch Settings This I/O addressing mode is determined by the user by setting the switch position on the rack and the module.
I/O addressing method set by software This I/O addressing method is determined by the user through the software to compile the I/O address allocation table.

1U 2U 3U 4U Rackmount

1U Network Server,1U Rackmount Industrial Pc,1U Network Appliance,1U Rackmount Server

Shenzhen Innovative Cloud Computer Co., Ltd. , https://www.xcypc.com

Posted on