Northern greenhouse tropical fruit microclimate adaptive control system based on reinforcement learning
The reinforcement learning-based adaptive control system for the microclimate of tropical fruits in northern greenhouses solves the problem that traditional greenhouse control systems struggle to maintain the optimal physiological environment for tropical fruits under the complex winter climate of northern China, achieving efficient and reliable improvement in fruit quality and yield.
Patent Information
- Application Number
- CN202511807244.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-03
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2045-12-03
AI Technical Summary
Existing greenhouse control systems struggle to maintain the optimal physiological environment for tropical fruits under the complex winter climate conditions in northern regions, leading to decreased fruit quality and increased energy consumption. Traditional control methods cannot effectively coordinate the nonlinear coupling relationships between devices, resulting in oscillations and hysteresis.
An adaptive control system for the microclimate of tropical fruits in a northern greenhouse, based on reinforcement learning, is adopted. Through a data acquisition module, an open-loop trajectory optimization module, a strategy fine-tuning module, and an instruction execution module, a neural ODE environment model is constructed to perform open-loop trajectory optimization and strategy fine-tuning, generating a control trajectory that meets the equipment safety boundaries and power constraints.
It achieves precise coordination of multi-device collaborative operation under extreme climatic conditions, significantly improving control accuracy, response speed and energy utilization, ensuring fruit quality and yield, and providing highly reliable and highly adaptive environmental control.
Smart Images

Figure CN121325625A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of artificial intelligence, and particularly relates to a northern greenhouse tropical fruit microclimate adaptive control system based on reinforcement learning. BACKGROUND
[0002] Since bananas, mangoes, dragon fruits, pineapples and other tropical fruit trees are extremely sensitive to temperature, humidity, carbon dioxide concentration, light intensity and light quality ratio, the climate control system of a conventional greenhouse is difficult to maintain the optimal physiological environment of the tropical fruit trees under the conditions of low temperature, short daylight and atmospheric humidity stagnation in winter. Most of the current public facility environment control technologies are derived from the control field of vegetable and flower greenhouses, and generally adopt a segmented control, a proportional integral derivative control or a fuzzy control method based on a set threshold. Such a method can maintain the balance of basic temperature and humidity in a relatively stable seasonal climate, but its control precision and response speed significantly decrease under the conditions of complex climate coupling, large diurnal temperature difference and frequent light mutation in the northern winter.
[0003] The existing automatic greenhouse control system usually relies on fixed models or empirical rules to perform actuator scheduling. For example, a heating device is started when the air temperature is lower than a certain threshold, ventilation or dehumidification is started when the humidity is higher than an upper limit, and supplemental lighting is started when the light is lower than the target. Although this rule-based control method is easy to implement, it cannot consider the nonlinear coupling relationship between devices. For example, heating increases air temperature while reducing relative humidity, spraying increases humidity but reduces leaf temperature and affects carbon dioxide concentration, and supplemental lighting increases photosynthetic rate but also causes local heat accumulation. These cross-influences often cause oscillation or lag in single-variable control strategies, and crops experience multiple over-regulations in a short period of time, affecting fruit quality and significantly increasing energy consumption. In recent years, model predictive control methods have appeared to some extent to improve the above problems. Such methods predict the future environmental changes at several time steps by establishing a greenhouse energy and material balance model, thereby optimizing actuator actions. However, model predictive control relies on the accuracy of the model, and in the case of rapid climate change in the northern winter, device performance decay over time, and continuous adjustment of the crop canopy structure, the static parameters of the model are difficult to maintain effectively. In addition, the computational complexity of model predictive control is high, and it usually requires strong computing hardware and frequent model updates, making it difficult to run in real time on distributed edge controllers. SUMMARY
[0004] The main purpose of the present application is to provide a northern greenhouse tropical fruit microclimate adaptive control system based on reinforcement learning, which can continuously maintain the optimal physiological range of tropical fruits in the complex environment of low temperature, little light and high humidity in the northern winter, significantly reduce energy consumption and actuator start-stop frequency, improve fruit quality and yield, and realize high energy efficiency, strong robustness and adaptive greenhouse intelligent climate control.
[0005] To solve the above problems, the technical scheme of the present application is implemented as follows: The north greenhouse tropical fruit microclimate adaptive control system based on reinforcement learning comprises: a data acquisition module configured to acquire multi-channel sensor data at a preset sampling period and construct a state vector comprising at least one daytime / nighttime flag and one growth stage flag; an open-loop trajectory optimization module configured to: based on the state vector, establish a neural ODE environment model, and perform open-loop trajectory optimization using Pontryagin approximation to generate a control trajectory comprising multiple time periods, with an overall window deviation score and an overall window energy consumption; a strategy fine-tuning module configured to: configure a strategy network, the strategy network is trained by imitating the actions of the first time period of the control trajectory, and is fine-tuned online based on the sensitivity of the overall window deviation score and the overall window energy consumption; and an instruction execution module configured to: preferentially generate an executable message sequence using the control trajectory, and when the control trajectory is missing, generate an executable message sequence using the output of the strategy network and issue it to the controlled device.
[0006] Further, the data acquisition module is further configured to: perform a preset sensor arbitration and denoising processing procedure on the same physical quantity readings from the above sensors to generate a single valid reading; and concatenate the acquisition channel data from the outdoor environment, the indoor environment, the physiological state of the crop body, and the state of the controlled device, together with the daytime / nighttime flag and the growth stage flag, into the state vector in a fixed order.
[0007] Further, the open-loop trajectory optimization module is further configured to: construct the neural ODE environment model using a neural network with a multi-layer feedforward structure and a rectified linear function activation, and solve it using a deterministic numerical integrator; perform a start-up period online calibration process comprising multiple preset identification sequences during the system start-up period, the preset identification sequences are used to sequentially stimulate different types of controlled devices to produce step responses; perform incremental training during the start-up period online calibration process until the neural ODE environment model's prediction of a set of key environmental states meets a set of preset convergence thresholds; after the start-up period online calibration stops, periodically perform health checks, and when the prediction average absolute deviation exceeds any preset convergence threshold, trigger a rapid retraining process.
[0008] Further, the open-loop trajectory optimization module is further configured to: discretize the prediction time window into a plurality of time segments with fixed time length; call the neural ODE environment model to perform forward simulation to obtain a prediction state sequence in the prediction time window; calculate a whole-window deviation score, which is a sum of segment deviation scores of all time segments; the segment deviation score is used to quantify at least one of the following: an environmental state or a crop physiological state in the prediction state sequence deviates from a boundary value of a crop target interval in the corresponding time segment, and a difference between a leaf surface temperature and a dew point temperature deviates from a safety threshold value; calculate a whole-window energy consumption, which is a cumulative sum of power conversion coefficients of controlled devices, control values of the corresponding time segments, and time segment lengths.
[0009] Further, the open-loop trajectory optimization module is further configured to: calculate, by automatic differentiation, a sensitivity vector of the whole-window deviation score and the whole-window energy consumption with respect to a control trajectory including the plurality of time segments; update the control trajectory by using a sequential two-stage strategy: in a first stage, iteratively update the control trajectory with a sole objective of minimizing the whole-window deviation score; in a second stage, iteratively update the control trajectory with a sole objective of minimizing the whole-window energy consumption after the whole-window deviation score meets a preset condition; perform action projection after each iteration in the first stage and the second stage; and terminate the open-loop trajectory optimization when a total iteration number upper limit or an optimization target convergence condition is met.
[0010] Further, the action projection is configured to perform the following projections on each time segment item by item: upper and lower limit projection: clip control values in the control trajectory to boundaries of a preset device physical value range; change amplitude projection: retract a control value difference between adjacent time segments to within a preset device single change amplitude limit; continuous time length projection: scan the control trajectory, and merge segments with adjacent same direction and less than a minimum continuous operation or rest time length to meet a minimum time constraint of starting and stopping of the controlled device; partition power projection: according to a total power upper limit of a partition, start from a preset lowest priority device, and decrease control values in a priority order until the total power meets the upper limit; wherein, the priority order from low to high is: spraying device, LED device, ventilation device, shading device, and warming device.
[0011] Further, the control variables used by the open-loop trajectory optimization module have the following value ranges and action boundaries: for control variables such as warming output, side window opening degree, top window opening degree, circulating fan speed, spraying duty cycle, shading curtain opening and closing, LED red light, LED blue light, LED white light, and carbon dioxide release, set their respective upper and lower limits, single change amplitude limits, minimum continuous operation time length, minimum shutdown time length, single operation maximum time length, and minimum interval time length between two consecutive actions.
[0012] Further, the policy fine-tuning module is further configured to: adopt a policy network with a multi-layer feedforward structure and rectified linear function activation; periodically extract control values of a first time period from the control trajectory generated by the open-loop trajectory optimization module as teaching signals, and form imitation learning samples with the current state vector for training of the policy network; periodically trigger online fine-tuning: when a target achievement rate of an overall window deviation score in a statistical window meets a first preset condition, apply a first amplitude of correction to the output of the policy network in a direction of negative sensitivity of overall window energy consumption; when the target achievement rate meets a second preset condition, apply a second amplitude of correction to the output of the policy network in a target direction of the first segment of the control trajectory; perform action projection on the corrected action, and write the instruction into the instruction buffer.
[0013] Further, the instruction execution module is further configured to: pull the controlled device reward and indoor and outdoor observations in each control period to generate an actual curve; compare the actual curve with a predicted curve generated by the open-loop trajectory optimization module, and when an average absolute deviation of the two exceeds a review threshold set for indoor air temperature, indoor relative humidity, indoor carbon dioxide concentration, or leaf surface temperature, preferentially adopt the process of the open-loop trajectory optimization module in the next period, and trigger fast retraining of the open-loop trajectory optimization module; execute device linkage rules based on crop species and growth stages, including priority strategies for night heat preservation and ventilation, sunshade priority strategies for specific crop growth stages, and light supplement combination strategies for specific crop growth stages.
[0014] Further, the data acquisition module is further configured to: establish and reference a crop parameter table, the crop parameter table defining corresponding target intervals and device action boundaries for daytime and nighttime respectively according to crop species and growth stages of tropical fruits; the target intervals at least include: indoor air temperature target interval, indoor relative humidity target interval, carbon dioxide concentration target interval, minimum safety difference between leaf surface temperature and dew point temperature, and daytime target photosynthetically active radiation interval; the device action boundaries at least include: minimum ventilation opening, maximum single spraying duration, proportions of different light qualities in light supplement devices, and minimum night ventilation intensity.
[0015] The northern greenhouse tropical fruit microclimate self-adaptive control system based on reinforcement learning has the following beneficial effects: the neural ODE environment model describes the dynamic coupling relationship of multi-dimensional variables such as indoor air temperature, humidity, carbon dioxide concentration, leaf surface temperature and light conditions in a continuous time manner, compared with a traditional discrete time prediction model, the state evolution is smoother, and the nonlinear change under the action of devices such as spraying, ventilation, shading and light supplementing can be captured, thereby avoiding short-period oscillation and hysteresis. The control trajectory is optimized by Pontryagin approximation, the system can balance the crop target interval deviation and energy consumption within the prediction window at the same time, output the optimal trajectory within the physical constraint range, realize fine coordination of multi-device collaborative action, and significantly improve the energy utilization rate. The reinforcement learning fine-tuning part uses imitation learning to keep the consistency of the trajectory and the strategy network, and when environmental disturbance or model deviation occurs, the strategy output is corrected online according to the sensitivity of the whole window deviation score and the whole window energy consumption, so as to realize continuous self-adaptation without manual intervention. The strategy network keeps the interpretability and executability, and through the action projection mechanism, it ensures that the generated control instructions always meet the device safety boundary and power constraint, effectively preventing excessive start-stop and abnormal concurrent operation. The method realizes the dynamic fusion of open-loop prediction and closed-loop adjustment, so that the system can automatically maintain thermal balance and humidity balance in extreme climate or device performance fluctuation, and guarantee the stability of the fruit coloring, sugar accumulation and physiological safety interval. Compared with traditional rule-based or static model control, the present application shows significant improvement in control accuracy, response speed and energy consumption ratio, and can adapt to the multi-dimensional target demand of different crops and growth stages, providing a high reliability, high adaptability and high energy efficiency environment intelligent regulation scheme for the northern region tropical fruit greenhouse. BRIEF DESCRIPTION OF DRAWINGS
[0016] Figure 1 The open-loop trajectory optimization two-stage iterative convergence curve provided by the embodiment of the present application is shown in the figure.
[0017] Figure 2 The strategy network imitation learning training loss convergence curve provided by the embodiment of the present application is shown in the figure.
[0018] Figure 3 The control strategy feature comparison diagram of different tropical fruit growth stages provided by the embodiment of the present application is shown in the figure.
[0019] Figure 4 The leaf surface temperature and dew point temperature difference time evolution curve provided by the embodiment of the present application is shown in the figure. DETAILED DESCRIPTION
[0020] The terms first, second, third, fourth, and the like, if any, used in the specification and claims herein, and above-described drawings, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the use of such terms is interchangeable under appropriate circumstances such that the embodiments described herein are capable of operation in other sequences than described or illustrated herein.
[0021] The north greenhouse tropical fruit microclimate adaptive control system based on reinforcement learning comprises a data acquisition module configured to acquire multi-channel sensor data at a preset sampling period and construct a state vector comprising at least one daytime / nighttime flag and one growth stage flag; an open-loop trajectory optimization module configured to: based on the state vector, establish a neural ODE environment model, and perform open-loop trajectory optimization using Pontryagin approximation to generate a control trajectory comprising multiple time periods and having a whole-window deviation score and a whole-window energy consumption; a strategy fine-tuning module configured to: configure a strategy network, the strategy network is trained by imitating the actions of the first time period of the control trajectory, and is fine-tuned online based on the sensitivity of the whole-window deviation score and the whole-window energy consumption; and an instruction execution module configured to: preferentially generate an executable message sequence using the control trajectory, and when the control trajectory is missing, generate an executable message sequence using the output of the strategy network and issue it to the controlled device.
[0022] In a specific implementation process, first, the acquisition channels need to be arranged in the greenhouse by zoning. The area of each zone is planned to be 200 square meters, and a sensing corridor is arranged in the long direction for hanging and fixing the sensing units. The sensing units include outdoor environment acquisition units, indoor environment acquisition units, crop body physiological state acquisition units, and controlled device state acquisition units. All acquisition units are connected to the same time reference and work under the same sampling period. The sampling period is set to 60 seconds, and the trigger time is fixed at the 10th second of each minute. This avoids the transient jitter generated by the device switching at the whole minute, ensures uniform intervals between adjacent samplings, and the time period discrete of the subsequent open-loop trajectory optimization can directly use the interval. Each sampling carries a timestamp, which is derived from the standard clock inside the edge controller. The standard clock performs synchronization with the external time source once a day at 1 o'clock in the morning through Ethernet, and the single calibration drift does not exceed 100 milliseconds.
[0023] The outdoor environment collection unit is installed on the north side of the greenhouse outside wall at a height of 200 cm from the ground, avoiding the eaves dripping and backflowing hot air stream, collecting outdoor air temperature, outdoor relative humidity, outdoor total radiation, and outdoor wind speed. The outdoor air temperature and outdoor relative humidity sensors are installed in a louver box with active ventilation, with the ventilation speed maintained at about 200 cm per second, so that the sensing element is in the approximate environmental airflow, reducing the reading deviation caused by direct sunlight heating. The outdoor total radiation sensor selects a thermopile radiation table with a full-sky field of view, which is installed horizontally and calibrated for levelness. The outdoor wind speed sensor is installed on the upstream side of the radiation table, with the probe being at least 50 cm horizontally away from the column to avoid the influence of the column wake.
[0024] The indoor environment collection unit adopts a multi-point arrangement strategy. The indoor air temperature and indoor relative humidity sensors are arranged with the canopy height as the reference, with the vertical distance between the center of the sensing probe and the top of the canopy being set to 30 cm. One measuring point is set every 10 meters along the row, and one measuring point is set every two rows transversely, for a total of not less than 6 measuring points. The leaf surface temperature sensor uses a non-contact infrared measurement method and is fixed on an extension bracket. The measurement field of view covers the center area of the main leaf, with the horizontal distance between the probe and the leaf being set to 50 cm, and the zero point is checked after installation using a black body tape. The indoor carbon dioxide concentration sensor is installed at a height of 150 cm and selects a non-dispersive infrared type with automatic zero calibration function. The fruit surface temperature measuring point is set for bananas, mangoes, and pineapples. After the temperature-sensitive patch is adhered to the outside of the main fruit, the contact probe reads it. The probe is fixed by a flexible band with a pre-tightening force controlled between 2 and 3 newtons, ensuring close contact without compressing the fruit skin tissue. The canopy coverage percentage and fruit color index are obtained by a visual collection unit installed on the inter-row beam with the lens pointing to the ground. The field of view covers a width of not less than 180 cm, with a resolution of not less than 1920 by 1080, a fixed frame rate of 5 frames per second, and the closest frame to the trigger time being captured in each sampling period. The number of visible lesions is obtained by image segmentation of the same frame as the color index, with the threshold being pre-generated by artificial sample marking and stored in the configuration table.
[0025] Controlled device state acquisition channel directly reads from the state register of the field controller, including the percentage of heating output, the percentage of side window opening, the percentage of top window opening, the percentage of circulating fan speed, the percentage of spray duty, the percentage of sunshade opening and closing, the percentage of red light source, the percentage of blue light source, the percentage of white light source, the percentage of carbon dioxide release valve opening, and the three-phase active power reading. The reading sequence is fixed to ensure that the position is reusable when the state vector is spliced. Before each sampling, the acquisition program performs a reading prefetch according to the order of active power reading first. The difference between the prefetch value and the final reading of this period is compared. If the difference exceeds 5% of the nominal range of the device specification, the channel in this period is marked as pending review. The pending review mark enters the subsequent sensor arbitration process.
[0026] Sensor arbitration and denoising use a strategy combining priority rules and majority consensus principles. For channels with three sensors configured for the same physical quantity, compare the difference between each pair of readings, select the pair with the smallest difference, and calculate the average value as the effective reading. The advantage of this is that the majority of the two sensors are usually in a normal state, and selecting these two can offset the influence of a single abnormal sensor. For channels with two sensors configured for the same physical quantity, calculate the average value of the two as the effective reading, and at the same time, calculate the difference between the two. When the difference exceeds twice the allowed error of the physical quantity, the channel is recorded as pending inspection at the same time. The pending inspection list is used for maintenance planning. For channels with one sensor configured for the same physical quantity, a median filter sequence with a length of 3 is used, and the median of the last 3 sampling periods is taken as the effective reading. This method can eliminate occasional spikes. For device state channels with pending review marks, linear interpolation of adjacent two samples is used as the effective reading of this time, and the interpolation source is recorded in the log. The interpolation interval is limited to 120 seconds.
[0027] Time alignment uses a combination of buffer queues and interpolation. The raw data of all channels enters their respective buffer queues, with a buffer depth of 5 sampling periods. When the trigger time is reached, the data item with the timestamp closest to the trigger time is taken from each buffer queue as the candidate data item. If the time difference between the candidate data item and the previous data item is within 30 seconds, it is directly taken as the effective reading; if the time difference is between 30 seconds and 90 seconds, a linear interpolation is performed on the two items according to the time ratio to obtain the effective reading; if the time difference is greater than or equal to 90 seconds, the channel in this period is marked as expired and excluded from the state vector. The excluded channel is marked with a missing mark in the position of the state vector. This segmented approach can repair short delays while ensuring time consistency, isolate long delays, and prevent long delay readings from affecting subsequent trajectory optimization.
[0028] The generation of the day / night flag uses a dual criterion of outdoor total radiation threshold and solar elevation angle. First, the solar elevation angle at the sampling time is calculated. When the solar elevation angle is greater than or equal to 3 degrees, it is considered to have potential sunlight conditions. At the same time, the outdoor total radiation is read. When the outdoor total radiation is greater than or equal to 50 and less than 1000, it is considered to be in natural sunlight or scattered light conditions. When both conditions are met, the day / night flag is set to 1. If either condition is not met, the day / night flag is set to 0. The reason for using a dual criterion instead of a single threshold is that the solar elevation angle can reflect the astronomical sunrise and sunset state, and the outdoor total radiation can reflect the short-term cloud changes. The combination of the two can reduce the misjudgment caused by rainy days. In the shading greenhouse scene, it is common for the outdoor total radiation to be high and the actual available indoor light to be low. In this case, the day / night flag in the state vector is still set to 1, because the subsequent control side will configure light compensation and shading according to the actual deviation of the indoor environment.
[0029] The generation of the growth stage flag provides two implementation methods. Method one uses manual registration, which submits a stage record on the day of stage switching by the planting management system. The record includes crop type, zone number, and stage number. The stage number is encoded as an integer. The vegetative growth period is encoded as 1, the flowering and fruiting period is encoded as 2, the disease sensitive period is encoded as 3, and the color changing or sugar increasing period is encoded as 4. The acquisition program reads the latest stage record at each sampling period and writes the growth stage flag. Method two uses visual recognition assistance. On the basis of manual registration, it performs daily self-checking. The visual acquisition unit counts the canopy coverage percentage, flower number, and fruit color index. When the statistical results are inconsistent with the stage characteristics recorded by manual registration for three consecutive days, a prompt is given on the interface and manual confirmation is requested. This combined approach ensures that the stage flag is consistent with the actual crop physiological process, while avoiding the risk of stage drift caused by pure automatic identification.
[0030] After the valid reading and flag bit are completed, the state vector is spliced in a fixed order. The field order of the vector is loaded when the system is deployed and remains unchanged during the life cycle. Specifically, the outdoor air temperature, outdoor relative humidity, outdoor total radiation, outdoor wind speed, indoor air temperature, indoor relative humidity, indoor carbon dioxide concentration, leaf surface temperature, fruit surface temperature, canopy coverage percentage, fruit color index, number of visible disease spots, warming output percentage, side window opening percentage, top window opening percentage, circulating fan speed percentage, spray duty cycle percentage, sunshade curtain opening percentage, light source red light percentage, light source blue light percentage, light source white light percentage, carbon dioxide release valve opening percentage, three-phase active power reading, day and night flag bit, and growth stage flag bit are spliced in the above order. The above order corresponds to 26 fields. For channels with missing marks, the field is set to a preset placeholder value during splicing and a missing list is attached in the same sampling record. The missing list is only used selectively by subsequent processing programs and does not change the number and order of fields in the state vector.
[0031] The units of each physical quantity are uniformly processed. Temperature is represented in degrees Celsius, relative humidity is represented in percentage, total radiation is represented in watts per square meter, wind speed is represented in centimeters per second, carbon dioxide concentration is represented in parts per million, and percentage fields are uniformly represented in percentage. Active power is represented in kilowatts. The canopy coverage percentage and fruit color index output by the visual acquisition unit are mapped through a calibration set. The calibration set for canopy coverage percentage selects 50 representative samples for manual annotation, and the calibration set for color index selects 100 representative samples for manual annotation. After annotation, the percentage or grade value is mapped through a lookup table, and the lookup table is updated once a season.
[0032] In order to make the data closer to the actual feeling of crops, the position of the sensing point is configured according to the characteristics of tropical fruits. The banana leaf is wide and the transpiration amount is high, and the temperature and humidity difference between the top and middle of the canopy is obvious, so the indoor air temperature and indoor relative humidity sensors are preferentially arranged at a position 30 cm above the top of the canopy. After the position is determined, the representativeness of the reading is verified through a short-term comparison test. The short-term comparison test lasts for 30 minutes, during which the wind speed and shading state are fixed. The temperature and humidity difference between 30 cm above the top of the canopy and 30 cm below the top of the canopy is compared. If the difference is less than 1 degree Celsius and 5 percent, the position of the sensing point is confirmed. The cactus performs pollen activity at night, and the ventilation state at night has a significant effect on humidity, so a relative humidity probe at a height of 50 cm near the ground in the row at night is added to the cactus partition to identify the night humidity lag phenomenon. The mango disease sensitive period emphasizes the safety margin of dew condensation, and the field of view of the infrared measurement of the leaf surface temperature needs to avoid the high-reflectivity fruit wax area. When installing, the field of view is confirmed to cover the main vein area of the leaf by using a handheld thermal imager. The pineapple sugar content promotion period emphasizes strong light shading. The outdoor total radiation sensor is calibrated once a day before and after noon. If the horizontal deviation is within 0.5 degrees, the radiation reading can be consistent with the actual incident light, thereby providing a stable basis for shading control.
[0033] After the sampling is completed, the acquisition program writes the state vector and channel quality information of the current period to the local time sequence library. The local time sequence library is a ring structure, and each partition saves the latest 1440 records, corresponding to 24 hours of data. The write operation uses the method of writing to the cache first and then to the disk. Single disk falling is executed at the 12th second of each minute. In order to meet the near-real-time needs of subsequent open-loop trajectory optimization, the acquisition program pushes the state vector to the upper layer processing program through the memory queue after disk falling. The queue length is limited to 5, and when the upper limit is reached, the length is maintained by dequeuing the earliest item to avoid squeezing and delaying.
[0034] Under the same embodiment, the day and night flag and the growth stage flag also bear the function of configuration selection. When the day and night flag is 1, the subsequent processing program references the daytime target interval and daytime device action boundary; when the day and night flag is 0, it references the nighttime target interval and nighttime device action boundary. The value of the growth stage flag determines the specific row of the referenced target interval and device action boundary, for example, the growth stage flag is 1 to select the configuration of the vegetative growth period, and the growth stage flag is 4 to select the configuration of the color changing period or the sugar content promotion period. Through this explicit flag driving method, the state vector not only carries the instantaneous state of the environment and the device, but also clearly specifies the target reference required by the subsequent processing, so that the subsequent open-loop trajectory optimization and strategy fine-tuning can be directly indexed by bit without the need to parse text or external descriptions, thereby reducing runtime overhead and improving reliability.
[0035] In one optional implementation, the sampling period is set to 30 seconds, and the trigger times are fixed at the 15th and 45th seconds of each minute. Dual-time triggering can shorten the time required to detect rapid disturbances, such as illumination fluctuations caused by short-term cloud shadows. The time alignment strategy remains unchanged, the buffer queue depth is adjusted to 10, and the interpolation interval thresholds are adjusted to 15 seconds and 45 seconds, respectively. Other processes are executed as described above.
[0036] The state vector triggered by sampling enters the prediction process within one second of reaching the processing channel. First, the prediction window and time period are determined. The prediction window is set to 3600 seconds, divided into 60 time periods, each 60 seconds long. The reason for choosing 60 seconds as the time period length is that the recognizable setting refresh cycle of most greenhouse actuators is between 30 and 120 seconds; 60 seconds can cover the minimum effective response of the actuator action, while also providing convenience for integer-based accumulation of power budget. The reason for choosing 3600 seconds as the prediction window is that this duration is sufficient to cover a typical supplemental lighting or heating regulation cycle, allowing the control trajectory given by open-loop trajectory optimization to maintain a stable microclimate target within one hour while also considering energy consumption.
[0037] like Figure 1 As shown, the open-loop trajectory optimization of this invention adopts a two-stage iterative strategy. The horizontal axis represents the iteration round, the left vertical axis represents the whole window deviation score, and the right vertical axis represents the whole window energy consumption, in kilowatt-hours. Initially, the whole window deviation score is 287.3, and the whole window energy consumption is 70.2 kilowatt-hours, indicating the system is in a non-optimal state. The first stage focuses solely on reducing the whole window deviation score. From iteration 0 to iteration 10, the deviation score shows a rapid downward trend, decreasing from 287.3 to 23.8, a reduction of 87.8%, while energy consumption remains relatively stable between 49 and 51 kilowatt-hours. In iteration 10, the deviation score drops below the target threshold of 25 for the first time, meeting the microclimate compliance requirements. The second stage, with the deviation score already meeting the target, shifts to optimizing energy consumption. From iteration 10 to iteration 14, the deviation score fluctuates narrowly between 23 and 24, while energy consumption decreases significantly, from 49 kilowatt-hours to 15.4 kilowatt-hours, a reduction of 78.1%. The entire optimization process consists of 18 iterations. It terminates early when the deviation score changes by less than 5 for two consecutive iterations. The final output control trajectory balances microclimate compliance and energy efficiency. The technical advantage of this two-stage strategy is that it first solidifies the hard constraint of crop safety, then optimizes the soft objective of economic efficiency, avoiding sacrificing microclimate quality for energy conservation. The whole-window deviation score is represented by a solid line, and the whole-window energy consumption is represented by a dashed line. The intersection of the two curves marks the switching of the optimization strategy, demonstrating the invention's ability to coordinate crop growth needs and energy consumption in a hierarchical manner.
[0038] The neural ODE environment model takes the concatenated sequence of state and action vectors as input, outputs the estimation of state rate of change, and obtains the future state by numerical integration. The network structure adopts a three-layer feedforward structure, the input layer width is the number of state vector fields plus the number of control variable fields in the current deployment, the hidden layer width is 128 units, the activation function uses rectified linear function activation, and the output layer width is equal to the number of state vector fields. Unlike traditional static networks, the neural ODE environment model does not directly output the next time state within each time period, but outputs the state rate of change per unit time, which is iteratively advanced to the end of the time period by a numerical integrator within a 1-second step. The fourth-order Runge-Kutta numerical integration is selected here because this method is superior to the simple forward Euler method in stability and error control for nonlinear processes at the same step length, and can significantly reduce the amplification of short-period oscillations caused by temperature and humidity linkage and gas exchange in simulation. The step size is set to 1 second, taking into account the resolution requirements of fast variables such as leaf surface temperature and the computational overhead; when the step size is further shortened, the edge computing pressure will increase, and when the step size is further enlarged, the transient changes caused by spraying and ventilation cannot be captured.
[0039] To make the neural ODE environment model accurately reflect the current behavior of the greenhouse and equipment, an online calibration is performed at the first run of each day. The online calibration consists of 5 preset identification sequences, with a duration of about 40 minutes. In the first segment, the side window opening is set to 40 percent and maintained for 8 minutes, recording the response of indoor air temperature and indoor relative humidity to natural ventilation; in the second segment, the side window is restored to the default state and the light source white light is set to 30 percent for 10 minutes, recording the contribution of light supplementation to indoor air temperature and leaf surface temperature; in the third segment, the heating output is set to 30 percent for 12 minutes, recording the thermal inertia of the heating end; in the fourth segment, the spray duty cycle is set to 20 percent for 6 minutes, recording the effect of humidification on indoor relative humidity and leaf surface temperature; in the fifth segment, the sunshade curtain opening and closing is set to 50 percent for 4 minutes, recording the coupling of sunshade to indoor total radiation transfer and temperature. All stages are written to the training cache at a granularity of 1 second, and then the network parameters are incrementally trained using the adaptive moment estimation optimization method, with a batch length of 240 seconds. The training termination condition is set to the average absolute deviation of the four key variables being less than the following thresholds in turn: indoor air temperature not more than 0.7 degrees Celsius, indoor relative humidity not more than 4 percent, indoor carbon dioxide concentration not more than 60 parts per million concentration, and leaf surface temperature not more than 0.8 degrees Celsius. The reason for adopting these thresholds is that in the northern winter greenhouse, the allowable error of temperature is less than 1 degree Celsius in terms of human body feeling, the relative humidity is in the order of 5 percent in terms of operation, and the actual fluctuation of carbon dioxide control is within 100 parts per million concentration, which is acceptable. Selecting thresholds slightly stricter than the acceptable range is beneficial to ensuring the usability of subsequent sensitivity calculations. A health check is performed every 10 minutes during operation, with a 20-minute window. If the average absolute deviation of any key variable exceeds the above threshold, immediate fast retraining of the last 10 minutes of data is triggered to keep the model in line with changes in equipment state and external disturbances.
[0040] The control variables include 10 items, namely, heating output, side window opening degree, top window opening degree, circulating fan speed, spray duty cycle, sunshade curtain opening and closing, light source red light, light source blue light, light source white light, and carbon dioxide release. Each item is set with upper and lower limits, single change amplitude limit, minimum continuous working time, and minimum downtime, and the numerical values are as follows: heating output is 0 to 100, single change amplitude is not more than 20, minimum continuous working time is 300 seconds, and minimum downtime is 300 seconds; side window and top window opening degree is 0 to 100, single change amplitude is not more than 25, minimum continuous window opening or closing time is 120 seconds; circulating fan speed is 0 to 100, single change amplitude is not more than 30, and minimum continuous running time is 180 seconds; spray duty cycle is 0 to 60, single change amplitude is not more than 30, single running maximum time is 180 seconds, and single running rest time is at least 120 seconds; sunshade curtain opening and closing is 0 to 100, single change amplitude is not more than 30, and minimum continuous running time is 120 seconds; light source three channels are all 0 to 100, single change amplitude is not more than 40, daytime continuous lighting maximum time is 180 minutes, and nighttime lighting maximum time is 30 minutes; carbon dioxide release is 0 to 100, single running maximum time is 600 seconds, and the minimum interval between two consecutive releases is 600 seconds. The upper limit of the total power of the partition is calculated as 80 percent of the sum of the equipment nameplate power to leave a safety margin; the power conversion coefficient is recommended to be about 1.0 kilowatt per percent for heating, about 0.02 kilowatt per percent for circulating fan, about 0.05 kilowatt per percent for spray pump, about 0.01 kilowatt per percent for light source, and about 0.005 kilowatt per percent for carbon dioxide valve drive, and the sunshade drive can be ignored. The value of uniformly assembling these boundaries and conversions is that subsequent action projection no longer needs to query external tables, thereby reducing branches and waiting in real-time paths.
[0041] The initialization strategy adopts a combination of crop characteristics and time period characteristics: priority is given to heat preservation at night and to shading and ventilation during the day; for bananas, the light source red light is initialized to 50 and the light source white light is initialized to 30 during the color change period to facilitate uniform coloring; for pitaya, the side window opening degree is initialized to 10 and the spray duty cycle is initialized to 0 at night during the flowering and fruit setting period to reduce the risk of flower organ wet stagnation; for mango, the circulating fan speed is initialized to 40 during the disease sensitive period to improve crown gas exchange; for pineapple, the sunshade curtain opening and closing is initialized to 60 during the sugar content improvement period to reduce the midday radiation peak. The reason for preferentially using these initializations is that they are derived from extensive cultivation experience, which provides a starting point close to the center of the feasible region while ensuring that the constraints are not triggered, thereby reducing subsequent iterations on the boundary.
[0042] The forward simulation is performed once per iteration, taking the current state vector and control trajectory as input to the neural ODE environment model, which is advanced by a numerical integrator to the end of the prediction window in 1-second steps, resulting in a predicted state sequence for 60 time periods. Segment deviation scores are then computed for each time period. The segment deviation score is computed as the sum of the out-of-boundary metrics for four key quantities: indoor air temperature, indoor relative humidity, indoor carbon dioxide concentration, and the difference between leaf surface temperature and dew point temperature. The out-of-boundary metric is computed using the distance-to-boundary method: when a quantity is within the target interval for the crop and growth stage, it is scored as 0; when it is below the lower bound, it is scored as the distance to the lower bound; when it is above the upper bound, it is scored as the distance to the upper bound; and when the difference between leaf surface temperature and dew point temperature is below the safety threshold, it is scored as the distance between the safety threshold and the actual difference. For the example of the banana vegetative growth stage, the target intervals are 27-29°C for indoor air temperature, 65-80% for indoor relative humidity, 800-1000 ppm for carbon dioxide concentration, and 1.5°C for the difference between leaf surface temperature and dew point temperature. When the indoor air temperature is 26.2°C, the indoor relative humidity is 84%, the carbon dioxide concentration is 920 ppm, and the difference between leaf surface temperature and dew point temperature is 1.0°C, the segment produces an out-of-boundary distance of 0.8 for temperature, 4 for relative humidity, 0 for carbon dioxide, and 0.5 for the leaf-dew point difference, for a segment deviation score of 4.8. The window deviation score is the sum of the segment deviation scores for the 60 time periods. The window energy consumption is computed by converting the device power for each time period and summing over the time period lengths. For example, when the heating output is 40, the circulating fan speed is 30, the red light source is 20, the blue light source is 0, the white light source is 0, and the misting duty cycle is 0, the segment power is approximately 40 * 1.0 + 30 * 0.02 + 20 * 0.01 = 40.8 kW, and the segment energy consumption is approximately 40.8 kW * 60 s = 0.68 kWh.
[0043] The Pontryagin approximation in the present implementation corresponds to the backpropagation of the influence degree of the whole-window deviation score and the whole-window energy consumption with respect to the control trajectory of each variable in each time period. The calculation of the influence degree is completed by automatic differentiation on the joint computational graph of the neural ODE environment model and the numerical integrator, and the result forms a set of 60-length vectors, each corresponding to a set of control variables. After obtaining the influence degree, a sequential two-stage update strategy is adopted. The first stage aims to reduce the whole-window deviation score only, and makes a slight adjustment to the control value of each time period in the opposite direction of the influence degree, with a step size of 0.1. Immediately after adjustment, action projection is performed to ensure that the control trajectory remains within the device executable domain at each step, avoiding wasting calculations in infeasible regions. The second stage, when the whole-window deviation score has met the target, changes to reducing the whole-window energy consumption as the only goal, and makes a slight adjustment in the opposite direction of the energy consumption influence degree, with a step size of 0.05, and action projection is performed again. The consideration of choosing a two-stage strategy is that the greenhouse microclimate meets the standard is a hard constraint, and energy consumption optimization is a soft target; first solidify the standard, then optimize the energy consumption, which can avoid sacrificing crop safety for energy consumption.
[0044] Action projection is executed in four steps: the first step is upper and lower limit projection, which clips any control value that exceeds the physical or process upper and lower limits back to the boundary. The second step is the change amplitude projection, which checks the difference of the same control variable in adjacent time periods, and if it exceeds the single change amplitude limit of the variable, it is reduced to the limit value. This can reduce mechanical wear caused by frequent start and stop, and avoid oscillation when the device response lags. The third step is the continuous time length projection, which scans the trajectory of each control variable and combines short segments that are less than the minimum continuous running time or minimum shutdown time with adjacent segments in the same direction. For example, the heating output is turned off for a short time and then turned on again, which will be combined with the subsequent running segment to form a longer segment, thereby ensuring the heat exchange efficiency and combustion stability of the heat source device. The fourth step is the partition power projection, which calculates the total power obtained by all control values in this time period according to the conversion coefficient. When it exceeds the upper limit of the partition total power, the control value is sequentially reduced from low to high according to the priority order, and the priority order is spray, light source, ventilation, shading, and heating. The reason for such priority arrangement is that the night heat preservation and disease prevention and control of tropical fruits rely more on heating and dehumidification, and spray and light source can be compressed in a short time to transfer power margin.
[0045] The iterative loop includes 10 rounds of the first stage and the second stage, a total of 20 rounds; when the change of the whole-window deviation score is less than 5 for 2 consecutive rounds, it is terminated in advance to save calculation time. After termination, the control trajectory and the corresponding whole-window deviation score and whole-window energy consumption are output. Then, according to the device communication protocol, executable messages are generated, each time period is converted into a set of messages, and the messages include device address, target set value, ramp time and start-stop time. The ramp time is uniformly set to 60 seconds, consistent with the length of the time period, which is convenient for the execution layer to transition from the previous segment value to the next segment value in a linear manner.
[0046] In different growth stages of tropical fruits, the open-loop initialization and constraint sorting can be configured in a targeted manner. The minimum difference threshold between the leaf surface temperature and the dew point temperature during the banana turning stage is set to 2.0 degrees Celsius, and this item is preferentially accumulated in the segment deviation score to reduce the risk of condensation and mottling on the fruit fingers. During the flowering and fruit setting stage of pitaya, the relative humidity is preferentially reduced at night, and the initialization of night ventilation is kept at a low opening and the spray is zero. During the mango disease sensitive stage, the upper limit of the relative humidity target interval is set to 65 percent, and the circulating fan is initialized to 40 to improve the crown gas exchange. During the pineapple sugar content promotion stage, the shading screen is initialized to 60 during the day to control the fruit core temperature rise, and the light source three-channel is initialized to red light 30, blue light 10, and white light 0 to avoid excessive light compensation under high radiation conditions.
[0047] As shown in Figure 3 , the present application configures special control strategies for different tropical fruits in different growth stages. The figure shows the percentage distribution of control parameters of four typical stages of banana turning stage, pitaya flowering and fruit setting stage, mango disease sensitive stage, and pineapple sugar content promotion stage. Banana turning stage emphasizes uniform coloring, light source red light initialization is 50, white light is 30, blue light is 10, and warming output is 60 to maintain a temperature interval of 26 to 28 degrees Celsius, and the shading screen opening and closing is set to 40, and the relative humidity is controlled at 70 to 80 percent. The core goal of the flowering and fruit setting stage of pitaya is to prevent night wet stagnation, and the spray duty is strictly limited to 0, the side window opening is kept at a low opening of 10, the circulating fan speed is raised to 55 to strengthen air flow, the warming output is 40, the carbon dioxide emission ratio reaches 60, the temperature target interval is 24 to 26 degrees Celsius, and the relative humidity is controlled at 60 to 70 percent. The mango disease sensitive stage emphasizes the prevention of dew disease, the circulating fan speed is initialized to 40, the side window opening is 50, the top window opening is 55, forming a strengthened ventilation pattern, the warming output is 35, the spray duty is reduced to 5, the relative humidity upper limit is strictly controlled below 65 percent, and the temperature is maintained at 25 to 27 degrees Celsius. The control focus of the pineapple sugar content promotion stage is to control the fruit core temperature rise, the shading screen opening and closing ratio is as high as 70 to reduce the noon radiation peak, the light source red light is 30, the blue light is 10, the circulating fan speed is 40, the carbon dioxide emission is 55, the temperature target interval is 28 to 30 degrees Celsius, and the relative humidity is 65 to 75 percent. Comparative analysis shows that the light source configuration of banana turning stage has the highest red light ratio, the humidity management of pitaya flowering stage is the most strict, the ventilation strategy of mango disease stage adopts the strengthening scheme of circulating fan combined with double window, and the temperature target of each stage differs by 2 to 4 degrees Celsius. This stage difference control reflects the precise response ability of the present application to crop physiological needs.
[0048] The input of the policy network is the state vector generated by the data collection and state construction completed in the last period. The output is a set of actions corresponding to the controlled devices one by one, which are heating output, side window opening degree, top window opening degree, circulating fan speed, spray duty cycle, sunshade opening and closing, light source red light, light source blue light, light source white light, and carbon dioxide release, a total of 10 items. The policy network adopts a three-layer feedforward structure, with 128 units in each of the two hidden layers, and uses a rectified linear function to activate. The reason for using the current width is that this size can complete a forward inference on the edge processor in milliseconds, meeting the control rhythm of once every 60 seconds, while the parameter quantity is moderate, making it easy to complete frequent small-step updates on site. The teaching signal of imitation learning comes from the first time period of the control trajectory output by the open-loop trajectory optimization. The reason for choosing the first time period instead of a more distant time period is that the first time period is aligned with the action to be performed on site in the time axis, which can minimize the misalignment between on-site execution and learning goals; in a greenhouse, a slowly but continuously disturbed system, the closer to the current action, the more it represents the executable optimal approximation, so that the policy network learns the decision closest to the executable domain in each period. To get stable learning results, the first time period of the 10 control values in the control trajectory is extracted at the 15th second of each minute, and they are spliced with the state vector at the same time to form a sample; 30 samples can be obtained by continuous collection for 30 minutes, forming a batch of teaching data. The adaptive moment estimation optimization method is used for training, the learning rate is set to 0.0005, the batch size is 16, and the training rounds are 50. The definition of loss is the average absolute error of the policy network output and the teaching signal in 10 actions. After training, the policy network is immediately switched to the inference channel for the next minute. Such a configuration enables a short, flat, and fast round of imitation learning every minute, and the policy network always moves with the latest trajectory decision, avoiding aging due to slow environmental drift.
[0049] As Figure 2As shown, the strategy network of the present application is trained in an imitation learning manner. The horizontal axis represents the training epoch, and the vertical axis represents the loss value. The loss value is defined as the average absolute error between the output of the strategy network and the teaching signal in 10 actions. The training data comes from the first time period of the control trajectory output by the open-loop trajectory optimization. 30 samples can be obtained by continuously collecting for 30 minutes, and the batch size is set to 16. The training loss curve is represented by a solid line, and the validation loss curve is represented by a dashed line. In the initial state, the training loss is 5.83, and the validation loss is 5.95, reflecting that the fitting ability of the strategy network to the teaching signal is weak. As the training epoch increases, the loss value shows a rapid downward trend. In the first 20 epochs, the loss value decreases most rapidly, which is called the rapid convergence zone. At the 20th epoch, the training loss decreases to 1.8, and the validation loss decreases to 1.9, which are close to each other, indicating that the network does not appear to be over-fitted. Continue training to the 40th epoch, the training loss decreases to 0.28, and the validation loss decreases to 0.32, approaching the convergence threshold of 0.3. Finally, the training is completed at the 50th epoch, the training loss is 0.24, and the validation loss is 0.30, which meet the termination condition. The learning rate is set to 0.0005, and the adaptive moment estimation optimization method is used. This configuration can complete forward inference in milliseconds on the edge processor, meeting the control beat of once every 60 seconds. After training, the strategy network is immediately switched to the inference channel for use in the next minute, forming a short, flat, and fast learning cycle. This design makes the strategy network always move with the latest trajectory decision, avoiding model aging caused by slow environmental drift, and ensuring that reliable alternative actions can be output when the open-loop trajectory optimization is temporarily missing.
[0050] The online fine-tuning is driven by the sensitivity of the whole-window deviation score and the whole-window energy consumption. The output is slightly corrected without changing the structure of the strategy network. The sensitivity is generated by automatic differentiation during the open-loop trajectory optimization. There is a corresponding set of influence values for each control variable in the first time period. The fine-tuning is triggered every 5 minutes, and a sliding statistical window is used with a window length of 30 minutes. At each trigger, the number of minutes that meet the target in the window is counted first. The target is determined by whether the segment deviation score accumulates in each minute is within the corresponding compliance range of the crop parameter table. If the number of minutes that meet the target is not less than 50, it is considered that the microclimate in the window has stabilized, and the energy consumption is preferentially reduced. At this time, the 10 outputs of the strategy network are corrected once along the negative sensitivity direction of the whole-window energy consumption with a correction value of 0.02. The correction value represents the relative adjustment in the percentage dimension, for example, the red light source is 40, and after one correction, it is 39.2. If the number of minutes that meet the target is less than 50, it is considered that the compliance level still needs to be improved in the window. At this time, the 10 outputs of the strategy network are corrected once along the target direction of the first segment of the control trajectory with a correction value of 0.05. Both corrections are performed on the output side and are not written back to the network weights. The writing back action is naturally absorbed in the next round of imitation learning. The reason for choosing this order is to prioritize safety and compliance, and then optimize energy consumption. At the same time, the output-side correction obtains an immediate response, and the correction is solidified into the weights by the next round of imitation learning, reducing unnecessary large parameter fluctuations.
[0051] All corrected actions must pass through the action projection into the executable domain. The action projection is executed item by item in four steps. The first step is the upper and lower limit projection, which clips the values that exceed the physical range to the boundary, for example, the side window opening is less than 0, which is clipped to 0. The second step is the change amplitude projection, which limits the action difference between adjacent minutes to within the corresponding single change amplitude, for example, the circulating fan speed difference between adjacent minutes is limited to not more than 30. The third step is the continuous time projection, which combines short opening segments or shutdown segments to ensure the minimum continuous running time and the minimum shutdown time, for example, the heating output is turned on for less than 300 seconds and then turned off, which is extended to more than 300 seconds. The fourth step is the partition power projection, which recovers the action amplitude according to the priority of spray, light source, ventilation, shading, and heating from low to high, until the power estimate value does not exceed the upper limit of the partition total power. Such four-step processing can ensure that the actions given to the field devices are achievable, maintainable, and matched with the mechanical and thermal inertia of the devices.
[0052] The action generated by the policy network is produced once per minute while the control trajectory from the open-loop trajectory optimization is reserved. The message generation follows a priority path and an alternative path. When the open-loop trajectory optimization provides a complete set of control values covering the first time segment in the current minute, the message generation directly uses the first segment of the control trajectory. The control trajectory is preferred because it is a solution that considers both compliance and energy consumption under the whole window optimization, and it contains overall coordination for the next 60 minutes, with better continuity at the boundary between the first segment and the subsequent segments. When the control trajectory is missing, for example, the previous optimization has not been completed or the first segment is marked for review, the message generation uses the output of the policy network. The output of the policy network has been processed by the action projection, which can meet the execution boundary and power constraints of the device, so it can be used as an alternative path to issue at the same time.
[0053] The message content is mapped according to the device type. The heating setting message contains the device station number, target output, ramp time, and start time; the side window and top window setting message contains the device station number, target opening degree, ramp time, and start time; the circulating fan setting message contains the device station number, target speed, and start time; the spray setting message contains the device station number, target duty cycle, cycle period, and start time; the sunshade setting message contains the device station number, target opening and closing position, ramp time, and start time; the light source setting message contains the device station number, target percentage of red light, target percentage of blue light, target percentage of white light, and start time; and the carbon dioxide release setting message contains the device station number, target percentage, and duration. The ramp time is uniformly set to 60 seconds, so that each device switches from the value of the previous segment to the value of the next segment in a linear transition within a time segment, which shows smoother changes in thermal and humidity loads, and can reduce the secondary fluctuations of temperature and relative humidity, thereby reducing the peak value of the segment deviation score. The message issuance time is fixed at the 20th second of each minute, avoiding data collection at the 10th second and disk operation at the 12th second, reducing the probability of bus competition and processing congestion. The communication protocol preferentially uses Modbus TCP of Ethernet, and uses Modbus RTU when only a serial link is available, with 3 frame retransmission times and 1000 ms timeout time for each retransmission; after 3 consecutive timeouts, the device is included in the review list and the last setting value is kept unchanged in the next minute.
[0054] To make the messages targeted for different crops and growth stages, explicit stage condition branches are introduced in the generation logic. For banana in the color change stage, the red light is prioritized to reach the target percentage first, and the white light is enabled after 30 seconds, and the blue light is gradually increased when the whole window deviation score is below the target threshold. This way, the energy consumption at night can be controlled while keeping the peel color even. For dragon fruit in the flowering and fruit setting stage, the low opening ventilation instruction is prioritized and the spray is kept at zero. Only when the relative humidity is below the target range for three consecutive time periods, the spray instruction with an occupancy of no more than 20 is issued, so as to avoid wet stagnation at night as much as possible. For mango in the disease sensitive stage, the target rotating speed of the circulating fan is lifted to no less than 40, and the side window is prioritized to be opened when the relative humidity tends to the upper limit, so as to help maintain the difference between the leaf surface temperature and the dew point temperature. For pineapple in the sugar content improving stage, the target opening and closing of the sunshade curtain is set to an interval of 60 to 80 in the daytime message, and when the outdoor total radiation rises for a short time, the sunshade opening and closing is prioritized to be increased instead of directly increasing the ventilation, so as to avoid the metabolic shock caused by the rapid cooling of the fruit core. After the end of each control cycle, the device returns are uploaded by the execution layer. The instruction execution end compares the return value with the target value that has been issued, and if the difference exceeds twice the allowed error given in the device manual, for example, the side window opening difference exceeds 5 or the circulating fan rotating speed difference exceeds 6, the device setting is kept unchanged for the next minute and a review flag is attached in the message. The review flag triggers the maintenance plan, such as prompting to check the push rod jam or check the fan inverter fault. Such closed-loop checking can reduce the repeated adjustment caused by execution deviation, so as to avoid the subsequent segment of the control trajectory to produce cascading errors under the premise of unavailability.
[0055] As Figure 4As shown, the present application monitors the difference between the leaf surface temperature and the dew point temperature, which is the key indicator for disease prevention and control. The horizontal axis represents time in hours, covering a 24-hour period; the vertical axis represents the temperature difference in degrees Celsius. The safe threshold line is represented by a thick solid line, and the safe threshold for banana vegetative growth period is set at 1.5 degrees Celsius, and the safe threshold for banana color change period is relaxed to 2.0 degrees Celsius, represented by a dashed line. The measured temperature difference curve is 0.8 degrees Celsius at the initial stage of the night, in the dew risk zone. As time goes on, the temperature difference reaches a peak of 3.2 degrees Celsius at 4 am, entering the safe margin sufficient stage. During the daytime, the temperature difference maintains between 2.5 and 3.5 degrees Celsius, meeting the safety requirements. When the temperature difference decreases to 1.8 degrees Celsius at 20 o'clock, it approaches the safe threshold. When the temperature difference is below the safe threshold, the system enters the dew risk zone, where the leaf surface temperature and the dew point temperature are close, and water film is easily formed, providing conditions for pathogen reproduction. The control intervention point marked in the figure is at the time when the temperature difference first approaches the threshold, and the system immediately starts the heating equipment in cooperation with the circulating fan, which raises the air temperature and enhances the air flow on the leaf surface, so that the leaf surface temperature rises and the dew point temperature relatively decreases, and the temperature difference quickly rises to the safe interval above 1.5 degrees Celsius. The safe threshold for different crops is different, and the mango disease sensitive period requires 1.8 degrees Celsius, and the pitaya flowering and fruiting period requires more stringent 1.2 degrees Celsius. The present application automatically switches the corresponding safe threshold through the growth stage marker, and when the actual difference is less than the safe threshold, the distance between the safe threshold and the actual difference is counted as a positive value and accumulated in the segment deviation score calculation, so as to drive the control system to actively intervene before the disease risk occurs, realizing preventive control rather than passive response.
[0056] In field operation, there are cases where both the control trajectory and the strategy network are available. To avoid jitter caused by alternating two sources, a stable priority arbitration method is adopted: if the first segment action returned by the open-loop trajectory optimization in the current minute passes the complete action projection, the first segment is directly adopted; if the returned first segment action has a pending review label or the optimization process exceeds 30 seconds, the strategy network output is adopted; if both are available, compare the average number of minutes meeting the standard in the past 3 minutes, and select the one with higher average number of minutes meeting the standard. The starting point of this processing is to use the meeting standard performance as an approximate indicator of stability, and to preferentially execute the more stable one, reducing alternating switching.
[0057] To ensure the generality of the policy network on different device combinations and different crops, two device capability adaptive related processes are added on the output side. The first one is capability scaling, the policy network output is linearly mapped with the maximum capability of the device before action projection, for example, the maximum available percentage of a certain partition light source white light is configured as 70, then the white light output of the policy network is multiplied by 0.7 before entering the action projection. The second one is availability shielding, when a device is marked as maintenance or offline in the device list, the output of the corresponding channel of the policy network is fixed to 0 and the message generation is skipped. Both capability scaling and availability shielding are retained at the execution end, the structure and training process of the policy network itself do not need to be redefined due to hardware changes, which reduces the deployment and maintenance cost.
[0058] In an optional embodiment, a layer of gated recurrent unit is introduced on the structure of the policy network, and the number of hidden units is 64. The gated recurrent unit is placed between the input layer and the first hidden layer, and its internal state is reset every minute. The advantage of introducing the gated recurrent unit is that it can keep the memory of the recent several actions and state changes on a minute granularity, so as to give smoother alternative actions when the open-loop trajectory optimization is temporarily missing. In order to avoid historical dependence caused by too long memory, the reset interval is not more than 60 seconds.
[0059] The above-described and above-embodied examples are only used to illustrate the technical solutions of the present application, but not to limit the same; although the foregoing embodiments of the present application have been described in detail, those skilled in the art should understand that they can modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A reinforcement learning-based adaptive control system for the microclimate of tropical fruits in a northern greenhouse, characterized in that, The system includes: a data acquisition module configured to acquire multi-channel sensor data at a preset sampling period and construct a state vector containing at least one day / night marker and one reproductive stage marker; an open-loop trajectory optimization module configured to: establish a neural ODE environment model based on the state vector and perform open-loop trajectory optimization using the Pontryagin approximation to generate a control trajectory that includes multiple time periods, a whole-window deviation score, and a whole-window energy consumption; a strategy fine-tuning module configured to: configure a strategy network, which is trained by imitating the actions of the first time period of the control trajectory and fine-tuned online based on the sensitivity of the whole-window deviation score and whole-window energy consumption; and an instruction execution module configured to: preferentially use the control trajectory to generate an executable message sequence, and when the control trajectory is missing an item, use the output of the strategy network to generate an executable message sequence and send it to the controlled device.
2. The system as defined in claim 1, characterized in that, The data acquisition module is also configured to: perform a preset sensor arbitration and noise reduction procedure on the same physical quantity readings from more than one sensor to generate a single valid reading; and concatenate the acquisition channel data from outdoor environment, indoor environment, crop physiological state, and controlled equipment state, together with day / night flags and growth stage flags, into a state vector in a fixed order.
3. The system according to claim 1 or 2, characterized in that, The open-loop trajectory optimization module is also configured to: construct a neural ODE environment model using a neural network with a multi-layer feedforward structure and rectified linear function activation, and solve it using a deterministic numerical integrator; execute an online calibration process during system startup that includes multiple preset identification sequences, which are used to sequentially excite different types of controlled devices to generate step responses; perform incremental training during the online calibration process during startup until the mean absolute deviation of the neural ODE environment model's predictions for a set of key environmental states meets a set of preset convergence thresholds; and after the online calibration during startup stops, periodically perform health checks, triggering a fast retraining process when the mean absolute deviation of the predictions exceeds any preset convergence threshold.
4. The system according to claim 1, characterized in that, When performing open-loop trajectory optimization, the module is also configured to: discretize a prediction window into multiple time periods of fixed duration; call the neural ODE environment model to perform forward simulation to obtain the prediction state sequence within the prediction window; and calculate the whole window bias score, which is the sum of the segment bias scores of all time periods. The segment deviation score is used to quantify the out-of-bounds value of at least one environmental state or crop physiological state in the predicted state sequence that deviates from the target range of the crop within the corresponding time period, as well as the excess value of the difference between leaf surface temperature and dew point temperature that deviates from the safe threshold. Calculate the total window energy consumption, which is the sum of the power conversion coefficient of each controlled device, the control value of the corresponding time period, and the duration of the time period.
5. The system according to claim 1, characterized in that, The open-loop trajectory optimization module is also configured to: automatically differentiate and calculate the whole window deviation score and whole window energy consumption relative to the sensitivity vector of the control trajectory, which includes multiple time periods; and update the control trajectory using a sequential two-stage strategy: in the first stage, iterative updates are performed with minimizing the whole window deviation score as the sole objective; in the second stage, after the whole window deviation score meets a preset condition, iterative updates are performed with minimizing the whole window energy consumption as the sole objective. Action projection is performed after each iteration update in the first and second phases; open-loop trajectory optimization is terminated when the upper limit of the total number of iterations or the convergence condition of the optimization objective is met.
6. The system according to claim 5, characterized in that, The motion projection configuration is used to perform the following projections for each time period: upper and lower limit projection: clips the control values in the control trajectory to the boundaries of the preset physical value range of the equipment; change amplitude projection: shrinks the difference between control values in adjacent time periods back to the preset single change amplitude limit of the equipment; continuous duration projection: scans the control trajectory and merges segments that are less than the minimum continuous running or rest duration with adjacent segments in the same direction to meet the minimum time constraints for starting and stopping the controlled equipment. Zoned power projection: Based on the total power limit of a zone, starting from a preset lowest priority device, the control value is decreased in order of priority until the total power meets the limit; where the priority from low to high is: spray device, LED device, ventilation device, shading device, and heating device.
7. The system according to claim 1, characterized in that, The control variables used in the open-loop trajectory optimization module have the following value ranges and action boundaries: for control variables such as heating output, side window opening, roof window opening, circulating fan speed, spray duty, sunshade opening and closing, LED red light, LED blue light, LED white light, and carbon dioxide release, their respective upper and lower limits, single change amplitude limits, minimum continuous working time, minimum downtime, maximum single operation time, and minimum interval between two consecutive actions are set.
8. The system according to claim 1, characterized in that, The strategy fine-tuning module is also configured to: employ a strategy network with a multi-layer feedforward structure and rectified linear function activation; periodically extract the control value of the first time period from the control trajectory generated by the open-loop trajectory optimization module as a teaching signal, and combine it with the current state vector to form an imitation learning sample for training the strategy network; periodically trigger online fine-tuning: when the target achievement rate of the whole window deviation score within a statistical window meets the first preset condition, apply a first magnitude correction to the output of the strategy network along the negative sensitivity direction of the whole window energy consumption; when the target achievement rate meets the second preset condition, apply a second magnitude correction to the output of the strategy network along the first target direction of the control trajectory; perform action projection on the corrected action and write it into the instruction buffer.
9. The system according to claim 1, characterized in that, The instruction execution module is also configured to: retrieve reports from controlled equipment and indoor and outdoor observations in each control cycle to generate actual curves; compare the actual curves with the predicted curves generated by the open-loop trajectory optimization module, and when the average absolute deviation between the two exceeds the verification thresholds set for indoor air temperature, indoor relative humidity, indoor carbon dioxide concentration, or leaf surface temperature, prioritize the process of the open-loop trajectory optimization module in the next cycle and trigger rapid retraining of the open-loop trajectory optimization module; and execute equipment linkage rules based on crop type and growth stage, including priority strategies for nighttime heat preservation and ventilation, priority strategies for shading at specific crop growth stages, and supplemental lighting combination strategies at specific crop growth stages.
10. The system according to claim 1, characterized in that, The data acquisition module is also configured to: establish and reference a crop parameter table, which defines corresponding daytime and nighttime target ranges and equipment action boundaries according to the crop type and growth stage of tropical fruits; the target ranges include at least: indoor air temperature target range, indoor relative humidity target range, carbon dioxide concentration target range, minimum safe difference between leaf surface temperature and dew point temperature, and daytime target photosynthetically active radiation range; the equipment action boundaries include at least: minimum ventilation opening, maximum duration of a single spray, proportion of different light qualities in the supplemental lighting equipment, and minimum nighttime ventilation intensity.
Citation Information
Patent Citations
Underground mining articulated vehicle trajectory planning method based on trust domain
CN113885518A
Greenhouse environment optimal control method, server and system
CN116449897A
Artificial intelligence climate box adaptive control system based on reinforcement learning algorithm
CN120295148A
Approximate dynamic programming control method and system based on long short-term memory network
CN120386206A
Greenhouse intelligent temperature control automatic adjustment optimization method based on multi-parameter dynamic cooperation
CN120428790A
Cited By
Edible mushroom detection system based on short-wave infrared multi-band fusion
CN121569707A
