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.
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
- Popular Resources
- Popular amplifiers
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- High-precision electronic heartbeat comes from TI's breakthrough BAW resonator technology
- Keil newly built project, why can't I find ADuC7029
- [Fudan Micro FM33LG0 Series Development Board Evaluation] Development Board Hardware Evaluation, CMSIS-DAP Download Test
- What is carrier bandwidth in wireless communications?
- Participate to get gifts | Welcome to Tektronix High Speed Serial Knowledge Planet
- 【Fudan Micro FM33LC046N】A breathtaking clock
- What happened to ZTE? I saw an article and shared it with everyone
- [Gizwits Gokit 3 Review] + Late Unboxing Review
- SHT31 review + sharing an mdk5 engineering code file
- TMS320F280049C Learning-GPIO