Three Algorithms for PLC Programming

Publisher:火箭少年Latest update time:2023-08-18 Source: elecfansKeywords:PLC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The most complete PLC programming algorithm

PLC programming algorithm (1):

There are only three quantities in PLC: switch quantity, analog quantity and pulse quantity. If you understand the relationship between the three, you can master PLC skillfully.

1. Switch quantity is also called logic quantity, which means it has only two values, 0 or 1, ON or OFF. It is the most commonly used control. Controlling it is the advantage of PLC and also the most basic application of PLC.

The purpose of switch quantity control is to make the PLC generate corresponding switch quantity output according to the current input combination of the switch quantity and the historical input sequence, so that the system can work in a certain order. Therefore, it is sometimes called sequential control.

Sequential control is divided into manual, semi-automatic or automatic. The control principles adopted are decentralized, centralized and mixed control.

2. Analog quantity refers to some continuously changing physical quantities, such as voltage, current, pressure, speed, flow, etc.

PLC is developed from the introduction of microprocessing technology into relay control, and can be used conveniently and reliably for switch quantity control. Since analog quantity can be converted into digital quantity, and digital quantity is just a multi-bit switch quantity, PLC can also process and control the converted analog quantity reliably.

Since continuous production processes often involve analog quantities, analog quantity control is sometimes also called process control.

Analog quantities are mostly non-electrical quantities, while PLC can only process digital quantities and electrical quantities. All the conversion between them requires sensors to convert analog quantities into digital quantities. If the quantity is not standard, it must pass through a transmitter to convert the non-standard quantity into a standard electrical signal, such as 4-20mA, 1-5V, 0-10V, etc.

At the same time, there must be an analog input unit (A/D) to convert these standard electrical signals into digital signals; and an analog output unit (D/A) to convert the digital quantities processed by the PLC into analog quantities - standard electrical signals.

Therefore, the conversion between standard electrical signals and digital quantities requires various operations, which requires understanding the resolution of the analog unit and the standard electrical signal.

For example:

The resolution of the PLC simulation unit is 1/32767, and the corresponding standard power is 0-10V. The temperature to be detected is 0-100℃. Then 0-32767 corresponds to the temperature value of 0-100℃. Then the digital value corresponding to 1℃ is 327.67. If you want to get the temperature value accurate to 0.1℃, just divide 327.67/10.

Analog control includes: feedback control, feedforward control, proportional control, fuzzy control, etc. These are all calculation processes of digital quantities inside PLC.

3. Pulse quantity is a digital quantity whose value is always changing between 0 (low level) and 1 (high level). The number of pulse changes per second is called frequency.

The purpose of PLC pulse control is mainly position control, motion control, trajectory control, etc. For example: the application of pulse number in angle control. The subdivision of the stepper motor driver is 10000 per circle, and the stepper motor is required to rotate 90 degrees. Then the pulse value required for the action = 10000/(360/90) = 2500.

PLC programming algorithm (2) - calculation of analog quantity

1. -10—10V. When the voltage is -10V—10V, it is converted to F448—0BB8Hex (-3000—3000) at 6000 resolution; when the resolution is 12000, it is converted to E890—1770Hex (-6000—6000).

2. 0-10V. When the voltage is 0-10V, it is converted to 0-1770Hex (0-6000) at a resolution of 12000; it is converted to 0-2EE0Hex (0-12000) at a resolution of 12000.

3. 0-20mA. When the current is 0-20mA, it is converted to 0-1770Hex (0-6000) at 6000 resolution; it is converted to 0-2EE0Hex (0-12000) at 12000 resolution.

4. 4-20mA. When the current is 4-20mA, it is converted to 0-1770Hex (0-6000) at 6000 resolution; it is converted to 0-2EE0Hex (0-12000) at 12000 resolution.

The above is just a brief introduction. Different PLCs have different resolutions, and the ranges of the physical quantities you measure are different. The calculation results may be somewhat different.

Note: Analog input wiring requirements

1. Use shielded twisted pair cables, but do not connect the shielding layer.

2. When an input is not used, short-circuit the V IN and COM terminals.

3. The analog signal line is isolated from the power line (AC power line, high-voltage line, etc.).

4. When there is interference on the power line, install a filter between the input part and the power unit.

5. After confirming the correct wiring, first power on the CPU unit and then power on the load.

6. When powering off, first cut off the power to the load, and then cut off the power to the CPU.

PLC programming algorithm (3) - calculation of pulse quantity

The control of pulse quantity is mostly used for angle control, distance control, position control, etc. of stepper motors and servo motors. The following is an example of stepper motors to illustrate various control methods.

1. Angle control of stepper motor. First, we need to determine the subdivision number of the stepper motor, and then determine the total number of pulses required for the stepper motor to rotate one circle. Calculate "angle percentage = set angle / 360° (i.e. one circle)" and "angle action pulse number = total number of pulses in one circle * angle percentage."

The formula is: Angle action pulse number = total pulse number in one circle * (set angle/360°).

2. Distance control of stepper motor. First, determine the total number of pulses required for the stepper motor to rotate one circle. Then determine the diameter of the stepper motor roller and calculate the circumference of the roller. Calculate the running distance of each pulse. Finally, calculate the number of pulses required to run the set distance.

The formula is: set distance pulse number = set distance / [(roller diameter * 3.14) / total pulse number in one circle]

3. The position control of the stepper motor is a combination of angle control and distance control.

The above is just a simple analysis of the control method of the stepper motor, which may differ from the actual situation and is only for reference by colleagues.

The action of a servo motor is the same as that of a stepper motor, but the internal electronic gear ratio of the servo motor and the reduction ratio of the servo motor must be considered.


Keywords:PLC Reference address:Three Algorithms for PLC Programming

Previous article:SEW-MOVIPRO Startup Application Configuration Program Setting Steps
Next article:Leveraging Power over Ethernet for the Industrial Market

Recommended ReadingLatest update time:2024-11-16 09:36

Contactor K50 application case for monitoring PLC
The block is used to monitor the contactor K50 of the PLC (acknowledgement of safety device). In addition, the time stamp of the real-time clock of the controller is formed and provided as 6 bytes. The block generates 2 blink cycles (1Hz/Blink_L and 2Hz/Blink_S), presets the global flags for True/False, VKE=0/VKE=1
[Embedded]
Contactor K50 application case for monitoring PLC
A brief analysis of several communication protocols supported by S7-200 PLC
Before we get started with this question, we should understand a rather confusing issue. The difference between RS485 and MODBUS: RS485 is a physical interface, or simply put, hardware. MODBUS is an international standard communication protocol used for data exchange between devices from different man
[Embedded]
A brief analysis of several communication protocols supported by S7-200 PLC
Huawei established the PLC-IoT Ecological Alliance and launched contactless payment in cooperation with UnionPay
Today, Huawei and China UnionPay Co., Ltd. held the 2019 PLC-IoT Industry Development Forum and Huawei PLC-IoT Ecological Alliance Establishment Conference in Dongguan. At the conference, the "Huawei PLC-IoT Ecological Alliance" initiated by Huawei was officially established. A total of 43 industry partners from multi
[Mobile phone portable]
Huawei established the PLC-IoT Ecological Alliance and launched contactless payment in cooperation with UnionPay
Four-axis motion control based on PLC
1 Control Task The control system design requirements of the test diagnosis platform are as follows: (1) According to the instructions of the on-site installation personnel, the operator issues the servo electric cylinder action command, and the four servo electric cylinders act independently within the to
[Embedded]
Four-axis motion control based on PLC
Introduction to common PLC transmission instructions
Single data transfer instruction The single data transfer instruction is used to transfer a data. According to the different word lengths of the transferred data, it can be divided into byte, word, double word and real number transfer instructions. The function of the single data transfer instruction is to send
[Embedded]
Introduction to common PLC transmission instructions
What are the 10 PLC analog input filtering methods?
1 Limiting filter method/Program judgment filter method A. Methods: Based on experience, determine the maximum deviation allowed for two samples (set as A) Every time a new value is detected, it is judged: If the difference between this value and the previous value is = A, then the current v
[Embedded]
PLC control cabinet overview PLC control cabinet components
Components of PLC control cabinet 1. Air switch: A general air switch, which is the power control of the entire cabinet. I believe that every cabinet must have this thing. 2. PLC: This should be selected according to the needs of the project. For example, if the project is small, you can directly use an in
[Embedded]
Design and Application of PLC Simulation Software
The function of the PLC instruction simulation module is to give certain meanings according to the syntax and semantic structure of the people who have read it, so that it has the function of the PIE CPU. For the instruction simulation module, its input is the various information contained in the syntax tree generat
[Embedded]
Design and Application of PLC Simulation Software
Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号