A Method and System for Optimizing Environmental Control Strategies in Facility Agriculture Based on Large Language Models
By constructing a hybrid simulator and a large language model, heterogeneous domain knowledge of facility agriculture environmental control is automatically integrated, and control strategies are autonomously designed and optimized. This solves the problems of low automation and poor cross-scenario applicability in existing technologies, and achieves efficient and safe environmental control.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING HEZI TECHNOLOGY CO LTD
- Filing Date
- 2026-04-10
- Publication Date
- 2026-06-30
Smart Images

Figure CN122308098A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of smart agriculture and environmental control technology, specifically relating to a method and system for optimizing environmental control strategies in facility agriculture based on a large language model, applicable to the automatic optimization of environmental control strategies in facility agriculture (including facility breeding and facility planting). Background Technology
[0002] Environmental control in facility agriculture is a key technology in modern intensive agriculture. Its core lies in the comprehensive regulation of multiple environmental factors within facilities (such as poultry houses and greenhouses), including temperature, humidity, wind speed, light, and CO2 concentration, to create the optimal environment for the growth of organisms (animals or crops). Unlike traditional single-factor control, there are complex coupling effects between various environmental factors in facility agriculture, and the environmental requirements of organisms differ significantly at different growth stages.
[0003] Taking facility-based poultry farming as an example, the thermal comfort of broilers is determined by a combination of temperature, humidity, and wind speed. The Effective Temperature (ET) index proposed by Tao & Xin is a quantitative representation of this combined effect. Broilers of different ages have vastly different environmental requirements. For instance, chicks aged 1-7 days require a high temperature of 32-35℃ and are intolerant of wind chill, while adult chickens aged 29-42 days require a low temperature of 20-24℃ and have a strong need for heat dissipation. Modern poultry houses are equipped with tiered ventilation fans, heaters, and evaporative cooling pads, and there is a strong coupling effect between these devices (e.g., ventilation cooling is accompanied by a wind chill effect, and evaporative cooling pads are accompanied by a humidification effect).
[0004] Taking greenhouse cultivation as an example, the growth of greenhouse tomatoes is affected by the coupling of multiple factors such as temperature, humidity, light, and CO2. The vapor pressure difference (VPD) directly determines the crop's transpiration rate and nutrient transport efficiency, while the cumulative daylight integral (DLI) determines the total amount of photosynthetic products. Different growth stages (such as flowering and fruiting stages) have different requirements for each factor. Modern greenhouses are equipped with skylights, supplemental lighting, shading nets, CO2 generators, etc., which also exhibit strong coupling (e.g., increasing temperature will reduce humidity, thus increasing VPD, but excessively high VPD will inhibit photosynthesis).
[0005] Constructing a high-quality environmental control strategy requires integrating heterogeneous domain knowledge from multiple sources, mainly including: (1) numerical knowledge, such as heat production curves and VPD-stomatal conductance response curves; (2) rule-based knowledge, such as management suggestions in natural language such as "the ground wind speed during the brooding period should not exceed 0.15 m / s"; (3) constraint-based knowledge, such as fan speed mapping logic defined by equipment manufacturers and equipment interlock rules; and (4) formula-based knowledge, such as ET calculation formulas and Penman-Monteith transpiration formulas. Traditionally, the integration of this knowledge has relied on experienced environmental control engineers spending weeks on on-site commissioning, a process that is inefficient, non-reproducible, and highly dependent on personal experience.
[0006] Currently, similar technical solutions can be mainly categorized as follows:
[0007] (1) PID / fuzzy control method: A single environmental parameter (such as dry bulb temperature) is used as the control variable, and a fixed target value and parameter are set. The parameters of this method are fixed and need to be manually readjusted according to the growth stage and season. It cannot adapt to changes in the growth stage and ignores the comprehensive influence of multiple factors such as humidity and wind speed.
[0008] (2) Reinforcement learning method: By defining a state space, action space, and reward function, the agent learns the optimal policy through interaction with the environment. This method requires a large amount of online interaction, and improper control during the exploration process may cause animal stress or crop yield reduction, resulting in high safety risks, and the training process cannot be repeated.
[0009] (3) Bayesian optimization / AutoML method: efficiently finds the best solution within a predefined continuous parameter search space. Its disadvantage is that the search space itself depends on the predefined parameters, and structural decisions such as "whether to set different ventilation limits for different ages" cannot be automatically discovered, which limits the optimization limit of the strategy.
[0010] (4) General LLM+RAG method: By retrieving text fragments that are semantically similar to the question, the large language model is assisted in generating the answer. This method lacks the ability to automatically convert the retrieved heterogeneous text (such as rules and constraints) into executable control code, and it is also impossible to verify the correctness of the conversion results through simulation. It also lacks a knowledge structuring and parameter mapping mechanism specific to the field of facility agriculture.
[0011] In summary, existing technologies generally suffer from the following shortcomings: (1) Unable to automatically integrate scattered heterogeneous domain knowledge: Existing methods do not have the complete ability to extract numerical, rule-based, constraint-based and formula-based knowledge from unstructured text and map it uniformly to the structured parameter space required for facility environment control.
[0012] (2) Unable to independently design the structural control strategy: The search or learning space of existing methods is fixed before operation, and cannot automatically discover and adjust architectural control logic such as "differentiated control modes at different growth stages" and "equipment switching logic under extreme conditions".
[0013] (3) Lack of process interpretability and reproducibility: Existing methods (such as black box strategies in reinforcement learning and manual experience-based parameter tuning) lack structured experimental recording mechanisms, making it difficult to trace the basis of decision-making and to reproduce the results.
[0014] (4) Lack of cross-scenario universality: Existing methods highly couple the control strategy structure with specific scenarios (such as poultry houses or greenhouses), and the optimization scheme designed for one scenario cannot be directly transferred to another scenario, resulting in poor universality.
[0015] To address the aforementioned issues, this invention proposes a method and system for optimizing environmental control strategies in facility agriculture based on a large language model. Summary of the Invention
[0016] The purpose of this invention is to propose an optimization method and system for environmental control strategies in facility agriculture based on a large language model to solve the problems mentioned in the background art.
[0017] To achieve the above objectives, the present invention adopts the following technical solution: The optimization method for environmental control strategies in facility agriculture based on large language models includes the following steps: S1. Construct a hybrid simulator, which includes a gray-box physical model submodule, a residual correction submodule, and a periodic state reset submodule; wherein: The gray box physical model submodule calculates the physical prediction value of the environmental state based on the environmental dynamics equation of the facility agriculture scenario; the residual correction submodule uses a machine learning model to learn and correct the prediction residual of the gray box physical model submodule; the periodic state reset submodule replaces the internal state of the simulator with the real historical observation value at a preset time interval during the simulation process. S2. Establish a comprehensive evaluation system, which includes a scorer based on a six-dimensional weighted scoring function, used to map the environmental trajectory output by the hybrid simulator into a comprehensive score; The six-dimensional weighted scoring function includes six dimensions: suitability, deviation, energy consumption, switching frequency, safety violations, and biological growth vitality. S3. Configure a security verification mechanism, which includes a set of security check rules for verifying the controller code; S4. Perform the large language model structure discovery phase, which includes the following sub-steps: S41. Specifications and historical experimental logs of the large language model agent reading task; S42, The large language model agent retrieves domain experience related to the current optimization objective from pre-trained knowledge; S43. The large language model agent maps the retrieved domain experience to a preset facility environment control parameter space to form a structured parameter set; S44. The large language model agent generates or modifies controller code based on the structured parameter group; S45. Verify the generated controller code using the security verification mechanism. If the verification passes, proceed with the next steps; otherwise, revert to the previous version. S46. Input the verified controller code into the hybrid simulator for simulation, and have the scorer calculate the overall score. S47. Based on the comprehensive score, decide whether to retain or roll back the current controller code, and record a structured experimental log containing code changes and scoring results; Repeat sub-steps S41 to S47 until the preset number of rounds of experiment are completed; S5. In the fine-tuning stage of execution parameters, the strategy framework in the controller code output in step S4 is fixed, and the continuously adjustable parameters are extracted to form a search space. The Bayesian optimization algorithm is used to search for the parameter combination that makes the overall score optimal in the search space. S6. Output the final controller. Combine the strategy framework output in step S4 with the optimal parameter combination fine-tuned in step S5 to generate the final environment controller.
[0018] 2. The method according to claim 1, wherein the gray box physical model submodule in step S1 selects the corresponding environmental dynamics equations according to the facility type: In facility-based farming scenarios, the poultry house heat and humidity balance equation is adopted, in which the heat dissipation term of organisms is a dynamic coupling term related to the age and weight of animals. In the facility planting scenario, a three-equation set consisting of the greenhouse energy balance equation, humidity equation and CO2 concentration equation is adopted, in which the crop transpiration heat dissipation term is a dynamic coupling term related to the leaf area index and saturated water vapor pressure difference. The mapping from equipment control signals to physical effects adopts a hierarchical calculation method based on the actual equipment configuration.
[0019] Preferably, the residual correction submodule in step S1 adopts a gradient boosting tree model and segments the routing according to the working conditions, training and using independent residual correction models under different working conditions.
[0020] Preferably, the calculation formula for the six-dimensional weighted scoring function in step S2 is as follows:
[0021] in, S suitability The percentage of time steps in which the environmental suitability index is within the suitable range; S deviation The normalized average deviation between the environmental suitability index and the center of the suitability interval; S energy The normalized value of the weighted sum of energy consumption of all devices; S switchThis is the normalized value of the sum of the state changes of all devices; S violation The percentage of time steps that violated security constraints; S vitality This is the biological growth vitality calculated based on the stress-metabolism analytical formula; the weight settings satisfy... w 5> w 1> w 6> w 2> w 4> w 3. Decreasing sequentially to ensure the highest possible penalty for safety violations.
[0022] Preferably, the security check rules in step S3 include at least the following seven items: (1) Syntax check: Verify that the controller code can be successfully parsed by the Python interpreter; (2) Interface compliance check: Verify that the controller code implements the specified input and output interfaces; (3) Output determinism check: Verify that given the same input, the controller code produces the same output; (4) Disable library check: Verify that the controller code has not imported the network communication library and the file system operation library; (5) Control action safety constraint check: verify that the output of the controller code meets the preset equipment operation constraints, which include minimum operation constraints, single-step maximum state change constraints, start-stop minimum interval constraints, mutually exclusive device interlock constraints and equipment operation upper limit constraints; (6) Extreme input robustness check: Verify that the controller code will not crash or output out-of-bounds values under extreme input conditions; (7) Code scope check: confirm that code modifications are limited to the controller file.
[0023] Preferably, the facility environmental control parameter space in step S4 consists of four types of parameters: biological growth demand curve, equipment capacity boundary, environmental dynamic parameters, and safety constraint threshold. The structured parameter group contains four elements: trigger condition, target value or target range, controlled device, and execution logic; The large language model agent transforms the retrieved qualitative knowledge into the structured parameter set and encodes it into branch logic and numerical parameters in the controller code.
[0024] Preferably, the Bayesian optimization in step S5 uses a tree-structured Parzen estimator as a surrogate model, and the parameters in the optimal controller code output in step S4 are used as the first evaluation point of the Bayesian optimization.
[0025] Preferably, the final environmental controller in step S6 is represented in an abstract format independent of the device brand, the abstract format including a time period-parameter table, a condition-action rule table, and a safety constraint table; The method further includes a controller parameter mapping sub-step, which maps the abstract format control strategy to a parameter format recognizable by the target controller based on the actual deployed environment controller type.
[0026] Preferably, the comprehensive evaluation system in step S2 adds a biological growth vitality sub-item to the five sub-items of suitability, deviation, energy consumption, switching, and safety violations. The biological growth vitality sub-item is calculated based on the stress-metabolism analytical formula, reflecting the impact of heat / cold stress on the growth efficiency of organisms. In the facility breeding scenario, this sub-item calculates the vitality loss according to the degree of deviation of the effective temperature from the comfort range, using the analytical formula that "for every 1°C increase in heat stress, feed intake decreases by about 2%, and for every 1°C decrease in cold stress, energy efficiency is lost by about 1.5%". In the facility planting scenario, this sub-item corresponds to the inhibitory effect of extreme VPD or light stress on crop growth. The sub-item is calculated using analytical formulas and does not rely on additional data-driven training.
[0027] Preferably, the structure discovery phase in step S4 adopts a phased strategy: in the early stage, the optimization direction is specified by the task specification but no specific parameters or strategy are given; in the later stage, the exploration direction is completely determined autonomously by the large language model agent; after each preset number of rounds, a phase summary is generated to summarize key discoveries and failure experiences.
[0028] Preferably, the periodic state reset mechanism used by the hybrid simulator in step S1 resets the internal state variables of the simulator to the true historical observation values at the corresponding time intervals at fixed time intervals. The fixed time interval is an integer multiple of the control decision cycle and does not exceed the number of steps corresponding to the upper limit of the cumulative drift that is acceptable for the single-step prediction accuracy of the simulator.
[0029] Preferably, the comprehensive environmental suitability index in step S2 is selected from existing publicly available models based on the type of facility agriculture scenario, including but not limited to: in facility breeding scenarios, effective temperature (ET), temperature and humidity index (THI), or equivalent temperature index (ETIS) is used to combine dry bulb temperature, relative humidity, and wind speed into a single value reflecting the temperature felt by animals; in facility planting scenarios, saturated vapor pressure difference (VPD), solar integral (DLI), or growth degree day (GDD) is used to combine parameters such as temperature, humidity, and light into an index reflecting the suitability of crop growth.
[0030] Preferably, the controller strategy framework output in step S4 includes the following structured control logic, which is derived from qualitative knowledge retrieved from heterogeneous domain documents by a large language model and then transformed: Growth stage differentiation control parameter system: Numerical knowledge is extracted from biological growth data in industry standards and scientific literature and transformed into the upper limit of environmental control equipment operation, basic output level, response sensitivity and control hysteresis width set according to biological growth stages. Conservative control strategy is adopted in the early growth stage and active control strategy is adopted in the mature stage. Extreme environmental protection mode: Extract formulaic knowledge from biological tolerance data and thermodynamic principles in scientific research literature, and transform it into the judgment conditions and execution logic for switching to protective control strategies when the comprehensive environmental suitability index exceeds the biological tolerance threshold minus the preset safety margin, so as to prioritize the protection of biosafety; Auxiliary equipment delayed shutdown strategy: Extract rule-based knowledge from process control literature and transform it into quantitative parameters that set the shutdown threshold of auxiliary equipment within the appropriate range of the comprehensive environmental suitability index, so as to reduce environmental oscillations; Over-biased response: Extract formulaic knowledge from control theory literature and transform it into a nonlinear response function to make the response smooth when the deviation is small and steep when the deviation is large; Minimum operational assurance in extreme environments: Extracting constraint knowledge from the minimum air exchange rate or minimum heating maintenance requirements in industry standards and transforming it into control rules that reduce equipment operation to the minimum safe level when environmental conditions exceed preset extreme thresholds; Seasonal dynamic compensation: Extract rule-based knowledge from seasonal management recommendations in industry management manuals and transform it into quantitative parameters for superimposing additional environmental regulation compensation on organisms at specific growth stages during seasonal transitions.
[0031] Preferably, when applied to facility-based farming scenarios, the structural control logic specifically includes: in the growth stage differentiation control parameter system, setting the upper limit of ventilation fan speed, basic fan speed, fan response slope, and temperature hysteresis width according to animal age; in the extreme environmental protection mode, when the effective temperature exceeds the upper limit of lethal temperature minus the safety margin, evaporative cooling device is activated and the fan speed is limited to the preset upper limit to achieve survival protection; the wind-cooling protection logic limits the fan speed to the lower upper limit for young animals to prevent cold stress caused by wind-cooling effect; in the auxiliary equipment delayed shutdown strategy, the shutdown threshold of the evaporative cooling device is set to when the effective temperature is below the lower boundary of the comfort range; extreme cold minimum ventilation guarantee, when the outdoor temperature is below the preset threshold, the ventilation fan is reduced to the lowest safe speed; autumn dynamic compensation for large chickens, dynamically adding the basic fan speed increment to large chickens nearing slaughter age within the mild outdoor temperature range.
[0032] Preferably, when applied to facility-based planting scenarios, the structural control logic specifically includes: in the growth stage differentiation control parameter system, setting ventilation equipment opening degree, supplemental light intensity, CO2 fertilizer concentration, and temperature control targets according to crop growth stages; VPD regulation strategy, adjusting ventilation and humidification equipment in real time according to saturated vapor pressure difference to maintain VPD within the appropriate range for the current growth stage; DLI supplemental light strategy, automatically starting supplemental lighting to supplement to the target DLI when natural light is insufficient based on the real-time cumulative value of sunlight integral; diurnal temperature difference management strategy, setting differentiated temperature targets for day and night, using temperature difference to promote crop stem elongation or inhibit excessive growth; and interlocking logic for mutually exclusive equipment, interlocking shading nets with supplemental lighting, and interlocking heating with forced ventilation.
[0033] Preferably, the method further includes a repeatability verification step: using the same hybrid simulator, evaluation system, and task specification as input, multiple independent large language model agents are started to execute the structure discovery phase described in step S4, and the agents do not share experimental logs; the final controller scores output by each agent are statistically analyzed to verify the convergence of the optimization results; and the control laws independently discovered by each agent are cross-compared to verify the repeatability of the core strategy.
[0034] This invention further protects a facility agriculture environmental control system based on a large language model, used to implement the above method, comprising: The data acquisition module is used to collect environmental parameters within the facility, outdoor meteorological parameters, and equipment operating status. The hybrid simulation module includes a gray box physical model submodule, a residual correction submodule, and a periodic state reset submodule, which are used to receive controller code and output the environmental state trajectory within the facility. The comprehensive evaluation module is used to execute a six-dimensional weighted scoring function to map the environmental trajectory into a comprehensive score; The security verification module is used to perform security checks on the controller code. The Large Language Model Knowledge Engineering module includes a large language model agent, structured log storage, and an experiment loop scheduler, which is used to execute the experiment loop in the structure discovery phase and generate controller code containing a policy framework. The parameter fine-tuning module is used to perform Bayesian optimization to search for the optimal parameter combination within the strategy framework output by the large language model knowledge engineering module. The controller output module is used to output the control strategy, which includes the strategy framework and the optimal parameter combination, in an abstract format that is independent of the device brand. The controller parameter mapping submodule is used to map the abstract format control strategy to a parameter format recognizable by the target controller according to the type of environmental controller actually deployed in the facility. The mapping process maintains the logical equivalence of the control strategy.
[0035] The present invention further protects a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the above-described method.
[0036] The present invention has the following beneficial effects: (1) Automated knowledge engineering, replacing weeks of manual debugging: This invention utilizes the pre-trained knowledge of LLM and the quadruple transformation path to automatically complete the transformation from qualitative experience in heterogeneous domain documents to quantitative control parameters. In the poultry house example, Haiku's 200 rounds of automatic optimization (approximately 4 hours) improved the overall score from 0.1674 to 0.7206 (+330%), with a total of 0.7517 (+349%) across the two stages, covering 12 seasonal / operating condition scenarios. The technical means to achieve this advantage are: the intermediate semantic layer of "facility environment control parameter space" and the standard quadruple transformation path of "trigger condition → target value → controlled equipment → execution logic" in the LLM knowledge engineering module.
[0037] (2) Breaking the limitations of continuous parameter search space: LLM can autonomously design structural strategies (age differentiation parameter system, survival protection mode, minimum ventilation guarantee in extreme cold, seasonal dynamic compensation, etc.), and these architectural decisions exceed the predefined search space of Bayesian optimization and reinforcement learning. The technical means to achieve this advantage is: two-stage division of labor - S4 is the responsibility of LLM for structure discovery (the code logic structure can be modified), and S5 is the responsibility of Bayesian optimization for parameter fine-tuning (searching for the optimal value within a fixed structure).
[0038] (3) The process is fully traceable and reproducible: Seven safety checks ensure the compliance of the controller in each round, the structured experimental log records the entire hypothesis-change-result-conclusion chain, and ten independent verifications confirm that the core findings have a 10 / 10 reproducibility rate. The technical means to achieve this advantage are: the seven-check mechanism of the safety verification module and the structured log storage module.
[0039] (4) One method is applicable to multiple facility agriculture scenarios: Facility breeding and facility planting share the same optimization framework, and only the physical equations of the gray box model and the comprehensive environmental suitability index need to be replaced to adapt to new scenarios. The technical means to achieve this advantage is the modular decoupling design of the optimization layer (LLM knowledge engineering + Bayesian optimization) and the simulation layer (gray box model) in the four-layer system architecture.
[0040] (5) Knowledge Extraction and Parameter Mapping Specific to the Agricultural Field: Addressing the heterogeneity of knowledge in facility agriculture (numerical / rule-based / constraint-based / formula-based), a dedicated mapping mechanism with the "facility environment control parameter space" as the intermediate semantic layer was designed. The final controller adapts to the actual deployed environment controller (Fancom / Priva / PLC) through the parameter mapping submodule, achieving the "last mile" conversion from abstract strategy to specific equipment format. The technical means to achieve this advantage is the format conversion mechanism of the controller parameter mapping submodule. Attached Figure Description
[0041] The invention will be further described with reference to the following figures: Figure 1 This is a schematic diagram of the four-layer system architecture proposed in this invention; Figure 2 This is a flowchart of the experimental loop for the LLM structure discovery phase proposed in this invention. Figure 3 This is a two-stage optimization score trajectory diagram of the poultry house embodiment proposed in this invention; Figure 4 This diagram serves as a verification of the air-cooling protection strategy in a poultry house embodiment proposed in this invention. Figure 5 This is a comparison diagram of the survival protection modes of poultry house embodiments proposed in this invention; Figure 6 The figure shows the results of an independent verification experiment of the poultry house embodiment proposed in this invention; Figure 7 This is a radar image of 12 scenarios proposed in this invention. Detailed Implementation
[0042] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings, not all of them.
[0043] This invention provides a method and system for optimizing environmental control strategies in facility agriculture based on a large language model. It aims to solve the technical problems in existing methods for optimizing environmental control strategies in facility agriculture, such as the difficulty of structural strategy innovation in numerical optimization methods, the low sample efficiency and safety risks of reinforcement learning methods, and the inability of general large language models to directly generate reliable control strategies.
[0044] The key advantages of the proposed method and system for optimizing environmental control strategies in facility agriculture based on a large language model, compared to existing technologies in the field, are as follows: 1: Two-stage optimization method (LLM structure discovery + numerical optimization parameter fine-tuning) The implementation scheme of this invention is as follows: In the first stage, the LLM agent retrieves industry experience from pre-trained knowledge and autonomously designs structured strategies (such as introducing an age differentiation parameter system, establishing a survival protection mode, and designing a delayed shutdown strategy) through a structured experimental loop, outputting a controller containing the strategy framework and initial parameters; in the second stage, the strategy framework is fixed, continuous parameters are extracted, and Bayesian optimization is used for fine-tuning. The combined score of the two stages is +349%.
[0045] Existing implementation methods: Bayesian optimization (Scheme 3) can only search within a predefined continuous parameter space and cannot automatically discover structured strategies (such as age differentiation and survival protection). Reinforcement learning (Scheme 2) learns within a predefined state-action space, where the policy structure is fixed before training.
[0046] The difference lies in the specific technical means: This invention leverages the pre-trained knowledge retrieval capabilities of LLM to separate "structural policy discovery" (discrete architecture decisions, such as whether to introduce a survival protection mode) and "continuous parameter optimization" (searching for optimal values within a given architecture) into two stages. The former is completed by LLM, and the latter by numerical optimization, each leveraging its own advantages. Existing methods combine the two—either only searching for continuous parameters (Bayesian optimization) or encoding structural decisions as continuous parameters as well (increasing the search space and resulting in extremely low efficiency). Experiments demonstrate that LLM is 36 times more efficient per round in the first 100 rounds (structural discovery) than in the last 500 rounds (parameter fine-tuning), while the parameter fine-tuning efficiency of Bayesian optimization is approximately twice that of LLM, verifying the rationality of the two-stage division of labor.
[0047] 2: Agricultural-specific knowledge modeling and quadruple transformation path The implementation scheme of this invention proposes a "facility environmental control parameter space" as an intermediate semantic layer (composed of four types of parameters: growth demand curves, equipment capacity boundaries, environmental dynamic parameters, and safety constraints). The knowledge retrieval goal of LLM is to structurally fill this parameter space. The transformation path adopts the standard four-tuple format: {trigger condition, target value / range, controlled equipment, execution logic}. Retrieval quality is measured by simulation scoring—only transformation results that pass simulation verification are retained.
[0048] The existing implementation scheme: The retrieval objective of the general LLM+RAG system (Scheme 4) is to "return text fragments that are semantically similar to the question," and the retrieval quality is measured by text similarity. It lacks a structured parameter space concept and a standard transformation path from qualitative knowledge to executable code.
[0049] The difference lies in the specific technical means: This invention designs an intermediate semantic layer and a standard conversion path specifically for the agricultural field, enabling heterogeneous knowledge (numerical / rule-based / constraint-based / formula-based) to be converted into control codes via a unified four-tuple format, and verifying the correctness of the conversion through simulation closed-loop verification. The general-purpose RAG system remains at the text retrieval level; the returned text fragments cannot be directly converted into control parameters, and there is no simulation verification step. For example, the general-purpose RAG can retrieve the text "wind speed during the brooding period does not exceed 0.15 m / s," but it cannot automatically convert it into a quantitative control parameter such as "in a 75m×15m poultry house, 0.15 m / s corresponds to ventilation level 3 → fan_max=3," and verify the effectiveness of this parameter through simulation.
[0050] 3: Structured Experiment Cycle and Seven Safety Checks The implementation scheme of this invention includes eight standard steps in each round of experiment (reading context → retrieving knowledge → parameter space mapping → quadruple transformation → security check → simulation scoring → retain / rollback → logging), and seven security checks to ensure that the controller generated in each round does not violate security constraints (syntax, interface compliance, determinism, disabled libraries, action constraints, robustness, scope), and structured logs make the entire optimization process traceable and auditable.
[0051] Existing implementation methods: RL's online interaction lacks a safety check mechanism, and the exploration phase may output control commands that violate safety constraints. Bayesian optimization is safe through parameter boundary constraints, but it cannot check the compliance of the control logic. The suggestion text generated by general LLM+RAG does not require safety checks and lacks simulation verification.
[0052] The difference lies in the specific technical means: This invention uses safety checks as a necessary checkpoint in the experimental cycle—code that fails the safety check will not be deployed to the simulator for execution, fundamentally preventing unsafe control strategies from entering the evaluation stage. The "deterministic check" and "scope check" are unique designs of this invention: the deterministic check ensures the reproducibility of the controller output (prohibiting random logic), and the scope check ensures that the LLM does not modify the evaluation system (preventing the "referee-player" problem). In existing methods, RL relies on implicit constraints of the reward function for safety, but unsafe actions may still occur during the exploration phase; Bayesian optimization constrains the safety range through parameter boundaries, but improper combinations within the parameter boundaries may still produce unsafe behaviors.
[0053] 4: Bidirectional coupling between organism and environment in the gray box model The implementation scheme of this invention: The environmental dynamics equations of the gray box model include organism-environment coupling terms that dynamically change with the biological growth stage—in facility aquaculture, this is the animal heat dissipation term (increasing with age according to the age-weight-heat production curve), and in facility cultivation, it is the crop transpiration heat dissipation term (coupled with leaf area index (LAI) and stomatal conductance, dynamically changing with the growth period and VPD). The residual correction model is segmented according to operating conditions (trained separately for different growth stages), and physical parameters are automatically identified through natural step response events.
[0054] Existing implementation methods: The physical equations of commonly used industrial digital twins (such as building HVAC simulation and industrial plant environment simulation) do not include interaction terms between organisms and the environment—heat sources (equipment heat dissipation) in industrial scenarios are usually fixed values that do not change dynamically over time. Furthermore, residual corrections in general environmental simulations are not segmented according to biological growth stages.
[0055] The difference lies in the specific technical means: The gray box model of this invention introduces a dynamically changing organism coupling term that varies with the growth stage, enabling the simulator to accurately predict the "two-way influence between the organism and the environment"—for example, as animals age, their heat production increases → the temperature in the enclosure rises → more ventilation is needed → wind speed increases → the wind-cooling effect intensifies → wind-cooling protection needs to be considered. This two-way coupling is the core challenge of environmental control in facility agriculture and a key feature that distinguishes the gray box model of this invention from general industrial digital twins. The segmented routing with residual correction further ensures the prediction accuracy at different growth stages.
[0056] 5: Cross-scenario universality and multi-agent repeatability verification The implementation scheme of this invention: The same "simulation-evaluation-optimization" framework is applicable to both facility-based aquaculture and facility-based planting, requiring only the replacement of the gray box model's physical equations (heat and humidity balance → greenhouse energy / humidity / CO2 three-equation set) and the comprehensive environmental suitability index (ET → VPD + DLI). The framework layer is decoupled from the domain knowledge layer, enabling LLM to automatically retrieve corresponding industry knowledge for different scenarios. A multi-agent independent verification method (ten independent agents performing optimization separately from the same starting point, without communicating with each other) verifies the reproducibility of the core findings.
[0057] Existing implementation methods, such as PID / RL / Bayesian optimization, are customized for specific scenarios. Their state space, action space, and reward function / search space are all coupled to the scenario, requiring a complete redesign when migrating to a new scenario. Furthermore, existing methods typically do not provide repeatability verification mechanisms.
[0058] The specific technical approaches differ: This invention achieves cross-scenario reuse at the methodological level by decoupling the "optimization methodology" (LLM structure discovery + BO fine-tuning) from the "domain physical model" (grey box equations and evaluation metrics). When switching scenarios, only the physical model and evaluation metric modules need to be replaced; the LLM knowledge engineering module and the two-stage optimization process are fully reused. Multi-agent verification leverages the independence of LLM—multiple agents independently execute optimization from scratch. If the core findings are reproduced by all agents (reproducibility rate 10 / 10), it proves that the LLM retrieves highly consensus-based knowledge within the domain, rather than randomly generated information.
[0059] Based on the above analysis, this invention proposes an optimization system for environmental control strategies in facility agriculture based on a large language model. Please refer to [link / reference]. Figure 1 A four-layer closed-loop architecture was constructed: "Data Layer → Simulation Layer → Evaluation Layer → Optimization Layer". The functions and data flow relationships of each layer are as follows: The data layer, located at the bottom of the architecture, is responsible for managing historical operational data from facility agriculture production sites. Data sources include sensors within the facility (temperature, humidity, wind speed, light intensity, CO2 concentration, etc.), outdoor weather stations (outdoor temperature, outdoor humidity, wind direction and speed, solar radiation), and equipment operation status records (fan speed, heater on / off status, evaporative cooling pad on / off status, skylight opening, etc.). The data layer provides model training data and initial simulation states to the simulation layer.
[0060] The simulation layer sits above the data layer and constructs a hybrid simulator based on historical data. The hybrid simulator consists of three sub-modules: (a) a gray-box physical model sub-module—selecting the corresponding environmental dynamics equations based on the scenario type (thermal and humidity balance equations for facility aquaculture, and energy / humidity / CO2 balance equations for facility planting greenhouses) to calculate the physical prediction values of the environmental state within the facility under given equipment control commands; (b) a residual correction sub-module—using a gradient boosting tree model, with the prediction residuals of the gray-box model as the training target, to correct prediction biases caused by simplification assumptions in the gray-box model; and (c) a periodic state reset sub-module—replacing the simulator's internal state with real historical observations every fixed number of steps (e.g., every 6 control cycles, i.e., 30 minutes) to prevent the accumulation of prediction errors leading to trajectory divergence. The simulation layer receives the controller code generated by the optimization layer as input and outputs the simulation environment trajectory for use by the evaluation layer.
[0061] The evaluation layer sits above the simulation layer and establishes a six-dimensional weighted scoring function based on the comprehensive environmental suitability index. The evaluation index selects existing publicly available models according to the scenario type: Effective Temperature (ET) for facility aquaculture and VPD+DLI for facility planting. The six dimensions are: suitability (the proportion of the environment within the suitable range), deviation (the degree of deviation from the center of the suitable range), energy consumption (the normalized value of equipment energy consumption), switching frequency (the normalized value of equipment action switching), safety violations (the proportion of time steps that violate safety constraints), and biological growth vitality (growth efficiency loss calculated based on the stress-metabolism analytical formula). The evaluation layer receives the environmental trajectory from the simulation layer as input and outputs a comprehensive score for use by the optimization layer.
[0062] The optimization layer, located at the top of the architecture, employs a two-stage strategy: In the first stage, a large language model agent executes a structured experimental loop, retrieving domain experience from pre-trained knowledge and transforming it into a control policy framework; in the second stage, the policy framework discovered by LLM is handed over to Bayesian optimization for parameter fine-tuning. Key design constraints: the optimization layer can only modify the controller code and cannot affect the simulator or scorer, ensuring the objectivity and consistency of the evaluation.
[0063] The proposed system includes the following eight functional modules: (1) Data acquisition module: Collects environmental parameters (temperature, humidity, wind speed, light intensity, CO2 concentration, etc.) inside the facility and outdoor meteorological parameters (outdoor temperature, outdoor humidity, solar radiation, etc.), and records the equipment operating status. Provides model training data and initial simulation status to the hybrid simulation module.
[0064] (2) Hybrid Simulation Module: This module comprises three sub-modules: a gray box physical model sub-module (which selects the corresponding environmental dynamics equations based on the scenario), a residual correction sub-module (using a gradient boosting tree model and segmented routing according to operating conditions), and a periodic state reset sub-module (which resets the simulation state with real observations every fixed number of steps). It receives controller code as input and outputs the environmental state trajectory within the facility.
[0065] (3) Comprehensive evaluation module: Calculate the comprehensive environmental suitability index, execute the six-dimensional weighted scoring function, and map the environmental trajectory into a comprehensive score.
[0066] (4) Security verification module: Performs seven security checks on the controller code (syntax, interface compliance, determinism, disabled libraries, action security constraints, robustness, scope), and rejects the controller if any one of them fails.
[0067] (5) LLM Knowledge Engineering Module: This module includes a large language model agent, a structured log store, and an experiment loop scheduler. The LLM agent retrieves domain experience from pre-trained knowledge, maps it to the facility environment control parameter space via a four-tuple transformation path, and transforms it into control policy code. The experiment loop scheduler manages the execution flow of multiple rounds of experiments (reading context → generating code → safety check → simulation scoring → retention / rollback → logging). The structured log store saves all experiment records for LLM to refer to in subsequent rounds.
[0068] (6) Parameter fine-tuning module: Within the policy framework discovered by LLM, continuously adjustable parameters are extracted and Bayesian optimization is performed to search for the optimal parameter combination.
[0069] (7) Controller output module: Outputs the two-stage optimized control strategy in an abstract format independent of the equipment brand, including time period-parameter table, condition-action rule table and safety constraint table.
[0070] (8) Controller parameter mapping submodule: Based on the type of environmental controller actually deployed in the facility (such as Fancom, Priva, self-developed PLC, etc.), the abstract format control strategy is mapped to the parameter format that the target controller can recognize, maintaining logical equivalence.
[0071] In summary, this invention constructs a four-layer closed-loop architecture comprising a "data layer, simulation layer, evaluation layer, and optimization layer," and designs a two-stage optimization strategy of "large language model structure discovery + numerical optimization parameter fine-tuning," thereby achieving automated, efficient, and safe optimization of environmental control strategies for facility agriculture.
[0072] Based on the above system, this invention also proposes an optimization method for environmental control strategies in facility agriculture based on a large language model, the overall process of which is as follows: Figure 2 As shown, it specifically includes the following: Step 1: Build a hybrid simulator Input: Historical operational data of the facility (time series of internal and external environmental parameters of the facility, time series of equipment operating status).
[0073] Processing procedure: (a) Establish a physical model of the gray box. Select the corresponding environmental dynamics equations according to the facility type.
[0074] In facility-based farming scenarios, the poultry house heat and humidity balance equation is adopted:
[0075] in This is a ventilation and heat exchange item (related to fan speed and indoor / outdoor temperature difference). This is the heat transfer term of the building envelope (related to the indoor and outdoor temperature difference and the heat transfer coefficient of the building envelope). This is a heat dissipation item for organisms (which dynamically changes with age-weight-heat production curves and is a unique item in facility-based aquaculture simulation). For the heat dissipation of the heater, This is the endothermic term for evaporative cooling.
[0076] In facility-based farming scenarios, the greenhouse energy balance equation is adopted:
[0077] in Heat gain from solar radiation (reduced by the transmittance of the covering material and the opening of the shade net). This is the crop transpiration heat dissipation term (related to leaf area index (LAI) and VPD, which changes dynamically with the growth stage and is unique to facility-based planting simulation). It forms a three-equation system with the humidity equation and the CO2 concentration equation.
[0078] In the aforementioned gray box model, the bidirectional coupling terms between organisms and the environment (heat dissipation of animals in aquaculture and transpiration of crops in planting) are the key difference from general industrial digital twins—industrial environment simulation models do not include interaction terms between organisms and the environment.
[0079] The mapping of equipment control signals to physical effects adopts a hierarchical calculation method. For example, in a poultry house, when the control signal of fan level 10 is mapped to the equivalent ventilation volume, it needs to be calculated in segments according to the actual number of fans installed (e.g., 2 36-inch fans + 16 54-inch fans) based on the equipment configuration: only small fans are used in levels 1-2, and large fans are gradually used in levels 3-10.
[0080] The physical parameters to be calibrated in the gray box model (such as the heat transfer coefficient of the building envelope and the equipment efficiency coefficient, totaling 6 parameters) are identified by natural step response events automatically extracted from historical operating data. Natural step response events refer to the response process of environmental parameters after a sudden change in equipment status (such as a fan speed increasing from level 3 to level 8) in historical data. Approximately 100 such events can be extracted from 12 months of historical data for parameter identification.
[0081] (b) Training the residual correction model. Gradient Boosting Tree (XGBoost) was used to learn the prediction residuals of the gray-box model. The residual correction model was segmented according to operating conditions: independent models were trained separately for the brooding period (high temperature and low ventilation) and general operating conditions in the poultry house scenario. During simulation, the corresponding residual model was automatically selected based on the current age and environmental conditions. The prediction accuracy was significantly improved after residual correction: In the poultry house example, the temperature prediction RMSE decreased from 0.74°C in the gray-box model to 0.23°C in the hybrid model (a reduction of 69.6%), and the humidity decreased from 3.75%RH to 0.88%RH (a reduction of 76.4%).
[0082] (c) Configure periodic state reset. Set the state reset interval to an integer multiple of the control decision cycle (e.g., if the control cycle is 5 minutes, the reset interval is 6 cycles, or 30 minutes). During the simulation, at each reset time, the simulator's internal state variables (temperature, humidity, etc.) are replaced with the corresponding real historical observation values, and then the simulation continues. This mechanism limits the simulation error within the reset interval, preventing long-term accumulation. In the poultry house embodiment, the multi-step temperature RMSE decreased from 8.0°C (free prediction, no reset) to 1.42°C.
[0083] Output: A hybrid simulator that can receive controller code as input and output environmental state trajectories.
[0084] Step 2: Establish a comprehensive evaluation system Input: Scene type definition (breeding / planting, variety, growth cycle).
[0085] Processing procedure: (a) Select comprehensive environmental suitability index. Select existing public models according to scenario type: for facility aquaculture, select effective temperature ET (Tao & Xin, 2003), which combines dry bulb temperature, relative humidity and wind speed into a single value; for facility planting, select VPD (saturated vapor pressure difference) and DLI (solar integral).
[0086] (b) Establish phased suitability ranges. Set target ranges for environmental suitability indicators based on the biological growth stages. For example, in a poultry house setting, segment by age: 1-7 days old, target ET 32-35°C; 8-14 days old, 30-32°C; 15-21 days old, 27-30°C; 22-28 days old, 24-27°C; 29-42 days old, 20-24°C.
[0087] (c) Construct a six-dimensional weighted scoring function. The formula is as follows:
[0088] The specific calculation methods for the six dimensions are as follows: (Suitability) = The percentage of time steps within the suitable range for the current growth stage in terms of environmental suitability index. Values range from [0, 1], with higher values being better.
[0089] (Deviance) = Normalized average deviation of the environmental suitability index from the center of the suitability range. Values range from [0, 1], with lower values being better. The normalization constant is set based on physical derivation (e.g., the theoretical maximum deviation for ET is 2.5°C).
[0090] (Energy Consumption) = Normalized value of the sum of weighted energy consumption of all devices. Values range from [0, 1], the lower the better.
[0091] (Switching frequency) = Normalized value of the sum of changes in the state of each device. Values range from [0, 1], the lower the better.
[0092] (Safety Violation) = Percentage of time steps in which safety constraints are violated. Values range from [0, 1]. Any violation is severely punished.
[0093] (Biological Growth Vitality) = Calculated based on the stress-metabolism analytical formula. In facility farming, it is calculated according to the degree of ET deviation from the comfort zone: under heat stress, feed intake decreases by approximately 2% for every 1°C exceeding the threshold; under cold stress, energy efficiency decreases by approximately 1.5% for every 1°C below the threshold; the value is 1.0 within the comfort zone, with a smooth decay on both sides, and 0.0 in the lethal zone. This sub-item uses the stress-feed intake analytical formula from animal husbandry literature and does not rely on additional data-driven training.
[0094] Weight settings satisfy This ensures that safety violations are punished with the highest possible severity. In the poultry house implementation example, the specific weights are... .
[0095] Output: A scoring function that maps environmental trajectories to a single comprehensive score.
[0096] Step 3: Configure the security verification mechanism Input: Facility and equipment constraints and biosafety standards.
[0097] Processing procedure: Seven safety checks are set up. In each round of the S4 experiment, the controller code generated by LLM is verified item by item. If any item fails, the system reverts to the previous version and does not proceed to the simulation scoring stage. (1) Syntax check: The controller code must be successfully parsed by the Python interpreter (without syntax errors).
[0098] (2) Interface compliance check: The controller must implement the specified input interface (receive environmental status dictionary) and output interface (return device control instruction dictionary), and the device instruction key name in the output must be consistent with the device set defined by the simulator.
[0099] (3) Output determinism check: Given the same environmental state input, the controller must produce the same control output (random number generators or timestamp-dependent logic are not allowed to ensure that the simulation is reproducible).
[0100] (4) Disable library checks: The controller code must not import network communication libraries, file system operation libraries or other libraries that may produce side effects (such as requests, os, subprocess, etc.) to ensure that the controller runs in a sandbox.
[0101] (5) Safety constraint check of control action: Verify whether the output of the controller meets the safety constraints under various extreme input conditions, including: minimum operating constraints of environmental control equipment (e.g., minimum ventilation fan ≥ 2), single-step maximum equipment state change constraints (e.g., |Δfan| ≤ 2, to prevent drastic equipment switching), minimum start-stop interval constraints of auxiliary equipment (e.g., heater / wet curtain switching interval ≥ 6 steps, i.e. 30 minutes, to prevent frequent start-stop damage to equipment), mutual exclusion equipment interlock constraints (e.g., heater and wet curtain cannot be started at the same time), and equipment operation upper limit constraints set according to biological growth stage (e.g., upper limit of fan during chick stage).
[0102] (6) Extreme input robustness check: Set the environmental state parameters to extreme values (extreme high temperature, extreme low temperature, extreme high humidity, etc.) and input them into the controller to verify that it will not crash or output out-of-bounds values.
[0103] (7) Code scope check: Confirm that the code modification of LLM is limited to the controller file and does not modify the simulator or scorer code, so as to ensure the objectivity of the evaluation system.
[0104] Output: A set of seven security check rules.
[0105] Step 4: Perform the LLM structure discovery phase (see Figure 2, where the horizontal axis represents the number of rounds and the vertical axis represents the overall score. The figure shows the score increase curve of 200 rounds of free exploration in LLM and the further improvement of Bayesian optimization, with key milestone rounds and corresponding strategy discoveries marked). Inputs: S1 Hybrid simulator, S2 Scoring function, S3 Safety check rules, and task specification document.
[0106] The task specification document includes the following content: (a) Optimization objective – Improve overall score; (b) Modifiable files – controller code files only; (c) List of simulation scenarios – 12 scenarios covering different seasons and working conditions; (d) Constraint condition—zero safety violations; (e) Description of known performance bottlenecks - current scores and suggestions for improvement for each scenario (e.g., "S10 Winter scenario has severe cold stress").
[0107] The task specification does not include specific strategy schemes or parameter values; LLM must retrieve them from pre-trained knowledge.
[0108] Processing procedure – single-round experimental cycle (the following is the complete process of one round of experimentation, repeated N times): Step 1: LLM Reads the Context. The LLM agent reads the task specifications and all historical experiment logs. The historical logs contain the hypotheses, code changes, parameter snapshots, actual scores, and conclusions for each previous round. Based on this, LLM determines the current performance bottlenecks and directions for further exploration.
[0109] Step 2: LLM retrieves domain experience from pre-trained knowledge. LLM identifies the corresponding knowledge category based on the current bottleneck and retrieves relevant domain experience from the pre-trained corpus. The minimum interface requirements for LLM are: input task specifications and historical experimental log text, output executable control code for modification. Any large language model that satisfies both code generation and domain knowledge retrieval capabilities can be used.
[0110] Step 3: Knowledge Mapping to Facility Environmental Control Parameter Space. LLM maps the retrieved heterogeneous knowledge to the "Facility Environmental Control Parameter Space" proposed in this invention. This parameter space consists of four types of parameters: Biological growth requirement curves – quantitative requirements for environmental factors at different growth stages (such as age-target ET curve, reproductive period-target VPD / DLI curve). Equipment capacity boundaries—the operating range, hierarchical mapping relationships, and interlocking constraints of various environmental control equipment; Environmental dynamic parameters—physical constants for energy and mass exchange within a facility; Safety constraint thresholds—the hard boundaries of biosafety and equipment safety.
[0111] Step 4: Quadruple Transformation Path – Qualitative Knowledge Transformed into Control Code. LLM transforms the retrieved qualitative recommendations into executable code following this path: The parsing is a structured parameter group containing four elements: trigger condition (e.g., "age ≤ 7 and outdoor temperature < 15°C"), target value or target range (e.g., "fan speed limit = 3, corresponding to wind speed of approximately 0.14 m / s"), controlled equipment (e.g., "longitudinal ventilation fan"), and execution logic (e.g., "override default fan speed limit parameter when the condition is met"). The structured parameter set is encoded into specific branch logic and numerical parameters in the control code.
[0112] Step 5: Security Check. Perform the seven security checks defined by S3 on the controller code generated by the LLM. If any check fails, revert to the previous version; this round of the experiment will be recorded as "Security check failed".
[0113] Step 6: Simulation Run and Scoring. Run 12 scenarios (covering spring / summer / autumn / winter, brooding / medium-sized chickens / large chickens, high temperature / low temperature / transition, equipment degradation, etc.) on the hybrid simulator, and calculate a weighted comprehensive score using a scoring function.
[0114] Step 7: Keep or Roll Back. If the overall score is higher than the historical best, keep the changes made in this round and update the optimal controller; otherwise, roll back to the previous version.
[0115] Step 8: Record a structured experiment log. Record the hypothesis of this round (why the LLM was modified), code changes, parameter snapshots (comparison of key parameters before and after modification), expected results (LLM predictions), actual scoring results (scores for each scenario), conclusions (analysis of the reasons for success / failure), and next steps. Records of positive breakthroughs and negative failures together form an accumulated knowledge base.
[0116] Phased Strategy: S4 employs a phased strategy—in the early phase (e.g., the first 20 rounds), the task specification outlines the optimization direction (e.g., "first address the heat stress in the summer high-temperature scenario of S1") but does not provide specific parameters or solutions. In the later phase, the LLM agent autonomously determines the exploration direction. A phase summary is generated after each preset number of rounds (e.g., every 10 rounds), summarizing key findings and lessons learned. Experiments show that guided hints only accelerate convergence in the first 20 rounds and do not determine the optimization ceiling—the free exploration group can achieve the same or higher scores as the guided group after 40 rounds.
[0117] Typical structural control logic discovered by LLM at this stage: Growth stage differentiation control parameter system: Numerical knowledge is extracted from growth data in industry standards and scientific research literature and transformed into equipment operating limits, basic output levels, response sensitivity, and control hysteresis widths set according to growth stages. For example, LLM extracts the numerical knowledge of "low heat production and intolerance to air cooling in young animals" from the age-heat production curve in the CIGR manual and transforms it into a quantitative parameter of "fan upper limit = level 3 within 7 days of age".
[0118] Extreme environmental protection mode: Formulaic knowledge is extracted from thermodynamic principles and transformed into judgment logic for switching to protective control strategies when environmental suitability indicators exceed biological tolerance thresholds. For example, LLM retrieves the thermodynamic principle that "evaporative cooling is superior to forced convection when the external temperature exceeds body temperature" and establishes a survival protection mode.
[0119] Auxiliary equipment delayed shutdown strategy: Extract rule-based knowledge from process control literature and transform it into quantitative parameters that set the auxiliary equipment shutdown threshold within an appropriate range to reduce environmental oscillations.
[0120] Minimum operational assurance in extreme environments: Extracting constraint knowledge from industry standards (such as CIGR minimum ventilation rate in extreme cold) and converting it into control rules for equipment to reduce to the lowest safe level under extreme conditions.
[0121] Seasonal dynamic compensation: Extract rule-based knowledge from industry management manuals and transform it into quantitative parameters for dynamically superimposing equipment output compensation for specific growth stages during seasonal transitions.
[0122] Output: Controller code containing the strategy framework and initial parameters, as well as a complete structured experimental log.
[0123] Step 5: Execution Parameter Fine-Tuning Stage Input: The controller policy framework and initial parameters output from step 4.
[0124] Processing procedure: (a) Fixed strategy framework, extracting continuous parameters. Keeping the code logic structure of the S4 output controller (branch conditions, mode switching logic, etc.) unchanged, extract the continuously adjustable parameters to form the search space. Adjustable parameters include: equipment output levels set according to growth stages (e.g., basic fan levels for each age group), response sensitivity (e.g., overheat response slope), control hysteresis width (e.g., temperature hysteresis), auxiliary equipment trigger thresholds (e.g., evaporative cooling pad start-up thresholds), and parameters newly introduced by LLM during the structure discovery phase (e.g., seasonal dynamic compensation coefficient, segmented control hysteresis width, etc.). In the poultry house embodiment, the parameter space is 33-dimensional.
[0125] (b) Bayesian Optimization Search. A tree-structured Parzen estimator (TPE) is used as a surrogate model, with the overall score as the objective function, to perform a global search in the parameter space. In each evaluation round, candidate parameters are injected into the controller code, all 12 scenarios are run on the hybrid simulator, and the overall score is calculated. The optimal parameters output by S4 are used as the first evaluation point for Bayesian optimization (initialization injection), ensuring that the search starts from the better region already found by LLM. Typically, 200 rounds of search are performed, taking approximately 7 minutes (significantly faster than the approximately 4 hours for 200 rounds of LLM).
[0126] Output: The optimal combination of parameters after fine-tuning.
[0127] Step 6: Output the final controller and deployment mapping Input: Strategy framework from step 4 + fine-tuning parameters from step 5.
[0128] Processing procedure: (a) Parameter Backfilling. The optimal parameters fine-tuned in S5 are backfilled into the strategy framework discovered in S4 to generate the final rule controller. This controller is represented in an abstract format independent of equipment brand and contains three types of control rules: - Time Period-Parameter Table: Equipment operating parameters segmented by growth stage (e.g., "Age 1-7 days: Fan upper limit = 3, Temperature target = 33°C, Heating trigger offset = 0.5°C”); - Condition-Action Rule Table: Environmental trigger conditions and corresponding device control actions (e.g., “ET>Leadership Limit”). "Activate the evaporative cooling pad and limit the fan to level 5 at 2°C"; - Safety constraints table: unavoidable hard constraints (such as "minimum ventilation fan ≥ 2" and "heater and evaporative cooling pad interlock").
[0129] (b) Controller parameter mapping. Based on the actual deployed environmental controller type, the above abstract format is mapped to a parameter format recognizable by the target controller: - In facility aquaculture scenarios, the abstract "fan upper limit = 3 when age d∈[1,7]" is mapped to the time period setpoint table format of the Fancom environmental controller; - In facility planting scenarios, the abstract "skylight opening += 20% when VPD>1.2 kPa" is mapped to the condition triggering rule format of the Priva climate computer; - For self-developed PLC controllers, the mapping output is a parameter configuration file that can be directly loaded by the PLC.
[0130] The mapping process maintains the logical equivalence of the control strategy, only changing the representation format and organization of the parameters.
[0131] Output: Final environment controller (abstract format + target controller format).
[0132] The following description, in conjunction with relevant accompanying drawings and specific examples, further illustrates the proposed method and system for optimizing environmental control strategies in facility agriculture based on a large language model.
[0133] Example 1: Optimization of Poultry House Environmental Control Strategies This embodiment takes a stacked cage poultry house in Guangdong Province as an example to illustrate the method and system proposed in this invention in detail. The specific content is as follows.
[0134] Target audience: A stacked poultry house in Guangdong Province (75m×15m×4m, 4 rows, 3 layers, maximum capacity 24,190 birds). Equipment configuration: 2 x 36-inch fans and 16 x 54-inch fans (10-speed control), 3 warm air blowers, 2 sets of evaporative cooling pads. Sensors: 41 temperature sensors, 41 humidity sensors, 48 wind speed sensors. Data source: dFarming digital twin cloud platform, time range: March 2025 to February 2026 (12 months, covering 8 breeding batches).
[0135] Specific execution steps: S1 simulator construction: The gray box model uses the poultry house heat and humidity balance equation, and the six parameters to be calibrated are identified through 100 natural step response events. Residual correction uses XGBoost, with two routes: one for the brooding period and the other for general operating conditions. After residual correction, the RMSE of the temperature is 0.74°C → 0.23°C. 69.6%, humidity 3.75%→0.88%RH ( 76.4%. State reset interval 6 steps (30 minutes), multi-step temperature RMSE 8.0°C→1.42°C.
[0136] S2 Evaluation System: The overall environmental suitability index used is ET. The comfortable temperature range for each day is as follows: 1-7 days 32-35°C, 8-14 days 30-32°C, 15-21 days 27-30°C, 22-28 days 24-27°C, 29-42 days 20-24°C.
[0137] Scoring weight: .
[0138] S4 LLM structure discovery: The Claude Opus 4 model (model version claude-opus-4-6, 2026-03) was used to conduct 100 rounds / 10 phases of structured experiments. The LLM automatically retrieved and implemented strategies and their knowledge sources (each item labeled with knowledge type and transformation path): Round 9 (Rule-based → Parameter): Search the control theory literature for "increasing the control dead zone can reduce oscillations", and increase the temperature hysteresis from 0.5°C to 1.3°C.
[0139] Round 16 (Rule-based → Parameter-based): Retrieve the qualitative recommendation "limit wind speed during brooding period" from the Aviagen manual and convert it into a fan speed limit of 3 for chicks under 7 days old (corresponding to a wind speed of approximately 0.14 m / s, close to the manual's recommendation of 0.15 m / s). Conversion path: Qualitative recommendation "wind speed not exceeding 0.15 m / s" → Structured parameter group {Condition: age ≤ 7, Target: wind speed ≤ 0.15 m / s, Equipment: longitudinal fan, Logic: fan_max = 3} → Control code branch.
[0140] Round 27 (Numerical → Parameter System): Retrieve age-heat production data from the NRC / CIGR standard and establish a complete age-differentiated parameter system (set the upper limit of the fan, the basic level, and the response slope for each of the 5 age segments).
[0141] Round 57 (Numerical Data → Parameter Adjustment): Physiological knowledge from research literature indicates that laying hens have higher heat dissipation requirements than broilers, leading to the setting of a higher baseline fan speed for laying hens. Transformation Path: Breed Heat Production Data → Baseline Fan Speed Parameter Adjustment.
[0142] Round 66 (Formula-based → Function-based): Retrieve the principle of "nonlinear response curve" from control theory and change the overheating response from a linear function to a power function (smooth response with small deviations and steep response with large deviations).
[0143] Round 74 (Formula-based → Mode Switching): Retrieve from thermodynamic principles that "evaporative cooling is superior to forced convection when external temperature exceeds body temperature," and establish a survival protection mode (ET exceeds the lethal limit). When the safety margin is sufficient, activate the evaporative cooling pad and limit the fan to level 5.
[0144] Round 93 (Rule-based → Parameter): Search the process control literature for "delayed shutdown of cooling equipment can reduce oscillation", and set the wet curtain shutdown threshold to ET below the lower limit of the comfort range.
[0145] Results after 100 rounds: Overall score 0.411 → 0.818 (+98.9%), safety violations 13 → 0. Comfort level in S1 summer high temperature scenario 40% → 91%, comfort level in S4 summer high humidity scenario 50% → 100%.
[0146] Extended experiment (12 scenarios + 6-dimensional scoring): Executed for 200 rounds using the Haiku model (approximately 4 hours), with a score increase from 0.1674 to 0.7206 (+330%).
[0147] Winter Scene Restoration: S10 0.20→+0.52, S11 0.24 → +0.64.
[0148] New findings from LLM: Minimum ventilation guarantee in extreme cold (fan=1 when outdoor < 10°C) and dynamic compensation for fall in large chickens.
[0149] S5 parameter fine-tuning: With a fixed LLM optimal policy framework for 200 rounds, 33-dimensional continuous parameters were extracted, and 200 rounds of Bayesian optimization (7 minutes) were performed using Optuna TPE. The score improved from 0.6955 to 0.7517 (+8.1%), with a total increase of 349% over the two stages.
[0150] Quantitative comparison with traditional methods (starting with the R27 optimal solution, fixed policy framework, 15-dimensional parameter space, and 100 rounds of evaluation budget):
[0151] 500 Rounds of Extended Experiments—Efficiency Analysis of LLM Structure Discovery and Parameter Fine-Tuning: Starting from the optimal solution in R93 (0.8175), 500 rounds of LLM deep optimization were performed. The optimal score after 500 rounds was 0.8741 (Round 447), with a cumulative improvement of only +6.9%. The average improvement per round was 0.00407 in the first 100 rounds (structure discovery phase), while the average improvement per round was 0.000113 in the last 500 rounds (parameter fine-tuning phase), a difference of 36 times in efficiency. This verifies the rationality of the two-stage division of labor—LLM excels at structure discovery but its efficiency decreases with parameter fine-tuning. The parameter search efficiency of numerical optimization methods within a fixed structure is approximately twice that of LLM.
[0152] Repeatability verification: Please see Figure 4-7 , Figure 4 This diagram serves as a verification of the air-cooling protection strategy in a poultry house implementation example. Figure 4The comparison shows that after LLM retrieved the knowledge of "wind speed restriction during the brooding period", the comfort rate of S4 scene (young animals) jumped from 68% to 100% before and after. Figure 5 A comparison diagram of survival protection modes in poultry house implementation examples. Figure 5 The demonstration shows a comparison of temperature trajectories in extreme high-temperature scenarios between survival protection mode and traditional maximum ventilation strategy after LLM retrieves the thermodynamic principle that "evaporative cooling is superior to forced convection". Figure 6 Figure 1 shows the results of an independent verification experiment for a poultry house example. Figure 6 Show the score distribution (box plot) of ten independent agents and the reproducibility of core findings (10 / 10 reproducibility rate); Figure 7 Radar charts for 12 scenarios. Figure 7 Show the baseline vs. the final controller scores across 12 simulation scenarios (3×4 radar subplots).
[0153] Ten independent LLM agents were divided into Group A (5 agents, guided and prompted) and Group B (5 agents, free exploration), each executing 40 rounds independently from the same baseline. Group A had a mean of 0.6781 (CV = 8.7%), and Group B had a mean of 0.6624 (CV = 8.1%). The core findings were reproduced 10 / 10 (age differentiation, wind-cooling protection, and survival protection were all independently discovered by all agents). Cross-model validation was also performed using the minimax-m2 model, which also reproduced the core findings, validating the robustness of the method for LLM selection.
[0154] Example 2: Optimization of Greenhouse Climate Control Strategies This embodiment uses the Venlo-type greenhouse tomato cultivation as an example to further illustrate the cross-scenario versatility of the present invention.
[0155] Target audience: Venlo-type greenhouse tomato cultivation (single greenhouse 9.6m×50m×6m, 6 connected greenhouses with a total area of 2880 m²) 2 Equipment configuration: 12 skylights (opening degree 0-100%), 4 side windows, 4 evaporative cooling fans (3 speeds), 8 hot water heating pipes (valve opening degree 0-100%), 120 high-pressure sodium lamps (divided into 4 zones, 600W per lamp), 2 layers of shading nets (internal / external shading, 0-100%), 2 CO2 generators (0-200 kg / h). Sensors: 24 temperature sensors, 24 humidity sensors, 12 PAR (partial ambient light) sensors, and 8 CO2 sensors.
[0156] Specific execution steps: S1 simulator construction: The gray box model employs a three-equation system for greenhouse energy, humidity, and CO2. The energy equation includes solar radiation heat gain (reduced by transmittance and shading opening), heat loss from heating pipes, ventilation heat loss (related to opening and wind speed), heat transfer from the building envelope, and crop transpiration heat loss (Penman-Monteith formula, related to LAI and VPD). The CO2 equation includes fertilizer injection, ventilation losses, and photosynthetic consumption (Michaelis-Menten relationship). Equipment mapping: skylight / side window opening → equivalent ventilation area (considering wind pressure and thermal pressure effects); supplemental lighting zone control → PAR contribution (considering lamp distribution and reflection).
[0157] S2 Evaluation System: The comprehensive environmental suitability index was VPD+DLI. Suitable ranges were set according to the tomato growth stages: seedling stage: VPD 0.3-0.8 kPa, DLI≥12; flowering stage: VPD 0.5-1.2, DLI≥15; fruiting stage: VPD 0.5-1.0, DLI≥18; color-changing stage: VPD 0.4-0.8, DLI≥20.
[0158] Scoring weight: (Supplemental lighting in greenhouses accounts for a high proportion of energy consumption, and its energy consumption weight is slightly higher than that in poultry houses).
[0159] Note: The biological growth vitality sub-item (w6) is not yet defined in the greenhouse scenario. This sub-item will be added later when it is expanded to the crop VPD / light stress response model.
[0160] S3 Safety Constraints: CO2 concentration not exceeding 1500 ppm (for personnel safety); supplemental lighting PAR not exceeding the light saturation point of approximately 800 μmol / m² / s; shading nets and supplemental lights interlocked; heating elements and large-aperture ventilation interlocked; single-step skylight / side window opening changes not exceeding 20%; CO2 fertilization prohibited at night.
[0161] S4 LLM Expected Knowledge Retrieval (The following is a reasonable deduction of the feasibility of the method, based on the existing greenhouse management knowledge in the LLM pre-training corpus): The literature on greenhouse management in Wageningen was searched for "excessive VPD during flowering affects pollination", and the result was converted into a control rule of "starting humidification or increasing ventilation when VPD > 1.2 kPa". The literature on plant growth regulation was searched for "DIF temperature difference control can regulate stem elongation", which was transformed into a differentiated temperature control strategy of "night temperature is 6-8°C lower than day temperature"; The phrase "CO2 fertilization should be performed when the skylight is closed and there is sufficient sunlight" from greenhouse management experience is translated into "skylight opening < 30% and PAR > 200 μmol / m²". 2The conditional control logic for "starting CO2 at / s" is executed. The principle of "shading nets should be radiation-driven rather than temperature-driven" was retrieved from best practices in greenhouse management and transformed into a control structure change of "shading nets are triggered by PAR sensors".
[0162] Example 3: Water quality control in aquaculture (extended scenario) The method of this invention can also be extended to factory-scale recirculating aquaculture systems. The gray box model is replaced with the water oxygen balance equation and ammonia nitrogen conversion kinetic equation, and the comprehensive environmental suitability index is replaced with the comprehensive water quality compliance rate (comprehensive parameters such as dissolved oxygen, pH, ammonia nitrogen, and nitrite). Environmental control equipment includes aerators, microfilters, biofilters, heaters, and water exchange pumps. The LLM pre-training corpus contains aquaculture technical manuals and water quality management standards (such as SC / T 9101 Fishery Water Quality Standard), which can support the knowledge retrieval and strategy discovery process. The key condition is that the LLM pre-training corpus contains industry knowledge in the relevant field. This embodiment further demonstrates the cross-scenario versatility of the "simulation-evaluation-optimization" framework of this invention—when switching scenarios, only the physical model and evaluation index module need to be replaced, while the LLM knowledge engineering module and the two-stage optimization process are completely reused.
[0163] In summary, this invention effectively solves the challenges in optimizing environmental control strategies for facility agriculture by constructing a hybrid simulator, a comprehensive evaluation system, and a two-stage optimization method, particularly by combining the structure discovery capabilities of large language models with the parameter fine-tuning capabilities of Bayesian optimization. The detailed data in Example 1, the feasibility study in Example 2, and the extended scenarios in Example 3 fully demonstrate the effectiveness, versatility, and robustness of the method presented in this invention.
[0164] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that the present invention can be implemented using either a pure software solution or by combining a hardware platform with supporting software. Based on this technical feature, the core solution of the present invention can be presented in the form of a computer program product. This program product can be stored on various non-volatile storage media (including but not limited to optical discs, solid-state storage devices, and portable hard drives), and its included programming instructions can drive electronic devices with data processing capabilities (including personal terminals, cloud servers, and IoT devices) to accurately execute the technical processes defined in the various embodiments of the present invention. This flexibility of implementation ensures the adaptability and scalability of the technical solution in different application scenarios, while providing a standardized interface for subsequent functional expansion and maintenance.
Claims
1. A method for optimizing environmental control strategies in facility agriculture based on a large language model, characterized in that, Includes the following steps: S1. Construct a hybrid simulator, which includes a gray-box physical model submodule, a residual correction submodule, and a periodic state reset submodule; wherein: The gray box physical model submodule calculates the physical prediction value of the environmental state based on the environmental dynamics equation of the facility agriculture scenario; the residual correction submodule uses a machine learning model to learn and correct the prediction residual of the gray box physical model submodule; the periodic state reset submodule replaces the internal state of the simulator with the real historical observation value at a preset time interval during the simulation process. S2. Establish a comprehensive evaluation system, which includes a scorer based on a six-dimensional weighted scoring function, used to map the environmental trajectory output by the hybrid simulator into a comprehensive score; The six-dimensional weighted scoring function includes six dimensions: suitability, deviation, energy consumption, switching frequency, safety violations, and biological growth vitality. S3. Configure a security verification mechanism, which includes a set of security check rules for verifying the controller code; S4. Perform the large language model structure discovery phase, which includes the following sub-steps: S41. Specifications and historical experimental logs of the large language model agent reading task; S42, The large language model agent retrieves domain experience related to the current optimization objective from pre-trained knowledge; S43. The large language model agent maps the retrieved domain experience to a preset facility environment control parameter space to form a structured parameter set; S44. The large language model agent generates or modifies controller code based on the structured parameter group; S45. Verify the generated controller code using the security verification mechanism. If the verification passes, proceed with the next steps; otherwise, revert to the previous version. S46. Input the verified controller code into the hybrid simulator for simulation, and have the scorer calculate the overall score. S47. Based on the comprehensive score, decide whether to retain or roll back the current controller code, and record a structured experimental log containing code changes and scoring results; Repeat sub-steps S41 to S47 until the preset number of rounds of experiment are completed; S5. In the fine-tuning stage of execution parameters, the strategy framework in the controller code output in step S4 is fixed, and the continuously adjustable parameters are extracted to form a search space. The Bayesian optimization algorithm is used to search for the parameter combination that makes the overall score optimal in the search space. S6. Output the final controller. Combine the strategy framework output in step S4 with the optimal parameter combination fine-tuned in step S5 to generate the final environment controller.
2. The method according to claim 1, characterized in that, The gray box physical model submodule in step S1 selects the corresponding environmental dynamic equations according to the facility type: In facility-based farming scenarios, the poultry house heat and humidity balance equation is adopted, in which the heat dissipation term of organisms is a dynamic coupling term related to the age and weight of animals. In the facility planting scenario, a three-equation set consisting of the greenhouse energy balance equation, humidity equation and CO2 concentration equation is adopted, in which the crop transpiration heat dissipation term is a dynamic coupling term related to the leaf area index and saturated water vapor pressure difference. The mapping from equipment control signals to physical effects adopts a hierarchical calculation method based on the actual equipment configuration; the residual correction submodule adopts a gradient boosting tree model and segments the routing according to the working conditions, and trains and uses independent residual correction models under different working conditions. The periodic state reset submodule in step S1 resets the simulator's internal state variables to the corresponding real historical observation values at fixed time intervals. The fixed time interval is an integer multiple of the control decision cycle and does not exceed the number of steps corresponding to the upper limit of the cumulative drift that the simulator's single-step prediction accuracy can accept.
3. The method according to claim 1, characterized in that, The calculation formula for the six-dimensional weighted scoring function mentioned in step S2 is as follows: in, S suitability The percentage of time steps in which the environmental suitability index is within the suitable range; S deviation The normalized average deviation between the environmental suitability index and the center of the suitability interval; S energy The normalized value of the weighted sum of energy consumption of all devices; S switch This is the normalized value of the sum of the state changes of all devices; S violation The percentage of time steps that violated security constraints; S vitality This is the biological growth vitality calculated based on the stress-metabolism analytical formula; the weight settings satisfy... w 5> w 1> w 6> w 2> w 4> w 3. Decreasing sequentially to ensure the highest possible penalty for safety violations. The biological growth vitality component is calculated based on the stress-metabolism analytical formula, reflecting the impact of heat / cold stress on the growth efficiency of organisms. In facility-based aquaculture, this component calculates the vitality loss according to the degree to which the effective temperature deviates from the comfort range, using the analytical formula that "for every 1°C increase in heat stress, feed intake decreases by 2%, and for every 1°C decrease in cold stress, energy efficiency is lost by 1.5%". In facility-based planting, this component corresponds to the inhibitory effect of extreme VPD or light stress on crop growth. The component is calculated using analytical formulas and does not rely on additional data-driven training.
4. The method according to claim 1, characterized in that, The facility environmental control parameter space described in step S4 consists of four types of parameters: biological growth demand curve, equipment capacity boundary, environmental dynamic parameters, and safety constraint threshold. The structured parameter group contains four elements: trigger condition, target value or target range, controlled device, and execution logic; The large language model agent transforms the retrieved qualitative knowledge into the structured parameter set and encodes it into branch logic and numerical parameters in the controller code; The structure discovery phase in step S4 adopts a phased strategy: in the early stage, the optimization direction is specified by the task specification but no specific parameters or strategy are given; in the later stage, the large language model agent decides the exploration direction completely autonomously. After each preset number of rounds, a phase summary is generated to summarize key discoveries and failure experiences.
5. The method according to claim 4, characterized in that, The controller strategy framework output in step S4 includes the following structured control logic, which is derived from qualitative knowledge retrieved from heterogeneous domain documents by a large language model and then transformed: Growth stage differentiation control parameter system: Numerical knowledge is extracted from biological growth data in industry standards and scientific literature and transformed into the upper limit of environmental control equipment operation, basic output level, response sensitivity and control hysteresis width set according to biological growth stages. Conservative control strategy is adopted in the early growth stage and active control strategy is adopted in the mature stage. Extreme environmental protection mode: Extract formulaic knowledge from biological tolerance data and thermodynamic principles in scientific research literature, and transform it into the judgment conditions and execution logic for switching to protective control strategies when the comprehensive environmental suitability index exceeds the biological tolerance threshold minus the preset safety margin, so as to prioritize the protection of biosafety; Auxiliary equipment delayed shutdown strategy: Extract rule-based knowledge from process control literature and transform it into quantitative parameters that set the shutdown threshold of auxiliary equipment within the appropriate range of the comprehensive environmental suitability index, so as to reduce environmental oscillations; Over-biased response: Extract formulaic knowledge from control theory literature and transform it into a nonlinear response function to make the response smooth when the deviation is small and steep when the deviation is large; Minimum operational assurance in extreme environments: Extracting constraint knowledge from the minimum air exchange rate or minimum heating maintenance requirements in industry standards and transforming it into control rules that reduce equipment operation to the minimum safe level when environmental conditions exceed preset extreme thresholds; Seasonal dynamic compensation: Extract rule-based knowledge from seasonal management recommendations in industry management manuals and transform it into quantitative parameters for superimposing additional environmental regulation compensation on organisms at specific growth stages during seasonal transitions.
6. The method according to claim 5, characterized in that, The structural control logic specifically includes the following in different facility agriculture scenarios: When applied to facility-based farming scenarios: In the growth stage differentiation control parameter system, the upper limit of the ventilation fan speed, the basic fan speed, the fan response slope, and the temperature hysteresis width are set according to the animal's age; in the extreme environmental protection mode, when the effective temperature exceeds the upper limit of the lethal temperature minus the safety margin, the evaporative cooling device is activated and the fan speed is limited to the preset upper limit to achieve survival protection; the wind-cooling protection logic limits the fan speed to the lower upper limit for young animals to prevent cold stress caused by the wind-cooling effect; in the auxiliary equipment delayed shutdown strategy, the shutdown threshold of the evaporative cooling device is set when the effective temperature is lower than the lower limit of the comfort range; the extreme cold minimum ventilation guarantee reduces the ventilation fan speed to the lowest safe speed when the outdoor temperature is lower than the preset threshold; the autumn dynamic compensation for large chickens dynamically adds the basic fan speed increment to large chickens nearing slaughter age within the mild outdoor temperature range; When applied to facility-based planting scenarios: the growth stage differentiation control parameter system sets ventilation equipment opening degree, supplemental light intensity, CO2 fertilizer concentration, and temperature control targets according to crop growth stages; the VPD regulation strategy adjusts ventilation and humidification equipment in real time based on the saturated vapor pressure difference to maintain VPD within the appropriate range for the current growth stage; the DLI supplemental light strategy automatically starts supplemental lighting to reach the target DLI when natural light is insufficient, based on the real-time cumulative value of sunlight integral; the diurnal temperature difference management strategy sets differentiated temperature targets for day and night, using temperature differences to promote crop stem elongation or inhibit excessive growth; and the interlocking logic of mutually exclusive equipment includes interlocking between shading nets and supplemental lighting, and between heating and forced ventilation.
7. The method according to claim 1, characterized in that, The Bayesian optimization described in step S5 uses a tree-structured Parzen estimator as a surrogate model, and takes the parameters in the optimal controller code output in step S4 as the first evaluation point of the Bayesian optimization.
8. The method according to claim 1, characterized in that, It also includes a repeatability verification step: using the same hybrid simulator, evaluation system and task specifications as input, multiple independent large language model agents are started to execute the structure discovery phase described in step S4 respectively, and the agents do not share experimental logs; the final controller scores output by each agent are statistically analyzed to verify the convergence of the optimization results; the control laws independently discovered by each agent are cross-compared to verify the repeatability of the core strategy.
9. A facility agriculture environmental control system based on a large language model, used to implement the method described in any one of claims 1 to 8, characterized in that, include: The data acquisition module is used to collect environmental parameters within the facility, outdoor meteorological parameters, and equipment operating status. The hybrid simulation module includes a gray box physical model submodule, a residual correction submodule, and a periodic state reset submodule, which are used to receive controller code and output the environmental state trajectory within the facility. The comprehensive evaluation module is used to execute a six-dimensional weighted scoring function to map the environmental trajectory into a comprehensive score; The security verification module is used to perform security checks on the controller code. The Large Language Model Knowledge Engineering module includes a large language model agent, structured log storage, and an experiment loop scheduler, which is used to execute the experiment loop in the structure discovery phase and generate controller code containing a policy framework. The parameter fine-tuning module is used to perform Bayesian optimization to search for the optimal parameter combination within the strategy framework output by the large language model knowledge engineering module. The controller output module is used to output the control strategy, which includes the strategy framework and the optimal parameter combination, in an abstract format that is independent of the device brand. The abstract format includes a time period-parameter table, a condition-action rule table, and a safety constraint table. The controller parameter mapping submodule is used to map the abstract format control strategy to a parameter format recognizable by the target controller according to the type of environmental controller actually deployed in the facility. The mapping process maintains the logical equivalence of the control strategy.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 8.