Intelligent medicine bottle liquid quantitative taking method and system based on intelligent sensing system

By synchronously collecting multi-dimensional physical quantities and controlling them in real time through an intelligent sensing system, the problems of low accuracy and susceptibility to environmental interference in existing liquid quantitative dispensing technologies have been solved, achieving high-precision and high-safety liquid quantitative dispensing.

CN122632698APending Publication Date: 2026-08-25THE SEVENTH MEDICAL CENTER OF PLA GENERAL HOSPITAL
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610797976.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-04
Publication Date
2026-08-25

AI Technical Summary

Technical Problem

Existing liquid quantitative sampling technology relies on open-loop calculation of a single physical quantity, resulting in low accuracy and susceptibility to environmental interference, posing safety hazards.

Method used

An intelligent sensing system is adopted to simultaneously collect three-dimensional heterogeneous physical quantities such as liquid level, weight and instantaneous flow rate. Combined with an adaptive fusion weighting mechanism and a PID controller, the driving parameters of the fluid-driven pump can be controlled in real time in a closed loop, eliminating the defects of single sensors being susceptible to interference.

Benefits of technology

It improves the accuracy and repeatability of liquid quantitative dispensing, suppresses volume deviations caused by changes in fluid viscosity and fluctuations in ambient temperature, enhances the reliability and availability of the system, and prevents the safety hazard of excessive extraction of liquid.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122632698A_ABST
    Figure CN122632698A_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of precise fluid measurement and control, and particularly relates to a method and system for intelligent medicine bottle liquid quantitative taking based on an intelligent sensing system. The method synchronously collects liquid level, weight and instantaneous flow data through an ultrasonic ranging sensor, a thin film pressure sensor array and a flow sensing unit, respectively calculates liquid volume estimation values based on liquid level, weight and flow accumulation, dynamically updates adaptive fusion weights in each dimension using prediction error variance, generates a fused liquid volume estimation value by weighting, inputs the deviation between the fused volume and a target volume into a positional PID controller, adjusts the driving signal of a fluid driving pump in real time, and forms a closed-loop control of multi-dimensional heterogeneous sensing and adaptive fusion. The present scheme realizes self-recovery compensation of liquid taking accuracy under dynamic disturbance, has a safety protection mechanism against loss of control, and is suitable for high-precision medical drug delivery and precise reagent dispensing scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of precision fluid measurement and control technology, specifically to a method and system for quantitative dispensing of liquid from a smart medicine bottle based on an intelligent sensing system. Background Technology

[0002] In medical drug delivery, precision reagent preparation, and high-precision liquid filling scenarios, the quantitative dispensing control of liquids generally relies on volumetric mechanical limiting mechanisms or a single time-flow rate open-loop integral model. Existing technologies linearly equate the absolute physical displacement of the mechanical actuator to the volume change of the extruded fluid. However, the fluid's physical state is subject to highly dynamic endogenous kinetic variables and external environmental disturbances. Changes in ambient temperature cause nonlinear abrupt changes in fluid density and dynamic viscosity; a continuous drop in the liquid level inside the vial leads to an increase in the volume of the air column, causing a nonlinear reverse pull between the surface tension of the non-Newtonian fluid and the hydrostatic pressure at the bottom. The open-loop calculation model based on pure mechanical displacement becomes completely ineffective. Under the same driving power, the actual dispensing volume of a micro diaphragm pump exhibits irreversible time-varying errors due to changes in the fluid viscosity coefficient and pipeline flow resistance drift.

[0003] While existing technologies incorporate unidirectional weight or liquid level threshold alarms, single-physical-dimensional sensing is highly susceptible to measurement distortion caused by mechanical vibrations or fluid cavitation bubbles. Existing technologies suffer from the following shortcomings: there is a severe disconnect between the single-dimensional data extraction of the physical sensing layer and the underlying power drive layer. The system only utilizes noisy physical quantities for passive post-event verification, lacking a feedback mechanism to assess confidence levels using variance variations of multi-source heterogeneous data and to provide real-time reverse intervention to the underlying actuator. This results in serious safety risks for microliter and milliliter-level high-safety medical drug delivery. Summary of the Invention

[0004] The purpose of this invention is to provide a method and system for quantitative dispensing of liquid from a smart medicine bottle based on an intelligent sensing system, which solves the technical problems of low accuracy and susceptibility to environmental interference caused by the reliance on open-loop calculation of a single physical quantity in existing quantitative liquid dispensing methods.

[0005] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:

[0006] A method for quantitative dispensing of liquid from a smart medicine bottle based on an intelligent sensing system includes the following steps:

[0007] Step 1: The main control chip acquires the target liquid volume setpoint. After determining that the system is in an absolutely static and stable state, the main control chip acquires the initial ultrasonic time-of-flight signal collected by the ultrasonic ranging sensor, the initial total weight analog electrical signal collected by the thin-film pressure sensor array, and the ambient temperature digital signal collected by the temperature sensor. It then calculates the initial absolute liquid volume constant of the system and stores it in non-volatile memory. The main control chip initializes the fused liquid volume estimate from the previous sampling period to the initial absolute liquid volume constant of the system.

[0008] Step 2: The main control chip acquires the ultrasonic time-of-flight difference signal output by the ultrasonic ranging sensor, the total weight analog electrical signal output by the thin-film pressure sensor array, the instantaneous flow characterization signal output by the flow sensing unit, and the ambient temperature digital signal output by the temperature sensor; the main control chip performs spatial geometric mapping to calculate the liquid volume estimate based on liquid level sensing for the current sampling period, performs density mapping to calculate the liquid volume estimate based on weight sensing for the current sampling period, and performs trapezoidal integration to calculate the liquid volume estimate based on flow accumulation for the current sampling period, combined with the initial absolute liquid volume constant of the system.

[0009] Step 3: The main control chip uses the fused liquid volume estimate from the previous sampling period and subtracts it from the liquid volume estimates based on liquid level sensing, weight sensing, and flow accumulation to separate the real-time prediction bias for each dimension. The main control chip calculates the prediction error variance within the sliding data window and calculates the corresponding adaptive fusion weight coefficient based on the prediction error variance. The main control chip then weights and sums the liquid volume estimates for each dimension with the adaptive fusion weight coefficient to output the fused liquid volume estimate for the current sampling period.

[0010] Step four: The main control chip extracts the liquid volume deviation value based on the target liquid volume setting, the initial absolute liquid volume constant of the system, and the fused liquid volume estimate of the current sampling period. When the liquid volume deviation value is greater than zero, the main control chip normalizes the liquid volume deviation value and inputs it into the positional PID equation to calculate the drive parameter adjustment amount. The main control chip converts the drive parameter adjustment amount into a drive signal and sends it to the fluid drive pump to change the liquid extraction flow rate. The flow rate change caused by the fluid drive pump is fed back to the sensor signal of the next sampling period.

[0011] Furthermore, in step one, the main control chip determines the absolute static stable state as follows: the total weight digital value is read with a sampling period of 10 milliseconds, and the differential change rate of 20 consecutive sampling points is lower than the preset system noise floor threshold; if the stable state is not reached within 3000 milliseconds, the main control chip issues a waiting prompt.

[0012] Furthermore, in step one, when the main control chip calculates the initial absolute liquid volume constant of the system, it first verifies whether the static liquid level volume projection value and the static gravity volume projection value are both greater than zero, then calculates the arithmetic mean of the two as the initial absolute liquid volume constant of the system; and calculates the relative deviation between the two to determine the calibration validity.

[0013] Furthermore, in step two, the main control chip calculates the formula for the liquid volume estimate based on liquid level sensing as follows:

[0014]

[0015] In the formula, This is an estimate of the liquid volume based on liquid level sensing. Pi is a constant. The calibration constant for the inner diameter of the medicine bottle body is pre-stored in non-volatile memory; This is the instantaneous liquid level height value; This is the viscosity compensation coefficient; This is the bottle deformation compensation coefficient.

[0016] Furthermore, in step two, the main control chip calculates the formula for the liquid volume estimate based on weight sensing as follows:

[0017]

[0018] In the formula, This is a weight-sensing estimate of the liquid volume. This is the total weight as a numerical value; The absolute weight constant of the empty bottle; To calibrate the liquid density constant; The constant is the macroscopic volume expansion coefficient of the fluid; The real-time ambient temperature is represented by a digital signal of ambient temperature. The absolute standard temperature; before executing this formula, the main control chip determines the denominator term. Is it greater than zero? If not greater than zero, then... Mark as invalid and set the corresponding weight to zero.

[0019] Furthermore, in step two, the main control chip calculates the liquid volume estimate based on flow accumulation using the following formula:

[0020]

[0021] In the formula, This is an estimate of liquid volume based on accumulated flow rate; The initial absolute liquid volume constant of the system; Index for the current sampling period; For integration iteration variables; For the first The instantaneous flow rate digital value for each sampling period; For the first The instantaneous flow rate digital value for each sampling period; For a fixed sampling time step constant; when hour, Set it to 0.

[0022] Furthermore, in step three, the formula for the main control chip to calculate the adaptive fusion weight coefficients is as follows:

[0023]

[0024] In the formula, For adaptive fusion weight coefficients; and The variance of the prediction error for the corresponding dimension; when a certain When it is zero, the corresponding It is processed into the largest representable floating-point number.

[0025] Furthermore, in step three, the formula for the main control chip to output the estimated value of the fused liquid volume for the current sampling period is:

[0026]

[0027] In the formula, This is an estimated value for the fusion liquid volume during the current sampling period; For adaptive fusion weight coefficients; These are the estimated liquid volume values ​​for the current sampling period in each dimension.

[0028] Furthermore, in step four, the main control chip calculates the formula for adjusting the drive parameters as follows:

[0029]

[0030] In the formula, For the adjustment amount of the driving parameters; This is the proportional adjustment control coefficient; The integral control coefficient; The differential adjustment control coefficient; This represents the current normalized liquid volume deviation value; This is the normalized liquid volume deviation value from the previous sampling period; This is a fixed sampling time step constant.

[0031] Furthermore, the flow sensing unit is a thermal micro-flow sensor, and the fluid drive pump is a miniature diaphragm pump; in step four, the main control chip converts the drive parameter adjustment amount into the PWM drive signal duty cycle, calculated as follows:

[0032]

[0033] In the formula, This refers to the duty cycle of the PWM drive signal. The conversion gain constant; For the adjustment amount of the driving parameters; The basic duty cycle constant.

[0034] Furthermore, the flow sensing unit is a differential pressure micro-flow sensor, and the instantaneous flow characterization signal is a differential pressure signal;

[0035] In step two, when calculating the liquid volume estimate based on flow accumulation, the main control chip acquires the differential pressure signal through the ADC and converts it into an instantaneous flow rate digital value, which is then substituted into the trapezoidal integral formula for calculation. .

[0036] Furthermore, the fluid drive pump is a precision injection pump driven by a stepper motor;

[0037] In step four, the main control chip converts the drive parameter adjustment amount into a drive signal as follows: when At that time, the number of output pulses ;when When, output And activate the over-extraction protection alarm; where, The total number of microstepping pulses sent to the stepper motor driver; The pulse conversion coefficient; The initial shear stress pulse constant; This is the floor function.

[0038] In addition, this invention also discloses an intelligent medicine bottle liquid quantitative dispensing system based on an intelligent sensing system, which executes the quantitative dispensing method described above; the static random access memory inside the main control chip opens an unlock-free circular buffer queue to store liquid volume estimates based on liquid level sensing, liquid volume estimates based on weight sensing, liquid volume estimates based on flow accumulation, and historical prediction deviation data for each dimension; the main control chip moves the sensor data generated by the analog-to-digital converter to the memory area through a direct memory access controller.

[0039] Furthermore, the main control chip runs a preemptive hard real-time operating system, and the hardware timer update interrupt configuration of the main control chip is set to the highest preemptive priority; the advanced control timer inside the main control chip generates physical electrical signals based on the duty cycle of the PWM drive signal to drive the three-phase full-bridge inverter circuit, directly adjusting the liquid discharge rate of the micro diaphragm pump.

[0040] Compared with the prior art, the present invention has the following beneficial effects:

[0041] This invention simultaneously acquires three heterogeneous physical quantities—liquid level, weight, and instantaneous flow rate—and independently calculates the estimated liquid volume for each channel. This eliminates the vulnerability of single sensors to interference from specific physical fields at the sensing source. An adaptive weighting mechanism based on historical prediction error variance is introduced at the data fusion layer. This allows the system to dynamically allocate fusion confidence based on the real-time data quality of each channel. When a channel experiences instantaneous disturbances or sensor drift, it automatically suppresses or even eliminates interfering data from that channel, achieving seamless removal of inferior information and robust fusion of multi-source data. Simultaneously, the deviation between the fused liquid volume and the target volume is fed into a position-based PID controller, which frequently adjusts the drive parameters of the fluid-driven pump, forming a real-time closed loop of sensing-decision-execution. This effectively suppresses volume deviations caused by changes in fluid viscosity, pipeline flow resistance drift, and environmental temperature fluctuations, significantly improving the accuracy and repeatability of liquid quantitative sampling.

[0042] The absolute static state determination strategy and initial absolute liquid volume anchoring mechanism of this invention provide a stable reference benchmark for the system, avoiding the impact of benchmark drift on liquid extraction accuracy during long-term operation. The improved recursive variance algorithm and the unified sliding window variance calculation ensure the continuity and smoothness of data fusion weights, preventing actuator jitter caused by algorithm switching. The introduction of a safety protection mechanism for the liquid extraction process, through real-time monitoring of extraction time and deviation, forces a shutdown and alarm in case of abnormal conditions such as sensor malfunction, pipeline blockage, or extraction timeout, eliminating the safety hazard of excessive liquid extraction due to system malfunction and improving the reliability and availability of the system in high-safety medical drug delivery scenarios.

[0043] This invention adapts to differential pressure microflow sensors and stepper motor syringe pumps, enabling the solution to flexibly cover extreme operating conditions such as non-conductive high-purity reagents and ultra-high viscosity non-Newtonian fluids, thus expanding the application boundaries. It achieves self-healing compensation and robust operation for precision liquid handling under dynamic disturbances. Attached Figure Description

[0044] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained from these drawings without creative effort.

[0045] Figure 1 This is a flowchart illustrating the control process of the method described in this invention.

[0046] Figure 2 This is a flowchart of the system initialization and physical reference anchoring process of the present invention.

[0047] Figure 3This is a flowchart of the adaptive fusion weight coefficient solver of the present invention.

[0048] Figure 4 This is a flowchart of the stepper motor drive conversion process of the present invention. Detailed Implementation

[0049] In the following description, only certain exemplary embodiments are briefly described. As those skilled in the art will recognize, the described embodiments can be modified in various ways without departing from the spirit or scope of the embodiments of the invention. Therefore, the drawings and description are considered to be exemplary in nature and not restrictive.

[0050] The following is in conjunction with the appendix Figures 1-4 The embodiments of the present invention will be described in detail below.

[0051] Example 1: This example discloses an intelligent liquid dispensing system for medicine bottles based on an intelligent sensing system. The core hardware of the system is a 32-bit ARM Cortex-M7 architecture main control chip integrating a double-precision hardware floating-point unit (FPU) and a direct memory access controller (DMA). The main control chip has a hard real-time operating system (RTOS) programmed inside. The RTOS uses a preemptive priority scheduling algorithm to ensure that sensor data acquisition interrupts and PID closed-loop calculations have the highest execution priority. The main control chip statically allocates contiguous memory addresses in its internal static random access memory (SRAM) to construct a lock-free circular buffer queue, avoiding memory fragmentation and pointer out-of-bounds risks caused by dynamic memory allocation. In a low-cost alternative without FPU and DMA, those skilled in the art can use a time-sharing multiplexing scheme combining timer interrupt polling and fixed-point integer arithmetic to achieve equivalent data acquisition and calculation functions. However, the sampling period of this alternative needs to be extended accordingly to ensure computational throughput.

[0052] The thin-film pressure sensor array physically comprises four high-precision strain gauges, which form a full-bridge Wheatstone bridge. The main control chip utilizes an internal low-dropout linear regulator (LDO) to provide a constant voltage to the full-bridge Wheatstone bridge. DC excitation voltage. The generation of the total weight analog electrical signal follows the following physical voltage mapping equation:

[0053]

[0054] In the formula, The original differential voltage signal (unit: V) output by the full-bridge Wheatstone bridge; The DC excitation voltage constant (unit: V); and The resistance values ​​of the strain gauges that form two adjacent arms of a half-bridge (unit: ), and The resistance values ​​of the strain gauges that form the two adjacent arms of the other half-bridge (unit: The resistance values ​​of the four strain gauges change under gravitational deformation. (Original differential voltage signal) The signal is extremely weak, and the main control chip is equipped with a dedicated instrumentation amplifier with a high common-mode rejection ratio (CMRR > 100dB). This dedicated instrumentation amplifier converts the original differential voltage signal... Amplified and filtered out by a second-order active low-pass filter After power frequency interference, a total weight analog electrical signal is generated. This total weight analog electrical signal is input to the internal 24-bit high-speed circuit through the main control chip's pins. A type of analog-to-digital converter (ADC) with a single conversion time of less than The main control chip directly transfers the digital value output from the analog-to-digital converter to the static random access memory via the direct memory access controller (DMA) to form the total weight digital value. The entire transfer process does not occupy CPU computing clock cycles.

[0055] The ultrasonic ranging sensor uses a piezoelectric ceramic transducer with a center frequency of 40kHz for air ranging to meet the high-precision echo reflection requirements of liquid surfaces in air.

[0056] In this embodiment, the flow sensing unit is specifically a thermal micro-flow sensor. It utilizes a heating element and a temperature sensing element to detect the heat carried away by the fluid as it flows through a thermal field, and outputs an electrical signal proportional to the mass flow rate. It is suitable for conductive or non-conductive liquids, including organic reagents and high-viscosity fluids. The instantaneous flow rate analog electrical signal is converted into an instantaneous flow rate digital value by an ADC.

[0057] The main control chip uses the flow calibration coefficients pre-stored in the non-volatile memory. Convert the instantaneous flow rate numerical value into the absolute value of physical flow rate. The unit is . The conversion factor obtained by calibration using a standard flow meter (unit: ).

[0058] The temperature sensor uses an I2C bus digital temperature chip to directly output the ambient temperature digital signal to the main control chip.

[0059] The human-machine interface module uses a serial communication LCD touchscreen. The values ​​input by the operator are parsed into the target liquid volume setting value via the serial port protocol. The main control chip first determines... ,like The error message will be displayed through the human-computer interaction module, prompting the user to re-enter the information.

[0060] Once verification is successful, the target liquid dispensing volume setting is latched in a global read-only register and cannot be modified during the entire dispensing cycle. A viscosity compensation coefficient is also pre-stored in non-volatile memory. Bottle deformation compensation coefficient . The dimensionless constant obtained by calibration based on the rheological properties of the target drug solution can be set to 1.0 for Newtonian fluids; The dimensionless constant obtained by calibration based on the elastic modulus of the medicine bottle material and wall thickness can be set to 1.0 for rigid medicine bottles. In this embodiment, the fluid-driven pump is specifically a miniature diaphragm pump, driven by a brushless DC motor. The advanced control timer inside the main control chip outputs a PWM waveform, which drives a three-phase full-bridge inverter circuit (MOSFET power array) to achieve stepless control of the speed of the miniature diaphragm pump.

[0061] The absolute volume constant is statically initialized and the physical reference is anchored. When the smart medicine bottle system is first powered on, the watchdog timer inside the main control chip is reset. The main control chip is then forced into system calibration mode. In system calibration mode, the main control chip forcibly locks the duty cycle of the PWM drive signal to a fixed value. When the fluid-driven pump is in a power-off and stopped state, the fluid inside the pipeline remains absolutely still.

[0062] The main control chip continuously reads the total weight digital value generated by the thin-film pressure sensor array after analog-to-digital conversion, with a sampling period of 10 milliseconds. The main control chip calculates the time derivative rate of change of the total weight digital value. When the derivative rate of change is determined to be lower than a preset system noise floor threshold for 20 consecutive sampling points, the system is considered to be in an absolutely static and stable state. The preset system noise floor threshold is set to a value that is a fraction of the full-scale range of the total weight digital value. If a stable state is not detected within 3000 milliseconds (300 sampling points), the main control chip will issue a "Please ensure system stability" prompt through the human-machine interface module and continue detection.

[0063] When in a perfectly stationary and stable state, the main control chip sends a high-frequency electrical pulse excitation signal to the ultrasonic ranging sensor. The ultrasonic ranging sensor returns an initial ultrasonic time-of-flight difference signal. The main control chip measures and records the corresponding time-of-flight difference value by inputting a capture timer. The main control chip synchronously reads the initial total weight digital value generated by analog-to-digital conversion. The main control chip also reads the ambient temperature digital signal generated by the temperature sensor via the I2C bus.

[0064] Since the system has not initiated the liquid extraction process, the instantaneous flow rate output by the flow sensor unit is zero. The main control chip extracts the temperature value represented by the ambient temperature digital signal, calls the same geometric space mapping equation (including temperature compensation and nonlinear projection), and combines it with the initial time-of-flight difference. Solve for the static liquid level volume projection value The main control chip simultaneously calls the mass density mapping equation corresponding to step S201, and calculates the static gravity volume projection value by combining the initial total weight numerical value. .

[0065] The main control chip performs an arithmetic mean calculation:

[0066]

[0067] In the formula, The initial absolute liquid volume constant of the system obtained by the solution (unit: ); The static liquid level volume projection value calculated by ultrasonic ranging (unit: ); The static gravity volume projection value calculated statically using a thin-film pressure sensor (unit: ).

[0068] Calibration validity determination: The main control chip is tested first. and Are all values ​​greater than zero?

[0069] If any value is not greater than zero, the calibration is deemed a failure. If all values ​​are greater than zero, calculate the relative deviation between the static liquid level volume projection value and the static gravity volume projection value: ,in This is a relative deviation (dimensionless). Let be the initial absolute liquid volume constant of the system to be determined. When the calibration is valid, it is determined to be valid; when If the calibration fails, the system automatically re-executes the static stability detection and benchmark anchoring process. If the calibration fails three times consecutively, the main control chip issues a calibration anomaly alarm through the human-machine interface module.

[0070] The main control chip will set the system's initial absolute liquid volume constant. The system's initial absolute liquid volume constant will be forcibly written to internal non-volatile memory for persistent storage. This constant will be extracted and forcibly consumed in subsequent first and third stages, serving as the absolute zero-point reference for multidimensional deviation optimization.

[0071] When the system is powered on again, the main control chip first reads the saved initial absolute liquid volume constant from the internal non-volatile memory. If the read fails or the user actively triggers a recalibration command, the system will enter calibration mode and re-execute the baseline anchoring process.

[0072] To eliminate the risk of wild pointers in the first iteration, the main control chip integrates the liquid volume estimate from the previous sampling period in the backup register. Initialize to the initial absolute liquid volume constant of the system. .

[0073] Phase 1: Parallel multidimensional physical field fluid volume calculation. The main control chip is configured with a nested vector interrupt controller (NVIC), and the preemption priority of the hardware timer update interrupt is set to the highest level (Level 0).

[0074] The main control chip is configured with a globally constant fixed sampling time step constant. (In this embodiment, it is preset to be) Each time the hardware timer overflows and triggers an interrupt, the main control chip suspends all non-critical tasks and completes data acquisition sequentially according to the following steps: First, the main control chip sequentially triggers the ADC conversion of each sensor through DMA and a multiplexer (MUX), transferring the converted digital values ​​to designated addresses in SRAM in batches. Within one sampling cycle... Within this scope, the acquisition and latching of the following five raw global physical input sources are completed:

[0075] First input source: Ultrasonic time-of-flight signal emitted by ultrasonic ranging sensor.

[0076] Second input source: The total weight digital value generated by the thin-film pressure sensor array after processing by an analog-to-digital converter.

[0077] Third input source: Instantaneous flow rate digital value output by the flow sensing unit after ADC conversion (corresponding to the absolute value of physical flow rate, unit: ).

[0078] Fourth input source: Ambient temperature digital signal sent by the temperature sensor. Fifth input source: Target liquid volume setpoint latched in the global read-only register. .

[0079] After latching the above data, the main control chip's hardware floating-point unit (FPU) immediately starts three parallel processing pipelines.

[0080] Step S101: Temperature drift compensation of ultrasonic time-domain acoustic characteristics;

[0081] The main control chip extracts the real value of Celsius from the digital signal representing the ambient temperature and calls the temperature acoustic compensation equation:

[0082]

[0083] In the formula, Real-time sound velocity after temperature compensation (unit: ); Real-time ambient temperature (unit: ) obtained by extracting the digital signal of ambient temperature. ); The fundamental sound velocity constant under the condition of zero degree absolute ideality (unit: ); The physical coefficient of the temperature gradient of sound waves propagating in air at standard atmospheric pressure (unit: This formula is applicable under standard atmospheric pressure and normal humidity conditions; for high-precision scenarios, it can be replaced by an extended velocity of sound equation that includes humidity and pressure correction terms.

[0084] The main control chip will calculate the real-time speed of sound Substituting the first input source of the hardware latch into the absolute spatial height mapping equation, the instantaneous liquid level height is calculated:

[0085]

[0086] In the formula, Real-time liquid level height (unit: ); The absolute vertical total height constant from the sensor's emitting end to the bottom of the medicine bottle, as specified in the system's factory laser calibration (unit: ...). ); The ultrasonic time-of-flight difference (in seconds) output by the ultrasonic ranging sensor is measured by the input capture timer of the main control chip; denominator This represents eliminating the impact of two-way physical paths.

[0087] Step S102: Geometric volume and rheological nonlinear projection in spatial dimension;

[0088] The main control chip executes the spatial nonlinear mapping equation:

[0089]

[0090] In the formula, Liquid volume estimation based on liquid level sensing (unit: ); Pi is a constant. The calibration constant for the inner diameter of the medicine bottle body (unit: ...) is pre-stored in non-volatile memory. ); Real-time liquid level height (unit: ); The viscosity compensation coefficient (dimensionless) is pre-stored in non-volatile memory. This is the bottle deformation compensation coefficient (dimensionless) pre-stored in non-volatile memory. The output... It is pushed into the register buffer.

[0091] Step S201: Inverse mapping of gravitational mass to thermodynamic volume density;

[0092] In the second pipeline, the main control chip extracts the second input source (the digital value of total weight). The main control chip then calls the fluid thermodynamic density equation:

[0093]

[0094] In the formula, Weight-sensing-based liquid volume estimates (unit: ); Total weight (in units) ); The absolute weight constant of the empty bottle (unit: ) is pre-stored in non-volatile memory. ); The calibration liquid density constant (unit: ) is pre-stored in non-volatile memory. ); The constant of the macroscopic volumetric expansion coefficient of the fluid (unit: ) is pre-stored in non-volatile memory. ); Real-time temperature (unit: ) represented by a digital signal of ambient temperature ); An absolute standard temperature (unit: ) pre-stored in non-volatile memory. ).

[0095] Before executing this formula, the main control chip first determines the denominator term. Is it greater than zero? If the denominator is not greater than zero (i.e., the temperature exceeds the effective compensation range), then the liquid volume estimate based on weight sensing will be directly used. Marked as invalid, and the fusion weight of the corresponding channel is adjusted. Zero is built into this cycle and does not participate in fusion. The output... It is pushed into the register buffer.

[0096] Step S301: High-order calculus time mapping of instantaneous flow rate in pipeline dynamics;

[0097] In the third pipeline, the main control chip extracts the third input source (instantaneous flow rate digital value, corresponding to the absolute value of physical flow rate). ,unit The main control chip uses a high-order trapezoidal integral approximation algorithm.

[0098]

[0099] In the formula, Liquid volume estimate based on flow accumulation (unit: ); The initial absolute liquid volume constant of the system strongly anchored by step S000 (unit: ); Index of the current sampling period; For integration iteration variables; For the first Instantaneous flow rate digital value for each sampling period (unit: ); For the first Instantaneous flow rate digital value for each sampling period (unit: ).when hour, Set it to 0. Fixed sampling time step constant (unit: The output of the solution. It was also pushed into the cache. At this point, the multidimensional physical quantity had been completely torn apart and reconstructed by the main control chip into three independent volume projections.

[0100] Phase 2: Integration of confidence assessment and multidimensional independent estimation game; three independent volume estimates enter the confidence assessment logic block.

[0101] Step S401: Calculation of historical prediction error variance and dynamic game weight update.

[0102] The main control chip divides the SRAM into three circular buffer queues as sliding data windows. The length constant of the sliding data window is... The preferred value is 20.

[0103] The main control chip extracts the estimated liquid volume values ​​for the current sampling period, subtracts them from the global fusion output value latched in the previous period, and separates the real-time prediction bias:

[0104]

[0105] In the formula, For the first Instantaneous prediction bias in the physical perception dimension (unit: ), subscript Choose 1, 2, and 3, which correspond to the liquid level, weight, and flow rate accumulation channels, respectively; For the first Estimated liquid volume values ​​for each sampling period (unit: ); The estimated fusion liquid volume for the previous sampling period (unit: ).when hour, Initialized to .

[0106] The main control chip will The sample variance is pushed into a circular buffer queue, and the prediction error variance within the sliding window is calculated. To maintain a consistent calculation benchmark, the Welford recursive algorithm is used to calculate the sample variance at all stages.

[0107] When the sliding window is not full ( When considering all historical data as a whole, calculate the recursive variance:

[0108] initialization: ,

[0109] for :

[0110] ;

[0111] ;

[0112] ;

[0113] When the sliding window is full ( When using the fixed window standard deviation formula:

[0114] ;

[0115] In the formula, For the first Dimensional prediction error variance (unit: ); The length constant of the sliding data window; To point to the first in the sliding data window Real-time prediction bias for one historical sampling period (unit: ); The arithmetic mean of all instantaneous prediction biases within the current sliding window (unit: ).

[0116] The main control chip uses the matrix arithmetic unit to calculate the adaptive fusion weight coefficients:

[0117]

[0118] In the formula, For the first The adaptive fusion weight coefficients (dimensionless) of the physical perception dimension satisfy the following: ; and The prediction error variance for each corresponding dimension (unit: When a certain When it is zero (i.e., the channel has no fluctuation), the corresponding It is processed into the largest representable floating-point number.

[0119] Forced removal of extreme interference:

[0120] When the variance of the prediction error of a certain dimension exceeds 1000 times the arithmetic mean of the variances of the prediction errors of the other two dimensions, the main control chip directly sets the adaptive fusion weight coefficient of that dimension to zero.

[0121] Step S402: Fusion of high-dimensional volumetric dot products in the state space;

[0122] The main control chip uses floating-point multiply-accumulate instructions to perform a weighted summation of three parallel volume estimates:

[0123]

[0124] In the formula, For the current number Estimated fusion liquid volume per sampling period (unit: ); For adaptive fusion weight coefficients (dimensionless); These are the estimated liquid volume values ​​based on accumulated liquid level, weight, and flow rate for the current sampling period (unit: Output It is overwritten to the backup register for use in the next cycle and then enters the third stage.

[0125] Phase 3: Dynamic compensation and physical disturbance closed-loop execution;

[0126] The main control chip sets the value based on the target liquid volume. The initial absolute liquid volume constant of the system and estimated value of fusion liquid volume Extract the liquid volume deviation value:

[0127]

[0128] In the formula, To obtain the liquid volume deviation value (unit: ); This represents the volume of liquid already removed. If the main control chip detects... If sensor drift causes the calculated remaining volume to be greater than the initial volume, the volume of liquid already taken will be forcibly set to zero, and a "sensor abnormality" warning will be issued through the human-computer interaction module.

[0129] The main control chip calculates the normalized liquid volume deviation value:

[0130]

[0131] Because it was ensured before entering this stage The denominator is not zero.

[0132] The main control chip inputs the normalized liquid volume deviation value into the positional PID controller to obtain the drive parameter adjustment amount:

[0133]

[0134] In the formula, The adjustment amount for the driving parameters (dimensionless). This is the proportional adjustment control coefficient (dimensionless). Integral control coefficient (unit: ); The differential adjustment control coefficient (unit: ); and These are the normalized liquid volume deviation values ​​(dimensionless) for the current and previous sampling periods, respectively. Fixed sampling time step constant (unit: The PID parameters are tuned using the Ziegler-Nichols critical proportional gain method, and the recommended range is: , , An integral separation strategy is adopted: when The integral term is cleared to zero when the time is equal to zero. Normal accumulation.

[0135] The main control chip performs a limiting physical conversion, mapping the drive parameter adjustment amount to the PWM drive signal duty cycle:

[0136] ;

[0137] In the formula, This refers to the duty cycle of the PWM drive signal. The conversion gain constant is 120 in this embodiment; The basic duty cycle constant is set to 20% in this embodiment. When the main control chip determines... When the PWM drive signal duty cycle is set to zero, immediately reset it.

[0138] Safety protection mechanism for liquid dispensing process: The main control chip has a built-in independent monitoring timer that starts when the liquid dispensing process begins. If the liquid dispensing time exceeds the preset maximum allowable time (according to...), the timer will detect if the liquid dispensing process is interrupted. It is calculated from the minimum flow rate, for example, taking , If the target volume is not reached even when the system's minimum safe flow rate is reached, the main control chip forcibly sets the PWM duty cycle to zero, terminates liquid extraction, and issues a "Liquid extraction timeout, please check" alarm through the human-machine interface module. Simultaneously, if the main control chip detects... If the value continues to increase (i.e. deviates from the target value), a forced shutdown alarm will also be triggered.

[0139] The main control chip writes the duty cycle of the PWM drive signal into the power amplifier stage through the GPIO port, and the mechanical physical rate at which the fluid-driven pump draws fluid changes immediately. The objective change in physical mass and volume acts without delay on the ultrasonic ranging sensor, thin-film pressure sensor array, and flow sensing unit in the next clock cycle, completing a dual closed loop of logic and physical operation.

[0140] To verify the self-healing capability of this invention, a complete data link was tested during the 50th sampling period when it encountered severe high-frequency mechanical vibration interference. A fixed sampling time step constant was used. The PID controller parameters are , , .

[0141] For the first 49 sampling periods, the system operated in a steady-state environment. Using the Welford recursive algorithm, the prediction error variance for all three channels remained at a low level. , , The adaptive fusion weight coefficients are close to an even distribution. , , ).

[0142] During the 50th sampling period, a sudden high-frequency resonance caused severe distortion in the thin-film pressure sensor array channels. The independent volume estimates calculated from the three channels in this period are as follows:

[0143] Liquid level sensing channel: ;

[0144] Weight sensing channel: (Severely deviated due to vibration interference);

[0145] Traffic accumulation channel: ;

[0146] Previous cycle fusion output value .

[0147] The main control chip calculates the real-time prediction deviation for each channel:

[0148] ;

[0149] ;

[0150] ;

[0151] Sliding window (window length) After the update, the weight channel... The mutation caused the variance of the prediction error, derived from the Welford algorithm recursion, to surge to [a certain value]. ; Liquid level channel maintained Traffic accumulation channel maintained .

[0152] The main control chip uses the reciprocal rule to calculate the adaptive fusion weight coefficients:

[0153] ;

[0154] ;

[0155] ;

[0156] The adaptive fusion weight coefficient of the weight channel is immediately suppressed to approach 0.00020, realizing the automatic stripping of inferior data.

[0157] The main control chip performs weighted dot product fusion:

[0158]

[0159] The system will merge volume values Substituting into the formula for liquid volume deviation in the third stage, we can calculate... After normalization, the input to the PID control law is used to calculate the adjustment amount of the drive parameters. After calculation using the amplitude limiting conversion formula, the final applied value is... The PWM drive signal duty cycle is transmitted to the micro diaphragm pump, enabling precise physical self-healing of micro-drug delivery rates despite external interference.

[0160] Example 2: This example is basically the same as Example 1, except that in this example, the flow sensing unit can use a differential pressure micro-flow sensor instead of a thermal micro-flow sensor. The differential pressure micro-flow sensor measures the pressure difference before and after flowing through a micro-pipe or orifice plate, and converts it to a flow rate value using Bernoulli's equation. It has no requirements on fluid conductivity and is suitable for... Ultra-low flow rate measurement.

[0161] The main control chip acquires the differential pressure signal via ADC and converts it into a digital value of instantaneous flow rate. Then substitute the values ​​into the trapezoidal integral solution in step S301. The process is completely consistent with the main embodiment 1.

[0162] Example 3: This example is basically the same as Example 1, except that in this example, the fluid drive pump can be a precision injection pump driven by a stepper motor instead of a micro diaphragm pump. In this case, the main control chip adjusts the drive parameters. Converted into stepper motor pulse count instructions. At that time, the pulse calculation formula is:

[0163]

[0164] when When (indicating excessive liquid intake), the main control chip outputs... The stepper motor drive is paused, and the over-liquid protection alarm is activated. Where, The total number of microstepping pulses sent to the stepper motor driver (dimensionless). The preset pulse conversion coefficient (dimensionless) is obtained by calibrating the stepper motor step angle and the volume of injection pump per pulse. The initial shear stress pulse constant is preset (dimensionless). This is the floor function. The system loop is now fully closed.

[0165] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.

[0166] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. It should be noted that any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for quantitative dispensing of liquid from an intelligent medicine bottle based on an intelligent sensing system, characterized in that, Includes the following steps: Step 1: The main control chip acquires the target liquid volume setpoint. After determining that the system is in an absolutely static and stable state, the main control chip acquires the initial ultrasonic time-of-flight signal collected by the ultrasonic ranging sensor, the initial total weight analog electrical signal collected by the thin-film pressure sensor array, and the ambient temperature digital signal collected by the temperature sensor. It then calculates the initial absolute liquid volume constant of the system and stores it in non-volatile memory. The main control chip initializes the fused liquid volume estimate from the previous sampling period to the initial absolute liquid volume constant of the system. Step 2: The main control chip acquires the ultrasonic time-of-flight difference signal output by the ultrasonic ranging sensor, the total weight analog electrical signal output by the thin-film pressure sensor array, the instantaneous flow characterization signal output by the flow sensing unit, and the ambient temperature digital signal output by the temperature sensor; the main control chip performs spatial geometric mapping to calculate the liquid volume estimate based on liquid level sensing for the current sampling period, performs density mapping to calculate the liquid volume estimate based on weight sensing for the current sampling period, and performs trapezoidal integration to calculate the liquid volume estimate based on flow accumulation for the current sampling period, combined with the initial absolute liquid volume constant of the system. Step 3: The main control chip uses the fused liquid volume estimate from the previous sampling period and subtracts it from the liquid volume estimates based on liquid level sensing, weight sensing, and flow accumulation to separate the real-time prediction bias for each dimension. The main control chip calculates the prediction error variance within the sliding data window and calculates the corresponding adaptive fusion weight coefficient based on the prediction error variance. The main control chip then weights and sums the liquid volume estimates for each dimension with the adaptive fusion weight coefficient to output the fused liquid volume estimate for the current sampling period. Step four: The main control chip extracts the liquid volume deviation value based on the target liquid volume setting, the initial absolute liquid volume constant of the system, and the fused liquid volume estimate of the current sampling period. When the liquid volume deviation value is greater than zero, the main control chip normalizes the liquid volume deviation value and inputs it into the positional PID equation to calculate the drive parameter adjustment amount. The main control chip converts the drive parameter adjustment amount into a drive signal and sends it to the fluid drive pump to change the liquid extraction flow rate. The flow rate change caused by the fluid drive pump is fed back to the sensor signal of the next sampling period.

2. The intelligent medicine bottle liquid quantitative dispensing method based on an intelligent sensing system according to claim 1, characterized in that, In step one, the main control chip determines the absolute static stable state as follows: the total weight digital value is read with a sampling period of 10 milliseconds, and the differential change rate of 20 consecutive sampling points is lower than the preset system noise floor threshold; if the stable state is not reached within 3000 milliseconds, the main control chip issues a waiting prompt.

3. The intelligent medicine bottle liquid quantitative dispensing method based on an intelligent sensing system according to claim 1, characterized in that, In step one, when the main control chip calculates the initial absolute liquid volume constant of the system, it first checks whether the static liquid level volume projection value and the static gravity volume projection value are both greater than zero, and then calculates the arithmetic mean of the two as the initial absolute liquid volume constant of the system; and calculates the relative deviation between the two to determine the calibration validity.

4. The intelligent medicine bottle liquid quantitative dispensing method based on an intelligent sensing system according to claim 1, characterized in that, In step two, the main control chip calculates the formula for the liquid volume estimate based on liquid level sensing as follows: In the formula, This is an estimate of the liquid volume based on liquid level sensing. Pi is a constant. The calibration constant for the inner diameter of the medicine bottle body is pre-stored in non-volatile memory; This is the instantaneous liquid level height value; This is the viscosity compensation coefficient; This is the bottle deformation compensation coefficient.

5. The intelligent medicine bottle liquid quantitative dispensing method based on an intelligent sensing system according to claim 1, characterized in that, In step two, the main control chip calculates the liquid volume estimate based on weight sensing using the following formula: In the formula, This is a weight-sensing estimate of the liquid volume. This is the total weight as a numerical value; The absolute weight constant of the empty bottle; To calibrate the liquid density constant; The constant is the macroscopic volume expansion coefficient of the fluid; The real-time ambient temperature is represented by a digital signal of ambient temperature. The absolute standard temperature; before executing this formula, the main control chip determines the denominator term. Is it greater than zero? If not greater than zero, then... Mark as invalid and set the corresponding weight to zero.

6. The intelligent medicine bottle liquid quantitative dispensing method based on an intelligent sensing system according to claim 1, characterized in that, In step two, the main control chip calculates the liquid volume estimate based on flow accumulation using the following formula: In the formula, This is an estimate of liquid volume based on accumulated flow rate; The initial absolute liquid volume constant of the system; Index for the current sampling period; For integration iteration variables; For the first The instantaneous flow rate digital value for each sampling period; For the first The instantaneous flow rate digital value for each sampling period; For a fixed sampling time step constant; when hour, Set it to 0.

7. The intelligent medicine bottle liquid quantitative dispensing method based on an intelligent sensing system according to claim 1, characterized in that, In step three, the formula for the main control chip to calculate the adaptive fusion weight coefficients is as follows: In the formula, For adaptive fusion weight coefficients; and The variance of the prediction error for the corresponding dimension; when a certain When it is zero, the corresponding It is processed into the largest representable floating-point number.

8. The intelligent medicine bottle liquid quantitative dispensing method based on an intelligent sensing system according to claim 1, characterized in that, In step three, the formula for the estimated fusion liquid volume output by the main control chip in the current sampling period is: In the formula, This is an estimated value for the fusion liquid volume during the current sampling period; For adaptive fusion weight coefficients; These are the estimated liquid volume values ​​for the current sampling period in each dimension.

9. A smart medicine bottle liquid dispensing system based on an intelligent sensing system, used to execute the smart medicine bottle liquid dispensing method based on an intelligent sensing system as described in any one of claims 1 to 8; characterized in that: The main control chip's internal static random access memory (SRAM) creates a lock-free circular buffer queue to store liquid volume estimates based on liquid level sensing, liquid volume estimates based on weight sensing, liquid volume estimates based on flow accumulation, and historical prediction deviation data for each dimension. The main control chip uses a direct memory access controller to move the sensor data generated by the analog-to-digital converter to the memory area.

10. The intelligent liquid dispensing system for medicine bottles based on an intelligent sensing system according to claim 9, characterized in that, The main control chip runs a preemptive hard real-time operating system, and the hardware timer update interrupt configuration of the main control chip is set to the highest preemptive priority. The advanced control timer inside the main control chip generates physical electrical signals based on the duty cycle of the PWM drive signal to drive the three-phase full-bridge inverter circuit and directly adjust the liquid discharge rate of the micro diaphragm pump.