PLC programming algorithm (1)
There are only three quantities in PLC: switch quantity, analog quantity and pulse quantity. As long as you understand the relationship between the three, you can master PLC skillfully.
1. Switch quantity is also called logic quantity, which means that there are only two values, 0 or 1, ON or OFF (switch quantity has only two states 0/1. It includes input quantity and output quantity, which reflects the state). 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 (digital quantity is discontinuous. It reflects the measurement value of electrical quantity), 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 reliably process and control the converted analog quantity.
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. To achieve the conversion between them, sensors are required to convert analog quantities into digital quantities.
If the amount of electricity is not standard, it must pass through a transmitter to convert the non-standard amount of electricity 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. An analog output unit (D/A) is used to convert the digital quantity processed by the PLC into analog quantity - a standard electrical signal.
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. The corresponding standard power is 0-10V, and 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 calculated to be 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 alternating between 0 (low level) and 1 (high level) (a signal quantity in which voltage or current jumps from one value to another in an instant). The number of pulse alternations per second is called frequency.
The purpose of PLC pulse quantity control is mainly position control, motion control, trajectory control, etc. For example: the application of pulse number in angle control. The subdivision of stepper motor driver is 10000 per circle. 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; it is converted to E890—1770Hex (-6000—6000) at 12000 resolution.
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 a resolution of 6000; it is converted to 0-2EE0Hex (0-12000) at a resolution of 12000.
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 lines are isolated from the power lines (AC power lines, high-voltage lines, 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 number of subdivisions of the stepper motor, and then determine the total number of pulses required for the stepper motor to make one revolution.
Calculate "angle percentage = set angle / 360° (i.e. one circle)"
"Number of pulses for angle action = 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.
Previous article:Learn PWM in a blink
Next article:Simulation of permanent magnet synchronous motor speed control system based on Simulink
- Popular Resources
- Popular amplifiers
- Red Hat announces definitive agreement to acquire Neural Magic
- 5G network speed is faster than 4G, but the perception is poor! Wu Hequan: 6G standard formulation should focus on user needs
- SEMI report: Global silicon wafer shipments increased by 6% in the third quarter of 2024
- OpenAI calls for a "North American Artificial Intelligence Alliance" to compete with China
- OpenAI is rumored to be launching a new intelligent body that can automatically perform tasks for users
- Arm: Focusing on efficient computing platforms, we work together to build a sustainable future
- AMD to cut 4% of its workforce to gain a stronger position in artificial intelligence chips
- NEC receives new supercomputer orders: Intel CPU + AMD accelerator + Nvidia switch
- RW61X: Wi-Fi 6 tri-band device in a secure i.MX RT MCU
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- FAQ Sharing: Frequently Asked Questions about TI Wireless Product RF Hardware
- 【TGF4042 Signal Generator】+ Noise Test
- Authoritative sharing of Lingdong Microelectronics MM32 MCU information
- ESP8266WiFi module (IoT switch) test (AP mode)
- CAN communication design, please help
- How to make component packages with multiple pins connected internally in Allegro
- 【Home Smart Dashboard】Using ESP-WHO to implement face detection
- How to choose external memory for DSP?
- Plastic turnover box as fish pond filter box
- 【Gravity:AS7341 Review】+ Choice of driver development board