Greenhouse environment parameter short-term prediction method and system based on deep neural network

CN122655858APending Publication Date: 2026-08-28YUXI AGRI VOCATIONAL & TECH COLLEGE
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

当预测温度偏离目标时,控制器只能依据偏差量被动响应,难以在多个候选控制方案中预判优劣并主动择优

Benefits of technology

当所述输出不确定度降低时,减小所述风险成本项的权重系数;以此使控制器在模型置信度不足时,自动在优化求解中趋向于选择推演方差更小、控制效果更保守安全的控制指令序列。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122655858A_ABST
    Figure CN122655858A_ABST
Patent Text Reader

Abstract

The application discloses a greenhouse environment parameter short-term prediction method and system based on a deep neural network, comprising the following steps: obtaining a current environment state of a greenhouse; and using a pre-trained environment deduction model with the current environment state and a plurality of candidate control instruction sequences as inputs. A greenhouse environment parameter short-term prediction method based on a deep neural network according to an embodiment of the application changes a traditional passive mode of 'predicting temperature changes' into an active decision-making mode of 'deducing control consequences'. The environment deduction model quickly pre-rehearses future effects of different control instructions in a virtual space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of greenhouse prediction, and in particular to a method and system for short-term prediction of greenhouse environmental parameters based on deep neural networks. Background Technology

[0002] In greenhouse environmental control, temperature prediction is a crucial tool for assisting control decision-making. A common approach in existing technologies is to first use deep learning models such as BP neural networks and LSTM to predict future greenhouse temperatures over time, then use the prediction results as input for a PID controller or rule-based controller to calculate control commands. This method separates prediction and control into two independent steps. The prediction model only outputs the future temperature value and does not directly answer the crucial question of "how the temperature will change after executing a certain control action." When the predicted temperature deviates from the target, the controller can only passively respond based on the deviation, making it difficult to predict the merits of multiple candidate control schemes and actively select the optimal one. Therefore, existing technologies suffer from a disconnect between prediction and control, and the prediction results cannot directly guide optimal control decisions. Summary of the Invention

[0003] This application aims to at least partially address one of the technical problems in the related art.

[0004] Therefore, one objective of this application is to provide a short-term prediction method for greenhouse environmental parameters based on deep neural networks, transforming the traditional passive mode of "predicting temperature changes" into an active decision-making mode of "parameterizing control consequences." By rapidly pre-simulating the future effects of different control commands in a virtual space through an environmental simulation model, the controller can compare the advantages and disadvantages of each scheme before execution, thereby achieving rolling optimization decisions that balance temperature control accuracy, energy saving, and risk avoidance without relying on precise mechanistic models.

[0005] To achieve the above objectives, the first aspect of this application proposes a short-term prediction method for greenhouse environmental parameters based on deep neural networks, comprising the following steps: Obtain the current environmental status of the greenhouse ; Using a pre-trained environment inference model, with the current environment state and multiple candidate control instruction sequences As input, the future environmental state sequence corresponding to each candidate control command sequence is derived. The environmental simulation model is a deep neural network that learns the state transition laws of the greenhouse environment; Based on each candidate control command sequence and its inferred future environmental state sequence, the value of a preset cost function is calculated. The cost function includes at least a target environmental parameter deviation penalty term, a control energy consumption cost term, and a risk cost term related to the uncertainty of the output of the environmental inference model. Select the first control instruction from the candidate control instruction sequence that minimizes the cost function value. , And execute the control command; Repeat the above steps to complete the rolling optimization based on model predictive control.

[0006] This application presents a method for short-term prediction of greenhouse environmental parameters based on deep neural networks, transforming the traditional passive mode of "predicting temperature changes" into an active decision-making mode of "parameterizing control consequences." By rapidly pre-simulating the future effects of different control commands in a virtual space using an environmental simulation model, the controller can compare the advantages and disadvantages of each scheme before execution. This allows for rolling optimization decisions that balance temperature control accuracy, energy conservation, and risk avoidance without relying on precise mechanistic models.

[0007] In addition, the short-term prediction method for greenhouse environmental parameters based on deep neural networks proposed in this application may also have the following additional technical features: In one embodiment of this application, the training steps of the environment simulation model include: State transition pairs are constructed from historical greenhouse operation data, with each pair including the current state. Execution of control commands and the next state ; In the current state and control commands As input to the model, the following state The environmental inference model is trained using supervisory labels. Loss function used in training for:

[0008] in, To predict error loss, Penalty loss for physical consistency These are the weighting coefficients. The environmental simulation model is based on the current state. and control commands The predicted value of the next state output by the deduction. This represents the actual value of the next state collected in this sample pair.

[0009] In one embodiment of this application, the physical consistency penalty loss is constructed based on the thermodynamic laws inside the greenhouse and is used to penalize deduction results that violate physical laws. The deduction results that violate physical laws include at least the following: after executing the cooling control command, the deduced temperature rises instead without the intervention of other external heat sources.

[0010] In one embodiment of this application, the inclusion of the risk cost item follows the following threshold determination mechanism: Set an upper limit for the tolerance of uncertainty; When the inference variance corresponding to the candidate control instruction sequence is lower than the uncertainty tolerance upper limit, the value of the risk cost term is set to zero; When the variance of the deduction corresponding to the candidate control instruction sequence is equal to or higher than the uncertainty tolerance limit, the value of the risk cost term is included in the cost function.

[0011] In one embodiment of this application, the cost function, for any candidate control instruction sequence, has a total cost value. The calculation method is as follows:

[0012] in, To extrapolate the temperature, For the target temperature, To control the energy consumption cost corresponding to the command, To extrapolate the variance, , , These are the weighting coefficients.

[0013] In one embodiment of this application, the weighting coefficient , , At least one of them is a dynamically adjustable coefficient; during the rolling optimization process of model predictive control, the values ​​of each weight coefficient are dynamically adjusted according to the output uncertainty of the environmental extrapolation model as evaluated in real time, wherein: When the output uncertainty increases, the weighting coefficient of the risk cost item is increased. ; When the output uncertainty decreases, the weighting coefficient of the risk cost item is reduced. This enables the controller to automatically select a sequence of control commands with smaller inference variance and more conservative and safer control effect during the optimization process when the model confidence is insufficient.

[0014] In one embodiment of this application, the target environment parameter deviation penalty term further includes a safety hard constraint; when the predicted future environment state violates a preset safety threshold, the candidate control command sequence containing the prediction result is processed as follows: By directly assigning a maximum cost value to the cost function, the candidate control instruction sequence is eliminated during the optimization process; And directly remove the candidate control instruction sequence from the set of options for optimization.

[0015] The preset safety thresholds include at least one of the following: the lower limit of indoor temperature and the upper limit of indoor temperature.

[0016] In one embodiment of this application, a highest-level security verification and mode switching step is included before executing the control command: The confidence index of the current simulation result output by the environmental simulation model is obtained in real time. When the confidence index is lower than the preset safety confidence threshold, the model predictive control mode is determined to be unreliable, and the control mode is automatically switched to the classic feedback control mode. Once the confidence index rises above the safety confidence threshold and remains stable for a preset duration, the system switches back from the classic feedback control mode to the model prediction control mode.

[0017] In one embodiment of this application, the environmental simulation model is first run in shadow mode before being put into closed-loop control: The environmental simulation model receives the actual state of the greenhouse and the actual control commands being executed, performs real-time simulations, but does not output control commands to the outside world. The model accuracy is evaluated and optimized by comparing the simulation results with the actual future state collected. Once the model's simulation accuracy meets the preset performance indicators, switch to closed-loop control mode.

[0018] A second aspect of this application proposes a short-term prediction system for greenhouse environmental parameters based on deep neural networks, comprising: The status sensing module is used to obtain the current environmental status of the greenhouse; The environment simulation model module is equipped with a pre-trained environment simulation model, which is used to infer the future environment state sequence based on the current environment state and candidate control command sequence. The training loss function of this model includes a prediction error loss term and a physical consistency penalty loss term based on thermodynamic laws. The decision module is used to select the optimal command from multiple candidate control command sequences according to a preset cost function and output the first control command. The cost function includes a target environment parameter deviation penalty term, a control energy consumption cost term, and a risk cost term determined by the model output variance. The safety switching module is used to monitor the inference error or uncertainty of the environmental simulation model and automatically switch from the model predictive control mode to the classical feedback control mode when preset conditions are met. The execution module is used to send the final control commands to the greenhouse actuator.

[0019] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0020] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 This is a flowchart of a method for short-term prediction of greenhouse environmental parameters based on a deep neural network according to an embodiment of this application; Figure 2 This is a system block diagram of a short-term prediction system for greenhouse environmental parameters based on a deep neural network, according to another embodiment of this application. Detailed Implementation

[0021] Embodiments of this application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application. Rather, embodiments of this application include all variations, modifications, and equivalents falling within the spirit and scope of the appended claims.

[0022] The following is in conjunction with the appendix Figure 1-2 This application describes a method for short-term prediction of greenhouse environmental parameters based on deep neural networks, comprising the following steps: Obtain the current environmental status of the greenhouse ; Using a pre-trained environment inference model, with the current environment state and multiple candidate control instruction sequences As input, the future environmental state sequence corresponding to each candidate control command sequence is derived. The environmental simulation model is a deep neural network that learns the state transition laws of the greenhouse environment; Based on each candidate control command sequence and its inferred future environmental state sequence, the value of the preset cost function is calculated. The cost function includes at least a target environmental parameter deviation penalty term, a control energy consumption cost term, and a risk cost term related to the uncertainty of the environmental simulation model output. Select the first control instruction from the candidate control instruction sequence that minimizes the cost function value.

[0023] and execute the control command; Repeat the above steps to complete the rolling optimization based on model predictive control.

[0024] Specifically, in practical use, this method is a closed-loop control process based on a neural network model for rolling optimization, which is manifested in the following steps.

[0025] First, the system collects environmental data in real time through sensors deployed inside the greenhouse (such as temperature and humidity sensors, light sensors, CO2 sensors, etc.) to determine the current environmental status. This state vector includes environmental parameters related to crop growth, such as indoor temperature, humidity, light intensity, and CO2 concentration.

[0026] Secondly, the system invokes a pre-trained environmental simulation model. This model was trained offline using historical greenhouse operating data before being put into actual control, learning the state transition patterns of the greenhouse environment under various control commands. During actual operation, the controller generates multiple candidate control command sequences. For example, combinations of consecutive future HH steps such as "sunroof opening 30%, fan speed 50%". These candidate sequences are then compared with the current state. Once all the candidate sequences are input into the environmental simulation model, the model can deduce the future environmental state sequence corresponding to each candidate sequence. .

[0027] Then, the system calculates the value of a preset cost function for each candidate sequence. This cost function takes into account three factors: first, the penalty term for deviation of the target environmental parameters, i.e., the difference between the projected temperature and the target temperature; second, the control energy consumption cost term, i.e., the electrical energy, heat energy, etc. required to execute the control sequence; and third, the risk cost term related to the uncertainty of the model output, i.e., the confidence level of the model in the result of this projection.

[0028] Finally, the system compares the cost values ​​of all candidate sequences, selects the one with the lowest cost, and takes the first control instruction from that sequence. The commands are then sent to the greenhouse actuators (such as skylight motors, fans, and evaporative cooling pad pumps) for execution. After execution, the system collects new environmental data again and repeats the above process of perception-deduction-evaluation-execution, forming a continuously optimized closed-loop control.

[0029] It should be noted that, in this embodiment, the greenhouse environment condition Data is collected in real time by a variety of sensors. These sensors include, but are not limited to: air temperature and humidity sensors, soil temperature sensors, light intensity sensors, CO2 concentration sensors, and soil nitrogen, phosphorus, and potassium nutrient sensors. The sensors are deployed in representative areas within the greenhouse, and the data is aggregated to a local controller or edge computing device via wired or wireless means for subsequent model extrapolation and control decisions.

[0030] In one embodiment of this application, the training steps of the environmental simulation model include: State transition pairs are constructed from historical greenhouse operation data, with each pair including the current state. Execution of control commands and the next state ; In the current state and control commands As input to the model, the following state As a supervisory label, it is used to train the environment inference model; Loss function used in training for:

[0031] in, To predict error loss, Penalty loss for physical consistency These are the weighting coefficients. The environmental simulation model is based on the current state. and control commands The predicted value of the next state output by the deduction. This represents the actual value of the next state collected in this sample pair.

[0032] Specifically, an explanation of the training process for the environmental simulation model.

[0033] The environmental simulation model was trained offline before being put into actual control. Its purpose was to allow the model to learn the environmental state changes of the greenhouse under various control commands. The training process is as follows.

[0034] First, training samples are constructed from historical greenhouse operation data. During daily operation, the greenhouse control system continuously records sensor readings (i.e., environmental conditions) and control commands executed at that time (such as skylight opening and fan speed). These time-series data are then reorganized into "state transition sample pairs" in chronological order. Each sample pair contains three parts: the current state. Control commands to be executed at the current moment And the actual state collected by the sensor at the next moment. This is equivalent to telling the model: "In..." Under such environmental conditions, it was executed With such control actions, the environment actually becomes ".

[0035] Secondly, the model is trained using the aforementioned samples under supervised learning conditions. The current state is then used. and control commands Together with the model input, the true state at the next moment is used. As a supervisory label (i.e., the target the model needs to learn to approximate), the model computes a predicted next state based on the input. to compare it with the real The models are compared, and the difference between them is calculated. During the training process, the internal parameters of the model are repeatedly adjusted to gradually reduce this difference until the model can accurately deduce the "next state" based on the "current state + control command".

[0036] Finally, the loss function used for training, in addition to the usual prediction error loss... In addition, a physical consistency penalty loss was added. The purpose of including this term is to increase the loss value when the model extrapolates results that violate the laws of greenhouse thermodynamics (for example, when the model predicts an increase in indoor temperature despite opening skylights for cooling). This additional penalty term forces the model to correct this unreasonable prediction tendency during parameter updates. Weighting coefficients This is used to adjust the proportion of the physical consistency penalty in the overall loss function. After training, the model can be used for environmental simulations in real-world control scenarios.

[0037] Furthermore, physical consistency penalty loss Based on the thermodynamic laws inside the greenhouse, it is used to punish the deduction results that violate the physical laws. The deduction results that violate the physical laws include at least the following: after executing the cooling control command, the deduced temperature rises instead without the intervention of other external heat sources.

[0038] Physical consistency penalty loss The specific calculation method is as follows: For each state transition data in the training samples, let the indoor temperature in the current state be...

[0039] The ventilation opening degree in the executed control command is The predicted temperature for the next moment is Then, judge the following conditions: like (The opening of the ventilation vents is increased) and (If the inferred temperature rises instead), then the sample violates the physical laws by a certain amount. ; like (The opening of the ventilation vents is reduced) and (If the inferred temperature decreases instead), then the violation of this sample pair is... ; Otherwise, it violates the principle of quantity. ; The physical consistency penalty loss is the violation amount of all samples in that training batch. Mean square value:

[0040] in This represents the number of samples in this training batch.

[0041] Specifically, the role of the physical consistency penalty loss is to identify and penalize deductions that violate basic thermodynamic principles of greenhouses during model training, ensuring that the trained model not only fits historical data but also conforms to known physical laws. The specific calculation process is as follows.

[0042] First, each sample in the training batch is evaluated individually. Each sample contains the current indoor temperature. The opening degree of the ventilation opening in the control command being executed at the current moment. And the temperature at the next moment predicted by the model. The judgment is based on a fundamental thermodynamic principle: in the absence of other external heat sources, increasing the opening of the vents (i.e., increasing natural ventilation) should lower the indoor temperature, while decreasing the opening of the vents should raise or maintain the indoor temperature.

[0043] Based on this common sense, we will make judgments one by one. If the current control command shows that the vent opening is larger than the previous moment ( (i.e., performing a cooling operation), but the model predicts that the temperature at the next moment will be higher than the current temperature. This indicates that the model's deduction results violate physical laws, and the violation amount should be recorded at this point. The larger the value, the more severe the violation. Conversely, if the ventilation opening is reduced ( However, the predicted temperature actually decreased. This also falls under the category of violating physical laws; in this case, the violation of quantity... Apart from the two situations mentioned above, all other situations are not considered violations, and the penalty for violation is... Set it directly to zero.

[0044] After completing the checklist, calculate the violation rate for all samples in the training batch. Calculate the mean square value, that is, the mean square value for each sample. Sum the squares, then divide by the total number of samples in that batch. The result obtained is the physical consistency penalty loss for that batch. During training, this loss is weighted and added to the prediction error loss to form the total loss. The model updates its parameters through backpropagation to reduce both losses simultaneously, thereby improving prediction accuracy while suppressing the tendency of inferences that violate physical laws.

[0045] In one embodiment of this application, the inclusion of the risk cost item follows the following threshold determination mechanism: Set an upper limit for the tolerance of uncertainty; When the inference variance corresponding to the candidate control command sequence is lower than the uncertainty tolerance limit, the value of the risk cost term is set to zero; When the variance of the deduction corresponding to the candidate control instruction sequence is equal to or higher than the upper limit of uncertainty tolerance, the value of the risk cost term is included in the cost function.

[0046] Furthermore, in the preset cost function, for any candidate control instruction sequence, its total cost value is... The calculation method is as follows:

[0047] in, To extrapolate the temperature, For the target temperature, To control the energy consumption cost corresponding to the command, To extrapolate the variance, , , These are the weighting coefficients.

[0048] Specifically, instructions for using the risk cost item threshold judgment mechanism.

[0049] The purpose of this mechanism is to avoid imposing penalties on the variance at every step of the model inference, and to only include costs when the variance exceeds the preset tolerance limit, thus avoiding over-constraining the controller within the normal fluctuation range of the model.

[0050] The specific execution process is as follows: Step 1: Set an upper limit for uncertainty tolerance.

[0051] After the environmental simulation model is trained and before it is put into actual control, the variance distribution of the model under various normal operating conditions is statistically analyzed using validation set data. The 95th quantile of this distribution (or another quantile selected based on the degree of conservatism in actual control) is taken as the upper limit of uncertainty tolerance. .

[0052] Step 2: Step-by-step deduction of each candidate sequence and obtaining the variance.

[0053] In each control cycle, the controller generates A candidate control instruction sequence. Each candidate sequence is compared with the current state. Input environment extrapolation model, model output future The temperature of the step and the variance of the deduction at each step .

[0054] Step 3: Gradual threshold determination.

[0055] For each inference step of each candidate sequence ( ), perform the following judgment: If the variance of this step is... The risk cost item corresponding to this step The value is zero; If the variance of this step is... The risk cost item corresponding to this step Calculated by multiplying the actual variance by the weighting factor.

[0056] Step 4: Calculate the total cost and select the optimal solution.

[0057] The total cost of each candidate sequence is calculated using the cost function formula:

[0058] Among them, each step The threshold value has been determined to be zero or the actual value based on the threshold judgment result in step three. The cost values ​​of all candidate sequences are then compared. Select the smallest one, and issue its first control command for execution. The total generation value of each candidate sequence is calculated separately and denoted as . Compare this Given a set of values, the candidate sequence with the lowest total value is selected, and its first control command is issued to the greenhouse actuator for execution. The above process is repeated in the next control cycle.

[0059] Practical significance: When the model confidence is high, the risk cost term is zero, and the controller mainly selects the optimal controller based on temperature deviation and energy consumption. When the model lacks confidence in the prediction of certain control actions, the risk cost term is automatically included, increasing the cost of the sequence and causing it to be naturally eliminated in the optimization process without the need for manual judgment or switching of control modes.

[0060] Furthermore, weighting coefficients , , At least one of them is a dynamically adjustable coefficient; during the rolling optimization process of model predictive control, the values ​​of each weight coefficient are dynamically adjusted based on the output uncertainty of the model derived from the real-time environmental assessment, wherein: When output uncertainty increases, increase the weighting coefficient of the risk cost item. ; When output uncertainty decreases, the weighting coefficient of the risk cost term should be reduced. This enables the controller to automatically select a sequence of control commands with smaller inference variance and more conservative and safer control effect during the optimization process when the model confidence is insufficient.

[0061] Instructions for using the dynamic adjustment mechanism for weighting coefficients

[0062] The mechanism enables the controller to automatically adjust the relative weight of the risk cost term in the cost function when the uncertainty of the model deduction changes, thereby achieving a smooth trade-off between "pursuing temperature control accuracy" and "avoiding uncertainty risks" without manual intervention or switching control modes.

[0063] The specific execution process is as follows:

[0064] Step 1: Obtain the uncertainty of the model output in real time.

[0065] In each control cycle, the controller generates After a candidate control command sequence is input into the environmental simulation model, the model outputs the simulation temperature and the simulation variance for each step. The mean or maximum value of the variances of all simulation steps in the current candidate sequence set is taken as the output uncertainty index for this control cycle, denoted as . .

[0066] Step 2: Assess the trend of uncertainty changes.

[0067] The moving average of the uncertainty U of the current period and the uncertainty of recent historical periods. Comparison: like If the uncertainty increases significantly, then the confidence level of the model will decrease. like If the uncertainty decreases significantly, then the confidence level of the model is considered to have increased. Otherwise, if the uncertainty is determined to be within the normal fluctuation range, the current weights will remain unchanged.

[0068] in This is a preset fluctuation tolerance threshold used to avoid frequent weight adjustments due to minor fluctuations.

[0069] Step 3: Dynamically adjust the weighting coefficients.

[0070] Based on the evaluation results of the second step, the weighting coefficients were adjusted. Perform dynamic assignment: When the uncertainty of the judgment increases, Updated to ; When the uncertainty of the judgment decreases, Updated to ; The value is always constrained to a preset lower limit. and preset upper limit value between.

[0071] and In this embodiment, it remains fixed, but it can also be dynamically adjusted using the same mechanism.

[0072] Step 4: Substitute the cost function and select the optimal one.

[0073] After dynamic adjustment Substitute the cost function:

[0074] Calculate the total value of each candidate sequence, select the one with the lowest total value, and issue the first control command.

[0075] Practical significance: When the model has a high confidence level in extrapolating the current operating conditions, Automatic reduction; the controller primarily selects its optimal configuration based on temperature deviation and energy consumption, resulting in more precise control. When the model's confidence level is insufficient... The automatic increase amplifies the total cost of candidate sequences with large variances, causing the controller to naturally eliminate these high-risk options during the solution process and tend to select a more conservative and safer control scheme. The entire process is completed through automatic parameter adjustment without involving hard switching of control modes.

[0076] In one embodiment of this application, the target environment parameter deviation penalty term further includes a safety hard constraint; when the predicted future environment state violates a preset safety threshold, the candidate control command sequence containing the prediction result is processed as follows: By directly assigning a maximum cost value to the cost function, the candidate control instruction sequence is eliminated during the optimization process; And directly remove the candidate control instruction sequence from the set of options for optimization.

[0077] The preset safety thresholds include at least one of the following: the lower limit of indoor temperature and the upper limit of indoor temperature.

[0078] The purpose of hard safety constraints is to set an inviolable safety threshold during the process of the controller generating candidate control command sequences and performing simulations and evaluations. If the simulation results of a candidate sequence show that the environmental state at any future time will exceed the safety threshold, the sequence is determined to be an infeasible solution and is directly excluded, without proceeding to the subsequent cost comparison stage.

[0079] The specific execution process is as follows: Step 1: Preset the security threshold.

[0080] Before system deployment, safety thresholds for environmental parameters are set based on the physiological tolerance characteristics of crops grown in the greenhouse. These safety thresholds include at least a lower and upper limit for indoor temperature. For example, the lower limit is set to the lowest temperature the crops can tolerate (e.g., 5°C), and the upper limit is set to the highest temperature the crops can tolerate (e.g., 40°C). These thresholds are written into the controller configuration as hard constraints.

[0081] Step 2: Check each candidate sequence step by step.

[0082] In each control cycle, the controller generates A candidate sequence of control instructions, with each sequence linked to the current state. Input environment extrapolation model, obtain future The inference environment status of each step. For each inference step of each candidate sequence, check whether its inference temperature falls within the safe threshold range.

[0083] Step 3: Determine the violation and take action.

[0084] For any candidate sequence, if its future... If the calculated temperature at any step is lower than the lower limit of the indoor temperature range or higher than the upper limit of the indoor temperature range, the candidate sequence is determined to violate the hard safety constraint. In this case, the following processing is performed on the candidate sequence: The total cost of directly addressing the candidate sequence Endowed with great value , The value should be above the normal cost order of magnitude (for example, a large number much larger than the maximum possible value of the cost function under normal operating conditions, such as 10). 6 This ensures that the candidate sequence will inevitably be at the bottom in the value ranking, thus being naturally eliminated during the optimization process; At the same time, the candidate sequence is directly removed from the set of candidate sequences participating in the selection, and will not be further calculated or compared.

[0085] For candidate sequences that do not violate hard safety constraints, their total algebraic value J is calculated normally and they are used for ranking and selection.

[0086] Step 4: Selection and Implementation.

[0087] After completing the security checks and eliminations, the substitution values ​​of the remaining candidate sequences are compared, and the one with the smallest total substitution value is selected, and its first control command is issued for execution.

[0088] In one embodiment of this application, a highest-level security verification and mode switching step is included before executing the control command: Real-time acquisition of the confidence index of the environmental simulation model's output of the current simulation results; When the confidence index is lower than the preset safety confidence threshold, the model predictive control mode is determined to be unreliable, and the control mode is automatically switched to the classic feedback control mode. Once the confidence index rises above the safe confidence threshold and remains stable for the preset duration, the system switches back from the classic feedback control mode to the model predictive control mode.

[0089] Specifically, the system acquires the confidence index of the environmental simulation model's output on the current simulation result in real time during each control cycle. This confidence index is taken from the average or maximum value of the simulation variance of all simulation steps in the current candidate sequence set, or the confidence score directly output by the model's built-in uncertainty estimation module. The higher the confidence index, the more confident the model is in the simulation result; the lower the index, the worse the reliability of the simulation result. The system presets a safety confidence threshold, which is selected based on the model's confidence distribution on historical validation data, typically taking the lower quantile of the confidence index under normal operating conditions as the safety critical point.

[0090] When the real-time confidence level falls below a preset safety confidence threshold, the system determines that the environmental simulation model's prediction results under the current operating conditions are unreliable and triggers a mode switch, transferring control from model predictive control to classical feedback control. After the switch, the system ceases using the environmental simulation model's prediction results for decision-making and instead uses the classical feedback controller to directly calculate and output control commands based on the deviation between the current and target temperatures. During classical feedback control operation, the environmental simulation model continues to receive real-time status data for simulation but does not participate in control, while continuously outputting confidence levels for system monitoring.

[0091] Once the confidence level index rises above the safe confidence threshold and remains stable in this state for a preset period, the system determines that the environmental simulation model has recovered its reliability. At this point, control is smoothly switched back from the classical feedback control mode to the model predictive control mode, resuming rolling optimization decisions based on simulation evaluation. The entire switching and reverting process is executed automatically by the system without manual intervention.

[0092] In one embodiment of this application, the environmental simulation model is first run in shadow mode before being implemented in closed-loop control: The environmental simulation model receives the actual state of the greenhouse and the actual control commands being executed, performs real-time simulations, but does not output control commands to the outside world. The model accuracy is evaluated and optimized by comparing the simulation results with the actual future state collected. Once the model's simulation accuracy meets the preset performance indicators, switch to closed-loop control mode.

[0093] Specifically, the shadow mode is an offline verification and online validation stage that the environmental simulation model must go through before it is put into closed-loop control. Its purpose is to ensure that the model has sufficient simulation accuracy in the actual greenhouse environment before taking over control, thereby reducing the control risk caused by model errors.

[0094] During shadow mode operation, the environmental simulation model is deployed to the greenhouse local controller or edge computing device and establishes data connections with the sensor system and actuators, but its simulation results are not sent to the actuators. During normal system operation, the classical feedback controller or other existing controllers are actually responsible for greenhouse temperature control. The actual control commands generated by this controller are sent to the actuators and simultaneously fed into the environmental simulation model. The environmental simulation model receives the current environmental state and the executing actual control commands, and performs real-time simulations of future environmental states, but does not output any control commands.

[0095] Meanwhile, the system continuously collects real readings from greenhouse sensors, comparing the actual environmental conditions collected at subsequent moments with the corresponding states predicted by the model step-by-step, and calculating the prediction error. The prediction error is calculated using mean absolute error, mean square error, or other preset accuracy indicators. Statistical analysis of the prediction errors accumulated over a period of time is performed to evaluate whether the model's prediction accuracy under real-world conditions meets the preset performance indicators. If not, the model is further optimized and trained using the state transition data accumulated during the shadow mode; if it meets the requirements, the model is deemed ready for closed-loop control.

[0096] Once the model's simulation accuracy consistently meets the preset performance indicators across multiple consecutive evaluation periods, the system issues a switching signal, switching the environmental simulation model from shadow mode to closed-loop control mode, officially taking over the control decisions for greenhouse temperature. The switching process is completed automatically by the system. After the switch, the closed-loop system consisting of the environmental simulation model and the model predictive controller begins to execute rolling optimization control. The simulation error statistics accumulated during the shadow mode operation can be used as a reference for setting the safety confidence threshold during the closed-loop operation phase.

[0097] This application discloses a short-term prediction system for greenhouse environmental parameters based on deep neural networks, including: The status sensing module is used to obtain the current environmental status of the greenhouse; The environment simulation model module is equipped with a pre-trained environment simulation model, which is used to infer the future environment state sequence based on the current environment state and candidate control command sequence. The training loss function of this model includes a prediction error loss term and a physical consistency penalty loss term based on thermodynamic laws. The decision module is used to select the optimal command from multiple candidate control command sequences according to a preset cost function and output the first control command. The cost function includes a penalty term for deviation of target environmental parameters, a control energy consumption cost term, and a risk cost term determined by the variance of the model output. The safety switching module is used to monitor the inference error or uncertainty of the environmental simulation model and automatically switch from the model predictive control mode to the classical feedback control mode when preset conditions are met. The execution module is used to send the final control commands to the greenhouse actuator.

[0098] Specifically, after the system is deployed on-site in the greenhouse, the various modules work together to form a complete closed loop from environmental perception, simulation and evaluation, decision-making and selection to safety assurance and command execution.

[0099] The state perception module acquires environmental parameters such as indoor temperature, humidity, light intensity, and CO2 concentration in real time through data acquisition devices such as temperature and humidity sensors, light sensors, and CO2 concentration sensors deployed in the greenhouse. This data forms the environmental state vector at the current moment, and the state data is sent to the environmental inference model module and the decision-making module.

[0100] The environmental simulation model module is equipped with an environmental simulation model that has been trained offline. During the training phase, this model uses historical greenhouse operation data to construct state transition sample pairs. Supervised learning is performed using the current state and control commands as inputs, and the actual state at the next moment as the supervision label. Its training loss function, in addition to the conventional prediction error loss term, includes a physical consistency penalty loss term based on thermodynamic laws, ensuring that the model's simulation results not only fit historical data but also conform to the basic physical laws of the greenhouse environment. During actual system operation, this module receives the current environmental state from the state perception module and multiple candidate control command sequences from the decision-making module. It then outputs the future multi-step environmental state sequence and simulation variance corresponding to each candidate sequence.

[0101] The decision module generates multiple candidate control command sequences in each control cycle and sends them to the environmental simulation model module for simulation. For each candidate sequence, the total cost value is calculated according to a preset cost function, which includes three terms: a target temperature deviation penalty term, used to measure the difference between the simulated temperature and the target temperature; a control energy consumption cost term, used to measure the energy cost of executing the sequence; and a risk cost term determined by the simulation variance output by the model, used to measure the uncertainty of the model regarding the simulation result. The decision module compares the total cost values ​​of all candidate sequences, selects the one with the lowest cost, and outputs its first control command to the safety switching module.

[0102] The safety switching module continuously monitors the inference error or output uncertainty of the environmental inference model during system operation. When the inference error or uncertainty exceeds a preset safety threshold, the module determines that the current model predictive control mode is unreliable and automatically switches control from model predictive control mode to classical feedback control mode. At this time, the classical feedback controller takes over the calculation and output of control commands. When the inference error or uncertainty falls below the safety threshold and remains stable for a preset period of time, the module smoothly switches control back to model predictive control mode. During normal operation in model predictive control mode, the module directly transmits the control commands output by the decision module to the execution module.

[0103] The execution module receives the final control command from the safety switching module, converts it into control signals recognizable by the greenhouse actuators, and sends them to the actuators such as the skylight motor, fan, wet curtain water pump, and heat pump to complete the actual regulation of the greenhouse environment. The system repeats the above process in each control cycle to achieve continuous rolling optimization control.

[0104] Specifically, this application is implemented in practice.

[0105] Phase 1: Offline Training. Using historical greenhouse operation data, sample pairs are constructed from the environmental state, control commands, and the actual state at each moment. Supervised learning training is then performed on the environmental projection model. In addition to prediction error, the training loss function includes a physical consistency penalty term—a penalty is applied when the model produces results that violate thermodynamic principles, such as "increasing the vent opening leads to a temperature increase." This ensures that the model's projections both fit the data and conform to physical laws.

[0106] Phase Two: Shadow Mode Validation. After training, the model is first deployed in shadow mode—receiving real-world environmental conditions and actual control commands for simulation, but without outputting control commands. The simulation results are continuously compared with the sensor measurement data. Once the simulation accuracy meets the target for several consecutive cycles, the model automatically switches to closed-loop control mode.

[0107] Phase 3: Closed-loop rolling optimization. In each control cycle, the controller generates multiple candidate control command sequences, and the input environment deduction model extrapolates the future temperature and variance of each sequence. (Based on the cost function...) The total cost of each sequence is calculated, with risk costs only included when the extrapolation variance exceeds a preset tolerance limit. The system also incorporates hard safety constraints—sequences whose extrapolated temperatures exceed safety upper and lower limits are directly discarded and assigned a maximum cost; when the overall model confidence falls below the safety threshold, it automatically switches to classic feedback control mode, smoothly switching back after the confidence recovers and stabilizes. The candidate sequence with the lowest cost is selected, and its first control command is issued to the actuator. This process is repeated in the next cycle, forming a continuous rolling optimization closed loop.

[0108] In summary, the embodiments of this application transform the traditional passive mode of "predicting temperature changes" into an active decision-making mode of "paraphrasing control consequences". By rapidly pre-simulating the future effects of different control commands in a virtual space through an environmental simulation model, the controller can compare the advantages and disadvantages of each scheme before execution, thereby achieving rolling optimization decisions that balance temperature control accuracy, energy saving, and risk avoidance without relying on a precise mechanistic model.

[0109] In the description of this specification, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0110] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0111] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.

Claims

1. A short-term prediction method for greenhouse environmental parameters based on deep neural networks, characterized in that, Includes the following steps: Obtain the current environmental status of the greenhouse ; Using a pre-trained environment inference model, with the current environment state and multiple candidate control instruction sequences As input, the future environmental state sequence corresponding to each candidate control command sequence is derived. The environmental simulation model is a deep neural network that learns the state transition laws of the greenhouse environment; Based on each candidate control command sequence and its inferred future environmental state sequence, the value of a preset cost function is calculated. The cost function includes at least a target environmental parameter deviation penalty term, a control energy consumption cost term, and a risk cost term related to the uncertainty of the output of the environmental inference model. Select the first control instruction from the candidate control instruction sequence that minimizes the cost function value. and execute the control command; Repeat the above steps to complete the rolling optimization based on model predictive control.

2. The method according to claim 1, characterized in that, The training steps for the environmental simulation model include: State transition pairs are constructed from historical greenhouse operation data, with each pair including the current state. Execution of control commands and the next state ; In the current state and control commands As input to the model, the following state The environmental inference model is trained using supervisory labels. Loss function used in training for: in, To predict error loss, Penalty loss for physical consistency These are the weighting coefficients. The environmental simulation model is based on the current state. and control commands The predicted value of the next state output by the deduction. This represents the actual value of the next state collected in this sample pair.

3. The method according to claim 2, characterized in that, The physical consistency penalty loss is constructed based on the thermodynamic laws inside the greenhouse and is used to penalize deductions that violate physical laws. The deductions that violate physical laws include at least the following: after executing a cooling control command, the deduced temperature rises instead of the actual temperature without the intervention of other external heat sources.

4. The method according to claim 1, characterized in that, The inclusion of the risk cost item follows the following threshold determination mechanism: Set an upper limit for uncertainty tolerance; When the inference variance corresponding to the candidate control instruction sequence is lower than the uncertainty tolerance upper limit, the value of the risk cost term is set to zero; When the variance of the deduction corresponding to the candidate control instruction sequence is equal to or higher than the uncertainty tolerance limit, the value of the risk cost term is included in the cost function.

5. The method according to claim 4, characterized in that, In the cost function, for any candidate control instruction sequence, its total cost value is... The calculation method is as follows: in, To extrapolate the temperature, For the target temperature, To control the energy consumption cost corresponding to the command, To extrapolate the variance, , , These are the weighting coefficients.

6. The method according to claim 5, characterized in that, The weighting coefficient , , At least one of them is a dynamically adjustable coefficient; during the rolling optimization process of model predictive control, the values ​​of each weight coefficient are dynamically adjusted according to the output uncertainty of the environmental deduction model as evaluated in real time, wherein: When the output uncertainty increases, the weighting coefficient of the risk cost item is increased. ; When the output uncertainty decreases, the weighting coefficient of the risk cost item is reduced. This enables the controller to automatically select a sequence of control commands with smaller inference variance and more conservative and safer control effect during the optimization process when the model confidence is insufficient.

7. The method according to claim 1, characterized in that, The target environment parameter deviation penalty term also includes hard safety constraints; when the predicted future environment state violates the preset safety threshold, the candidate control command sequence containing the prediction result is processed as follows: By directly assigning a maximum cost value to the cost function, the candidate control instruction sequence is eliminated during the optimization process; And directly remove the candidate control instruction sequence from the set of options for optimization. The preset safety thresholds include at least one of the following: the lower limit of indoor temperature and the upper limit of indoor temperature.

8. The method according to claim 1, characterized in that, Before executing control commands, the highest level of security checks and mode switching procedures are also included: The confidence index of the current simulation result output by the environmental simulation model is obtained in real time. When the confidence index is lower than the preset safety confidence threshold, the model predictive control mode is determined to be unreliable, and the control mode is automatically switched to the classic feedback control mode. Once the confidence index rises above the safety confidence threshold and remains stable for a preset duration, the system switches back from the classic feedback control mode to the model prediction control mode.

9. The method according to claim 1, characterized in that, Before implementing the environmental simulation model into closed-loop control, it is first run in shadow mode: The environmental simulation model receives the actual state of the greenhouse and the actual control commands being executed, performs real-time simulations, but does not output control commands to the outside world. The model accuracy is evaluated and optimized by comparing the simulation results with the actual future state collected. Once the model's simulation accuracy meets the preset performance indicators, switch to closed-loop control mode.

10. A short-term prediction system for greenhouse environmental parameters based on deep neural networks, characterized in that, include: The status sensing module is used to obtain the current environmental status of the greenhouse; The environment simulation model module is equipped with a pre-trained environment simulation model, which is used to infer the future environment state sequence based on the current environment state and candidate control command sequence. The training loss function of this model includes a prediction error loss term and a physical consistency penalty loss term based on thermodynamic laws. The decision module is used to select the optimal command from multiple candidate control command sequences according to a preset cost function and output the first control command. The cost function includes a target environment parameter deviation penalty term, a control energy consumption cost term, and a risk cost term determined by the model output variance. The safety switching module is used to monitor the inference error or uncertainty of the environmental simulation model and automatically switch from the model predictive control mode to the classical feedback control mode when preset conditions are met. The execution module is used to send the final control commands to the greenhouse actuator.