How to Perceive Water Temperature-Analog Input AI with Temperature
2019 is about to pass. Did the original New Year's wishes come true? Anyway, my wish is not fulfilled, why? Strength is not enough, not enough effort! Those who have worked hard during this year must have gained something and salute you!
Closer to home, last time we finished the two legs of the PLC-digital input (DI) and digital output (DO), as if our hands were dirty, go to the pool to wash our hands, and the faucet received the open signal of our hands (DI ), The outflow of water (DO), washed and received our hand off signal, the faucet closed. So easy?
But now it's winter, washing your hands with cold water is too cold, and people like me can't get cold water, then you need the hot water in the water heater. If the water is too cold, it will hurt your stomach, and if it is too hot, it wo n’t work. The second elder brother can do scalding, although the second elder brother can't afford to burn it. Then how to judge whether it is cold or hot? This requires analog input (AI), which is Analog Input. The temperature perceived by our hands is an analog input value. The difference between it and digital is obvious. Digital has only two states, 0 or 1, while analog The quantity is continuously changing. For example, the water temperature is 0-100 ° C. Our hands are responsible for sensing the temperature and receiving the signal value of the temperature. It is hot at 60 degrees. Such a signal is a typical analog input signal.
In addition to feeling the emotions of anger, grief, grief, horror, our brain can also be responsible for the calculation and processing of data. When the hand touches water, it will tell us whether it is hot or cold. So how can a PLC make such a judgment like the brain? Let's take a look at this important process A / D conversion, that is, how the analog quantity becomes a digital signal that the computer can recognize.
There are two important concepts in the conversion process. The first is resolution, that is, using several digital signals to represent an analog value, or to put it simply, dividing an analog value into several parts. Let's use water temperature of 0-100 ° C as an example. If only one digit is used to distinguish the water temperature, there are only two states: 0 for 0 degrees and 1 for 100 degrees, which is too imprecise. How about two-digit numbers? Divide 0-100 ° C into three portions, as shown in the table below (note that there are three portions, not four, find the reason yourself):
If it is 8 bits, exactly one byte (Byte), the binary abbreviation is: 2 #, then a byte is 2 # 0000 0000 to 2 # 1111 1111, and the decimal is 0 to 255. The water temperature is Minutes are finer. If 16 bits is exactly a word, that is, 0 to 65535 in decimal, you can see that the higher the resolution, the finer the minute, and the water temperature will be more accurately represented. It's a bit like the resolution of our monitor, TV, or mobile phone. The higher the resolution, the more delicate the picture is cut, and the sharper the image, the same reason.
The second concept is the sampling frequency, which is how many times the analog value is measured in a unit time. If you measure it twice a year, you will eat dumplings once on the New Year's Day, and once in the summer when you blow on the air conditioner. The temperature information is lost, and the result of this will surely make you properly scolded by dogs. Hurry up and measure it once a minute. The results are slightly acceptable. If you work in the gym and let you measure the temperature of the swimming pool, this frequency should be able to pass. But if you are measuring the temperature of the bath water, you may be complained again. The water temperature has reached 60 degrees. Before the measurement time, the guest has been burned. You must increase the measurement frequency, once every five seconds. The water temperature is not suitable for adjustment at any time. However, if you work in a chemical plant, the temperature change directly affects the quality of the finished product of a can of raw materials, and the frequency of three times per second can ensure normal production. It can be seen that different occasions require different sampling frequencies, and the size of the sampling frequency determines whether the trend of this analog value change is smooth.
The last is the process of A / D conversion. In fact, it is a comparison process. First, the analog value is collected according to the sampling frequency.
Then compare the acquired value with each step according to the resolution. The figure below uses three digits as an example to measure the water temperature. Divide 0-100 ° C into 7 portions
If the measured temperature is between 0 and 14.29 degrees, the output digital value is 000, and the temperature rises to 14.3 degrees, and the output number becomes 001. Simply comparing the measured water temperature and step value, the output digital value is obtained. value.
Of course, there are also issues such as filtering, algorithms, and circuit design, but it is not important. We understand the principle. The analog module reads the analog value and finally converts it into a digital value (usually a Word). And it is transmitted to the processor of the PLC, just like the hand senses the water temperature, and transmits it to the brain, telling us that the water temperature is just right, and we can prepare to take off our clothes and take a bath.
But in case the water temperature is not right, how to adjust it? Do n’t worry, next time we will see how the water temperature is adjusted and talk about the analog output AO.