An agricultural internet of things intelligent gateway control method based on edge computing

CN122933690APending Publication Date: 2026-10-16SHANGHAI BUFU TECH DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611174803.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-04
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

当相邻区域同时执行灌溉、通风等操作时,气流和水汽迁移会导致环境变量相互干扰,使控制效果偏离预期

Benefits of technology

通过扩展因果图模型与反事实推理,实现了对执行器故障、空间冲突和模型失配三种偏差源的精准归因与在线解耦,显著提升了复杂环境下的控制鲁棒性;引入空间耦合节点和动态冲突消解机制,有效消除了相邻区域间的相互干扰,避免了控制指令的无效对冲。在此基础上,通过引入传感器信任度管理机制,利用执行器动作作为校准基准并结合贝叶斯原理动态更新信任度,有效滤除了异常传感器的污染数据,保障了归因推理的输入质量;信任度加权融合与模型边权重动态调整进一步增强了因果推理链条对数据噪声的鲁棒性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122933690A_ABST
    Figure CN122933690A_ABST
Patent Text Reader

Abstract

The application discloses an agricultural Internet of Things intelligent gateway control method based on edge computing, which comprises the following steps: deploying an extended causal graph model, containing four types of nodes and three types of edges of actuators, environmental states, control instructions and spatial coupling; starting an observation window and collecting multi-dimensional data in parallel after MPC issues an instruction; inputting the data into the model to perform three times of counterfactual reasoning, calculating the difference between the expected and actual change rates; making an attribution decision by comparing the difference, and immediately triggering a resolution process when there is a spatial conflict; and performing differentiated processing according to the attribution result and continuously monitoring the effect in the subsequent control cycle. The application realizes accurate attribution and online decoupling of actuator failure, spatial conflict and model mismatch, eliminates mutual interference between adjacent areas, greatly reduces the false alarm rate and the demand for manual intervention, and improves the intelligent level of agricultural production and the resource utilization efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of Internet of Things (IoT) integration technology, and in particular to a smart gateway control method for agricultural IoT based on edge computing. Background Technology

[0002] Currently, agricultural IoT smart gateways play a crucial role in data aggregation and control command forwarding in greenhouse and field environments. Existing agricultural control systems mostly employ PID-based or simple rule-based control strategies, with each actuator operating independently, lacking a comprehensive consideration of multi-regional coupling effects. When adjacent areas simultaneously perform operations such as irrigation and ventilation, airflow and water vapor migration can cause environmental variables to interfere with each other, leading to deviations from expected control results. Furthermore, actuators are prone to mechanical failures such as valve jamming and motor overload in harsh field environments, and sensors also experience accuracy drift and occasional anomalies. These sources of deviation are often intertwined, making it difficult for traditional control methods to separate and attribute them online during operation, resulting in frequent false alarms and increased manual inspection burden.

[0003] While existing agricultural control schemes based on model predictive control exist, they typically assume accurate and reliable sensor data and precise actuator responses, failing to adequately consider the impact of sensor degradation and environmental fingerprint changes on data quality. When sensor accuracy declines due to aging or environmental migration, the collected data still participates in state estimation with equal weight, contaminating the input basis for control decisions. Furthermore, existing schemes lack proactive sensing and predictive maintenance capabilities for sensor health status, often only responding passively after sensor failure, leading to control interruptions or crop losses. Therefore, there is an urgent need for an agricultural IoT smart gateway control method capable of online data quality sensing, adaptive adjustment of control strategies, and accurate attribution of deviation sources. Summary of the Invention

[0004] This application provides an agricultural IoT smart gateway control method based on edge computing, which can sense data quality online, adaptively adjust control strategies, and accurately attribute deviation sources to agricultural IoT smart gateways.

[0005] This application provides a method for controlling an agricultural IoT smart gateway based on edge computing, including: S1, Deploy an extended causal graph model within the edge computing node to represent the causal relationships between elements in the agricultural control system in the form of a directed graph; S2: After each set of control commands is issued by MPC, a preset observation window is started, during which the edge gateway collects multi-dimensional data in parallel. S3, input the collected multidimensional data into the causal graph model to perform three hypothesis inferences, calculate the expected rate of change of the environment under different hypothesis conditions, and calculate the difference between the actual measured rate of change and the assumed expected rate of change; S4 makes an attribution decision by comparing the absolute values ​​and sign of the three differences. When the attribution result shows that spatial conflict is the dominant cause, the conflict resolution process is immediately triggered. S5 performs edge node control processing based on the attribution results. After each attribution and resolution is completed, the control effect of the subsequent three observation windows is continuously monitored to verify the effect of the attribution results.

[0006] Preferably, the three-stage hypothetical reasoning specifically includes: the first reasoning is based on the normal assumption, assuming that all actuators accurately execute control commands, the edge weights of the causal graph model are accurate, and the spatial coupling nodes are not activated, and propagating forward along the execution edges and model edges according to predetermined weights; the second reasoning is based on the actuator failure assumption, replacing the control command value of the corresponding actuator node with the actuator feedback value, and the remaining conditions are the same as the normal assumption; the third reasoning is based on the spatial conflict assumption, keeping the actuator nodes using control command values ​​and the model edge weights unchanged, activating the spatial coupling nodes and assigning the inter-regional influence intensity coefficient to their attributes, so that the environmental changes of adjacent regions are superimposed through the spatial coupling edges.

[0007] Preferably, the immediate triggering of the conflict resolution process includes: when the attribution results show that spatial conflict is the most probable dominant cause, the conflict resolution process is triggered immediately without waiting for the next control cycle.

[0008] Preferably, the edge node control processing based on the attribution results specifically includes: S51, in the causal graph model deployed within the edge computing node, establishing an independent trust node for each sensor and determining the trust score based on experimental experience; S52, after the actuator action issued by MPC is completed, calculating the expected value of the current environmental variable through the edges of the causal graph model and physical parameters, and comparing it with the measured values ​​of each sensor to obtain the relative deviation; S53, treating each calibration event as an observation, and updating the trust score based on the relationship between the relative deviation and a preset threshold according to the Bayesian principle; S54, during causal attribution, the environmental state node value is weighted by trust score to obtain the fusion value, data below the lower limit is removed and an alarm is triggered; the model edge weights in the causal graph are dynamically adjusted according to the trust score of the dependent sensor; S55, the edge computing node uploads the trust score changes of each sensor to the cloud, and the cloud uses trend analysis to predict the time when the trust score falls below the lower limit, generating predictive maintenance work orders in advance; S56, actively triggering low-energy calibration events during idle periods, with the calibration frequency dynamically adjusted according to the sensor trust score.

[0009] Preferably, the step of updating the trust level based on the relationship between the relative deviation and a preset threshold according to the Bayesian principle specifically includes: if the relative deviation is less than a first threshold, it is determined to be a normal event, the consecutive normal count is increased and the consecutive abnormal count is cleared, and the trust level recovers according to a preset recovery step size; if the relative deviation is greater than a second threshold, it is determined to be an abnormal event, the consecutive abnormal count is increased and the consecutive normal count is cleared, and the trust level decreases according to a preset decay factor, the decay factor decreasing as the number of consecutive abnormal events increases; if the relative deviation is between the first threshold and the second threshold, it is determined to be an uncertain event, the trust level remains unchanged, and the consecutive normal count and the consecutive abnormal count are multiplied by a forgetting factor to decay the historical cumulative effect.

[0010] Preferably, the dynamic adjustment of the model edge weights in the causal graph based on the trust level of the dependent sensors includes: if the data of a certain environmental state node mainly comes from a sensor with a low trust level, then the weights of all model edges dependent on that node are temporarily reduced; when the trust level of the sensor is restored, the model edge weights are restored synchronously.

[0011] Preferably, uploading the trust level changes of each sensor to the cloud at the edge computing node includes: S551, at the beginning of each MPC control cycle, the edge node calculates the comprehensive trust level of each region, defined as the weighted geometric average of the trust levels of all sensors involved in control within that region; S552, a mapping table between trust level and risk is pre-established, mapping the comprehensive trust level range to the risk preference level of the MPC; S553, the objective function of the MPC is dynamically modified according to the risk level; when the comprehensive trust level of a region rises from a low level, the MPC adopts a gradual switching strategy to switch back to a high risk preference; S554, when the comprehensive trust level of a region is too low, the edge node automatically switches the control task of that region from edge inference to cloud inference, using cloud sensor data for cross-validation; S555, the cloud predicts potential data quality crises based on the long-term trend of the comprehensive trust level of each region and adjusts agricultural plans in advance.

[0012] Preferably, the cross-validation process involves: the edge node uploading environmental sensing data, actuator feedback data, and spatial relationship data of the current area to the cloud; the cloud using the stored multi-source data to perform cross-validation, recalculating the estimated environmental state and control commands for the area; and the cloud sending the inferred control commands back to the edge node, which then sends them to the corresponding actuator for execution.

[0013] Preferably, calculating the comprehensive trust level of each region at the edge node includes: defining a unique region identifier for each region and associating it with an environmental fingerprint vector; the environmental fingerprint of each region is determined during initialization; the trust level of each sensor within the region adopts a dictionary structure associated with the environmental fingerprint; detecting position changes when sensors migrate, creating a temporary trust level entry with an initial value of 0.5 for the new environment, initiating high-frequency calibration events to accumulate samples, and switching to normal frequency after reaching a preset number of times; if the cosine similarity of the environmental fingerprints of the new environment and similar environments is greater than 0.8, then using transfer learning to use the historical trust level of similar environments as the Bayesian update prior mean to accelerate the convergence of trust level in the new environment; when the change magnitude of any dimension in the environmental fingerprint vector of a certain region exceeds a preset threshold, automatically resetting the trust level of all sensors in that region to 0.5 and triggering collective cold start calibration.

[0014] Preferably, the method includes: edge computing nodes being actuator nodes, environmental state nodes, control command nodes, and spatial coupling nodes; multidimensional data including actuator feedback data, environmental sensing data, and spatial relationship data; a region being defined as a physical spatial unit covered by a sensor cluster belonging to the same environmental state node group; and an environmental fingerprint vector including soil type, electromagnetic interference intensity, average wind speed, typical temperature range, and irrigation water quality.

[0015] One or more technical solutions provided in this application have at least the following technical effects or advantages: By extending the causal graph model and counterfactual reasoning, accurate attribution and online decoupling of three sources of deviation—actuator failure, spatial conflict, and model mismatch—were achieved, significantly improving control robustness in complex environments. The introduction of spatial coupling nodes and a dynamic conflict resolution mechanism effectively eliminated mutual interference between adjacent regions, preventing ineffective offsetting of control commands. Furthermore, by introducing a sensor trust management mechanism, using actuator actions as calibration benchmarks and dynamically updating trust levels based on Bayesian principles, contaminated data from abnormal sensors was effectively filtered out, ensuring the input quality of attribution reasoning. Trust-weighted fusion and dynamic adjustment of model edge weights further enhanced the robustness of the causal reasoning chain to data noise.

[0016] By establishing a mapping mechanism between regional comprehensive trust level and MPC risk preference, the control strategy can be dynamically adjusted according to data quality. It automatically switches to a conservative mode and enables cloud-based cross-validation when trust levels are low, significantly improving system safety under sensor degradation conditions. A gradual switching strategy avoids drastic oscillations in the control strategy, and long-term trend-driven preventative control upgrades from passive response to proactive prevention. Finally, by introducing environmental fingerprint vectors and a trust level partitioned storage mechanism, trust level assessment accurately adapts to sensor characteristics under different environmental conditions. Migration detection and cold start mechanisms ensure rapid calibration when sensors are deployed across regions, cross-environment transfer learning accelerates trust level convergence using historical similar data, and a trust level reset mechanism when environmental fingerprints change effectively avoids misjudgments caused by outdated data, comprehensively enhancing the system's adaptability and long-term stability in variable agricultural environments. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating an agricultural IoT smart gateway control method based on edge computing, according to an embodiment of the present invention. Detailed Implementation

[0018] To facilitate understanding of the present invention, a more complete description of this application will be given below with reference to the accompanying drawings, which illustrate preferred embodiments of the invention. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided to enable a more thorough and complete understanding of the disclosure of the present invention.

[0019] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains; the terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to limit the invention; the terminology used herein includes any and all combinations of one or more of the associated listed items.

[0020] Example 1: Figure 1 This is a flowchart illustrating an agricultural IoT smart gateway control method based on edge computing, according to an embodiment of the present invention.

[0021] like Figure 1 As shown, an agricultural IoT smart gateway control method based on edge computing includes the following steps: S1 deploys an extended causal graph model within an edge computing node, representing the causal relationships between elements in an agricultural control system in the form of a directed graph.

[0022] The edge computing nodes are divided into four types: actuator nodes, with each actuator corresponding to one node, and attributes including current control command value, actual feedback value, and fault flag; environmental status nodes, with each region's key environmental variables corresponding to one node, and attributes including real-time sensor values; control command nodes, with each MPC output target setpoint corresponding to one node, and attributes including target value; and spatial coupling nodes, a newly added type of virtual node that represents the physical influence channel between adjacent regions. Each spatial coupling node connects two adjacent region environmental status nodes, and attributes include wind direction coefficient, distance attenuation factor, and occlusion coefficient.

[0023] Edge types include: execution edges, which point from the control instruction node to the executor node and then from the executor node to the environment state node, representing a causal chain of instruction → action → environmental change; model edges, which point from one environment state node to another, or from an environment state node to a crop environment state node; and spatial coupling edges, which connect the environment state nodes of two different regions through spatial coupling nodes, representing the impact of environmental changes in one region on adjacent regions.

[0024] It should be noted that the agricultural control system connects the environment, crops, and equipment in a greenhouse, shed, or field into an automatically regulating closed-loop system; in this application, the system will be used as the term. The initial weight of each edge in the causal graph is set based on agricultural theory, and the weights are fine-tuned using historical data from fault-free and conflict-free periods through linear regression or Bayesian network learning algorithms to ensure they conform to actual physical laws.

[0025] S2: After each set of control commands is issued by MPC, a preset observation window is started, during which the edge gateway collects multidimensional data in parallel.

[0026] The window length is dynamically adjusted based on the actuator response speed. Multidimensional data includes: actuator feedback data, which acquires the actual action value of each actuator through sensors or the actuator's built-in feedback interface and records the action arrival time; environmental sensing data, which acquires real-time values ​​of environmental variables such as soil moisture, temperature, and carbon dioxide concentration through sensors in each area and calculates their rate of change; and spatial relationship data, which acquires real-time wind direction and speed through anemometers installed in the field, and, combined with pre-stored center coordinates of each area, calculates the influence intensity coefficient between areas under the current wind direction conditions.

[0027] S3 involves inputting the collected multidimensional data into the causal graph model for three hypothetical inferences, calculating the expected rate of change of the environment under different hypothetical conditions, and calculating the difference between the actual measured rate of change and the hypothetical expected rate of change.

[0028] Specifically, the multidimensional data collected within the observation window is input into the deployed extended causal graph model, and counterfactual inference is performed three times in sequence to calculate the expected rate of change of environmental variables in each region under three different assumptions.

[0029] The first inference is based on the normal assumption, which assumes that all actuators execute control commands precisely, the edge weights of the causal graph model are completely accurate, and the spatial coupling nodes are inactive. In this case, the model propagates forward along the execution edges and model edges according to the predetermined weights, calculating the expected rate of change for each environmental state node. The second inference is based on the actuator failure assumption. The actual collected actuator feedback values ​​replace the current control command values ​​of the corresponding actuator nodes in the causal graph, with all other conditions remaining the same as the normal assumption. Propagation forward again yields another set of expected rates of change. The third inference is based on the spatial conflict assumption. The actuator nodes use the same control command values ​​and the model edge weights, but the spatial coupling nodes are activated. The inter-regional influence intensity coefficient, calculated based on real-time wind direction and speed, is assigned to the attributes of the spatial coupling nodes. This causes environmental changes in adjacent regions to be superimposed on the current region through the spatial coupling edges, and propagation forward again yields the third set of expected rates of change.

[0030] After completing three inferences, the actual rate of change of environmental variables in each region is extracted from the observation data. The difference between the actual rate of change and the expected rate of change for each group is calculated to obtain the total deviation, actuator deviation and spatial deviation.

[0031] S4 makes an attribution decision by comparing the absolute values ​​and sign directions of the three differences. When the attribution result shows that spatial conflict is the dominant cause, the conflict resolution process is immediately triggered.

[0032] Specifically, the absolute values ​​and signs of the three differences calculated by S3—total deviation, actuator deviation, and spatial deviation—are compared. If the absolute value of the actuator deviation is significantly smaller than the absolute value of the total deviation, and the absolute value of the spatial deviation is close to the absolute value of the total deviation, then actuator failure is determined to be the dominant cause. In this case, further examination of the actuator feedback data is needed to distinguish between mechanical and electrical faults. If the absolute value of the spatial deviation is significantly smaller than the absolute value of the total deviation, and the absolute value of the actuator deviation is close to the absolute value of the total deviation, then spatial conflict is determined to be the dominant cause, and the conflicting regions, conflict directions, and conflict intensities are recorded. If the absolute values ​​of both the actuator deviation and the spatial deviation are significantly smaller than the absolute value of the total deviation, then the remaining deviation is attributed to model mismatch. If there is no significant difference between the absolute values ​​of the three, it is considered a mixed cause, and the responsibility weights are allocated according to the proportion of each hypothesis residual.

[0033] The attribution results are output as a triplet of actuator failure probability, model mismatch probability, and spatial conflict probability, along with specific evidence. When the attribution results show that spatial conflict is the most probable dominant cause, the conflict resolution process is triggered immediately without waiting for the next control cycle.

[0034] S5 performs edge node control processing based on the attribution results. After each attribution and resolution is completed, the control effect of the subsequent three observation windows is continuously monitored to verify the effect of the attribution results.

[0035] Specifically, based on the attribution result triplet output by S4, the edge node performs differentiated control processing. If the actuator has the highest failure probability, the edge node immediately reports a fault alarm to the cloud via the message queue telemetry transmission protocol. The alarm content includes the device identifier, fault type, fault occurrence time, and related sensor data. After receiving the alarm, the cloud automatically generates a maintenance work order and pushes it to the operation and maintenance terminal. At the same time, the edge node temporarily removes the faulty actuator from the control loop. If a backup actuator is available, it is activated; otherwise, the control strategy of adjacent areas is adjusted for compensation.

[0036] If the model mismatch probability is the highest, the edge node packages the decision vector, observation data and attribution results of this control cycle into a negative sample and stores it in the local experience pool. In subsequent federated learning training, the negative sample is given a higher sampling weight and is given priority to update the weights of related edges in the causal graph model.

[0037] If the probability of spatial conflict is the highest, the edge node will use the actual control effect after conflict resolution as a positive sample to strengthen the weight learning of the spatially coupled node. If the net effect after coordination is better than the effect of the original conflict instruction, the absolute value of the weight of the spatially coupled edge will be increased, and vice versa. At the same time, the cloud generates regional layout optimization suggestions based on the long-term accumulated conflict statistics.

[0038] After each attribution and resolution process, the edge nodes continuously monitor the control effect of the subsequent three observation windows, comparing the trend of the total deviation before and after the measures are taken: if the attribution conclusion is correct and the deviation is significantly reduced, the current causal graph parameters and decision threshold remain unchanged; if the deviation expands or does not improve, the decision threshold is automatically adjusted, or the spatial conflict judgment threshold is lowered, or the online fine-tuning of the causal graph weights is triggered, using the most recent one hundred samples for incremental learning, and the closed-loop verification mechanism enables the system to adapt to the dynamic changes of different seasons, crops and equipment aging.

[0039] The technical solutions described in the embodiments of this application have at least the following technical effects or advantages: By extending the causal graph model and counterfactual reasoning, the system achieves accurate attribution and online decoupling of three sources of deviation in agricultural control systems: actuator failure, spatial conflict, and model mismatch, significantly improving control robustness in complex environments. The introduction of spatially coupled nodes and a dynamic conflict resolution mechanism effectively eliminates mutual interference between adjacent regions, avoiding ineffective offsetting of control commands. Combined with closed-loop verification and adaptive evolution capabilities, the system can dynamically adjust parameters according to seasons, crops, and equipment aging, greatly reducing false alarm rates and the need for manual intervention, thereby improving the intelligence level and resource utilization efficiency of agricultural production.

[0040] Example 2: In Example 1, the values ​​of the environmental state nodes depend on the real-time measurement data of sensors in each area, but no differentiation is made for individual differences, aging drift, or occasional failures of different sensors. When a sensor experiences a decrease in accuracy or intermittent anomalies, its collected data still participates in the forward propagation and counterfactual inference of the causal graph with equal weight, causing the fused value of the environmental state node to deviate from the true physical value. This contaminates the weight transmission of model edges, reducing the attribution accuracy of actuator failures, spatial conflicts, and model mismatches. In addition, Example 1 lacks an active perception and early warning mechanism for sensor health status, making it impossible to intervene in the early stages of sensor performance degradation, which can easily lead to a chain of deviations in control decisions. To solve the above problems, a dynamic sensor trust evaluation mechanism needs to be introduced into the causal graph model. By establishing an independent trust node for each sensor, constructing calibration events using actuator actions, updating the trust based on Bayesian principles, and using the trust as the basis for weighted fusion and causal graph parameter adjustment, data quality and attribution robustness can be improved. Therefore, Example 2 is proposed.

[0041] In some embodiments, edge node control processing is performed based on the attribution results, and step S5 further includes: S51, in the causal graph model deployed within the edge computing node, establishes an independent trust node for each sensor and determines the trust score based on experimental experience.

[0042] In this context, the trust level node is not part of the causal path in the causal graph, but rather a dynamic parameter node with a value ranging from 0 to 1, initially set to 1. Trust level reflects the reliability of the sensor's current data; the higher the trust level, the greater the fusion weight of the sensor data in subsequent state estimation. The trust level value is determined based on factors including sensor ID, installation location, model, last calibration time, historical trust level curve, consecutive normal counts, and consecutive abnormal counts.

[0043] S52, after the actuator action issued by MPC is completed, calculates the expected value of the current environmental variable through the edge and physical parameters of the cause-effect graph model, and compares it with the measured value of each sensor to obtain the relative deviation.

[0044] The physical parameters include the actuator's rated output, action duration, area, soil water holding capacity, and current crop transpiration rate. The expected change in environmental variables for the area due to this action is calculated using physical models such as the water balance equation, yielding the expected value. Each sensor within the area reads its measured value after the action concludes, and the relative deviation percentage for each sensor is calculated—the absolute value of the difference between the measured value and the expected value divided by the expected value.

[0045] S53 treats each calibration event as an observation and updates the confidence level based on the relationship between the relative deviation and a preset threshold according to the Bayesian principle.

[0046] Specifically, if the relative deviation δ of a sensor is less than a preset first threshold (5%), the sensor is considered to have performed normally in this calibration event, its consecutive normal count is incremented by 1, and its consecutive abnormal count is reset to zero. Trust level recovers as follows: New Trust Level = min(1, Old Trust Level + 0.05). Trust level increases by 0.05 for each normal event; the more consecutive normal events, the faster the trust level recovers.

[0047] If the relative deviation δ of a sensor exceeds a preset second threshold (20%), the sensor is considered to have malfunctioned during the calibration event. Its consecutive abnormality count is incremented by 1, and the consecutive normality count is reset to zero. The confidence level decreases as follows: New confidence level = Old confidence level × Attenuation factor. The attenuation factor is determined by the consecutive abnormality count: 0.8 for the first abnormality, 0.6 for the second, 0.4 for the third, and thereafter, the attenuation factor remains fixed at 0.4 for each consecutive abnormality, with the confidence level dropping to a minimum of 0.1.

[0048] If the relative deviation is between the first threshold and the second threshold, it is considered an uncertain event. The confidence level remains unchanged, but the consecutive normal counts and consecutive abnormal counts are not cleared. Instead, they are each multiplied by a forgetting factor (0.9) to attenuate the historical cumulative effect and prevent long-term accumulation of bias.

[0049] It should be noted that after each update, the new trust level is smoothed with the historical trust level of the sensor (exponential moving average) to avoid drastic fluctuations in the trust level caused by a single anomaly.

[0050] S54, when performing causal attribution, the values ​​of environmental state nodes are weighted by trust level to obtain the fusion value, and data below the lower limit are removed and an alarm is triggered; the model edge weights in the causal graph are dynamically adjusted according to the trust level of the sensors they rely on.

[0051] Specifically, when performing causal attribution, the values ​​of environmental state nodes are no longer taken as a simple arithmetic mean or median, but rather as a weighted average based on the confidence level of each sensor. The calculation formula is as follows: Sensor data with a trust level below a preset lower limit (0.3) is completely excluded, not included in the weighted average, and triggers a maintenance alarm pushed to the operations and maintenance personnel. The model edge weights in the causal graph are also dynamically adjusted according to the sensor trust level: if the data of a certain environmental state node mainly comes from sensors with low trust levels, the weights of all model edges dependent on that node are temporarily reduced (multiplied by 0.5) to avoid low-quality data contaminating the causal inference chain. When the trust level of that sensor recovers, the model edge weights recover synchronously.

[0052] In S55, edge computing nodes upload the trust level changes of each sensor to the cloud. The cloud uses trend analysis to predict when the trust level will fall below the lower limit and generates predictive maintenance work orders in advance.

[0053] S56 can proactively trigger low-power calibration events during system idle periods, and the calibration frequency is dynamically adjusted according to the sensor trust level.

[0054] The technical solutions described in the embodiments of this application have at least the following technical effects or advantages: By introducing a sensor trust management mechanism into the causal graph model, the reliability and anti-interference capability of the data acquisition process are significantly improved. Utilizing actuator actions as a natural calibration benchmark and dynamically updating the trust levels of each sensor based on Bayesian principles, contamination data from abnormal or degraded sensors is effectively filtered out, ensuring the input quality for subsequent counterfactual inference and attribution decisions. The trust-weighted fusion mechanism makes state estimation closer to real physical conditions, and the dynamic adjustment of model edge weights further enhances the robustness of the causal inference chain to data noise. Cloud-based predictive maintenance transforms sensor fault response from passive to proactive early warning, significantly reducing the risk of control interruption due to sudden failures and improving the overall long-term stability and operational efficiency of the system.

[0055] Example 3: In Example 2, dynamic assessment and weighted fusion of sensor trust levels effectively improved data quality and attribution robustness. However, its impact on the MPC control strategy was limited to data-level corrections and did not dynamically adjust the aggressiveness of the control objective based on changes in data quality. When the overall regional data quality deteriorated due to the simultaneous degradation of multiple sensors, MPC still operated in the default high-precision tracking mode, potentially leading to over-control based on unreliable perception and increasing security risks. Furthermore, Example 2 lacked a mapping mechanism from regional data quality to control strategy risk preference, failing to automatically switch to a conservative mode when data quality deteriorated or smoothly transition during recovery. To address these issues, a dynamic linkage mechanism between regional comprehensive trust level and MPC risk preference needs to be established based on sensor trust management to achieve adaptive adjustment of the control strategy to data quality. Example 3 is proposed for this purpose.

[0056] In some embodiments, step S55, where the edge computing node uploads the trust level changes of each sensor to the cloud, further includes: S551, at the beginning of each MPC control cycle, the edge node calculates the overall trust level for each region, which is defined as the weighted geometric mean of the trust levels of all sensors involved in the control within that region.

[0057] In this context, a region is defined as a physical spatial unit covered by a sensor cluster belonging to the same environmental state node group. Specifically, each region corresponds to a set of environmental state nodes. For example, the environmental state nodes of region A include three physical quantities: soil moisture, air temperature, and carbon dioxide concentration. Each physical quantity is observed by several redundant sensors. These sensors constitute the sensor set involved in the control of this region, and the weighted geometric average of the overall trust level of the region is calculated on this set.

[0058] S552, pre-establish a mapping table between trust level and risk, mapping the overall trust level range to the MPC risk preference level. The mapping relationship is as follows: overall trust level ≥ 0.9 corresponds to high risk preference; 0.7 ≤ overall trust level < 0.9 corresponds to medium risk preference; 0.5 ≤ overall trust level < 0.7 corresponds to low risk preference; overall trust level < 0.5 corresponds to conservative mode.

[0059] S553, dynamically modify the objective function of MPC according to the risk level; when the overall regional trust level recovers from a low level, MPC adopts a gradual switching strategy to switch back to a high-risk preference.

[0060] Specifically: In high-risk preference mode, the objective function remains at its default settings, with accurate tracking of the setpoint as the primary objective; in medium-risk preference mode, a small control penalty term is added to the objective function to suppress excessive control actions; in low-risk preference mode, the variation in control variables is limited to within 70% of the default allowable range; in conservative mode, the weight of the tracking error term in the objective function is significantly reduced, while the weights of the control cost term and the safety constraint violation penalty term are increased. Simultaneously, the original soft constraints are tightened into hard constraints, such as limiting the humidity range to absolutely not falling below 15% or exceeding 35%, and disabling all actuators that may cause risk. When the overall regional confidence level recovers from a low level, MPC does not immediately switch back to high-risk preference, but instead adopts a gradual switching strategy: within N consecutive control cycles, if the overall confidence level remains above the threshold corresponding to the current risk preference level, the risk preference is increased by one level each cycle until it returns to high-risk preference mode, thereby avoiding drastic fluctuations in the control strategy caused by a single calibration event.

[0061] S554: When the overall trust level of a region is too low, the edge node automatically switches the control task of that region from edge inference to cloud inference and uses cloud sensor data for cross-validation.

[0062] Specifically, the edge node packages and uploads the current environmental sensor data, actuator feedback data, and spatial relationship data of the area to the cloud. After receiving the data, the cloud uses its stored satellite remote sensing data, historical and real-time data from neighboring farms, and a more comprehensive global model for cross-validation to recalculate the estimated environmental state and control commands for the area. The cloud then sends the inferred control commands back to the edge node. Upon receiving the cloud commands, the edge node directly sends them to the corresponding actuators for execution. Simultaneously, it treats the cloud inference result as an additional calibration event to update the trust level of each sensor in the area, accelerating the recovery of local sensor trust. Once the overall trust level of the area rises above a preset lower limit and remains stable, the edge node switches the control task back to edge inference mode.

[0063] S555 uses the cloud to predict potential data quality crises based on long-term trends in overall trust levels across different regions, and adjusts agricultural plans accordingly in advance.

[0064] The technical solutions described in the embodiments of this application have at least the following technical effects or advantages: By introducing a regional comprehensive trust level and risk preference mapping mechanism, the MPC control strategy can dynamically adjust according to the quality of sensor data. When the trust level is low, it automatically switches to a conservative mode and enables cloud cross-validation, which significantly improves the system's safety and robustness under sensor degradation or abnormal operating conditions. The gradual switching strategy avoids drastic fluctuations in the control strategy and ensures a smooth system transition. The long-term trend-driven preventive control realizes the upgrade from passive response to active prevention, effectively reducing the risk of sudden failures and maintenance costs, and comprehensively enhancing the adaptive capability and reliability of the agricultural IoT smart gateway.

[0065] Example 4: In Example 3, by introducing a regional comprehensive trust level and risk preference mapping mechanism, the MPC control strategy was dynamically and adaptively adjusted to improve data quality, effectively enhancing the system's safety under sensor degradation conditions. However, in Example 3, the trust level of each sensor still adopted a global scalar form, meaning the same sensor shared the same trust level value under all environmental conditions. In actual agricultural environments, the measurement accuracy of the same sensor may vary significantly in different regions. The global scalar cannot reflect this environmental dependence, leading to overestimation or underestimation of the sensor's trust level in some environments, thus affecting the accuracy of weighted fusion and attribution inference. Furthermore, when sensors migrate across regions, the global trust level cannot distinguish between old and new environments, requiring the system to accumulate calibration samples from scratch, resulting in slow convergence. To address these issues, an environmental fingerprint vector needs to be introduced for partitioned storage and management of sensor trust levels, enabling refined adaptation of trust level assessment to environmental conditions. Example 4 is proposed for this purpose.

[0066] In some embodiments, step S551, where the edge node calculates the overall trust level for each region, further includes: 1A defines a unique region identifier for each region and associates it with an environmental fingerprint vector. The environmental fingerprint of each region is determined during system initialization.

[0067] The environmental fingerprint vector includes: soil type (sand / loam / clay), electromagnetic interference intensity (measured by a spectrum analyzer), average wind speed, typical temperature range, and irrigation water quality (EC value).

[0068] 1B, the trust level of each sensor in the region adopts a dictionary structure associated with the environmental fingerprint. The key of the dictionary is the region identifier, and the value is the trust level of the sensor in the environment of that region. When the sensor undergoes a calibration event in a specific environment, only the trust level entry corresponding to that environment is updated, and the trust level in other environments remains unchanged.

[0069] The associated dictionary structure has key-value pairs in the form of {environment fingerprint A: trust level A, environment fingerprint B: trust level B, ...}.

[0070] 1C: When the sensor migrates, it detects a change in position, creates a temporary trust level entry with an initial value of 0.5 for the new environment, starts a high-frequency calibration event to accumulate samples, and switches to normal frequency after reaching a preset number of times.

[0071] Specifically, edge nodes periodically verify the current assigned region of each sensor. By comparing the gateway access point identifier reported by the sensor or the coordinates returned by the built-in positioning module with the pre-stored spatial boundaries of each region (defined during system initialization), if the current assigned region is inconsistent with the region at the time of the last trust update, it is determined that the sensor has migrated across regions. The edge node adds a new entry to the sensor's trust dictionary with the new region identifier as the key, with an initial value of 0.5, and marks the entry as cold start. In cold start mode, the edge node actively triggers low-power calibration events for the new region to which the sensor belongs. The calibration event interval is set to a preset high-frequency calibration interval (30 minutes / time), and the actuator movement amplitude of a single calibration is controlled within 20% of the actuator's rated output to avoid disturbing the normal growth of organisms. The number of valid calibration events (i.e., calibration events that have been completed and whose relative deviation can be calculated) is counted separately. When the cumulative number of valid calibration events under the new region entry reaches the preset threshold (10 times), the edge node clears the cold start flag of the entry, and the active calibration frequency of the region is switched to the normal frequency that matches the current sensor trust level, connecting to the subsequent regular calibration logic.

[0072] 1D. If the cosine similarity of the environmental fingerprints of the new environment and similar environments is greater than 0.8, then transfer learning is used to use the historical trust of similar environments as the Bayesian update prior mean to accelerate the convergence of trust in the new environment.

[0073] Specifically, if the sensor's initial calibration performance in a new region is highly correlated with its performance in historically similar regions, and the cosine similarity of the environmental fingerprint vectors of the two regions is greater than 0.8, then the system uses transfer learning to use the historical trust value of the similar region as the prior mean of the Bayesian update, instead of using the default 0.5, thereby accelerating the convergence of the trust value in the new region.

[0074] It should be noted that before calculating cosine similarity, each dimension of the environmental fingerprint vector needs to be normalized, and discrete dimensions need to be converted into one-hot encoding or ordered values.

[0075] 1F: When the change in any dimension of the environmental fingerprint vector of a certain area exceeds the preset threshold, the trust level of all sensors in that area will be automatically reset to 0.5 and a collective cold start calibration will be triggered.

[0076] The technical solutions described in the embodiments of this application have at least the following technical effects or advantages: By introducing a partitioned storage mechanism for environmental fingerprint vectors and sensor trust scores, trust score assessment can accurately adapt to sensor characteristics under different environmental conditions, significantly improving the accuracy of data quality evaluation. The migration detection and cold start mechanism ensures rapid calibration and reliable access when sensors are deployed across regions. Cross-environment transfer learning utilizes historical similar environmental data to accelerate trust score convergence, greatly shortening the adaptation cycle in new environments. The trust score reset mechanism when environmental fingerprints change effectively avoids misjudgments caused by outdated data, comprehensively enhancing the system's adaptability and long-term operational stability in the ever-changing agricultural environment.

[0077] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. For those skilled in the art, the present invention can have various modifications and variations. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A smart gateway control method for agricultural IoT based on edge computing, characterized in that, include: S1, Deploy an extended causal graph model within the edge computing node to represent the causal relationships between elements in the agricultural control system in the form of a directed graph; S2: After each set of control commands is issued by MPC, a preset observation window is started, during which the edge gateway collects multi-dimensional data in parallel. S3, input the collected multidimensional data into the causal graph model to perform three hypothesis inferences, calculate the expected rate of change of the environment under different hypothesis conditions, and calculate the difference between the actual measured rate of change and the assumed expected rate of change; S4 makes an attribution decision by comparing the absolute values ​​and sign of the three differences. When the attribution result shows that spatial conflict is the dominant cause, the conflict resolution process is immediately triggered. S5 performs edge node control processing based on the attribution results. After each attribution and resolution is completed, the control effect of the subsequent three observation windows is continuously monitored to verify the effect of the attribution results.

2. The agricultural IoT smart gateway control method based on edge computing according to claim 1, characterized in that, The three hypothetical reasoning steps specifically include: the first reasoning is based on the normal assumption, which assumes that all actuators accurately execute control commands, the edge weights of the causal graph model are accurate, and the spatial coupling nodes are not activated, and propagates forward along the execution edges and model edges according to the predetermined weights; the second reasoning is based on the actuator failure assumption, which replaces the control command value of the corresponding actuator node with the actuator feedback value, and the other conditions are the same as the normal assumption; the third reasoning is based on the spatial conflict assumption, which keeps the actuator nodes using control command values ​​and the model edge weights unchanged, activates the spatial coupling nodes and assigns the inter-regional influence intensity coefficient to their attributes, so that the environmental changes of adjacent regions are superimposed through the spatial coupling edges.

3. The agricultural IoT smart gateway control method based on edge computing according to claim 1, characterized in that, The immediate triggering of the conflict resolution process includes: when the attribution results show that spatial conflict is the most probable dominant cause, the conflict resolution process is triggered immediately without waiting for the next control cycle.

4. The agricultural IoT smart gateway control method based on edge computing according to claim 1, characterized in that, The edge node control processing based on the attribution results specifically includes: S51, in the causal graph model deployed within the edge computing node, establishing an independent trust node for each sensor and determining the trust score based on experimental experience; S52, after the actuator action issued by MPC is completed, calculating the expected value of the current environmental variable through the edges of the causal graph model and physical parameters, and comparing it with the measured values ​​of each sensor to obtain the relative deviation; S53, treating each calibration event as an observation, and updating the trust score based on the relationship between the relative deviation and a preset threshold according to the Bayesian principle; S54, during causal attribution, the environmental state node value is weighted by trust score to obtain the fusion value, data below the lower limit is removed and an alarm is triggered; the model edge weights in the causal graph are dynamically adjusted according to the trust score of the dependent sensor; S55, the edge computing node uploads the trust score changes of each sensor to the cloud, and the cloud uses trend analysis to predict the time when the trust score will fall below the lower limit, generating predictive maintenance work orders in advance; S56, actively triggering low-energy calibration events during idle periods, with the calibration frequency dynamically adjusted according to the sensor trust score.

5. The agricultural IoT smart gateway control method based on edge computing according to claim 4, characterized in that, The method of updating the trust level based on the relationship between relative deviation and a preset threshold according to Bayesian principles specifically includes: if the relative deviation is less than the first threshold, it is determined to be a normal event, the consecutive normal count is increased and the consecutive abnormal count is cleared, and the trust level recovers according to a preset recovery step size; if the relative deviation is greater than the second threshold, it is determined to be an abnormal event, the consecutive abnormal count is increased and the consecutive normal count is cleared, and the trust level decreases according to a preset decay factor, which decreases as the number of consecutive abnormal events increases; if the relative deviation is between the first threshold and the second threshold, it is determined to be an uncertain event, the trust level remains unchanged, and the consecutive normal count and the consecutive abnormal count are multiplied by a forgetting factor to decay the historical cumulative effect.

6. The agricultural IoT smart gateway control method based on edge computing according to claim 4, characterized in that, The model edge weights in the causal graph are dynamically adjusted based on the trust level of the sensors they rely on, including: if the data of a certain environmental state node mainly comes from a sensor with a low trust level, then the weights of all model edges that depend on that node are temporarily reduced; when the trust level of that sensor is restored, the model edge weights are restored synchronously.

7. The agricultural IoT smart gateway control method based on edge computing according to claim 3, characterized in that, Uploading the trust level changes of each sensor to the cloud at the edge computing node includes: S551, at the beginning of each MPC control cycle, the edge node calculates the comprehensive trust level of each region, defined as the weighted geometric average of the trust levels of all sensors involved in control within that region; S552, a trust level-risk mapping table is pre-established, mapping the comprehensive trust level range to the MPC risk preference level; S553, the objective function of the MPC is dynamically modified according to the risk level; when the comprehensive trust level of a region rises from a low level, the MPC adopts a gradual switching strategy to switch back to a high risk preference; S554, when the comprehensive trust level of a region is too low, the edge node automatically switches the control task of that region from edge inference to cloud inference, using cloud sensor data for cross-validation; S555, the cloud predicts potential data quality crises based on the long-term trend of the comprehensive trust level of each region and adjusts agricultural plans in advance.

8. The agricultural IoT smart gateway control method based on edge computing according to claim 7, characterized in that, The cross-validation process involves the following steps: edge nodes upload environmental sensor data, actuator feedback data, and spatial relationship data of the current area to the cloud; the cloud uses the stored multi-source data to perform cross-validation, recalculates the estimated environmental state and control commands for the area; the cloud sends the inferred control commands back to the edge nodes, which then send them to the corresponding actuators for execution.

9. The agricultural IoT smart gateway control method based on edge computing according to claim 7, characterized in that, The calculation of the comprehensive trust level for each region at the edge node includes: defining a unique region identifier for each region and associating it with an environmental fingerprint vector; the environmental fingerprint of each region is determined during initialization; the trust level of each sensor within the region adopts a dictionary structure associated with the environmental fingerprint; detecting position changes during sensor migration, creating a temporary trust level entry with an initial value of 0.5 for the new environment, initiating high-frequency calibration events to accumulate samples, and switching to normal frequency after reaching a preset number of times; if the cosine similarity of the environmental fingerprints of the new environment and similar environments is greater than 0.8, then using transfer learning to use the historical trust level of similar environments as the Bayesian update prior mean to accelerate the convergence of trust level in the new environment; when the change in any dimension of the environmental fingerprint vector of a certain region exceeds a preset threshold, the trust level of all sensors in that region is automatically reset to 0.5 and a collective cold start calibration is triggered.

10. The agricultural IoT smart gateway control method based on edge computing according to claim 1, characterized in that, The method includes: edge computing nodes are actuator nodes, environmental state nodes, control command nodes, and spatial coupling nodes; multidimensional data includes actuator feedback data, environmental sensing data, and spatial relationship data; a region is defined as a physical spatial unit covered by a sensor cluster belonging to the same environmental state node group; and the environmental fingerprint vector includes soil type, electromagnetic interference intensity, average wind speed, typical temperature range, and irrigation water quality.