Fluid parameter calculation method, system and equipment

The PID controller parameters are tuned through the particle swarm optimization algorithm, combined with amplitude control and phase difference calculation, the problems of insufficient measurement accuracy and coupling characteristics of Coriolis flowmeter are solved, and higher accuracy and more comprehensive fluid parameter measurement are achieved.

CN120176794AActive Publication Date: 2025-06-20SHANGHAI FEEJOY ELECTRONICS TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510350807.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-06-20
Estimated Expiration
2045-03-24

AI Technical Summary

Technical Problem

When measuring the mass flow rate and density of existing Coriolis flowmeters, there are problems of insufficient measurement accuracy and inability to effectively reveal coupling characteristics, especially when the fluid flow is complex and structural modeling is difficult.

Method used

The particle swarm optimization algorithm is used to adjust the PID controller parameters to improve the accuracy and stability of the sensor output signal, and calculate the mass flow rate and density of the fluid through amplitude control and phase difference calculation.

Benefits of technology

It improves the accuracy and stability of fluid parameter calculation, expands the types of measurable fluid parameters, and supports the ability to measure fluid density in addition to mass flow.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120176794A_ABST
    Figure CN120176794A_ABST
Patent Text Reader

Abstract

The invention discloses a fluid parameter calculation method, system and equipment. The fluid parameter calculation method comprises the steps that the position and speed of each particle in a particle swarm are initialized; based on the position of each particle, acquiring a sensor output signal under the action of the controller, and calculating the deviation between the amplitude of the sensor output signal under the action of the controller and an expected amplitude; on the basis of the deviation corresponding to each particle, updating the speed and position of each particle, and on the basis of the updated position of each particle, acquiring a new output signal of the sensor under the action of the controller until a preset stop condition is met, and outputting an optimal controller parameter; and enabling the controller to perform amplitude control on two paths of sensor output signals of the mass flow meter according to the optimal controller parameters, and calculating the mass flow rate and the density of the fluid to be measured based on the two paths of output signals after amplitude control. Compared with the prior art, the application of the mass flow meter is expanded; and improvement is carried out from a signal output side and a signal processing side, so that the precision of a calculation result is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of signal control and processing, and particularly relates to a method, a system, and a device for calculating fluid parameters. Background Art

[0002] In the past few decades, Coriolis flowmeters have been widely used in many aspects such as petroleum, chemical industry, food, and medical pharmaceuticals due to their excellent performance. A Coriolis flowmeter is a flowmeter that works based on the principle of the Coriolis effect discovered by a French scientist. When a fluid flows through a flow pipe at a certain frequency (natural frequency), the mass and flow velocity of the fluid will generate a Coriolis force perpendicular to the flow direction, causing the pipe to undergo a slight distortion. The sensor inside the flowmeter captures the vibration state of the pipe, converts the vibration data into an electrical signal, and processes it through a transmitter, and finally calculates the mass flow rate of the fluid. Since the Coriolis effect is not affected by changes in fluid density, temperature, etc., this flowmeter has a high measurement accuracy and is widely used for accurately measuring the mass flow rate of various fluids.

[0003] Currently, the theoretical research on Coriolis flowmeters has been quite in-depth. However, due to the difficulty of modeling fluid flow and complex structures, the coupling characteristics of Coriolis flowmeters are still difficult to fully reveal through theoretical models. At the same time, with the development of engineering, the requirements for measurement accuracy and the need to analyze more parameter information of fluids are more urgent.

[0004] Therefore, in view of the above technical problems, it is necessary to provide a method, a system, and a device for calculating fluid parameters.

[0005] The information disclosed in this background art section is only intended to enhance the overall understanding of the present invention and should not be regarded as an admission or any form of implication that this information constitutes prior art already known to those of ordinary skill in the art. Summary of the Invention

[0006] The object of the present invention is to provide a method, a system, and a device for calculating fluid parameters, which can increase the types of measurable fluid parameters while improving the test accuracy.

[0007] To achieve the above object, the technical solution provided by a specific embodiment of the present invention is as follows:

[0008] In a first aspect, the present invention provides a method for calculating fluid parameters, which is applied to a Coriolis mass flowmeter and includes:

[0009] Initializing the positions and velocities of each particle in the particle swarm, where the position of the particle is composed of controller parameters, and the velocity of the particle is the change amount of the particle position parameters in each round;

[0010] Based on the positions of the respective particles, obtain the output signal of the sensor under the action of the controller, and calculate the deviation between the amplitude of the output signal of the sensor under the action of the controller and the desired amplitude;

[0011] Based on the deviations corresponding to the respective particles, update the velocities and positions of the respective particles, and based on the updated positions of the particles, obtain a new output signal of the sensor under the action of the controller until a preset stop condition is satisfied, and output the optimal controller parameters;

[0012] Enable the controller to perform amplitude control on the output signals of the two sensors of the Coriolis mass flowmeter with the optimal controller parameters, and calculate the mass flow rate and density of the fluid to be measured based on the amplitude-controlled output signals of the two sensors.

[0013] In one or more embodiments of the present invention, calculating the deviation between the amplitude of the output signal of the sensor under the action of the controller and the desired amplitude includes:

[0014] Collect the output signal of the sensor without a controller;

[0015] If the difference between the amplitude of the output signal without a controller and the desired amplitude is greater than or equal to a preset non-linear threshold, calculate the non-linear deviation between the amplitude of the output signal of the sensor under the action of the controller and the desired amplitude;

[0016] If the difference between the amplitude of the output signal without a controller and the desired amplitude is less than the preset non-linear threshold, calculate the linear deviation between the amplitude of the output signal of the sensor under the action of the controller and the desired amplitude.

[0017] In one or more embodiments of the present invention, the calculation formulas for the linear deviation and the non-linear deviation are:

[0018] ΔA1[n]=[ln(A hope -|x1[n]|)*k1] / k2

[0019] ΔA2[n]=A hope -|x1[n]|

[0020] Where, ΔA1[n] is the non-linear deviation; ΔA2[n] is the linear deviation; A hope is the desired amplitude of the output signal, |x1[n]| is the actual amplitude of the output signal; k1, k2 are proportionality coefficients.

[0021] In one or more embodiments of the present invention, updating the velocities and positions of the respective particles based on the deviations corresponding to the respective particles includes:

[0022] Based on the deviation corresponding to each particle, record the position of the particle with the smallest deviation in the particle swarm in history as the global optimal term, and record the position corresponding to the historical minimum deviation of each particle as the individual optimal term;

[0023] Based on Update the velocity of each said particle;

[0024] Based on X i+1 = X i + V i+1 to update the position of each said particle;

[0025] wherein, w is the inertia weight; c1, c2 are inertia constants; r1, r2 are random numbers; is the individual optimal term of the particle; G best is the global optimal term of the said particle swarm; X i is the position of the particle in the i-th round; V i is the velocity of the particle in the i-th round.

[0026] In one or more embodiments of the present invention, the method further includes:

[0027] Configure the particle velocity interval and the particle position interval;

[0028] If the updated velocity / position of the particle is greater than the maximum value of the velocity interval / position interval, then modify the updated velocity / position to the maximum value of the velocity interval / position interval;

[0029] If the updated velocity / position of the particle is less than the minimum value of the velocity interval / position interval, then modify the updated velocity / position to the minimum value of the velocity interval / position interval.

[0030] In one or more embodiments of the present invention, after controlling based on the optimal controller parameters, the amplitude of the sensor output signal of the Coriolis mass flowmeter is:

[0031]

[0032] wherein, is the cumulative error of the signal amplitude; is the said optimal controller parameter; ΔA[n] is the deviation between the amplitude of the sensor output signal and the expected amplitude; x[n] is the amplitude of the sensor output signal, x adjusted [n] is the amplitude of the output signal after being controlled by the controller.

[0033] In one or more embodiments of the present invention, calculating the mass flow rate and density of the fluid to be measured based on the two output signals after amplitude control includes:

[0034] Convert the two output signals after amplitude control into corresponding continuous functions;

[0035] Filter the continuous function and sample the filtered continuous function to respectively obtain two optimized output signals corresponding to the two output signals;

[0036] Calculate the phase difference of the complex signals corresponding to the two optimized output signals, and calculate the mass flow rate and density of the fluid to be measured based on the phase difference.

[0037] In one or more embodiments of the present invention, the formula for calculating the mass flow rate and density of the fluid to be measured based on the phase difference is:

[0038]

[0039] where Q m is the mass flow rate of the fluid to be measured; C1 is the sensor characteristic constant; Δφ 12 [k] is the phase difference of the complex signals corresponding to the two optimized output signals; ρ is the density of the fluid to be measured; C2 is the relationship constant between the fluid and the sensor geometry; A adjusted is the minimum value of the deviation between the two output signals and the expected output signal; A max is the maximum value of the deviation between the two output signals and the expected output signal.

[0040] In a second aspect, the present invention provides a fluid parameter calculation system, which applies the fluid parameter calculation method, and includes:

[0041] An initialization module for initializing the positions and velocities of the particles in the particle swarm, where the positions of the particles are composed of controller parameters, and the velocities of the particles are the change amounts of the particle position parameters in each round;

[0042] A first calculation module for obtaining the sensor output signal under the action of the controller based on the positions of the particles, and calculating the deviation between the amplitude of the sensor output signal under the action of the controller and the expected amplitude;

[0043] An iteration module for updating the velocities and positions of the particles based on the deviations corresponding to the particles, and obtaining the new output signal of the sensor under the action of the controller based on the updated positions of the particles until a preset stop condition is met, and outputting the optimal controller parameters;

[0044] A second calculation module for enabling the controller to perform amplitude control on the two sensor output signals of the Coriolis mass flowmeter with the optimal controller parameters, and calculating the mass flow rate and density of the fluid to be measured based on the two output signals after amplitude control.

[0045] In a third aspect, the present invention provides a computer device, which includes: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to execute the fluid parameter calculation method described above.

[0046] Compared with the prior art, the fluid parameter calculation method provided by the present invention realizes the parameter tuning of the PID controller through the particle swarm optimization algorithm, improves the accuracy and stability of the sensor output signal, controls from the signal output side, and ensures the calculation accuracy of the final fluid parameters. On the other hand, the present invention makes the sensor output signal continuous based on the sensor output signal, and filters and samples the corresponding continuous function, which can restore the integrity of the sensor output signal, make the signal parameters brought into the calculation closer to the actual phase, frequency and amplitude; at the same time, the number of sampling points can be increased as needed to further improve the calculation accuracy of the final fluid parameters from the signal processing side. Finally, based on the above-mentioned beneficial effects, the fluid parameter calculation method provided by the present invention further expands the types of fluid parameters that the scheme can obtain. In addition to the mass flow rate of the fluid, the present invention also supports the calculation of the fluid density. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments recorded in the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0048] Figure 1 It is a block diagram of a hardware system in an embodiment of the present invention;

[0049] Figure 2 It is a flowchart of a fluid parameter calculation method in an embodiment of the present invention;

[0050] Figure 3 It is a block diagram of the structure of a fluid parameter calculation system in an embodiment of the present invention;

[0051] Figure 4 It is a block diagram of the structure of an electronic device in an embodiment of the present invention;

[0052] Figure 5 It is a block diagram of a software system in an embodiment of the present invention;

[0053] Figure 6 It is a block diagram of an algorithm design system in an embodiment of the present invention;

[0054] Figure 7It is a continuous signal diagram generated after the output signal passes through the Lagrange interpolation method in an embodiment of the present invention;

[0055] Figure 8 It is a comparison diagram of the amplitude responses of the output signals under different numbers of iterations in an embodiment of the present invention;

[0056] Figure 9 It is a block diagram of the algorithm design for calculating the phase difference by Hilbert in an embodiment of the present invention. Detailed implementation manners

[0057] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0058] Unless otherwise clearly stated, in the whole specification and claims, the term "comprising" or its variations such as "including" or "having" etc. will be understood to include the stated elements or components, without excluding other elements or other components.

[0059] Please refer to Figure 1 、 Figure 5 and Figure 6 which respectively show schematic diagrams of the application scenarios of the fluid parameter calculation method provided by the present invention under a specific implementation manner. This scenario specifically includes a hardware system, a software system, and an algorithm design system.

[0060] The hardware system is as Figure 1As shown in the figure, the system includes multiple modules and components. The system starts from the temperature compensation module. After the temperature signal collected by the temperature sensor is amplified, filtered, and AD sampled, the signal is input into the main control chip of the digital processing module for temperature compensation calculation. Next is the sensor input module, which includes two sensors (sensor 1 and sensor 2). Similarly, the sensor signals are amplified, filtered, and input into the DSP module to calculate the frequency. The phase difference calculation measures the value, and the amplitude detection is used as part of the PI control. The driving module mainly processes the excitation signal after PI control at the DSP end through DDS (Direct Digital Synthesizer), MDAC (Multi-Channel Digital-to-Analog Converter), power amplification, and an exciter to generate and amplify the signal. The digital processing module consists of a DSP (Digital Signal Processor), GPIO (General-Purpose Input / Output Interface), indicator lights, serial communication, EEPROM (Electrically Erasable Programmable Read-Only Memory), and SDRAM (Synchronous Dynamic Random Access Memory), and is responsible for processing and storing digital signals. Finally, the system also includes a power-off monitoring module to monitor the power supply status and prevent power-off. These modules perform data processing and control through the DSP to form a complete hardware system.

[0061] The software system structure is as Figure 5 shown: In the initialization stage, necessary initialization operations are performed when the system starts to ensure the normal operation of each module; the interrupt program processes various possible emergencies in the system to ensure the responsiveness and stability of the system; analog-to-digital conversion (ADC) converts analog signals into digital signals for subsequent processing; the upper computer communication module is responsible for communicating with the upper computer to transmit data and instructions; the main monitoring program is the core control module that coordinates the work of each sub-module to ensure the overall operation of the system; the temperature monitoring module detects the system environment temperature and provides a temperature compensation function to ensure the stable operation of the system at different temperatures; the phase difference calculation result is used for the mass flow calculation variable and further analysis; the frequency monitoring module monitors the frequency change of the signal in real time to ensure that the frequency is within the set range; the amplitude control module adjusts the amplitude of the signal to reach the expected level. Through the collaborative work of these modules, the entire system realizes the precise monitoring and control of the phase difference, frequency, and amplitude.

[0062] The overall algorithm design system block diagram is as Figure 6 shown. After the vibration characteristics output by the exciter coil are captured by the sensor, amplitude detection is performed. The deviation between this amplitude and the expected amplitude is calculated and input into the particle swarm algorithm module as a calculation parameter. The particle swarm algorithm updates the best K at the current moment p , K i value and inputs it into the PI control. The PI control inputs the calculated data into the excitation system to drive the exciter coil. After repeating this process until the maximum number of iterations of the particle swarm algorithm is reached, the K p , K iThe value is used as the optimal PI control coefficient. After stable vibration, the AD samples of the two sensors in the primary instrument are filtered by a lattice filter with targeted frequency filtering characteristics to remove noise, and then the phase difference Δφ between the two sensors is calculated through the Fourier transform to the Hilbert algorithm module. 12 As the calculation parameter of the measured value.

[0063] Please refer to Figure 2 As shown, it is a schematic flowchart of fluid parameter calculation in an embodiment of the present invention. This fluid parameter calculation method is applied to a Coriolis mass flowmeter and specifically includes the following steps:

[0064] S201: Initialize the positions and velocities of the particles in the particle swarm, where the positions of the particles are composed of controller parameters, and the velocities of the particles are the change amounts of the particle position parameters in each round.

[0065] It should be noted that the Coriolis mass flowmeter is a device that determines the mass flow rate of a fluid by measuring the Coriolis force generated by the fluid in the flow tube based on the Coriolis force effect. Specifically, when the fluid flows through the flow tube, the vibration direction of the flow tube is perpendicular to the fluid flow direction, and the fluid generates a Coriolis force due to inertia, causing the flow tube to twist. There is a proportional relationship between the twist amount of the flow tube and the mass flow rate of the fluid therein. Therefore, the mass flow rate value of the fluid in the flow tube can be calculated based on the detection of the twist amount of the flow tube.

[0066] It can be understood that there is an optimal amplitude value during the vibration of the flow tube. When the flow tube vibrates stably at the optimal amplitude value, the measurement performance of the instrument can be maximally improved, and the service life of the flow tube can be extended. Therefore, it is desired that the vibration signal (sensor output signal) of the flow tube output by the sensor reaches the optimal amplitude value. However, in actual production activities, mass flowmeters are mostly used in the process of fluid storage and transportation, and there is mostly noise in the scenario, which is likely to interfere with the output signal of the sensor. In fact, the output of the sensor may have a steady-state error due to system disturbances and noise; the output signal may also contain high-frequency noise or short-term fluctuations caused by the environment; and there may even be problems such as output drift or non-linear response of the sensor due to aging and temperature changes. Directly applying the original output signal will greatly affect the calculated fluid parameters.

[0067] Therefore, in order to improve the calculation accuracy of the final fluid parameters, in the embodiments of the present invention, a controller is added on the signal output side to perform amplitude control on the output signals of the sensors arranged on the Coriolis mass flowmeter. The controller may include, but is not limited to, a PI controller, a PID controller, a lead-lag compensator, etc. The specific selection of the controller may vary dynamically based on specific implementation scenarios, and the embodiments of the present invention do not limit this. It can be understood that the controller is an algorithm or logic for achieving the control objective. In order to implement the control strategy corresponding to the controller, the corresponding parameters of the controller also need to be configured. The configuration of the controller parameters can not only determine the specific behavior of the controller, but also affect the dynamic response of the system, and is a key variable for adjusting the behavior of the controller. Therefore, in order to achieve adaptive and precise control, the tuning of the controller parameters is also crucial.

[0068] For example, in a specific embodiment, the PI amplitude control algorithm is selected to make the vibration of the flow tube reach the desired vibration amplitude value, and the input is adjusted through the proportional algorithm and integral algorithm of the error to achieve the purpose of stable vibration of the flow tube. In system testing, the proportional parameter and integral parameter of the PI controller need to be appropriately selected according to previous experience or the performance of specific sensors. If the proportional parameter is too large, it may lead to overreaction and oscillation, while if it is too small, it may lead to slow response and large steady-state error; if the integral parameter is too large, it may cause system oscillation or instability, and if it is too small, it may not be able to eliminate the steady-state error. When adjusting these two parameters, it is necessary to balance the response speed, steady-state error, and system stability.

[0069] Based on this, the present invention constructs particles with swarm cooperation characteristics, simulates the global search and local development behaviors of the particle swarm in the solution space, and realizes the tuning of the optimal controller parameters through the dual guidance mechanism of inertia weight and individual-swarm experience iteration optimization.

[0070] During the initialization process, it is necessary to generate corresponding initial positions and initial velocities for a given number of particles. Among them, the position of the particle is composed of the controller parameters, and its dimension can vary dynamically based on the number of parameters to be tuned by the controller. Relatively, the velocity of the particle represents the change amount of the particle position in each round. That is, the velocity has the same dimension as the position, and each component of the velocity corresponds one-to-one with each component of the position. If the number of parameters to be tuned is n, then the initial position of each particle can be generated as X i =(l1, l2, l3,...., l n ); the initial velocity is V i =(v1, v2, v3,...., v n ), where v n represents the change amount of the current round position component l n . It can be specifically expressed as: X i+1 =Xi +V i+1 。

[0071] It should be noted that the position representation controller parameter and the speed represent the moving speed of the particle in the solution space, and both have a reasonable range. To avoid the initial values of the position and speed being too large or too small and reduce the speed of iteratively obtaining the optimal controller parameter. In the fluid parameter calculation method provided by the present invention, a particle speed interval and a particle position interval also need to be configured. The initialized speed and position need to be within the ranges of the particle speed interval and the particle position interval.

[0072] Continuing with the above specific embodiment, if a PI controller is used to perform amplitude control on the output of the sensor, the particle position interval can be set as k p ∈[0.01, 0.05], k i ∈[0.00001, 0.0001]; the particle speed interval is v ∈ [-V max , V max , and the positions of the particles in the particle swarm are initialized within the above intervals as and the speed is where represents the controller parameter, is the speed parameter corresponding to the particle position parameter.

[0073] S202: Based on the positions of the particles, obtain the sensor output signal under the action of the controller, and calculate the deviation between the amplitude of the sensor output signal under the action of the controller and the expected amplitude;

[0074] It should be noted that the sensor output signal in the present invention is a digital signal. In one embodiment, if the sensor output signal of the Coriolis mass flowmeter is an analog signal, before calculating the deviation between the amplitude of the sensor output signal under the action of the controller and the expected amplitude, it is also necessary to first pass the output signal in the form of an analog signal through a preset analog-to-digital converter to convert the analog signal into a digital signal, obtaining the corresponding digital signal x1[n], where x1[n] = x1(t) (n = 1, 2, 3,..., N); N represents the number of sampling points, and n is the discrete time index. Subsequently, based on the output signal in the form of the digital signal, the deviation between the amplitude and the expected amplitude is calculated.

[0075] Furthermore, the deviation may include a linear deviation and a non-linear deviation. Both can be used to realize the tuning of the controller parameter. The calculation formulas for the linear deviation and the non-linear deviation are:

[0076] ΔA1[n] = [ln(A hope - |x1[n]|) * k1] / k2

[0077] ΔA2[n] = A hope -|x1[n]|

[0078] where ΔA1[n] is the non - linear deviation; ΔA2[n] is the linear deviation; A hope is the expected amplitude of the output signal, and |x1[n]| is the actual amplitude of the output signal; k1 and k2 are proportionality coefficients.

[0079] It should be noted that the present invention is used during the rising period when the signal does not overshoot. At this time, the deviation must be positive. After the signal stabilizes, there will be times when the expected amplitude is lower than the actual amplitude, and ordinary PI control can be used. Therefore, during the rising process, it is default that the expected amplitude is greater than the actual amplitude.

[0080] In another embodiment, if this method is used throughout, then the absolute value needs to be added to the term (A hope -|x1[n]|) in the formula; at the same time, the positive and negative of (A hope -|x1[n]|) is judged. Specifically, when the difference between the expected amplitude and the actual amplitude is positive, the corresponding linear deviation / non - linear deviation is positive; when the difference between the expected amplitude and the actual amplitude is negative, the corresponding linear deviation / non - linear deviation is negative.

[0081] In the embodiments of the present invention, when the computing power is sufficient, the optimal controller parameters can be iteratively output based on the linear deviation and the non - linear deviation respectively; when the computing power is tight, the two deviations can also be selected, and one of them can be selected for the iterative output of the optimal controller parameters.

[0082] It should be noted that the linear deviation is actually the difference between the expected amplitude and the actual amplitude. When the deviation is small, its control effect is good. However, relatively speaking, the control effect will become worse as the difference between the expected amplitude and the actual amplitude increases. The larger the difference, the easier the system is to overshoot. The non - linear deviation has the opposite effect to the linear deviation. Since the logarithmic function has a range from negative infinity to 0 in the interval greater than 0 and less than 1; when it is greater than 1, its curve changes relatively gently. Therefore, when the difference between the expected amplitude and the actual amplitude is small, the system is prone to overshoot; when the difference between the expected amplitude and the actual amplitude is large, the non - linear deviation tends to be stable and the control effect is good.

[0083] In one embodiment of the present invention, the output signal of the sensor without a controller can be collected; if the difference between the amplitude of the output signal without a controller and the expected amplitude is greater than or equal to a preset non - linear threshold, then the non - linear deviation between the amplitude of the output signal of the sensor under the action of the controller and the expected amplitude is calculated; if the difference between the amplitude of the output signal without a controller and the expected amplitude is less than the preset non - linear threshold, then the linear deviation between the amplitude of the output signal of the sensor under the action of the controller and the expected amplitude is calculated.

[0084] It is understandable that the embodiments of the present invention do not limit the specific value of the non-linear threshold. Considering the properties and characteristics of the linear deviation and the non-linear deviation, it is preferred to configure the non-linear threshold to be greater than 1.

[0085] S203: Based on the deviations corresponding to each of the particles, update the velocity and position of each of the particles, and based on the updated positions of each particle, obtain a new output signal of the sensor under the action of the controller until a preset stop condition is satisfied, and output the optimal controller parameters;

[0086] In an exemplary embodiment of the present invention, the updating of the velocity and position of each of the particles based on the deviations corresponding to each of the particles includes: based on the deviations corresponding to each particle, record the position of the particle with the smallest deviation in the particle swarm in history as the global optimal item, and record the positions corresponding to the historical minimum deviations of each particle as the individual optimal items; based on Update the velocity of each of the particles; based on X i+1 = X i + V i+1 , update the position of each of the particles; where w is the inertia weight; c1, c2 are inertia constants; r1, r2 are random numbers; is the individual optimal item of the particle; G best is the global optimal item of the particle swarm; X i is the position of the particle in the i-th round; V i is the velocity of the particle in the i-th round.

[0087] Similarly, it is preferred to preset the value range of the random numbers, and generate random numbers r1, r2 within the value range of the random numbers. At the same time, reasonably setting the inertia weight and the learning factor can significantly improve the convergence speed and the global optimization ability of the algorithm. Among them, the inertia constant is used to control the weight of the individual experience and the group experience, and the inertia weight is used to control the inheritance ratio of the particle velocity, balancing the global exploration and the local development ability. The methods for setting the inertia weight may include but are not limited to: fixed value method, linear decreasing method, random value taking, etc.; the methods for setting the inertia constant may include but are not limited to: fixed value method, symmetric adjustment or asymmetric adjustment, etc. The embodiments of the present invention do not limit the configuration methods and the specific values of the above parameters, but preferably ensure the convergence condition, that is, ω < 1 and c1 + c2 < 4(1 + ω).

[0088] It should be noted that when updating the velocity parameter and position parameter of the particle, it is also necessary to ensure that the updated parameters are within the corresponding particle velocity range and particle position range. If the updated velocity / position of the particle is greater than the maximum value of the velocity range / position range, the updated velocity / position is modified to the maximum value of the velocity range / position range; if the updated velocity / position of the particle is less than the minimum value of the velocity range / position range, the updated velocity / position is modified to the minimum value of the velocity range / position range.

[0089] After updating the velocity and position parameters of each particle, a new round of iterative loop can be entered. Based on the controller parameters corresponding to the updated particle positions, a new deviation value is calculated, and based on the new deviation value, the particle velocity and position parameters are updated again until a preset stop condition is reached. The stop condition may include but is not limited to: reaching the maximum number of iterations or the deviation value being less than a preset threshold.

[0090] It can be understood that one or more stop conditions can be set. After reaching any of the preset stop conditions, that is, when the iteration ends. At the same time, as Figure 8 shown in the amplitude response comparison diagram of the output signal under different numbers of iterations in an embodiment of the present invention, it can be seen that the more the number of iteration rounds, the better the amplitude response of the output signal. After the iteration ends, the global optimal position at this time is the optimal controller parameter output.

[0091] S204: Enable the controller to perform amplitude control on the output signals of the two sensors of the Coriolis mass flowmeter with the optimal controller parameters, and calculate the mass flow rate and density of the fluid to be measured based on the two output signals after amplitude control.

[0092] In an exemplary embodiment of the present invention, after controlling based on the optimal controller parameters, the amplitude of the sensor output signal of the Coriolis mass flowmeter is:

[0093]

[0094] Among them, is the cumulative error of the signal amplitude; is the optimal controller parameter; ΔA[n] is the deviation between the amplitude of the sensor output signal and the expected amplitude; x[n] is the amplitude of the sensor output signal, and x adjusted [n] is the amplitude of the output signal after being controlled by the controller.

[0095] Calculating the mass flow rate and density of the fluid to be measured based on the two output signals after amplitude control, including: converting the two output signals after amplitude control into corresponding continuous functions; filtering the continuous functions, and sampling the filtered continuous functions to respectively obtain two optimized output signals corresponding to the two output signals; calculating the phase difference of the complex signals corresponding to the two optimized output signals, and calculating the mass flow rate and density of the fluid to be measured based on the phase difference.

[0096] Among them, the Lagrange interpolation method can be applied to convert the two output signals after amplitude control into corresponding continuous functions. Specifically, as Figure 7 shown, it is the continuous signal diagram of the output signal after the Lagrange interpolation method in an embodiment of the present invention. The Lagrange interpolation method is to construct a polynomial passing through all the above-known data points by using the known data points. For the given discrete signal x(n), assuming that N + 1 data points (n0, x(n0)), (n1, x(n1)), …, (n N , x(n N )) are known, the Lagrange interpolation polynomial P(x) can be expressed as:

[0097]

[0098] Among them, L i (n) is the i-th Lagrange basis function, defined as:

[0099]

[0100] In the above formula: n is the position to be interpolated, n i is the position of the known data point, x(n i ) is the value of the signal at n i .

[0101] The Lagrange basis function L i (n) makes L i (n j ) = 0 for all j ≠ i, while L i (n j ) = 1, thus ensuring that the interpolation polynomial passes through all the known data points. The obtained continuous function P(n) is as Figure 5 shown.

[0102] If the continuity of the output signal is not carried out, then the output signal after amplitude control is a discrete signal, and it is difficult to determine the phase, frequency, and amplitude closest to the actual based on the discrete signal. Based on methods such as the Lagrange interpolation method, the integrity of the signal can be restored, and new sampling points can also be added, making the calculation accuracy of the fluid parameters higher.

[0103] It should be noted that before sampling the continuous function obtained by converting the output signal, the continuous function can also be filtered to remove noise. The embodiments of the present invention do not limit the filtering method, which can be dynamically adjusted according to the actual application scenario, preferably lattice filtering or Kalman filtering.

[0104] Furthermore, after sampling the continuous function to obtain the optimized output signal, the optimized output signal also needs to be subjected to frequency domain conversion and phase difference calculation. It includes: Fourier transform of two amplified and filtered sensor signals to obtain frequency domain characteristics, constructing an analytic signal by combining with Hilbert transform, and eliminating noise interference by calculating the instantaneous phase difference between the two signals.

[0105] Specifically, the signal y[n] after filtering and sampling is converted into a frequency domain signal Y[k] through fast Fourier transform as follows:

[0106]

[0107] where j is the imaginary unit, N is the total number of signal sampling points, and k is the frequency index.

[0108] Perform Hilbert transform on the frequency domain signal Y[k] to obtain the instantaneous phase φ[k] of the complex signal, as shown in Figure 9 , which is the algorithm design block diagram for calculating the phase difference by Hilbert in an embodiment of the present invention. After the two signals pass through lattice filtering to obtain enhanced signals, perform Hilbert transform on the frequency domain signals, and the trigonometric operation is only a time function of the instantaneous phase difference.

[0109] Subsequently, calculate the phase difference Δφ 12 [k] for phase tracking to ensure measurement accuracy:

[0110] φ[k] = arg(Y[k])

[0111] Δφ 12 [k] = φ1[k] - φ2[k]

[0112] where φ1[k] and φ2[k] respectively represent the instantaneous phases of the two sensors.

[0113] Finally, the formulas for calculating the mass flow rate and density of the fluid to be measured based on the phase difference are:

[0114]

[0115] where Q m is the mass flow rate of the fluid to be measured; C1 is the sensor characteristic constant; Δφ 12[k] is the phase difference between the complex signals corresponding to the optimized output signal of the one path and the optimized output signal of the two paths; ρ is the density of the fluid to be measured; C2 is the relationship constant between the fluid and the sensor geometry; A adjusted is the minimum deviation between the two output signals and the desired output signal; A max is the maximum deviation between the two output signals and the desired output signal.

[0116] Please refer to Figure 3 As shown, based on the same inventive concept as the foregoing fluid parameter calculation method, an embodiment of the present invention provides a fluid parameter calculation system 300, which includes: an initialization module 301, a first calculation module 302, an iteration module 303, and a second calculation module 304.

[0117] Specifically, the initialization module 301 is configured to initialize the positions and velocities of the particles in the particle swarm, where the positions of the particles are composed of controller parameters, and the velocities of the particles are the change amounts of the particle position parameters in each round; the first calculation module 302 is configured to obtain the sensor output signal under the action of the controller based on the positions of the particles, and calculate the deviation between the amplitude of the sensor output signal under the action of the controller and the desired amplitude; the iteration module 303 is configured to update the velocities and positions of the particles based on the deviations corresponding to the particles, and obtain the new output signal of the sensor under the action of the controller based on the updated positions of the particles, until a preset stop condition is met, and output the optimal controller parameters; the second calculation module 304 is configured to cause the controller to perform amplitude control on the two sensor output signals of the Coriolis mass flowmeter with the optimal controller parameters, and calculate the mass flow rate and density of the fluid to be measured based on the two output signals after amplitude control.

[0118] Please refer to Figure 4 As shown, an embodiment of the present invention further provides an electronic device 400, which includes at least one processor 401, a memory 402 (such as a non-volatile memory), a memory 403, and a communication interface 404, and at least one processor 401, the memory 402, the memory 403, and the communication interface 404 are connected together via an internal bus 405. The at least one processor 401 is configured to call at least one program instruction stored or encoded in the memory 402, so that the at least one processor 401 performs various operations and functions of the fluid parameter calculation method described in the various embodiments of the present specification.

[0119] In the embodiments of this specification, the electronic device 400 may include, but is not limited to: personal computers, server computers, workstations, desktop computers, laptop computers, notebook computers, mobile electronic devices, smart phones, tablet computers, cellular phones, personal digital assistants (PDAs), handheld devices, messaging devices, wearable electronic devices, consumer electronic devices, and so on.

[0120] An embodiment of the present invention also provides a computer-readable medium, on which computer-executable instructions are carried. When the computer-executable instructions are executed by a processor, they can be used to implement various operations and functions of the fluid parameter calculation method described in the various embodiments of this specification.

[0121] The computer-readable medium in the present invention may be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. The computer-readable storage medium may, for example, be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, the computer-readable storage medium may be any tangible medium that contains or stores a program, and the program can be used by or combined with an instruction execution system, apparatus, or device.

[0122] In the present invention, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which computer-readable program code is carried. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium, and the computer-readable medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0123] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) that contain computer-usable program code.

[0124] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses, systems, and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as the combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing device generate means for implementing the functions specified in Figure 1 one or more of the flows or multiple flows and / or blocks Figure 1 one or more of the blocks or multiple blocks.

[0125] The foregoing description of the specific exemplary embodiments of the present invention is for the purposes of illustration and exemplification. These descriptions are not intended to limit the present invention to the precise forms disclosed, and obviously, many changes and variations are possible in light of the above teachings. The purpose of selecting and describing the exemplary embodiments is to explain the specific principles of the present invention and its practical applications, so that those skilled in the art can implement and utilize the various different exemplary embodiments of the present invention, as well as various different selections and changes. The scope of the present invention is intended to be defined by the claims and their equivalents.

[0126] For those skilled in the art, it is obvious that the present invention is not limited to the details of the above-described exemplary embodiments, and without departing from the spirit or basic characteristics of the present invention, the present invention can be implemented in other specific forms. Therefore, in any aspect, the embodiments should be regarded as exemplary and non-limiting. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be included in the present invention. Any reference signs in the claims should not be construed as limiting the claims involved.

[0127] In addition, it should be understood that although this specification is described in terms of embodiments, not every embodiment contains only one independent technical solution. This narrative style of the specification is only for clarity. Those skilled in the art should regard the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.

Claims

1. A method for calculating fluid parameters, applied to a Coriolis mass flowmeter, characterized in that: include: Initialize the position and speed of each particle in the particle swarm, where the position of the particle is composed of the controller parameters, and the speed of the particle is the change in the particle position parameters in each round; Based on the position of each of the particles, a sensor output signal under the action of the controller is obtained, and a deviation between the amplitude of the sensor output signal under the action of the controller and an expected amplitude is calculated; Based on the deviations corresponding to the particles, the speed and position of the particles are updated, and based on the updated positions of the particles, new output signals of the sensors under the action of the controller are obtained until a preset stop condition is met, and optimal controller parameters are output; The controller is enabled to perform amplitude control on two-way sensor output signals of the Coriolis mass flowmeter with the optimal controller parameters, and the mass flow and density of the fluid to be measured are calculated based on the two-way sensor output signals after amplitude control.

2. The fluid parameter calculation method according to claim 1, characterized in that: The calculating the deviation between the amplitude of the sensor output signal under the action of the controller and the expected amplitude includes: Collect the output signal of the sensor without controller; If the difference between the output signal amplitude without the controller and the expected amplitude is greater than or equal to a preset nonlinear threshold, then calculating the nonlinear deviation between the output signal amplitude of the sensor under the action of the controller and the expected amplitude; If the difference between the output signal amplitude without the controller and the expected amplitude is less than a preset nonlinear threshold, the linear deviation between the output signal amplitude of the sensor under the action of the controller and the expected amplitude is calculated.

3. The fluid parameter calculation method according to claim 2, characterized in that: The calculation formulas for the linear deviation and the nonlinear deviation are: ΔA1[n]=[ln(A hope -|x1[n]|)*k1] / k2 ΔA2[n]=A hope -|x1[n]| Among them, ΔA1[n] is the nonlinear deviation; ΔA2[n] is the linear deviation; A hope is the expected amplitude of the output signal, |x1[n]| is the actual amplitude of the output signal; k1 and k2 are proportional coefficients.

4. The fluid parameter calculation method according to claim 1, characterized in that: The updating of the speed and position of each particle based on the deviation corresponding to each particle includes: Based on the deviations corresponding to each particle, the position of the particle with the smallest deviation in the particle swarm in history is recorded as the global optimal item, and the position corresponding to the historical minimum deviation of each particle is recorded as the individual optimal item; based on Updating the velocity of each particle; X-based i+1 =X i +V i+1 , update the position of each particle; Among them, w is the inertia weight; c1 and c2 are inertia constants; r1 and r2 are random numbers; is the optimal item for individual particles; G best is the global optimal term of the particle swarm; X i is the position of the particle in the i-th round; V i is the velocity of the particle in the i-th round.

5. The fluid parameter calculation method according to claim 1, characterized in that: The method further comprises: Configure particle velocity interval and particle position interval; If the updated speed / position of the particle is greater than the maximum value of the speed interval / position interval, modifying the updated speed / position to the maximum value of the speed interval / position interval; If the updated speed / position of the particle is less than the minimum value of the speed interval / position interval, the updated speed / position is modified to the minimum value of the speed interval / position interval.

6. The fluid parameter calculation method according to claim 1, characterized in that: After the optimal controller parameter control, the sensor output signal amplitude of the Coriolis mass flowmeter is: in, is the cumulative error of the signal amplitude; is the optimal controller parameter; ΔAn is the deviation between the amplitude of the sensor output signal and the expected amplitude; xn is the output signal amplitude of the sensor, x adjusted n is the output signal amplitude after being controlled by the controller.

7. The fluid parameter calculation method according to claim 1, characterized in that: The method of calculating the mass flow rate and density of the fluid to be measured based on the two output signals after amplitude control includes: Converting the two output signals after amplitude control into corresponding continuous functions; Filtering the continuous function, and sampling the filtered continuous function to obtain two optimized output signals corresponding to the two output signals respectively; The phase difference between the complex signals corresponding to the two optimized output signals is calculated, and the mass flow rate and density of the fluid to be measured are calculated based on the phase difference.

8. The fluid parameter calculation method according to claim 7, characterized in that: The formula for calculating the mass flow rate and density of the fluid to be measured based on the phase difference is: Among them, Q m is the mass flow rate of the fluid to be measured; C1 is the sensor characteristic constant; Δφ 12 k is the phase difference of the complex signal corresponding to the two optimized output signals; ρ is the density of the fluid to be measured; C2 is the relationship constant between the fluid and the sensor geometry; A adjusted A is the minimum deviation between the two output signals and the expected output signal; max is the maximum deviation between the two output signals and the expected output signal.

9. A fluid parameter calculation system, using the fluid parameter calculation method according to any one of claims 1 to 8, characterized in that: include: The initialization module is used to initialize the position and speed of each particle in the particle swarm, where the position of the particle is composed of the controller parameters, and the speed of the particle is the change of the particle position parameters in each round; A first calculation module, used for obtaining a sensor output signal under the action of the controller based on the position of each particle, and calculating a deviation between an amplitude of the sensor output signal under the action of the controller and an expected amplitude; An iteration module is used to update the speed and position of each particle based on the deviation corresponding to each particle, and obtain a new output signal of the sensor under the action of the controller based on the updated position of each particle, until a preset stop condition is met, and output the optimal controller parameters; The second calculation module is used to enable the controller to perform amplitude control on the two-way sensor output signals of the Coriolis mass flowmeter with the optimal controller parameters, and calculate the mass flow and density of the fluid to be measured based on the two-way output signals after amplitude control.

10. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the fluid parameter calculation method according to any one of claims 1 to 8 by executing the computer instructions.

Citation Information

Patent Citations

  • Coriolis mass flowmeter signal processing method based on orthogonal demodulation

    CN116576931A

  • Driving control method applied to Coriolis mass flow meter

    CN118376289A

  • Coriolis mass flowmeter

    JP2016090516A

  • Method For Determining The Mass Flow Through A Coriolis Mass Flowmeter

    US20090211373A1

  • Coriolis flowmeter

    US20100268484A1