A method and system for monitoring the temperature of medical supplies in a UAV

CN122411632BActive Publication Date: 2026-08-18PINGHU LOW-KING ECONOMIC DEVELOPMENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610847047.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-12
Publication Date
2026-08-18
Estimated Expiration
2046-06-12

AI Technical Summary

Technical Problem

如果无法将危及医疗物资安全的温度异常事件及时分离并开辟优先传输通道,将会导致后续的温控调节指令下发产生严重延迟

Benefits of technology

[0021] This invention, by deploying an eBPF program in the UAV kernel and attaching it to a temperature sensor driver, can intercept raw temperature data at the underlying level, reducing system communication overhead. Utilizing an aggregation time window adjustment mechanism based on consumer load factors, the processing window for low-priority data is extended or shortened according to the system load, and data is processed in a hierarchical and distributed manner. High-priority abnormal data is independently and quickly written to the mapping, while low-priority data is packaged and submitted to a circular buffer, ensuring a rapid and prioritized response to abnormal temperature events. The user-space program updates the load factor based on data backlog and consumption rate, and after prioritizing the processing of abnormal events and the storage of regular data, waveform-controlled cooling is executed. This establishes a complete link from underlying data interception to upper-level temperature control execution, improving resource utilization and data processing efficiency, achieving precise closed-loop temperature monitoring and control throughout the entire process of medical supply transportation, and ensuring the safety of supply transportation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122411632B_ABST
    Figure CN122411632B_ABST
Patent Text Reader

Abstract

The application provides a kind of unmanned plane medical material temperature control monitoring method and system, the monitoring method includes: in the kernel of unmanned plane deployment eBPF program, mount temperature sensor driving function and store temporarily original temperature data are grabbed, read load factor from eBPF mapping, adjust low priority data aggregation time window;When data meet high priority exception rule, immediately generate exception event and store into special mapping, pack current low priority data and send into ring buffer, there is no exception, then uniformly submit and reset timing after window end, user state program monitors buffer state, real-time updates and writes load factor, priority handles high priority exception event, in turn processes regular data and enters the warehouse, relies on analysis data to complete ground communication and temperature control instruction issuing, drives refrigeration piece to regulate temperature, realizes medical material transportation whole course temperature monitoring and accurate temperature control closed loop management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of monitoring, and in particular relates to a method and system for monitoring the temperature of medical supplies using unmanned aerial vehicles (UAVs). Background Technology

[0002] Medical supplies such as blood products, vaccines, biological samples, and special drugs are typically highly sensitive to ambient temperature. During transportation, they must be kept within specific cold chain temperature ranges; even minor temperature fluctuations or exceeding these limits can lead to spoilage or even serious medical safety hazards. When drones perform flight missions, their onboard computing resources are often very limited, and they need to handle multiple high-concurrency tasks simultaneously, including flight control, environmental perception, and real-time communication. Temperature monitoring usually relies on sensors continuously reporting data to the operating system at a fixed frequency. This method not only generates massive amounts of redundant data, consuming significant system bus and processing resources, but also often fails to identify and respond to sudden temperature anomalies in a timely manner, failing to meet the stringent temperature control requirements of high real-time performance and high reliability for the cold chain transportation of medical supplies.

[0003] While eBPF technology and the circular buffer mechanism can reduce system context switching overhead, in complex flight operation environments, when user-space programs face high load pressure, the data consumption and processing rate is easily lower than the kernel-space data acquisition rate, leading to circular buffer backlog or even overflow, resulting in the loss of critical monitoring data. Existing data transmission architectures generally lack reliable priority differentiation and adjustment mechanisms when dealing with continuous temperature sensing data. Occasional abnormal temperature fluctuations are often buried in massive queues of regular data awaiting processing. If temperature anomalies that endanger medical supplies cannot be promptly isolated and given priority transmission channels, subsequent temperature control commands will be severely delayed. Therefore, how to adjust data transmission strategies according to system load and ensure that abnormal temperature data receives absolute priority detection and response, achieving efficient closed-loop temperature monitoring and control, is a pressing technical problem to be solved in the field of UAV medical supply transportation. Summary of the Invention

[0004] To meet the requirements of high real-time performance and high reliability in the transportation of medical supplies, this invention provides a method and system for temperature control monitoring of medical supplies using unmanned aerial vehicles (UAVs).

[0005] According to one aspect of the present invention, a method for temperature control monitoring of medical supplies using an unmanned aerial vehicle (UAV) is provided, comprising the following steps: Deploy the eBPF program in the kernel mode of the drone, attach it to the temperature sensor driver function to capture raw temperature data, and transfer the captured raw temperature data to a temporary storage variable for later use; The eBPF program reads the consumer load factor from the shared eBPF map; when the load factor increases, it extends the aggregation time window for processing low-priority data, and vice versa; when the raw temperature data meets the high-priority determination rule, it generates an exception event and writes it to an independent high-priority eBPF map, and packages the low-priority data in the current window and submits it to the eBPF circular buffer; if the high-priority determination rule is not triggered, the low-priority data is packaged and submitted to the circular buffer as usual when the window is reached, and the relevant timers are reset. The user-mode program monitors the data backlog and consumption rate of the circular buffer to update the load factor, and refreshes the updated load factor to the mapped memory block; it prioritizes polling the high-priority eBPF mapping to handle abnormal events, and processes the low-priority data in the circular buffer in sequence, writing the separated temperature values ​​into the local database; based on the parsed temperature data, it executes ground communication and temperature control commands, sends waveforms to control the cooling chip, and realizes closed-loop temperature monitoring and control throughout the entire process of medical supply transportation.

[0006] Optionally, the step of deploying an eBPF program in the UAV kernel state, attaching it to the temperature sensor driver function to intercept raw temperature data, and transferring the intercepted raw temperature data to a temporary storage variable for later use includes: Compile the eBPF bytecode file containing data interception instructions in user space; The eBPF bytecode file is loaded into the kernel mode of the UAV operating system, and memory out-of-bounds checks and instruction security verifications are performed by the kernel verifier. Using the kretprobe kernel tracing mechanism, the verified eBPF program is mounted to the return function in the sensor bus driver that is responsible for reading temperature sensor data; Before the return function finishes execution, the eBPF program is triggered to read the parsed 16-bit binary format raw temperature data in the kernel-mode buffer and transfer the data to a temporary storage variable within the eBPF program.

[0007] Optionally, the eBPF program reads the consumer load factor from the shared eBPF mapping; when the load factor increases, the aggregation time window for processing low-priority data is extended, and vice versa, the window is shortened, including: Read the consumer load factor, stored in percentage integer format, from the shared eBPF map; When the consumer load factor is greater than the preset value, the timing length of the aggregation time window is updated to five seconds; When the consumer load factor is less than or equal to a preset value, the timing length of the aggregation time window is updated to two seconds.

[0008] Optionally, the step of generating an abnormal event and writing it into an independent high-priority eBPF mapping when the original temperature data meets the high-priority determination rule includes: The absolute temperature difference is calculated by subtracting the captured current raw temperature data from the previous raw temperature data stored in the preset state-preserving eBPF mapping, and the absolute temperature difference is divided by the time difference between the current time and the previous time to calculate the rate of temperature change. When the temperature change rate is greater than the currently set temperature change rate threshold or the current original temperature data is greater than the preset upper limit threshold of absolute temperature value, a sixteen-byte event data structure containing a timestamp, a Celsius value, and an alarm code is constructed in memory. Write the sixteen-byte event data structure into the storage space at offset address 0 in the high-priority eBPF mapping, and overwrite the event notification flag bit associated in the mapping with the hexadecimal value 0x01.

[0009] Optionally, the step of packaging and submitting low-priority data within the current window to the eBPF circular buffer includes: After an abnormal event is generated, the kernel array variable used to temporarily stack low-priority temperature data of the current time window in kernel mode is intercepted and frozen. Calculate the number of data entries already written into the kernel array variable; Allocate a circular buffer block with a length equal to the current count of data entries multiplied by the length of a single data item (two bytes), and then append a four-byte header structure. Write the current count of data entries into the first four bytes of the storage block as a packet header. Then, through a static bounded loop allowed by the eBPF kernel verifier, sequentially copy the temperature data corresponding to the data entry count in the kernel array variable into the subsequent address range of the storage block. Submit the storage block to complete the packaging and reporting, clear the data count counter, and reset the nanosecond-level timer of the current aggregation time window to zero.

[0010] Optionally, the user-space program monitors the data backlog and consumption rate of the circular buffer to update the load factor, and flushes the updated load factor to the mapped memory block, including: Start a user-mode heartbeat statistics thread with a period of one thousand milliseconds; When the timer period of every kiloms arrives, read the producer pointer representing the total number of bytes written and the consumer pointer representing the total number of bytes read from the underlying descriptor of the eBPF ring buffer. The current real-time backlog of bytes is obtained by subtracting the consumer pointer from the producer pointer. The total number of bytes read in the current period is subtracted from the total number of bytes read in the previous period. The difference is divided by the timing period to obtain the consumption rate value. The consumption rate value is divided by a preset standard consumption rate constant to obtain a dimensionless consumption rate ratio. The static occupancy ratio is obtained by dividing the real-time backlog of bytes by the maximum capacity quota declared in memory for the eBPF circular buffer. Add 1 to the dimensionless consumption rate ratio to obtain the zero-prevention denominator, and divide 1 by the zero-prevention denominator to obtain the consumption rate correction term; Multiply the preceding period smoothing weight constant by the consumption rate correction term, and then add it to the static occupancy ratio to obtain the comprehensive state value; Multiply the comprehensive state value by 100 and then perform a rounding operation. The resulting integer value is used as the consumer load factor. The shared eBPF mapping descriptor is located through the system function interface, and the consumer load factor is refreshed to the mapping memory block.

[0011] Optionally, the step of prioritizing the high-priority eBPF mapping to handle abnormal events and sequentially processing low-priority data in the circular buffer, and writing the separated temperature values ​​into the local database, includes: Set up a user-space state machine to poll the task with a fixed scheduling time slice of ten milliseconds; Each time the user-mode state machine is woken up by the system kernel, it polls the task to query the event notification flags in the high-priority eBPF mapping; If the flag is parsed as 0x01, an inter-thread semaphore is issued to wake up the blocked emergency task processor, so that the processor reads the exception event block structure from the high-priority eBPF mapping and writes a high-level pulse to the alarm buzzer through the GPIO pin. After reading is completed, a reverse overwrite call is initiated to reset the flag to 0x00. If the flag is parsed as 0x00 and the consumer pointer lags behind the producer pointer, a batch parsing thread is started to disassemble the aggregated data packet with built-in counting information in the header of the eBPF circular buffer in first-in-first-out order, and write the separated temperature value into the local database.

[0012] Optionally, the temperature data based on the parsing is used to execute ground communication and temperature control commands, and to send waveform control commands to the cooling element, including: Read the parsed integer real-time temperature value from the data processing pipeline; The integer real-time temperature value is encapsulated in JSON format and loaded into the MQTT communication protocol message payload segment, and then sent to the ground command terminal through the airborne communication module. Compare the real-time temperature value with the medical supplies standard cold chain upper and lower limit control parameter table pre-written before flight; If the current real-time temperature value is greater than the set upper limit, a high-frequency rectangular wave with a pulse width duty cycle of 80% is sent to the thermoelectric cooler drive circuit through the general input / output interface of the airborne main control board to control the thermoelectric cooler to increase its power for cooling. If the current real-time temperature value is less than the set lower boundary limit, a continuous low-level waveform is sent to the thermoelectric cooler drive circuit via the general-purpose input / output interface to control the thermoelectric cooler to power off and enter sleep mode.

[0013] According to another aspect of the present invention, a temperature control monitoring system for medical supplies from unmanned aerial vehicles (UAVs) is provided, comprising the following modules: The mounting module is used to deploy the eBPF program in the UAV kernel state, mount it to the temperature sensor driver function to intercept raw temperature data, and transfer the intercepted raw temperature data to a temporary storage variable for later use. The generation module is used by the eBPF program to read consumer load factors from a shared eBPF map; when the load factor increases, the aggregation time window for processing low-priority data is extended, and vice versa; when the raw temperature data meets the high-priority determination rule, an exception event is generated and written to an independent high-priority eBPF map, and the low-priority data in the current window is packaged and submitted to the eBPF circular buffer; if the high-priority determination rule is not triggered, the low-priority data is routinely packaged and submitted to the circular buffer when the window is reached, and the relevant timers are reset. The monitoring module is used by the user-mode program to monitor the data backlog and consumption rate of the circular buffer to update the load factor, and refresh the updated load factor to the mapped memory block; it prioritizes polling the high-priority eBPF mapping to handle abnormal events, and processes the low-priority data in the circular buffer in sequence, writing the separated temperature values ​​into the local database; based on the parsed temperature data, it executes ground communication and temperature control commands, sends waveforms to control the cooling element, and realizes closed-loop temperature monitoring and control throughout the entire process of medical supply transportation.

[0014] Preferably, the step of deploying the eBPF program in the UAV kernel state, attaching it to the temperature sensor driver function to intercept raw temperature data, and transferring the intercepted raw temperature data to a temporary storage variable for later use includes: Compile the eBPF bytecode file containing data interception instructions in user space; The eBPF bytecode file is loaded into the kernel mode of the UAV operating system, and memory out-of-bounds checks and instruction security verifications are performed by the kernel verifier. Using the kretprobe kernel tracing mechanism, the verified eBPF program is mounted to the return function in the sensor bus driver that is responsible for reading temperature sensor data; Before the return function finishes execution, the eBPF program is triggered to read the parsed 16-bit binary format raw temperature data in the kernel-mode buffer and transfer the data to a temporary storage variable within the eBPF program.

[0015] Preferably, the eBPF program reads the consumer load factor from the shared eBPF mapping; when the load factor increases, the aggregation time window for processing low-priority data is extended, and vice versa, the window is shortened, including: Read the consumer load factor, stored in percentage integer format, from the shared eBPF map; When the consumer load factor is greater than the preset value, the timing length of the aggregation time window is updated to five seconds; When the consumer load factor is less than or equal to a preset value, the timing length of the aggregation time window is updated to two seconds.

[0016] Preferably, the step of generating an abnormal event and writing it into an independent high-priority eBPF mapping when the original temperature data meets the high-priority determination rule includes: The absolute temperature difference is calculated by subtracting the captured current raw temperature data from the previous raw temperature data stored in the preset state-preserving eBPF mapping, and the absolute temperature difference is divided by the time difference between the current time and the previous time to calculate the rate of temperature change. When the temperature change rate is greater than the currently set temperature change rate threshold or the current original temperature data is greater than the preset upper limit threshold of absolute temperature value, a sixteen-byte event data structure containing a timestamp, a Celsius value, and an alarm code is constructed in memory. Write the sixteen-byte event data structure into the storage space at offset address 0 in the high-priority eBPF mapping, and overwrite the event notification flag bit associated in the mapping with the hexadecimal value 0x01.

[0017] Preferably, the step of packaging and submitting low-priority data within the current window to the eBPF circular buffer includes: After an abnormal event is generated, the kernel array variable used to temporarily stack low-priority temperature data of the current time window in kernel mode is intercepted and frozen. Calculate the number of data entries already written into the kernel array variable; Allocate a circular buffer block with a length equal to the current count of data entries multiplied by the length of a single data item (two bytes), and then append a four-byte header structure. Write the current count of data entries into the first four bytes of the storage block as a packet header. Then, through a static bounded loop allowed by the eBPF kernel verifier, sequentially copy the temperature data corresponding to the data entry count in the kernel array variable into the subsequent address range of the storage block. Submit the storage block to complete the packaging and reporting, clear the data count counter, and reset the nanosecond-level timer of the current aggregation time window to zero.

[0018] Preferably, the user-space program monitors the data backlog and consumption rate of the circular buffer to update the load factor, and refreshes the updated load factor to the mapped memory block, including: Start a user-mode heartbeat statistics thread with a period of one thousand milliseconds; When the timer period of every kiloms arrives, read the producer pointer representing the total number of bytes written and the consumer pointer representing the total number of bytes read from the underlying descriptor of the eBPF ring buffer. The current real-time backlog of bytes is obtained by subtracting the consumer pointer from the producer pointer. The total number of bytes read in the current period is subtracted from the total number of bytes read in the previous period. The difference is divided by the timing period to obtain the consumption rate value. The consumption rate value is divided by a preset standard consumption rate constant to obtain a dimensionless consumption rate ratio. The static occupancy ratio is obtained by dividing the real-time backlog of bytes by the maximum capacity quota declared in memory for the eBPF circular buffer. Add 1 to the dimensionless consumption rate ratio to obtain the zero-prevention denominator, and divide 1 by the zero-prevention denominator to obtain the consumption rate correction term; Multiply the preceding period smoothing weight constant by the consumption rate correction term, and then add it to the static occupancy ratio to obtain the comprehensive state value; Multiply the comprehensive state value by 100 and then perform a rounding operation. The resulting integer value is used as the consumer load factor. The shared eBPF mapping descriptor is located through the system function interface, and the consumer load factor is refreshed to the mapping memory block.

[0019] Preferably, the step of prioritizing the high-priority eBPF mapping to handle abnormal events and sequentially processing low-priority data in the circular buffer, and writing the separated temperature values ​​into the local database, includes: Set up a user-space state machine to poll the task with a fixed scheduling time slice of ten milliseconds; Each time the user-mode state machine is woken up by the system kernel, it polls the task to query the event notification flags in the high-priority eBPF mapping; If the flag is parsed as 0x01, an inter-thread semaphore is issued to wake up the blocked emergency task processor, so that the processor reads the exception event block structure from the high-priority eBPF mapping and writes a high-level pulse to the alarm buzzer through the GPIO pin. After reading is completed, a reverse overwrite call is initiated to reset the flag to 0x00. If the flag is parsed as 0x00 and the consumer pointer lags behind the producer pointer, a batch parsing thread is started to disassemble the aggregated data packet with built-in counting information in the header of the eBPF circular buffer in first-in-first-out order, and write the separated temperature value into the local database.

[0020] Preferably, the step of executing ground communication and temperature control commands based on the parsed temperature data, and sending waveform control commands to the cooling element, includes: Read the parsed integer real-time temperature value from the data processing pipeline; The integer real-time temperature value is encapsulated in JSON format and loaded into the MQTT communication protocol message payload segment, and then sent to the ground command terminal through the airborne communication module. Compare the real-time temperature value with the medical supplies standard cold chain upper and lower limit control parameter table pre-written before flight; If the current real-time temperature value is greater than the set upper limit, a high-frequency rectangular wave with a pulse width duty cycle of 80% is sent to the thermoelectric cooler drive circuit through the general input / output interface of the airborne main control board to control the thermoelectric cooler to increase its power for cooling. If the current real-time temperature value is less than the set lower boundary limit, a continuous low-level waveform is sent to the thermoelectric cooler drive circuit via the general-purpose input / output interface to control the thermoelectric cooler to power off and enter sleep mode.

[0021] This invention, by deploying an eBPF program in the UAV kernel and attaching it to a temperature sensor driver, can intercept raw temperature data at the underlying level, reducing system communication overhead. Utilizing an aggregation time window adjustment mechanism based on consumer load factors, the processing window for low-priority data is extended or shortened according to the system load, and data is processed in a hierarchical and distributed manner. High-priority abnormal data is independently and quickly written to the mapping, while low-priority data is packaged and submitted to a circular buffer, ensuring a rapid and prioritized response to abnormal temperature events. The user-space program updates the load factor based on data backlog and consumption rate, and after prioritizing the processing of abnormal events and the storage of regular data, waveform-controlled cooling is executed. This establishes a complete link from underlying data interception to upper-level temperature control execution, improving resource utilization and data processing efficiency, achieving precise closed-loop temperature monitoring and control throughout the entire process of medical supply transportation, and ensuring the safety of supply transportation. Attached Figure Description

[0022] Figure 1 A flowchart of the first embodiment; Figure 2 A schematic diagram of the step response of the consumer load factor and the aggregation time window; Figure 3 This diagram illustrates the read / write offset of the eBPF ring buffer for user-mode monitoring. Detailed Implementation

[0023] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0024] In the first embodiment, the present invention proposes a method for temperature control monitoring of medical supplies using a drone, such as... Figure 1 As shown, it includes the following steps: S1. Deploy the eBPF program in the UAV kernel state, attach it to the temperature sensor driver function to capture raw temperature data, and transfer the captured raw temperature data to a temporary storage variable for later use.

[0025] Using the libbpf framework and SEC macros, the extraction logic written in C is marked as a kprobe probe point type. The bpf_program_attach_kprobe function is then used to inject and attach this code to the read completion operation kernel symbol of the I2C bus temperature sensor driver in the UAV's Linux kernel, such as the i2c_smbus_read_word_data function. When the sensor hardware completes the analog-to-digital conversion of the temperature and triggers a kernel hardware interrupt, it traps the kprobe probe and executes eBPF instructions.

[0026] The instruction stream calls the `bpf_probe_read_kernel` safe memory read function to copy the raw hexadecimal high and low byte streams emitted by the sensor from the kernel space register address. A per-CPU array mapping table of type `BPF_MAP_TYPE_PERCPU_ARRAY` is predefined as a temporary storage area. The `bpf_map_lookup_elem` function is called to find the pointer to the starting address of the contiguous memory block allocated to the currently executing CPU core. The previously read raw hexadecimal data is directly overwritten into this memory block as a fixed-length structure. This establishes a zero-copy spare cache pool and avoids overflow crashes caused by the 512-byte kernel stack size limit.

[0027] In an optional embodiment, the step of deploying the eBPF program in the UAV kernel state, attaching it to the temperature sensor driver function to intercept raw temperature data, and transferring the intercepted raw temperature data to a temporary storage variable for later use includes: Compile the eBPF bytecode file containing data interception instructions in user space; The eBPF bytecode file is loaded into the kernel mode of the UAV operating system, and memory out-of-bounds checks and instruction security verifications are performed by the kernel verifier. Using the kretprobe kernel tracing mechanism, the verified eBPF program is mounted to the return function in the sensor bus driver that is responsible for reading temperature sensor data; Before the return function finishes execution, the eBPF program is triggered to read the parsed 16-bit binary format raw temperature data in the kernel-mode buffer and transfer the data to a temporary storage variable within the eBPF program.

[0028] In user-space environment, the C-lang eBPF source code is compiled into an eBPF bytecode file (.o object file) containing BPF_PROG_TYPE_KPROBE instruction types using the LLVM / Clang compiler suite. This bytecode file is then loaded into the UAV operating system's kernel space using the bpf system call. During loading, the kernel verifier performs static analysis on the bytecode, constructs a control flow graph to ensure the absence of infinite loops, and verifies the states of registers R0 to R10 to complete memory bounds checks and instruction safety verification. After successful verification, the perf_event_open system interface is called to utilize the kretprobe kernel tracing mechanism to attach the eBPF program to the low-level return function responsible for temperature data reading within the I2C or SPI sensor bus driver, such as i2c_smbus_read_word_data.

[0029] After successful mounting and operation, when the UAV's built-in temperature sensor, which operates within the -20℃ to +60℃ range, completes a single hardware sampling, the kernel triggers the eBPF program before the return function finishes executing and the data is copied back to user space. The eBPF program uses the `bpf_probe_read_kernel` helper function to read the raw 16-bit binary temperature data stored in the kernel-mode buffer. For example, a hexadecimal value of 0x015E represents 350 (35.0℃) after being magnified tenfold by a factor of ten. The program then transfers this two-byte temperature payload, along with the synchronously acquired 64-bit nanosecond-level system timestamp, to a temporary storage variable defined within the eBPF program based on the `BPF_MAP_TYPE_PERCPU_ARRAY` type. This allows subsequent processes to directly perform lock-free data access and comparison processing in kernel mode.

[0030] S2, the eBPF program reads the consumer load factor from the shared eBPF map; when the load factor increases, the aggregation time window for processing low-priority data is extended, and vice versa; when the raw temperature data meets the high-priority determination rule, an abnormal event is generated and written to an independent high-priority eBPF map, and the low-priority data in the current window is packaged and submitted to the eBPF circular buffer; if the high-priority determination rule is not triggered, the low-priority data is routinely packaged and submitted to the circular buffer when the window is reached, and the relevant timers are reset.

[0031] A global state array mapping table of type BPF_MAP_TYPE_ARRAY is defined in kernel space, and the consumer load factor stored in it is read by calling the bpf_map_lookup_elem function. A linear weighted algorithm is used, and a standard window baseline nanosecond value is set. If the currently read consumer load factor is greater than the set upper threshold, the baseline nanosecond value is multiplied by the ratio of the current consumer load factor to the baseline consumer load factor to calculate a longer aggregation time window parameter. If it is lower than the set lower threshold, the window parameter is reduced by the same proportion.

[0032] The raw temperature data is extracted from the temporary backup buffer pool and converted to decimal Celsius using bitwise operations. Relational operators are then used to determine if the raw temperature data exceeds the preset upper and lower limits of safe storage temperature for medical supplies. If an out-of-bounds condition is detected, triggering a high-priority rule, an exception alarm structure containing the out-of-bounds value and the current system tick count is immediately assembled. The `bpf_map_push_elem` function is called to insert the exception alarm structure into the preset `BPF_MAP_TYPE_QUEUE` queue mapping. The `bpf_ringbuf_reserve` function requests a large memory page equal to the total length of the current aggregated data from the `BPF_MAP_TYPE_RINGBUF` type ring buffer mapping. Inline assembly is used to copy the accumulated low-priority historical detail data from the buffer pool to the requested page. Finally, `bpf_ringbuf_submit` is called to force a commit and trigger a polling wake-up event. If the data is within the specified limits, the original temperature data is appended to a predefined kernel array variable for temporary stacking. `bpf_ktime_get_ns` is called to obtain a high-precision monotonic timestamp. The interval duration is obtained by subtracting the previous cycle commit timestamp stored in the mapping table. If the interval duration exceeds the calculated aggregate time window using a conditional branch statement, space is requested from the ring buffer, and low-priority data is copied and packaged. `bpf_ringbuf_submit` is then called to complete the regular commit operation. Finally, the latest high-precision monotonic timestamp is used to update the previous cycle commit timestamp in the mapping table to complete the timer reset operation. Figure 2 As shown, when the system load is low, a shorter 2-second window is used to ensure the real-time performance of the data; when the system load is too high, it automatically switches to a longer 5-second window to reduce the data submission frequency, thereby reducing CPU utilization and system overhead, and ensuring stable operation even when resources are scarce.

[0033] In an optional embodiment, the eBPF program reads the consumer load factor from a shared eBPF map; when the load factor increases, it extends the aggregation time window for processing low-priority data, and vice versa, including: Read the consumer load factor, stored in percentage integer format, from the shared eBPF map; When the consumer load factor is greater than the preset value, the timing length of the aggregation time window is updated to five seconds; When the consumer load factor is less than or equal to a preset value, the timing length of the aggregation time window is updated to two seconds.

[0034] Each time temperature data arrives, the eBPF program calls the helper function `bpf_map_lookup_elem` to non-blockingly retrieve the consumer load factor updated by user space from a pre-declared shared eBPF map region of type `BPF_MAP_TYPE_ARRAY`. The mapping depth is set to 1, and the key value is set to 0. This load factor is stored in memory as an unsigned 8-bit integer of type `uint8_t`, in percentage integer format, with a value range limited to 0 to 100. For example, an example read value of 85 represents a current system resource load level of 85%. During the read process, kernel memory barrier instructions are input to ensure that the read value is not affected by the cache and is the latest data refreshed from user space.

[0035] The program performs conditional branching on the acquired consumer load factor. When the consumer load factor exceeds the set warning threshold of 80, it indicates that there is task congestion or system computing resource shortage at the user-space data processing end. The eBPF program updates the nanosecond-level timer threshold variable used to manage the aggregation time window of low-priority regular temperature data batch processing to 5,000,000,000 ns (five seconds), increasing the data aggregation amount of a single batch of data packets to reduce the frequency of data submission interruptions to user space. Conversely, when the consumer load factor is determined to be less than or equal to 80, for example, a load value of 45 is read, indicating that the user-space computing processing capacity is relatively abundant, the eBPF program updates the timer threshold parameter of the aggregation time window to 2,000,000,000 ns (two seconds), thereby accelerating the cross-state flow rate of low-priority temperature data and balancing the real-time performance of system processing with kernel performance overhead.

[0036] In an optional embodiment, the step of generating an abnormal event and writing it into an independent high-priority eBPF mapping when the original temperature data meets the high-priority determination rule includes: The absolute temperature difference is calculated by subtracting the captured current raw temperature data from the previous raw temperature data stored in the preset state-preserving eBPF mapping, and the absolute temperature difference is divided by the time difference between the current time and the previous time to calculate the rate of temperature change. When the temperature change rate is greater than the currently set temperature change rate threshold or the current original temperature data is greater than the preset upper limit threshold of absolute temperature value, a sixteen-byte event data structure containing a timestamp, a Celsius value, and an alarm code is constructed in memory. Write the sixteen-byte event data structure into the storage space at offset address 0 in the high-priority eBPF mapping, and overwrite the event notification flag bit associated in the mapping with the hexadecimal value 0x01.

[0037] Upon successful temperature data capture, the eBPF program extracts the current raw temperature data from the temporary storage variable and, by calling the `bpf_map_lookup_elem` helper function, extracts the previously sampled raw temperature data and its corresponding 64-bit nanosecond timestamp from a preset eBPF mapping, such as the `BPF_MAP_TYPE_ARRAY` type mapping. The absolute temperature difference is calculated by subtracting the currently extracted raw temperature data from the data from the previous moment; for example, the difference between the two samples is converted to 3.0℃. The nanosecond-level time difference is obtained by subtracting the current timestamp from the previous timestamp; for example, 2,000,000,000 nanoseconds, equivalent to 2 seconds. The absolute temperature difference is then divided by this time difference to calculate the scalarized rate of temperature change, which is calculated to be 1.5℃ / s. The built-in high-priority judgment rule includes two logical OR conditions: determining that the temperature change rate is greater than the set temperature change rate threshold, the parameter range is from 0.5℃ / s to 2.0℃ / s, and is set to 1.0℃ / s in this embodiment; determining that the actual absolute value of the current original temperature data after conversion is greater than the preset upper limit threshold of absolute temperature value, the range is limited to 6.0℃ to 10.0℃, and is set to 8.0℃ in this embodiment, corresponding to a 16-bit original binary value of 0x0050.

[0038] If any of the above high-priority criteria are met, the eBPF program allocates and initializes a structure variable with a total length aligned to sixteen bytes in the kernel-mode execution stack memory. This structure contains an 8-byte unsigned long integer system timestamp, a 4-byte Celsius value (e.g., 8.5℃ for exceeding the limit), and a 4-byte unsigned integer alarm code (e.g., 0x00000001 for an abnormal temperature jump alarm). After the structure memory is filled, the eBPF program calls the `bpf_map_update_elem` helper function to update a designated high-priority eBPF mapping of type `BPF_MAP_TYPE_HASH` with the `BPF_ANY` flag. The sixteen-byte event data structure is stored in the memory space within this mapping with a key value of 0 (i.e., an offset address of zero), thus isolating high-priority and low-priority data. A 1-byte status bit variable independently allocated in this hash mapping is overwritten with a hexadecimal constant 0x01, serving as a notification flag that a sudden abnormal event has been written. The eBPF program calls the bpf_map_update_elem function to update and overwrite the current raw temperature data and timestamp into the aforementioned state-preserving eBPF mapping, thereby achieving state persistence across sampling cycles and enabling extraction and comparison in the next cycle.

[0039] In an optional embodiment, the step of packaging and submitting low-priority data within the current window to the eBPF circular buffer includes: After an abnormal event is generated, the kernel array variable used to temporarily stack low-priority temperature data of the current time window in kernel mode is intercepted and frozen. Calculate the number of data entries already written into the kernel array variable; Allocate a circular buffer block with a length equal to the current count of data entries multiplied by the length of a single data item (two bytes), and then append a four-byte header structure. Write the current count of data entries into the first four bytes of the storage block as a packet header. Then, through a static bounded loop allowed by the eBPF kernel verifier, sequentially copy the temperature data corresponding to the data entry count in the kernel array variable into the subsequent address range of the storage block. Submit the storage block to complete the packaging and reporting, clear the data count counter, and reset the nanosecond-level timer of the current aggregation time window to zero.

[0040] When the aforementioned exception event logic is triggered, to prevent dirty data from being mixed in, the eBPF program uses the bpf_spin_lock mechanism to lock a specified kernel array variable located within the BPF_MAP_TYPE_ARRAY mapping, such as a temperature data buffer queue with a pre-allocated length of 256, pausing subsequent appending and writing of regular data. The program reads the bound atomic_t type atomic counter, extracts and calculates the number of low-priority temperature data entries actually written into the current kernel array variable, for example, if the counter value is 120. The bpf_ringbuf_reserve function is called to request a contiguous block of memory in the pre-mapped eBPF ring buffer. The requested length of this memory block is calculated by multiplying the number of data entries (120) by the storage length occupied by a single data entry, using a 2-byte unsigned integer, and appending a 4-byte uint32_t type as the header structure size to the total length, resulting in a memory allocation request length of 244 bytes.

[0041] After successfully acquiring the pointer to the requested memory block, the eBPF program performs network byte order conversion on the count value 120 representing the number of data entries and writes it into a four-byte space at offset 0 at the beginning of the memory block as the parsed packet header. Using statically bounded loop logic supported by the LLVM compiler and checked by the eBPF verifier (e.g., limiting the loop to a maximum of 256 iterations via the #pragmaunroll directive), combined with the bpf_probe_read_kernel instruction, a total of 120 temperature data entries from the kernel array variable are sequentially copied into the address range following the beginning of the memory block, arranged in memory order. After all temperature payload copies are filled, the bpf_ringbuf_submit function is called to submit the entire packet header and payload structure to the read queue of the ring buffer. The program releases the resource spin lock, sets the data count value in the aforementioned atomic counter to 0, and resets the 64-bit nanosecond-level timestamp base variable that manages the aggregation time window to zero to the current system clock, for example, assigning a new value of 1678889900000000000ns, in order to restore the initial running state of the next round of data aggregation.

[0042] S3, the user-mode program monitors the data backlog and consumption rate of the ring buffer to update the load factor, and refreshes the updated load factor to the mapped memory block; it prioritizes polling the high-priority eBPF mapping to handle abnormal events, and processes the low-priority data in the ring buffer in sequence, writing the separated temperature value into the local database; based on the parsed temperature data, it executes ground communication and temperature control commands, sends waveforms to control the cooling chip, and realizes closed-loop temperature monitoring and control throughout the entire process of medical supply transportation.

[0043] The user-space control process reads the producer write offset and consumer read offset of the circular buffer, calculates the difference between them to obtain the current unprocessed data backlog, and combines this with the total number of bytes successfully dequeued from the circular buffer in the past second (consumption rate) as counted by the background timer thread. Using the Exponential Moving Average (EMA) algorithm, the data backlog is divided by the consumption rate to obtain the latest consumer load factor. The new consumer load factor value is then written to the zero key-value pair in the global state array mapping table using the `bpf_map_update_elem` function. The main thread uses the epoll mechanism provided by the Linux system to build an event-driven model. In each round of event dispatch, the non-blocking `bpf_map_pop_elem` function is executed first to clear all high-priority alarm data blocks in the BPF_MAP_TYPE_QUEUE queue for emergency response. Then, the `ring_buffer__poll` function is called, along with a custom callback parsing function, to process the regular circular buffer in a first-in-first-out order. After extracting the temperature time-series data load passed to the callback function, a standard SQL statement is assembled, and the `sqlite3_exec` function is called to persistently store the data in an SQLite database table mounted on the UAV's onboard file system using a file locking mechanism. The latest multiple temperature averages from the database are extracted as input deviation values ​​and input into the incremental PID proportional-integral-derivative control algorithm engine. After multiplication and accumulation, the control correction value is calculated. This correction value is converted into an integer duty cycle parameter from 0 to 100. The sysfs file system path introduced in the Linux kernel, such as the duty cycle configuration file of the microcontroller's pulse width modulation subsystem, is opened through standard C library functions. The write function is called to write the parameter value, which changes the duty cycle of the hardware output square wave and changes the drive current of the semiconductor refrigeration chip to adjust the cooling power. The pre-compiled Paho MQTT open-source C language runtime library is used to call the MQTTClient_publishMessage function to package the current temperature index and the refrigeration condition into a JSON payload format and publish it to the cloud server message broker through the 4G wireless module, thus achieving a closed loop of two-way air-ground linkage and precise constant temperature of the material microenvironment.

[0044] In an optional embodiment, the user-space program monitors the data backlog and consumption rate of the circular buffer to update the load factor, and flushes the updated load factor to the mapped memory block, including: Start a user-mode heartbeat statistics thread with a period of one thousand milliseconds; When the timer period of every kiloms arrives, read the producer pointer representing the total number of bytes written and the consumer pointer representing the total number of bytes read from the underlying descriptor of the eBPF ring buffer. The current real-time backlog of bytes is obtained by subtracting the consumer pointer from the producer pointer. The total number of bytes read in the current period is subtracted from the total number of bytes read in the previous period. The difference is divided by the timing period to obtain the consumption rate value. The consumption rate value is divided by a preset standard consumption rate constant to obtain a dimensionless consumption rate ratio. The static occupancy ratio is obtained by dividing the real-time backlog of bytes by the maximum capacity quota declared in memory for the eBPF circular buffer. Add 1 to the dimensionless consumption rate ratio to obtain the zero-prevention denominator, and divide 1 by the zero-prevention denominator to obtain the consumption rate correction term; Multiply the preceding period smoothing weight constant by the consumption rate correction term, and then add it to the static occupancy ratio to obtain the comprehensive state value; Multiply the comprehensive state value by 100 and then perform a rounding operation. The resulting integer value is used as the consumer load factor. The shared eBPF mapping descriptor is located through the system function interface, and the consumer load factor is refreshed to the mapping memory block.

[0045] In the Linux user-space process of the drone, a high-priority independent heartbeat statistics thread is created and started using the pthread library. The timerfd timer mechanism is configured to set the thread's execution scheduling period to 1000ms (1 second). When the thread is woken up by a hardware timer interrupt every kiloms, it accesses the header of the underlying structure descriptor of the eBPF circular buffer via mmap mapping, reading two 64-bit unsigned long integer key cursors: the producer write offset (producer_pos) representing the total number of bytes written since startup (e.g., 10240), and the consumer read offset (consumer_pos) representing the total number of bytes processed cumulatively (e.g., 8192). The data backlog for the current time period is calculated to be 2048 bytes using subtraction. The total number of bytes read in the current period (8192) is subtracted from the total number of bytes read in the cache in the previous period (e.g., 6144). The resulting difference of 2048 bytes is divided by the 1-second timing period to obtain the current data consumption rate of 2048 bytes / second. This rate is then divided by the system's preset standard consumption rate constant (e.g., 5000 bytes / second) to obtain a dimensionless consumption rate ratio of 0.4096.

[0046] The calculation logic divides the obtained data backlog of 2048 bytes by the maximum capacity quota declared when creating the circular buffer, such as the set total large page capacity of 65536 bytes. This yields a static memory occupancy ratio of approximately 3.1%, which is 0.03125. To prevent division by zero and incorporate a smoothing inverse load ratio, the program adds a constant 1 to the consumption rate ratio of 0.4096, resulting in a division-by-zero denominator of 1.4096. Dividing this denominator by the constant 1 yields a consumption rate correction term of approximately 0.7094. The system-defined pre-cycle smoothing weight constant, ranging from 0.1 to 0.5 (preset to 0.3 in this embodiment), is extracted. This weight constant is multiplied by the resulting consumption rate correction term of 0.2128, and then added to the static occupancy ratio of 0.03125, resulting in a floating-point composite state value of 0.24405 representing the current data backpressure composite state of the system. The thread multiplies the overall state value by 100 and calls the `round` function from the standard math library to round it to the nearest integer, obtaining 24. This unsigned 8-bit integer is used as the current consumer load factor of the system. After locating the file descriptor mapped to the shared load eBPF through system API interfaces such as `bpf_obj_get`, the thread calls the update function to write this 1-byte consumer load factor and overwrite it at offset 0 of the mapped kernel memory block, completing the load feedback loop for the kernel-mode working policy within this cycle.

[0047] In an optional embodiment, the process of prioritizing the high-priority eBPF mapping to handle abnormal events and sequentially processing low-priority data in the circular buffer, and writing the separated temperature values ​​into the local database, includes: Set up a user-space state machine to poll the task with a fixed scheduling time slice of ten milliseconds; Each time the user-mode state machine is woken up by the system kernel, it polls the task to query the event notification flags in the high-priority eBPF mapping; If the flag is parsed as 0x01, an inter-thread semaphore is issued to wake up the blocked emergency task processor, so that the processor reads the exception event block structure from the high-priority eBPF mapping and writes a high-level pulse to the alarm buzzer through the GPIO pin. After reading is completed, a reverse overwrite call is initiated to reset the flag to 0x00. If the flag is parsed as 0x00 and the consumer pointer lags behind the producer pointer, a batch parsing thread is started to disassemble the aggregated data packet with built-in counting information in the header of the eBPF circular buffer in first-in-first-out order, and write the separated temperature value into the local database.

[0048] In the main process of UAV control, a user-space state machine polling task based on epoll or a state machine architecture is constructed, and the dedicated execution time slice of this task is fixed at 10ms in the system task scheduler. When awakened by the system kernel timer every 10ms, the primary action of this polling task is to call the bpf_map_lookup_elem system-level function to detect the 1-byte event notification flag located at the specified memory address of the high-priority eBPF mapping based on the key-value index. If it is determined that the data of this flag has been modified to hexadecimal 0x01, it is determined that a sudden temperature anomaly has occurred. The main controller sends an inter-thread synchronization signal by calling a POSIX semaphore interface such as sem_post to wake up the high-priority emergency task processor that is in a blocked state. After startup, the processor reads the complete 16-byte exception event block structure through the same mapped interface, containing the actual floating-point temperature and timestamp that triggered the over-limit alarm. It then manipulates the ` / sys / class / gpio` device node under Linux to write the number 1 to a specified general-purpose input / output (GPIO) hardware control pin, such as physical pin number 17, applying a 500ms high-level 3.3V pulse to drive an external buzzer to emit a high-frequency alarm. After the emergency processing data reading and physical signal transmission are completed, the processor initiates a `bpf_map_update_elem` reverse overwrite call to clear and reset the memory value of the event notification flag to 0x00, releasing the alarm lock.

[0049] If the event notification flag is parsed as 0x00 within the polling cycle, and a comparison of the circular buffer memory descriptor reveals that the absolute value of the consumer's read offset lags behind the producer's write offset, it indicates that there is a backlog of batch data awaiting consumption in the regular circular memory pool. The main control program then submits a task to start or schedule the batch processing parsing thread. This parsing thread polls the buffer consumption queue through interfaces such as `ring_buffer__poll`, extracting aggregated data packets in blocks according to the first-in-first-out (FIFO) queue flow rule. After extraction, it first strips and parses the first four bytes of the packet header to obtain the temperature count information contained within the packet, for example, 50 consecutive samples. Using a memory pointer, it performs cyclic parsing in the data area with 2-byte steps, and uses linear decoding to inversely calculate the actual single-precision floating-point ambient temperature value from the read binary payload data. For example, the payload 0x015E is decoded as 35.0℃. After data separation, batch SQL INSERT statements are constructed using relevant database API components to write all temperature details with relative timestamps to the onboard local database file, thus storing the cold chain monitoring data.

[0050] In an optional embodiment, the execution of ground communication and temperature control commands based on the parsed temperature data, and the transmission of waveform control commands to the cooling element, includes: Read the parsed integer real-time temperature value from the data processing pipeline; The integer real-time temperature value is encapsulated in JSON format and loaded into the MQTT communication protocol message payload segment, and then sent to the ground command terminal through the airborne communication module. Compare the real-time temperature value with the medical supplies standard cold chain upper and lower limit control parameter table pre-written before flight; If the current real-time temperature value is greater than the set upper limit, a high-frequency rectangular wave with a pulse width duty cycle of 80% is sent to the thermoelectric cooler drive circuit through the general input / output interface of the airborne main control board to control the thermoelectric cooler to increase its power for cooling. If the current real-time temperature value is less than the set lower boundary limit, a continuous low-level waveform is sent to the thermoelectric cooler drive circuit via the general-purpose input / output interface to control the thermoelectric cooler to power off and enter sleep mode.

[0051] In the main business control loop where temperature control commands are issued, the system business layer reads the noise-reduced real-time integer temperature value from the shared memory-based data processing pipeline created by the user-space process. For example, if the actual detected temperature is 3.8℃, it is converted into the integer 38 for transmission. After obtaining the data, a lightweight string construction tool is used to assemble and serialize the extracted integer temperature value and the UAV's unique identifier into a JSON format text object, such as {"device":"UAV_MED_1","temp":38}. The assembled text string is then embedded as the core payload in the MQTT application layer protocol message body with a service quality level of QoS1. Relying on the long TCP socket connection of the airborne network communication module, it is sent to the topic channel of the remote cloud platform at a heartbeat frequency of 1Hz for the ground command terminal to monitor the transportation trajectory and container temperature.

[0052] While performing remote telemetry, the UAV's local closed-loop main control logic extracts the integer real-time temperature value in parallel and retrieves the standard cold chain control parameter table, which was pre-written to the UAV before takeoff and is specifically for special medical supplies such as nucleic acid reagents or refrigerated vaccines, from the local non-volatile Flash memory. The microprocessor core performs a logical comparison of the two sets of data. When it is determined that the currently acquired real-time temperature value, after conversion, is greater than the upper boundary threshold of 4℃ set in the parameter table, for example, the detected value is 4.5℃, the airborne hardware main control board will configure a hardware PWM controller associated with the general input / output interface to continuously send a PWM rectangular control wave with a base frequency of 10kHz and a pulse width duty cycle of 80% to the external thermoelectric cooler driver circuit responsible for power amplification; this drives the thermoelectric cooler to activate the cooling response and suppress temperature rise. When the real-time temperature value is calculated to be less than the set lower limit threshold of 2℃, for example, when the detected temperature drops to 1.5℃, the hardware peripheral control register of the main control board will block the PWM clock output signal and instead continuously output a stable 0V amplitude low-level waveform to the thermoelectric cooler drive circuit through this pin, which is equivalent to the duty cycle being reduced to 0%. This cuts off the conduction state of the field-effect transistor and instructs the thermoelectric cooler to perform power-off sleep, thus forming a closed-loop control strategy that limits the temperature range to 2℃ to 4℃ throughout.

[0053] In a second embodiment, the present invention also provides a temperature control monitoring system for medical supplies from unmanned aerial vehicles (UAVs), comprising the following modules: The mounting module is used to deploy the eBPF program in the UAV kernel state, mount it to the temperature sensor driver function to intercept raw temperature data, and transfer the intercepted raw temperature data to a temporary storage variable for later use. The generation module is used by the eBPF program to read consumer load factors from a shared eBPF map; when the load factor increases, the aggregation time window for processing low-priority data is extended, and vice versa; when the raw temperature data meets the high-priority determination rule, an exception event is generated and written to an independent high-priority eBPF map, and the low-priority data in the current window is packaged and submitted to the eBPF circular buffer; if the high-priority determination rule is not triggered, the low-priority data is routinely packaged and submitted to the circular buffer when the window is reached, and the relevant timers are reset. The monitoring module is used by the user-mode program to monitor the data backlog and consumption rate of the circular buffer to update the load factor, and refresh the updated load factor to the mapped memory block; it prioritizes polling the high-priority eBPF mapping to handle abnormal events, and processes the low-priority data in the circular buffer in sequence, writing the separated temperature values ​​into the local database; based on the parsed temperature data, it executes ground communication and temperature control commands, sends waveforms to control the cooling element, and realizes closed-loop temperature monitoring and control throughout the entire process of medical supply transportation.

[0054] In this specification, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise limited, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. In this document, "a," "an," "the," "the," and "its" may also include plural forms unless the context clearly indicates otherwise. "Multiple" refers to at least two, such as 2, 3, 5, or 8, etc. "And / or" includes any and all combinations of the associated listed items.

[0055] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.

[0056] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for monitoring temperature of medical supplies of a UAV, characterized in that, Includes the following steps: Deploy the eBPF program in the kernel mode of the drone, attach it to the temperature sensor driver function to capture raw temperature data, and transfer the captured raw temperature data to a temporary storage variable for later use; The eBPF program reads the consumer load factor from the shared eBPF map; when the load factor increases, it extends the aggregation time window for processing low-priority data, and vice versa; when the raw temperature data meets the high-priority determination rule, it generates an exception event and writes it to an independent high-priority eBPF map, and packages the low-priority data in the current window and submits it to the eBPF circular buffer; if the high-priority determination rule is not triggered, the low-priority data is packaged and submitted to the circular buffer as usual when the window is reached, and the relevant timers are reset. The user-space program monitors the data backlog and consumption rate of the circular buffer to update the load factor, and then refreshes the updated load factor to the mapped memory block. The system prioritizes polling the high-priority eBPF mapping to handle abnormal events, and processes the low-priority data in the circular buffer in sequence, writing the separated temperature values ​​into the local database; based on the parsed temperature data, it executes ground communication and temperature control commands, sends waveforms to control the cooling element, and realizes closed-loop temperature monitoring and control throughout the entire process of medical supply transportation.

2. The method of claim 1, wherein, The step of deploying an eBPF program in the UAV kernel state, attaching it to the temperature sensor driver function to intercept raw temperature data, and transferring the intercepted raw temperature data to a temporary storage variable for later use includes: Compile the eBPF bytecode file containing data interception instructions in user space; The eBPF bytecode file is loaded into the kernel mode of the UAV operating system, and memory out-of-bounds checks and instruction security verifications are performed by the kernel verifier. Using the kretprobe kernel tracing mechanism, the verified eBPF program is mounted to the return function in the sensor bus driver that is responsible for reading temperature sensor data; Before the return function finishes execution, the eBPF program is triggered to read the parsed 16-bit binary format raw temperature data in the kernel-mode buffer and transfer the data to a temporary storage variable within the eBPF program.

3. The method of claim 1, wherein, The eBPF program reads the consumer load factor from the shared eBPF mapping; When the load factor increases, the aggregation time window for processing low-priority data is extended; conversely, the window is shortened when the load factor decreases. This includes: Read the consumer load factor, stored in percentage integer format, from the shared eBPF map; When the consumer load factor is greater than the preset value, the timing length of the aggregation time window is updated to five seconds; When the consumer load factor is less than or equal to a preset value, the timing length of the aggregation time window is updated to two seconds.

4. The method according to claim 1, characterized in that, When the original temperature data meets the high-priority judgment rule, an abnormal event is generated and written into an independent high-priority eBPF mapping, including: The absolute temperature difference is calculated by subtracting the captured current raw temperature data from the previous raw temperature data stored in the preset state-preserving eBPF mapping, and the absolute temperature difference is divided by the time difference between the current time and the previous time to calculate the rate of temperature change. When the temperature change rate is greater than the currently set temperature change rate threshold or the current original temperature data is greater than the preset upper limit threshold of absolute temperature value, a sixteen-byte event data structure containing a timestamp, a Celsius value, and an alarm code is constructed in memory. Write the sixteen-byte event data structure into the storage space at offset address 0 in the high-priority eBPF mapping, and overwrite the event notification flag bit associated in the mapping with the hexadecimal value 0x01.

5. The method according to claim 1, characterized in that, The step of packaging and submitting low-priority data within the current window to the eBPF circular buffer includes: After an abnormal event is generated, the kernel array variable used to temporarily stack low-priority temperature data of the current time window in kernel mode is intercepted and frozen. Calculate the number of data entries already written into the kernel array variable; Allocate a circular buffer block with a length equal to the current count of data entries multiplied by the length of a single data item (two bytes), and then append a four-byte header structure. Write the current count of data entries into the first four bytes of the storage block as a packet header. Then, through a static bounded loop allowed by the eBPF kernel verifier, sequentially copy the temperature data corresponding to the data entry count in the kernel array variable into the subsequent address range of the storage block. Submit the storage block to complete the packaging and reporting, clear the data count counter, and reset the nanosecond-level timer of the current aggregation time window to zero.

6. The method according to claim 1, characterized in that, The user-mode program monitors the data backlog and consumption rate of the circular buffer to update the load factor, and flushes the updated load factor to the mapped memory block, including: Start a user-mode heartbeat statistics thread with a period of one thousand milliseconds; When the timer period of every kiloms arrives, read the producer pointer representing the total number of bytes written and the consumer pointer representing the total number of bytes read from the underlying descriptor of the eBPF ring buffer. The current real-time backlog of bytes is obtained by subtracting the consumer pointer from the producer pointer. The total number of bytes read in the current period is subtracted from the total number of bytes read in the previous period. The difference is divided by the timing period to obtain the consumption rate value. The consumption rate value is divided by a preset standard consumption rate constant to obtain a dimensionless consumption rate ratio. The static occupancy ratio is obtained by dividing the real-time backlog of bytes by the maximum capacity quota declared in memory for the eBPF circular buffer. Add 1 to the dimensionless consumption rate ratio to obtain the zero-prevention denominator, and divide 1 by the zero-prevention denominator to obtain the consumption rate correction term; Multiply the preceding period smoothing weight constant by the consumption rate correction term, and then add it to the static occupancy ratio to obtain the comprehensive state value; Multiply the comprehensive state value by 100 and then perform a rounding operation. The resulting integer value is used as the consumer load factor. The shared eBPF mapping descriptor is located through the system function interface, and the consumer load factor is refreshed to the mapping memory block.

7. The method according to claim 1, characterized in that, The process of prioritizing the high-priority eBPF mapping to handle exception events and sequentially processing low-priority data in the circular buffer, and writing the separated temperature values ​​into the local database, includes: Set up a user-space state machine to poll the task with a fixed scheduling time slice of ten milliseconds; Each time the user-mode state machine is woken up by the system kernel, it polls the task to query the event notification flags in the high-priority eBPF mapping; If the flag is parsed as 0x01, an inter-thread semaphore is issued to wake up the blocked emergency task processor, so that the processor reads the exception event block structure from the high-priority eBPF mapping and writes a high-level pulse to the alarm buzzer through the GPIO pin. After reading is completed, a reverse overwrite call is initiated to reset the flag to 0x00. If the flag is parsed as 0x00 and the consumer pointer lags behind the producer pointer, a batch parsing thread is started to disassemble the aggregated data packet with built-in counting information in the header of the eBPF circular buffer in first-in-first-out order, and write the separated temperature value into the local database.

8. The method according to claim 1, characterized in that, The temperature data based on the analysis is used to execute ground communication and temperature control commands, and to send waveforms to control the cooling element, including: Read the parsed integer real-time temperature value from the data processing pipeline; The integer real-time temperature value is encapsulated in JSON format and loaded into the MQTT communication protocol message payload segment, and then sent to the ground command terminal through the airborne communication module. Compare the real-time temperature value with the medical supplies standard cold chain upper and lower limit control parameter table pre-written before flight; If the current real-time temperature value is greater than the set upper limit, a high-frequency rectangular wave with a pulse width duty cycle of 80% is sent to the thermoelectric cooler drive circuit through the general input / output interface of the airborne main control board to control the thermoelectric cooler to increase its power for cooling. If the current real-time temperature value is less than the set lower boundary limit, a continuous low-level waveform is sent to the thermoelectric cooler drive circuit via the general-purpose input / output interface to control the thermoelectric cooler to power off and enter sleep mode.

9. A temperature control and monitoring system for medical supplies from an unmanned aerial vehicle (UAV), characterized in that, Includes the following modules: The mounting module is used to deploy the eBPF program in the UAV kernel state, mount it to the temperature sensor driver function to intercept raw temperature data, and transfer the intercepted raw temperature data to a temporary storage variable for later use. The generation module is used by the eBPF program to read consumer load factors from a shared eBPF map; when the load factor increases, the aggregation time window for processing low-priority data is extended, and vice versa; when the raw temperature data meets the high-priority determination rule, an exception event is generated and written to an independent high-priority eBPF map, and the low-priority data in the current window is packaged and submitted to the eBPF circular buffer; if the high-priority determination rule is not triggered, the low-priority data is routinely packaged and submitted to the circular buffer when the window is reached, and the relevant timers are reset. The monitoring module is used by the user-mode program to monitor the data backlog and consumption rate of the circular buffer to update the load factor, and refresh the updated load factor to the mapped memory block. The system prioritizes polling the high-priority eBPF mapping to handle abnormal events, and processes the low-priority data in the circular buffer in sequence, writing the separated temperature values ​​into the local database; based on the parsed temperature data, it executes ground communication and temperature control commands, sends waveforms to control the cooling element, and realizes closed-loop temperature monitoring and control throughout the entire process of medical supply transportation.

10. The system according to claim 9, characterized in that, The step of deploying an eBPF program in the UAV kernel state, attaching it to the temperature sensor driver function to intercept raw temperature data, and transferring the intercepted raw temperature data to a temporary storage variable for later use includes: Compile the eBPF bytecode file containing data interception instructions in user space; The eBPF bytecode file is loaded into the kernel mode of the UAV operating system, and memory out-of-bounds checks and instruction security verifications are performed by the kernel verifier. Using the kretprobe kernel tracing mechanism, the verified eBPF program is mounted to the return function in the sensor bus driver that is responsible for reading temperature sensor data; Before the return function finishes execution, the eBPF program is triggered to read the parsed 16-bit binary format raw temperature data in the kernel-mode buffer and transfer the data to a temporary storage variable within the eBPF program.

Citation Information

Patent Citations

  • Method and system for realizing CUDA call tracking based on eBPF

    CN120723587A

  • Data transmission method, device and equipment of intelligent system and storage medium

    CN121664750A