How to solve the traffic accumulation problem in Siemens PLC - Database & Sql Blog Articles

Probe current voltage pin 420*4450 head diameter 5.0 over current current and voltage pin
GW MB10F 0.8A 1000V rectifier bridge
Supply 1206 blue light 1206 blue LED quality assurance original authentic large number
SMD aluminum electrolytic capacitor
Brand AVX TPSE226M035R0125 Low impedance tantalum capacitor AVX 22

Nowadays, many of the upper computer systems require the flow accumulation function of the flow meter, and several problems arising therefrom are expected to be shared with you.
Question 1: The principle of writing the traffic accumulation program by writing the traffic accumulation program by itself is actually the most primitive algorithm concept of the integral. The instantaneous flow rate in the small interval time is multiplied by the unit interval time to get the flow in the small interval time. By accumulating these small flows, the cumulative flow is reached.
In the flow accumulation programming, the real number addition problem is often encountered. The precautions of the real number addition operation should also be paid attention to by the programmer. Please see the following example (assuming it is called in OB35, the purpose is to accumulate at regular intervals). One time flow)
L MD0 // cumulative flow storage value
L MD4 //Flow instantaneous value
+R
T MD 0
Is there a problem with the above program? Many people think that there is no problem, but the actual situation is that this program will run into error after running for a while. This program is normal at the beginning of the operation, because the initial value of the accumulated flow and the instantaneous value of the flow are all a small floating point number. After the two numbers are added, the result is correct. However, after a period of time, the value of the accumulated flow gradually increases. When it is far from the value of the instantaneous flow, the value of the instantaneous flow will be ignored after performing the addition operation (such as 9999990.0 and 0.2 for the addition operation). ). In fact, people with computer common sense should be aware of this, which is caused by the storage mechanism of floating point numbers, and is a problem that all computer aspects need to consider. This problem can be solved by using a second accumulation or multiple accumulation methods. Therefore, when programming, you should avoid operations between floating-point numbers that differ in order of magnitude. Many people report that "addition instructions are not easy to use", it is very likely that real numbers with a large number of differences are added.
Problem 2: Cumulative flow error problem For the integral algorithm, take a small rectangle to accumulate the flow, which is definitely the thinner the division of the rectangle, the smaller the error, and the absence of error is impossible.
Question 3: There are various types of error flowmeters for the system consisting of a flow meter and a plc. Here are some examples:
1. The flowmeter itself does not have a cumulative flow function, but the instantaneous flow rate can be output in an analog manner (for example, 4-20 mA).
The maximum error of the accumulated flow at this time can be estimated as:
Flowmeter error* Flowmeter D/A error* Analog module A/D error* PLC flow accumulation algorithm error Assume all the above errors are 1%, then the final error is about: 4.06%
1.01*1.01*1.01*1.01=1.0406
For some flow meters, the instantaneous flow error may be 3%, so the error of such system cumulative flow may be larger.
2. The flow meter itself does not have a cumulative flow function, but the instantaneous flow rate can be output in a digital manner.
Some flowmeters provide a digital interface that can be connected to the digital input template of the PLC. After each flow rate of the flowmeter (for example, 0.1 tons), the input point is turned on once, and the PLC adds 0.1 tons of accumulated flow.
Such systems avoid errors in A/D, D/A conversion, and PLC cumulative algorithm errors. However, there will be a situation in which the accumulated flow does not change within a certain period of time, and the real-time performance is not good (the accumulated time per 0.1 ton).
3. The flow meter itself has a cumulative flow function. At the same time, the instantaneous flow rate can be output in an analog manner (for example, 4-20 mA), but the cumulative flow value cannot be sent out.
The cumulative flow rate of the flowmeter itself may be very different from the cumulative flow value of the PLC. The reason may be caused by many factors. If the cumulative flow error of the system is removed, if the flowmeter is still inspected during the inspection of the PLC system, then The PLC cannot accumulate this part of the traffic.
4. The flow meter itself has a cumulative flow function, and the instantaneous flow rate and accumulated flow value can be sent to the PLC through communication. This situation is ideal, but the cost of the system is also the highest.

Coffee Maker

SHENZHEN CHONDEKUAI TECHNOLOGY CO.LTD , https://www.szsiheyi.com