Fluid parameter calculation method, system, and apparatus

CN120176794BActive Publication Date: 2026-09-22SHANGHAI FEEJOY ELECTRONICS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

[0003]目前,关于科氏流量计的理论研究已相当深入,但由于流体流动和复杂结构建模的困难,科氏流量计的耦合特性尚难通过理论模型完全揭示

Benefits of technology

[0046]与现有技术相比,本发明的提供的流体参数计算方法,通过粒子群优化算法,实现对于PID控制器的参数整定,提高传感器输出信号的精确性和稳定性。从信号输出侧进行控制,保障了最终流体参数的计算精度。另一方面,本发明基于传感器输出信号进行连续化,并对相应的连续函数滤波采样,可以恢复传感器输出信号的完整度,使带入计算的信号参数更加接近实际的相位、频率和幅值;同时可以按需增加采样点的个数,从信号处理侧进一步提高最终流体参数的计算精度。最后,本发明提供的流体参数计算方法,在前述有益效果的基础上,进一步扩展了方案可以求取的流体参数类型,除了流体的质量流量外,本发明还支持对于流体密度的求取。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120176794B_ABST
    Figure CN120176794B_ABST
Patent Text Reader

Abstract

The application discloses a kind of fluid parameter calculation method, system and equipment, comprising: the position and speed of each particle in initialization particle swarm;Based on the position of each particle, obtain the output signal of sensor under the action of controller, and calculate the deviation between the amplitude of sensor output signal under the action of controller and expected amplitude;Based on the deviation corresponding to each particle, update the speed and position of each particle, and based on the updated position of each particle, obtain the new output signal of sensor under the action of controller, until the preset stop condition is satisfied, output optimal controller parameter;Make the controller with optimal controller parameter, the amplitude control of two-way sensor output signal of mass flowmeter is carried out, and the mass flow and density of the fluid to be measured are calculated based on the two-way output signal after amplitude control.Compared with prior art, the application expands the application of mass flowmeter;From signal output side and signal processing side are improved respectively, the accuracy of calculation result is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of signal control and processing technology, specifically relating to a method, system, and device for calculating fluid parameters. Background Technology

[0002] For decades, Coriolis flow meters have been widely used in petroleum, chemical, food, and pharmaceutical industries due to their excellent performance. A Coriolis flow meter operates based on the Coriolis effect principle discovered by French scientists. When fluid flows through a pipe at a certain frequency (natural frequency), the fluid's mass and velocity generate a Coriolis force perpendicular to the flow direction, causing a slight twist in the pipe. An internal sensor captures this vibration, converting the data into an electrical signal. This signal is then processed by a transmitter to calculate the fluid's mass flow rate. Because the Coriolis effect is unaffected by changes in fluid density and temperature, this flow meter offers high measurement accuracy and is widely used for precisely measuring the mass flow rate of various fluids.

[0003] Currently, theoretical research on Coriolis flow meters is quite in-depth. However, due to the difficulties in modeling fluid flow and complex structures, the coupling characteristics of Coriolis flow meters are still difficult to fully reveal through theoretical models. Meanwhile, with the development of engineering, the requirements for measurement accuracy and the need to analyze more parameter information of the fluid are becoming increasingly urgent.

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

[0005] The information disclosed in this background section is intended only to enhance the understanding of the overall background of the invention and should not be construed as an admission or in any way implying that the information constitutes prior art known to those skilled in the art. Summary of the Invention

[0006] The purpose of this invention is to provide a method, system, and device for calculating fluid parameters, which can improve testing accuracy while increasing the types of measurable fluid parameters.

[0007] To achieve the above objectives, a specific embodiment of the present invention provides the following technical solution:

[0008] In a first aspect, the present invention provides a method for calculating fluid parameters, applied to a Coriolis mass flow meter, comprising:

[0009] Initialize the position and velocity of each particle in the particle swarm. The position of a particle is composed of controller parameters, and the velocity of a particle is the change in the particle position parameters in each round.

[0010] Based on the position of each particle, the sensor output signal under the action of the controller is obtained, and the deviation between the amplitude of the sensor output signal under the action of the controller and the expected amplitude is calculated.

[0011] Based on the deviation corresponding to each particle, the velocity and position of each particle are updated, and based on the updated position of each particle, the new output signal of the sensor under the action of the controller is obtained until the preset stopping condition is met, and the optimal controller parameters are output.

[0012] The controller uses the optimal controller parameters to control the amplitude of the two sensor output signals of the Coriolis mass flow meter, and calculates the mass flow rate and density of the fluid to be measured based on the amplitude-controlled two sensor output signals.

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

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

[0015] If the difference between the output signal amplitude without a controller and the expected amplitude is greater than or equal to a preset nonlinear threshold, then the nonlinear deviation between the sensor output signal amplitude and the expected amplitude under the action of the controller is calculated.

[0016] If the difference between the output signal amplitude without a controller and the expected amplitude is less than a preset nonlinear threshold, then the linear deviation between the sensor output signal amplitude and the expected amplitude under the action of the controller is calculated.

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

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

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

[0020] Where ΔA1[n] is the nonlinear deviation; ΔA2[n] is the linear deviation; A hope Let |x1[n]| be the expected amplitude of the output signal, and |x1[n]| be the actual amplitude of the output signal; k1 and k2 are proportional coefficients.

[0021] In one or more embodiments of the present invention, updating the velocity and position of each particle based on the deviation corresponding to each particle includes:

[0022] Based on the deviation of each particle, the position of the particle with the smallest deviation in the particle swarm in history is recorded as the global optimal term, and the position corresponding to the smallest deviation in history of each particle is recorded as the individual optimal term.

[0023] based on Update the velocity of each particle;

[0024] Based on X i+1 =X i +V i+1 Update the positions of each particle;

[0025] Where w is the inertia weight; c1 and c2 are inertia constants; and r1 and r2 are random numbers. For the individual particle's optimal term; G best X is the global optimal term for the particle swarm; i V represents the position of the particle in the i-th round; i Let be 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 range and particle position range;

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

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

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

[0031]

[0032] in, This represents the cumulative error of the signal amplitude. Here are the optimal controller parameters; ΔA[n] is the deviation between the amplitude of the sensor output signal and the desired amplitude; x[n] is the amplitude of the sensor output signal, x adjusted [n] represents the amplitude of the output signal after being controlled by the controller.

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

[0034] The two output signals after amplitude control are converted into corresponding continuous functions;

[0035] The continuous function is filtered, and the filtered continuous function is sampled to obtain two optimized output signals corresponding to the two output signals respectively;

[0036] Calculate the phase difference between the complex signals corresponding to the two optimized output signals, and calculate the mass flow rate and density of the fluid under test 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 as follows:

[0038]

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

[0040] Secondly, the present invention provides a fluid parameter calculation system, which applies the fluid parameter calculation method described above, and includes:

[0041] The initialization module is used to initialize the position and velocity of each particle in the particle swarm. The position of the particle is composed of controller parameters, and the velocity of the particle is the change of the particle position parameters in each round.

[0042] The first calculation module is used to obtain the sensor output signal under the action of the controller based on the position of each particle, and to calculate the deviation between the amplitude of the sensor output signal under the action of the controller and the expected amplitude.

[0043] The iteration module is used to update the velocity and position of each particle based on the deviation corresponding to each particle, and to obtain the new output signal of the sensor under the action of the controller based on the updated position of each particle, until the preset stopping condition is met and the optimal controller parameters are output.

[0044] The second calculation module is used to enable the controller to perform amplitude control on the two sensor output signals of the Coriolis mass flow meter with the optimal controller parameters, and to calculate the mass flow rate and density of the fluid to be measured based on the two output signals after amplitude control.

[0045] Thirdly, the present invention provides a computer device comprising: 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 by executing the computer instructions.

[0046] Compared with existing technologies, the fluid parameter calculation method provided by this invention, through particle swarm optimization algorithm, achieves parameter tuning of the PID controller, improving the accuracy and stability of the sensor output signal. Control from the signal output side ensures the accuracy of the final fluid parameter calculation. Furthermore, this invention, by making the sensor output signal continuous and filtering and sampling the corresponding continuous function, can restore the integrity of the sensor output signal, making the signal parameters used in the calculation closer to the actual phase, frequency, and amplitude. Simultaneously, the number of sampling points can be increased as needed, further improving the accuracy of the final fluid parameter calculation from the signal processing side. Finally, based on the aforementioned beneficial effects, the fluid parameter calculation method provided by this invention further expands the types of fluid parameters that can be calculated; in addition to the mass flow rate of the fluid, this invention also supports the calculation of fluid density. Attached Figure Description

[0047] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0048] Figure 1 This is a hardware system block diagram according to one embodiment of the present invention;

[0049] Figure 2 This is a flowchart illustrating a fluid parameter calculation method according to one embodiment of the present invention;

[0050] Figure 3 This is a structural block diagram of a fluid parameter calculation system according to an embodiment of the present invention;

[0051] Figure 4 This is a structural block diagram of an electronic device according to one embodiment of the present invention;

[0052] Figure 5 This is a software system block diagram according to one embodiment of the present invention;

[0053] Figure 6 This is a block diagram of an algorithm design system according to one embodiment of the present invention;

[0054] Figure 7This is a continuous signal diagram generated by Lagrange interpolation of the output signal in one embodiment of the present invention;

[0055] Figure 8 This is a comparison diagram of the amplitude response of the output signal under different iteration numbers in one embodiment of the present invention;

[0056] Figure 9 This is a block diagram of the algorithm design for Hilbert to calculate the phase difference in one embodiment of the present invention. Detailed Implementation

[0057] To enable those skilled in the art to better understand the technical solutions of this invention, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this invention.

[0058] Unless otherwise expressly stated, throughout the specification and claims, the term "comprising" or its variations such as "including" or "comprises" shall be understood to include the stated elements or components without excluding other elements or other components.

[0059] Please refer to Figure 1 , Figure 5 as well as Figure 6 The figures shown are application scenario diagrams of the fluid parameter calculation method provided by the present invention under a specific implementation method. The scenario specifically includes a hardware system, a software system, and an algorithm design system.

[0060] Hardware systems such as Figure 1As shown, the system comprises multiple modules and components. It begins with a temperature compensation module, which amplifies, filters, and samples the temperature signal acquired by a temperature sensor before inputting it into the main control chip of the digital processing module for temperature compensation calculations. Next is the sensor input module, containing two sensors (Sensor 1 and Sensor 2). The sensor signals are similarly amplified, filtered, and sampled by an ADC before being input into the DSP module to calculate frequency, phase difference, and measured value. Amplitude detection is part of PI control. The drive module primarily processes the excitation signal processed by PI control on the DSP through a DDS (Direct Digital Synthesizer), MDAC (Multi-Channel Digital-to-Analog Converter), power amplifier, and 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), responsible for processing and storing digital signals. Finally, the system includes a power-down monitoring module to monitor power status and prevent power loss. These modules, through data processing and control via the DSP, form a complete hardware system.

[0061] Software system architecture such as Figure 5 As shown: During the initialization phase, the system performs necessary initialization operations upon startup to ensure the normal operation of each module; the interrupt routine handles various possible unexpected events in the system, ensuring system responsiveness and stability; the analog-to-digital converter (ADC) converts analog signals into digital signals for subsequent processing; the host computer communication module is responsible for communicating with the host computer, transmitting data and instructions; the main monitoring program is the core control module, coordinating the work of various sub-modules to ensure the overall operation of the system; the temperature monitoring module detects the system ambient temperature and provides temperature compensation to ensure stable operation of the system under different temperatures; the phase difference calculation results are used for mass flow rate calculation variables and further analysis; the frequency monitoring module monitors the frequency changes 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 achieve the expected level. Through the coordinated work of these modules, the entire system achieves precise monitoring and control of phase difference, frequency, and amplitude.

[0062] The overall algorithm design system block diagram is as follows: Figure 6 As shown, the vibration characteristics output by the exciter coil are captured by the sensor and the amplitude is detected. The deviation between this amplitude and the expected amplitude is calculated and input into the particle swarm optimization (PSO) module as a calculation parameter. The PSO algorithm updates the optimal K value at the current moment. p ,K i The value is input into the PI control, which then inputs the calculated data into the excitation system to drive the exciter coil. This process is repeated until the maximum number of iterations of the particle swarm optimization algorithm is reached, at which point K is determined. p ,K iThe value is used as the optimal PI control coefficient. After stabilizing the vibration, the two sensors in the primary instrument are sampled by AD converters and then filtered for noise using a lattice filter with targeted frequency filtering characteristics. The samples are then subjected to Fourier transform and fed into the Hilbert algorithm module to calculate the phase difference Δφ between the two sensors. 12 As a parameter used in the calculation of measured values.

[0063] Please refer to Figure 2 The diagram shown illustrates a flow chart for fluid parameter calculation in one embodiment of the present invention. This fluid parameter calculation method, applied to a Coriolis mass flow meter, specifically includes the following steps:

[0064] S201: Initialize the position and velocity of each particle in the particle swarm. The position of the particle is composed of the controller parameters, and the velocity of the particle is the change of the particle position parameters in each round.

[0065] It should be noted that the Coriolis mass flow meter is a device that determines the mass flow rate of a fluid by measuring the Coriolis force generated in the fluid within a flow tube, based on the Coriolis force effect. Specifically, when fluid flows through the flow tube, the direction of vibration of the flow tube is perpendicular to the direction of fluid flow. Due to inertia, the fluid generates a Coriolis force, causing the flow tube to twist. The amount of twist in the flow tube is proportional to the mass flow rate of the fluid within it; therefore, the mass flow rate of the fluid within the flow tube can be calculated based on the detection of the twist amount.

[0066] It is understandable that there exists an optimal amplitude value during the vibration of the flow tube. When the flow tube vibrates steadily at this optimal amplitude value, the measurement performance of the instrument is maximized, and the service life of the flow tube is extended. Therefore, it is desirable for the vibration signal of the flow tube output by the sensor (sensor output signal) to reach this optimal amplitude value. However, mass flow meters are often used in actual production activities for fluid storage and transportation, where noise is prevalent, easily interfering with the sensor's output signal. In fact, the sensor output may have steady-state errors 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 with sensor output drift or nonlinear response due to aging and temperature changes. Directly applying the raw output signal will greatly affect the calculated fluid parameters.

[0067] Therefore, to improve the accuracy of the final fluid parameter calculation, in this embodiment of the invention, a controller is added to the signal output side to control the amplitude of the output signal from the sensor deployed on the Coriolis mass flow meter. 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 can be dynamically changed based on the specific implementation scenario, and this embodiment of the invention does not impose any limitations on this. It is understood that the controller is an algorithm or logic that achieves the control objective. To implement the control strategy corresponding to the controller, the corresponding controller parameters also need to be configured. The configuration of the controller parameters not only determines the specific behavior of the controller but also affects the dynamic response of the system, serving as a key variable for adjusting the controller's behavior. Therefore, in order to achieve adaptive and precise control, the tuning of the controller parameters is also crucial.

[0068] For example, in one specific embodiment, a PI amplitude control algorithm is chosen to make the flow tube vibration reach the desired vibration value. The input is adjusted by using proportional and integral algorithms to control the error, thereby achieving stable flow tube vibration. During system testing, the proportional and integral parameters of the PI controller must be appropriately selected based on prior experience or the performance of the specific sensor. An excessively large proportional parameter may lead to overreaction and oscillation, while an excessively small parameter may result in slow response and large steady-state error. Similarly, an excessively large integral parameter may cause system oscillation or instability, while an excessively small parameter may fail to eliminate steady-state error. Adjusting these two parameters requires balancing response speed, steady-state error, and system stability.

[0069] Based on this, the present invention constructs particles with swarm collaboration characteristics, simulates the global search and local development behavior of particle swarms in the solution space, and achieves the tuning of optimal controller parameters through iterative optimization by a dual guidance mechanism of inertial weight and individual-swarm experience.

[0070] During initialization, initial positions and velocities need to be generated for a given number of particles. The particle positions are determined by controller parameters, and their dimension can dynamically change based on the number of parameters to be tuned. Conversely, the particle velocity represents the change in particle position across different rounds. That is, the velocity and position have the same dimension, 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 an initial position X can be generated for each particle. i =(l1,l2,l3,....,l n The initial velocity is V. i =(v1,v2,v3,....,v n ), where v n Indicates the current round position component l n The change in X. This can be specifically expressed as: X i+1 =Xi +V i+1 .

[0071] It should be noted that position represents the controller parameters, and velocity represents the particle's movement speed in the solution space; both have a reasonable range. To avoid initializing position and velocity values ​​to be too large or too small, thus reducing the speed of iteratively obtaining the optimal controller parameters, the fluid parameter calculation method provided in this invention also requires configuring particle velocity ranges and particle position ranges. The initialized velocity and position must be within the ranges stated in the particle velocity and position ranges.

[0072] Following the specific embodiments described above, by using a PI controller to control the amplitude of the sensor's output, the particle position range can be set to k. p ∈[0.01,0.05], k i ∈[0.00001,0.0001]; the particle velocity range is v∈[-V max V max ], and initialize the positions of each particle in the particle swarm within the above interval as , and speed is in Indicates controller parameters, The velocity parameter corresponds to the particle's position parameter.

[0073] S202: Based on the position of each particle, 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 described in this invention is a digital signal. In one embodiment, if the Coriolis mass flow meter's sensor output signal is an analog signal, before calculating the deviation between the amplitude of the sensor output signal under the action of the controller and the desired amplitude, it is necessary to first convert the analog signal into a digital signal through a preset analog-to-digital converter to obtain 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 digital signal output signal, the deviation between the amplitude and the desired amplitude is calculated.

[0075] Furthermore, the deviation may include linear deviation and nonlinear deviation. Both can be used to tune the controller parameters. The calculation formulas for the linear deviation and nonlinear deviation are as follows:

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

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

[0078] Where ΔA1[n] is the nonlinear deviation; ΔA2[n] is the linear deviation; A hope Let |x1[n]| be the expected amplitude of the output signal, and |x1[n]| be the actual amplitude of the output signal; k1 and k2 are proportional coefficients.

[0079] It should be noted that this invention is used during the rising phase of a signal when no overshoot occurs, at which point the deviation is necessarily positive. After the signal stabilizes, there will be times when the expected amplitude is lower than the actual amplitude, at which point ordinary PI control can be used. Therefore, during the rising phase, the expected amplitude is assumed to be greater than the actual amplitude.

[0080] In another implementation, if this method is used throughout, then (A) in the formula needs to be modified. hope Add absolute values ​​to the -|x1[n]|) item; and simultaneously add absolute values ​​to (A) hope -|x1[n]|) determines the sign. Specifically, when the difference between the expected amplitude and the actual amplitude is positive, the corresponding linear deviation / nonlinear deviation is positive; when the difference between the expected amplitude and the actual amplitude is negative, the corresponding linear deviation / nonlinear deviation is negative.

[0081] In embodiments of the present invention, when computing power is sufficient, the optimal controller parameters can be iteratively output based on linear deviation and nonlinear deviation respectively; when computing power is limited, the two types of deviation can be selected, and the optimal controller parameters can be iteratively output based on one of them.

[0082] It should be noted that linear deviation is actually the difference between the expected amplitude and the actual amplitude. When the deviation is small, the control effect is good. However, the control effect deteriorates as the difference between the expected and actual amplitudes increases. The larger the difference, the more prone the system is to overshoot. Nonlinear deviation has the opposite effect to linear deviation. Since the logarithmic function ranges from negative infinity to 0 in the interval between 0 and 1, and its curve changes relatively smoothly when the difference is greater than 1, the system is prone to overshoot when the difference between the expected and actual amplitudes is small; when the difference between the expected and actual amplitudes is large, the nonlinear deviation tends to be stable, and the control effect is better.

[0083] In one embodiment of the present invention, the output signal of the sensor without a controller can be acquired; 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 nonlinear threshold, the nonlinear deviation between the amplitude of the sensor output signal and the expected amplitude under the action of the controller is calculated; if the difference between the amplitude of the output signal without a controller and the expected amplitude is less than the preset nonlinear threshold, the linear deviation between the amplitude of the sensor output signal and the expected amplitude under the action of the controller is calculated.

[0084] It is understood that the embodiments of the present invention do not impose restrictions on the specific value of the nonlinear threshold. Considering the nature and characteristics of linear deviation and nonlinear deviation, it is preferable to configure the nonlinear threshold to be greater than 1.

[0085] S203: Based on the deviation corresponding to each particle, update the velocity and position of each particle, and based on the updated position of each particle, obtain the new output signal of the sensor under the action of the controller until the preset stopping condition is met, and output the optimal controller parameters;

[0086] In an exemplary embodiment of the present invention, updating the velocity and position of each particle based on the deviation corresponding to each particle includes: recording the position of the particle with the smallest deviation in the particle swarm in history as the global optimal term, and recording the position corresponding to the smallest historical deviation of each particle as the individual optimal term; based on the deviation corresponding to each particle, recording the position of the particle with the smallest historical deviation as the individual optimal term; Update the velocity of each particle; based on X i+1 =X i +V i+1 Update the positions of each particle; where w is the inertial weight; c1 and c2 are inertial constants; and r1 and r2 are random numbers. For the individual particle's optimal term; G best X is the global optimal term for the particle swarm; i V represents the position of the particle in the i-th round; i Let be the velocity of the particle in the i-th round.

[0087] Similarly, a preset range of random number values ​​is preferred, and random numbers r1 and r2 are generated within this range. Simultaneously, appropriately setting the inertia weight and learning factor can significantly improve the algorithm's convergence speed and global optimization capability. The inertia constant controls the weight of individual experience and group experience, while the inertia weight controls the inheritance ratio of particle velocity, balancing global exploration and local development capabilities. Methods for setting the inertia weight can include, but are not limited to, fixed-value methods, linear decreasing methods, and random value selection; methods for setting the inertia constant can include, but are not limited to, fixed-value methods, symmetric adjustment, or asymmetric adjustment. This embodiment of the invention does not limit the configuration method or specific values ​​of the above parameters, but preferably ensures the convergence condition, i.e., ω < 1 and c1 + c2 < 4(1 + ω).

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

[0089] After updating the velocity and position parameters of each particle, a new iteration loop can begin. Based on the updated controller parameters corresponding to the particle positions, a new deviation value is calculated, and the particle velocity and position parameters are updated again based on the new deviation value until a preset stopping condition is reached. The stopping 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] Understandably, one or more stopping conditions can be set. The iteration ends when any preset stopping condition is met. Simultaneously, as... Figure 8 The figure shown is a comparison of the amplitude response of the output signal under different iteration numbers in one embodiment of the present invention. It can be seen that the more iterations, the better the amplitude response of the output signal. The global optimal position is shown after the iterations are completed. These are the optimal controller parameters output.

[0091] S204: The controller uses the optimal controller parameters to control the amplitude of the two sensor output signals of the Coriolis mass flow meter, and calculates 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 control based on the optimal controller parameters, the amplitude of the sensor output signal of the Coriolis mass flow meter is:

[0093]

[0094] in, This represents the cumulative error of the signal amplitude. Here are the optimal controller parameters; ΔA[n] is the deviation between the amplitude of the sensor output signal and the desired amplitude; x[n] is the amplitude of the sensor output signal, x adjusted [n] represents the amplitude of the output signal after being controlled by the controller.

[0095] The calculation of the mass flow rate and density of the fluid under test 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 functions and sampling the filtered continuous functions to 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 under test based on the phase difference.

[0096] Specifically, converting the two output signals after amplitude control into corresponding continuous functions can be achieved using Lagrange interpolation. Figure 7 The image shown is a continuous signal diagram of the output signal after Lagrange interpolation in one embodiment of the present invention. Lagrange interpolation constructs a polynomial that passes through all the known data points. For a given discrete signal x(n), assume that N+1 data points are known: (n0, x(n0)), (n1, x(n1)), ..., (n... N ,x(n N 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 The position of the known data point, x(n) i ) is the signal in n i The value at that location.

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

[0102] Without making the output signal continuous, the amplitude-controlled output signal is a discrete signal, making it difficult to determine the closest approximation of the actual phase, frequency, and amplitude based on the discrete signal. Methods such as Lagrange interpolation can restore the integrity of the signal and add new sampling points, resulting in higher accuracy in fluid parameter calculations.

[0103] It should be noted that before sampling the continuous function converted from the output signal, the continuous function can be filtered to remove noise. The present invention does not limit the filtering method and can be dynamically adjusted according to the actual application scenario. Preferably, lattice filtering or Kalman filtering is used.

[0104] Furthermore, after sampling the continuous function to obtain the optimized output signal, it is necessary to perform frequency domain transformation and phase difference calculation on the optimized output signal. This includes: performing Fourier transform on the two amplified and filtered sensor signals to obtain frequency domain characteristics, constructing an analytic signal by combining it with Hilbert transform, and eliminating noise interference by calculating the instantaneous phase difference between the two signals.

[0105] Specifically, the filtered and sampled signal y[n] is converted into the frequency domain signal Y[k] by the Fast Fourier Transform:

[0106]

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

[0108] Performing a Hilbert transform on the frequency domain signal Y[k] yields the instantaneous phase φ[k] of the complex signal, where... Figure 9 The diagram shown is a block diagram of the Hilbert algorithm for calculating the phase difference in one embodiment of the present invention. The two signals are filtered to obtain an enhanced signal. A Hilbert transform is performed on the frequency domain signal, and trigonometric operations are performed only as a time function of the instantaneous phase difference.

[0109] Then the phase difference Δφ between the two sensors was calculated. 12 [k] Perform 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] represent the instantaneous phases of the two sensors, respectively.

[0113] Finally, the formulas for calculating the mass flow rate and density of the fluid under test based on the phase difference are as follows:

[0114]

[0115] Among them, Q m C1 is the mass flow rate of the fluid being measured; C1 is the sensor characteristic constant; Δφ 12[k] represents the phase difference between the complex signals corresponding to the one optimized output signal and the two optimized output signals; ρ represents the density of the fluid under test; C2 represents the relationship constant between the fluid and sensor geometry; A adjusted A represents the minimum deviation between the two output signals and the desired output signal. max This represents 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 aforementioned fluid parameter calculation method, one embodiment of the present invention provides a fluid parameter calculation system 300, including: an initialization module 301, a first calculation module 302, an iteration module 303, and a second calculation module 304.

[0117] Specifically, initialization module 301 is used to initialize the position and velocity of each particle in the particle swarm, wherein the particle position is composed of controller parameters, and the particle velocity is the change in particle position parameters in each round; first calculation module 302 is used to obtain the sensor output signal under the action of the controller based on the position of each particle, and calculate the deviation between the amplitude of the sensor output signal under the action of the controller and the expected amplitude; iteration module 303 is used to update the velocity and position of each particle based on the deviation corresponding to each particle, and obtain the new output signal of the sensor under the action of the controller based on the updated position of each particle, until a preset stopping condition is met, and output the optimal controller parameters; second calculation module 304 is used to enable the controller to perform amplitude control on the two sensor output signals of the Coriolis mass flow meter 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, embodiments of the present invention also provide an electronic device 400, which includes at least one processor 401, a memory 402 (e.g., non-volatile memory), a memory 403, and a communication interface 404, wherein the 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 used to invoke at least one program instruction stored or encoded in the memory 402 to cause the at least one processor 401 to perform various operations and functions of the fluid parameter calculation methods described in the various embodiments of this specification.

[0119] In the embodiments of this specification, electronic device 400 may include, but is not limited to: personal computer, server computer, workstation, desktop computer, laptop computer, notebook computer, mobile electronic device, smartphone, tablet computer, cellular phone, personal digital assistant (PDA), handheld device, messaging device, wearable electronic device, consumer electronic device, etc.

[0120] This invention also provides a computer-readable medium carrying computer-executable instructions. When executed by a processor, these instructions can be used to implement various operations and functions of the fluid parameter calculation methods described in the various embodiments of this specification.

[0121] The computer-readable medium in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a 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, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

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

[0123] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0124] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus, systems, and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0125] The foregoing description of specific exemplary embodiments of the invention is for illustrative and explanatory purposes. These descriptions are not intended to limit the invention to the precise forms disclosed, and it will be apparent that many changes and variations can be made in accordance with the foregoing teachings. The exemplary embodiments were chosen and described in order to explain the specific principles of the invention and its practical application, thereby enabling those skilled in the art to implement and utilize various different exemplary embodiments of the invention, as well as various different choices and variations. The scope of the invention is intended to be defined by the claims and their equivalents.

[0126] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

[0127] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider 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 flow meter, characterized in that, include: Initialize the position and velocity of each particle in the particle swarm. The position of a particle is composed of controller parameters, and the velocity of a particle is the change in the particle position parameters in each round. Based on the position of each particle, the sensor output signal under the action of the controller is obtained, and the deviation between the amplitude of the sensor output signal under the action of the controller and the expected amplitude is calculated. Based on the deviations corresponding to each particle, the velocity and position of each particle are updated, and based on the updated positions of each particle, the new output signal of the sensor under the action of the controller is obtained until the preset stopping condition is met, and the optimal controller parameters are output. The controller uses the optimal controller parameters to control the amplitude of the two sensor output signals of the Coriolis mass flow meter, and calculates the mass flow rate and density of the fluid to be measured based on the amplitude-controlled two sensor output signals. The step of calculating the deviation between the amplitude of the sensor output signal under the action of the controller and the desired amplitude includes: acquiring the sensor output signal without a controller; 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 nonlinear threshold, then calculating the nonlinear deviation between the amplitude of the sensor output signal under the action of the controller and the desired amplitude; if the difference between the amplitude of the output signal without a controller and the desired amplitude is less than the preset nonlinear threshold, then calculating the linear deviation between the amplitude of the sensor output signal under the action of the controller and the desired amplitude. After control based on the optimal controller parameters, the amplitude of the Coriolis mass flow meter's sensor output signal is: in, This represents the cumulative error of the signal amplitude. , These are the optimal controller parameters; The deviation between the amplitude of the sensor output signal and the desired amplitude; The amplitude of the sensor's output signal. The amplitude of the output signal after being controlled by the controller; The method for calculating the mass flow rate and density of the fluid under test 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 functions and sampling the filtered continuous functions to 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 under test based on the phase difference.

2. The fluid parameter calculation method according to claim 1, characterized in that, The formulas for calculating the linear deviation and the nonlinear deviation are as follows: in, This is a non-linear deviation; For linear deviation; The desired amplitude of the output signal. This represents the actual amplitude of the output signal. , This is the proportionality coefficient.

3. The fluid parameter calculation method according to claim 1, characterized in that, The step of updating the velocity and position of each particle based on the deviation corresponding to each particle includes: Based on the deviation of each particle, the position of the particle with the smallest deviation in the particle swarm in history is recorded as the global optimal term, and the position corresponding to the smallest deviation in history of each particle is recorded as the individual optimal term. based on Update the velocity of each particle; based on Update the positions of each particle; in, Inertial weight; , It is the inertial constant; , It is a random number; For each individual particle, this is the optimal term. This is the globally optimal term for the particle swarm; For the first The position of the particles in each round; For the first The velocity of particles in each cycle.

4. The fluid parameter calculation method according to claim 1, characterized in that, The method further includes: Configure the particle velocity range and particle position range; If the updated velocity or position of the particle is greater than the maximum value of the velocity range or position range, then the updated velocity or position is modified to the maximum value of the velocity range or position range. If the updated velocity or position of the particle is less than the minimum value of the velocity range or position range, then the updated velocity or position is modified to the minimum value of the velocity range or position range.

5. The fluid parameter calculation method according to claim 1, characterized in that, The formula for calculating the mass flow rate and density of the fluid under test based on the phase difference is as follows: in, The mass flow rate of the fluid to be measured; These are the sensor characteristic constants; The phase difference between the complex signals corresponding to the two optimized output signals; The density of the fluid being measured; This is a constant relating the fluid and sensor geometry; This is the minimum deviation between the two output signals and the desired output signal; This represents the maximum deviation between the two output signals and the desired output signal.

6. A fluid parameter calculation system, employing the fluid parameter calculation method as described in any one of claims 1-5, characterized in that, include: The initialization module is used to initialize the position and velocity of each particle in the particle swarm. The position of the particle is composed of controller parameters, and the velocity of the particle is the change of the particle position parameters in each round. The first calculation module is used to obtain the sensor output signal under the action of the controller based on the position of each particle, and to calculate the deviation between the amplitude of the sensor output signal under the action of the controller and the expected amplitude. The iteration module is used to update the velocity and position of each particle based on the deviation corresponding to each particle, and to obtain the new output signal of the sensor under the action of the controller based on the updated position of each particle, until the preset stopping condition is met and the optimal controller parameters are output. The second calculation module is used to enable the controller to perform amplitude control on the two sensor output signals of the Coriolis mass flow meter with the optimal controller parameters, and to calculate the mass flow rate and density of the fluid to be measured based on the two output signals after amplitude control.

7. A computer device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the fluid parameter calculation method according to any one of claims 1-5 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