Understanding PLC Structure and Working Principles

Understanding PLC Structure and Working Principles

October Course Schedule

As a type of industrial control computer, the PLC has a structure similar to that of a regular computer; however, due to different usage scenarios and purposes, there are some structural differences.

Hardware Components of PLC

The basic structural block diagram of the PLC hardware system is shown in the figure.

Understanding PLC Structure and Working Principles

In the figure, the PLC’s main unit consists of the CPU, memory (EPROM, RAM), input/output units, peripheral I/O interfaces, communication interfaces, and power supply. For compact PLCs, these components are housed within the same casing.

For modular PLCs, each component is independently packaged, referred to as modules, and these modules are connected together through racks and cables.

All parts within the main unit are connected via the power bus, control bus, address bus, and data bus, and external devices are equipped according to the actual control objects, forming different PLC control systems.

Common external devices include programmers, printers, EPROM writers, etc. PLCs can be configured with communication modules to communicate with host computers and other PLCs, forming a distributed control system.

The following sections introduce the various components of the PLC and their functions to help users further understand the control principles and working processes of PLCs.

(1) CPU

The CPU is the control center of the PLC. Under the control of the CPU, the PLC coordinates operations in an orderly manner to control various devices in the field. The CPU consists of a microprocessor and a controller, capable of performing logical and mathematical operations, coordinating the work of various parts within the control system.

The role of the controller is to ensure that all components of the microprocessor work in an orderly fashion. Its basic function is to read instructions from memory and execute them.

(2) Memory

The PLC is equipped with two types of memory: system memory and user memory. System memory is used to store system management programs, which users cannot access or modify.

User memory is used to store the compiled application programs and the working data state. The part of user memory that stores the working data state is also known as the data storage area, which includes input/output data image areas, timer/counter preset and current value data areas, and buffers for storing intermediate results.

The PLC memory mainly includes the following types:

(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

① Digital Input Module

Digital input devices include various switches, buttons, sensors, etc. The input types of PLCs can usually be DC, AC, or AC/DC. The power supply for the input circuit can be provided externally, and some can also be supplied internally by the PLC.

② Digital 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 signals required to drive specific devices in the production field, thereby driving the action of the actuators.

(4) Programmer

The programmer is an important external device for the PLC. It can be used to send user programs to the PLC’s user program memory, debug programs, and monitor the execution process. Programmers can be structurally classified into the following three types.

(1) Simple Programmer

(2) Graphic Programmer

(3) General Computer Programmer

(5) Power Supply

The function of the power supply unit is to convert external power sources (220V AC) into internal working voltage. The externally connected power supply is converted into the working power supply needed by the PLC’s internal circuit (DC 5V, ±12V, 24V) through a dedicated switch-mode power supply equipped inside the PLC, and provides 24V DC power for external input components (such as proximity switches) for input endpoints only. The power supply driving the PLC load is provided by the user.

(6) Peripheral Interface

The peripheral interface circuit is used to connect handheld programmers or other graphic programmers, text displays, and can form the PLC control network through the peripheral interface. The PLC connects to the computer via RS-485 interface using PC/PPI cables or MPI cards, enabling programming, monitoring, networking, and other functions.

Software Components of PLC

The PLC software consists of system programs and user programs.

The system program is designed and written by the PLC manufacturer and stored in the PLC’s system memory, which users cannot directly read, write, or modify. The system program generally includes system diagnostic programs, input processing programs, compilation programs, information transmission programs, and monitoring programs.

The user program of the PLC is the program compiled by the user using the PLC programming language based on control requirements. The most important aspect of using the PLC is to write user programs using the PLC programming language to achieve control objectives.

Since PLCs are specifically developed for industrial control, their primary users are electrical technicians. To meet their traditional habits and capabilities, the main programming language of the PLC adopts a specialized language that is relatively simple, easy to understand, and visual compared to computer languages.

1. Graphic Instruction Structure

2. Clear Variable Constants

3. Simplified Program Structure4. Simplified Application Software Generation Process

5. Enhanced Debugging Methods

Basic Working Principles of PLC

The working mode of the PLC scanning is mainly divided into three stages: input sampling stage, user program execution stage, and output refresh stage. As shown in the figure

Understanding PLC Structure and Working Principles

(1) Input Sampling Stage

In the input sampling stage, the PLC reads all input statuses and data sequentially in a scanning manner and stores them in the corresponding units within the I/O image area. After the input sampling is completed, it enters the user program execution and output refresh stages. In these two stages, even if the input statuses and data change, the statuses and data in the corresponding units in the I/O image area do not change.

Therefore, if the input is a pulse signal, the width of that pulse signal must be greater than one scanning cycle to ensure that the input can be read under any circumstances.

(2) User Program Execution Stage

In the user program execution stage, the PLC always scans the user program (ladder diagram) in a top-down order. When scanning each ladder diagram, it first scans the control circuit composed of various contacts on the left side of the ladder diagram, performing logical operations on the control circuit from left to right and from top to bottom; then, according to the results of the logical operations, it refreshes the status of the corresponding bit in the system RAM storage area or refreshes the status of the corresponding bit in the I/O image area, or determines whether to execute the special function instructions specified by the ladder diagram.

During the execution of the user program, only the statuses and data of input points in the I/O image area do not change, while the statuses and data of other output points and soft devices in the I/O image area or system RAM storage area may change, and the execution results of the ladder diagrams above will affect those below that use these coils or data; conversely, the statuses or data of the refreshed logical coils from the ladder diagrams below will only take effect on the ladder diagrams above during the next scanning cycle.

(3) Output Refresh Stage

After the user program scanning is completed, the PLC enters the output refresh stage. During this period, the CPU refreshes all output latch circuits according to the statuses and data in the I/O image area, and then drives the corresponding peripherals through the output circuit. This is when the PLC’s actual output occurs.

Input/Output Delay Phenomenon

From the working process of the PLC, the following conclusions can be summarized:

1. The program is executed in a scanning manner, and there is a logical relationship delay between the input/output signals. The longer the scanning cycle, the more severe the delay.

2. The scanning cycle includes the time taken by the three main working stages: input sampling stage, user program execution stage, and output refresh stage, as well as the time occupied by system management operations. The execution time of the program is related to the length of the program and the complexity of the instruction operations, and is generally constant. The scanning cycle is generally in the nanosecond range.

3. During the nth scan execution of the program, the input data relied upon is the sampled values from the input sampling stage of that scan cycle, while the output data relies on the previous scan’s output value Y(n-1) and the current output value Yn; the signals sent to the output terminals are the final results Yn after executing all calculations in the current cycle.

4. The input/output response delay is not only related to the scanning method but also to the arrangement of the program design.

Understanding PLC Structure and Working Principles

Leave a Comment