A Method and System for Simulating and Alleviating Stress in Pigs Based on Multidimensional Environmental Parameters
By constructing a digital twin environment for pigsties and intelligent pig agents, and combining multiphysics and the Boids swarm algorithm, the stress problem caused by environmental parameter fluctuations in intensive pig farms was solved. Closed-loop simulation and relief of stress behaviors in pigs were achieved, improving teaching effectiveness and sensitivity to stress responses.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 厦门农芯数字科技有限公司
- Filing Date
- 2026-06-03
- Publication Date
- 2026-06-30
AI Technical Summary
In modern intensive pig farms, even slight fluctuations in environmental parameters can induce stress responses in pigs. Existing virtual simulation systems lack the ability to simulate a closed-loop dynamic process involving environmental changes, physiological feedback, behavioral evolution, and human intervention, leading to management delays and complex control.
A digital twin environment for pigsties is constructed, which simulates multidimensional environmental parameters in real time through a multiphysics coupling algorithm. Combined with pig intelligent agents and an improved Boids swarm algorithm to drive stress behaviors, and combined with virtual cameras and a deep learning recognition engine to form a closed-loop feedback, the system achieves deep coupling between multidimensional environmental parameters and pig stress behaviors and user interactive intervention.
It enables the reproduction of stress behaviors in a simulated space, allowing trainees to train repeatedly, improving their sensitivity to early signs of stress, significantly enhancing their ability to observe causal chains, and providing objective evaluation of trainees' performance through a closed-loop mechanism and scoring system.
Smart Images

Figure CN122314432A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of intelligent livestock farming, digital twin technology, and computer vision simulation training technology, specifically to a method and system for simulating and alleviating stress in pigs based on multi-dimensional environmental parameters. Background Technology
[0002] In modern intensive pig farms, even minor fluctuations in environmental parameters (such as high temperature and humidity, low ground temperature, excessive ammonia concentration, or uneven wind speed) can induce a series of physiological and behavioral stress responses in pigs. However, stress research in real-world scenarios suffers from problems such as complex environmental control logic and the lag in visual observation. Most existing virtual simulation systems are static demonstrations or only focus on anatomical structure display, lacking the ability to simulate a closed-loop dynamic process of environmental change, physiological feedback, behavioral evolution, and human intervention.
[0003] Specifically, current livestock education and training for livestock practitioners face the following bottlenecks: 1. On-site observation has a lag: When managers observe pigs with the naked eye that they have difficulty breathing or are biting their tails, physiological damage has often already occurred, leading to a decrease in feed conversion rate, stunted growth, or even death.
[0004] 2. The environmental control logic is highly complex: The microenvironment of the pig house is affected by the synergistic effect of multiple variables such as fan frequency, water curtain flow rate, and heater power. Its physical processes involve thermal balance, mass balance and fluid dynamics evolution. It is difficult for trainees to establish an intuitive cause-and-effect feedback logic based solely on written textbooks.
[0005] Therefore, there is an urgent need in this field for a method and system for simulating and relieving pig stress that can achieve deep coupling between multidimensional environmental parameters and pig stress behavior, support user interactive intervention, and form a closed-loop dynamic simulation. Summary of the Invention
[0006] To address the problems in existing technologies for studying real stress, such as complex environmental control logic, lag in visual observation, and lack of closed-loop dynamic simulation capabilities in existing simulation systems, this invention provides a method and system for simulating and alleviating stress in pigs based on multidimensional environmental parameters, thereby solving the aforementioned technical deficiencies.
[0007] This invention proposes a method for simulating and alleviating stress in pigs based on multidimensional environmental parameters, comprising the following steps: S1. Construct a digital twin environment for the pigsty. Simulate and update multi-dimensional environmental parameters in the pigsty in real time through a multi-physics coupling algorithm. The multi-dimensional environmental parameters include effective ambient temperature, conductive ambient ground temperature, and air quality ammonia concentration. S2. Construct multiple pig intelligent agents. Each pig intelligent agent obtains the multi-dimensional environmental parameters updated in step S1 and calculates its own core body temperature change based on the physiological energy equation to update its physiological state. S3. Based on the physiological state updated in step S2, the improved Boids swarm algorithm is used to drive multiple pig agents to exhibit group behavior. The cohesion weight in the improved Boids swarm algorithm is dynamically adjusted in real time according to multi-dimensional environmental parameters: when the effective ambient temperature is below the lower critical temperature, the cohesion weight increases non-linearly with increasing temperature difference, driving pig agents to move towards the group center to simulate huddling behavior; when the effective ambient temperature is above the upper critical temperature, the cohesion weight decays to a negative value, driving pig agents to disperse to simulate heat dissipation behavior; when the ammonia concentration exceeds the safety threshold, negative feedback decay is applied to the cohesion weight and a random noise vector is superimposed to simulate social disturbance behavior. S4. In response to the environmental control operation input by the user through the virtual central control interface, update the multi-dimensional environmental parameters in the digital twin environment in step S1. S5. Input the updated multidimensional environmental parameters from step S4 back into the pig agent from step S2, and repeat steps S2 and S3 to drive the pig agent to transition from group stress behavior to comfortable state behavior.
[0008] Preferably, in step S1, simulating and updating the effective ambient temperature EET specifically includes the following sub-steps: S111. Obtain the real-time dry-bulb temperature inside the pigsty. and local wind speed ; S112, Based on real-time dry-bulb temperature and local wind speed The effective ambient temperature (EET) is calculated using the modified Bjerg model. The calculation formula is as follows: ; in For reference base wind speed, The significance constant for wind speed is negative. The critical cancellation temperature, The wind speed power-law index. Indicates local wind speed of Power of 1 Indicates reference wind speed of Power; S113, when the real-time dry bulb temperature When the temperature is below the critical offset temperature d, increasing the local wind speed u reduces the effective ambient temperature EET; when the real-time dry-bulb temperature... When the temperature exceeds the critical offsetting temperature d, the local wind speed u is increased to raise the effective ambient temperature EET, and a virtual wet curtain is activated to reduce the real-time dry-bulb temperature. .
[0009] Preferably, in step S1, simulating and updating the air mass ammonia concentration specifically includes the following sub-steps: S121. Obtain the ammonia source item determined by the amount of pig excrement. Real-time ventilation rate inside the dormitory and the total volume of the pigsty ; S122. The rate of change of ammonia concentration with time is calculated using the differential kinetic equation, expressed as: ; S123. Integrate the rate of change over time to obtain the current ammonia concentration. ; S124, when the current ammonia concentration When the safety threshold is exceeded, the fog effect and the pig mucosal stress effect in the virtual rendering layer are triggered, and the probability of aggressive behavior in pigs is increased.
[0010] Preferably, in step S3, when the effective ambient temperature is below the lower critical temperature, the cohesion weight is nonlinearly increased with increasing temperature difference, driving the pig agents to move towards the group center to simulate huddling behavior. This specifically includes the following sub-steps: S311. Obtain the current effective ambient temperature. and basic cohesion parameters ; S312. Calculate the enhanced cohesion weight using the following formula. : ; in This is the cold stress sensitivity coefficient. This is the lower critical temperature. S313, Enhanced cohesion weight As a cohesion weight coefficient in the improved Boids swarm algorithm, it drives pig agents to move closer to the swarm center.
[0011] Preferably, in step S3, when the effective ambient temperature is higher than the upper limit critical temperature, the cohesion weight is decayed to a negative value, driving the pig agent to disperse to simulate heat dissipation behavior, specifically including the following sub-steps: S321. Obtain the current effective ambient temperature. and basic cohesion parameters ; S322. Calculate the attenuated cohesion weight using an attenuation model based on the Sigmoid function. The calculation formula is: ; in The maximum repulsion gain is used to control the attenuation of cohesion weights under thermal stress. This is the behavioral steepness coefficient. ; S323, Adjust the attenuated cohesion weight As a cohesion weight coefficient in the improved Boids swarm algorithm, it drives the dispersion of pig agents.
[0012] Preferably, in step S3, when the ammonia concentration exceeds the safety threshold, a negative feedback attenuation is applied to the cohesion weight and a random noise vector is superimposed to simulate social disturbance behavior, specifically including the following sub-steps: S331. Obtain the current ammonia concentration. and basic cohesion parameters ; S332, when the current ammonia concentration Exceeding the safety threshold When the attenuation of cohesion weight is calculated using the following formula, : ; in The stress sensitivity coefficient The preset safety threshold; S333, the attenuated cohesion weight As a cohesion weight coefficient in the improved Boids swarm algorithm, it is used to calculate the regular velocity vector. ; S334. Calculate the noise intensity according to the following formula. : ; Where σ is the preset maximum volatility coefficient. This is the environmental limit concentration; S335, Generation follows a uniform distribution Construct a random noise vector from a random scalar.
[0013] S336, Transfer the random noise vector Superimposed on the regular velocity vector The resultant velocity vector is obtained from the above. This is to drive pig agents to exhibit socially disruptive behaviors such as disorganization, hyperactivity, or mutual aggression.
[0014] Preferably, the method for simulating and alleviating stress in pigs based on multidimensional environmental parameters proposed in this invention further includes the following steps: After step S3: invoke the virtual camera array integrated in the virtual simulation scene to collect video streams of the group stress behaviors that emerge in step S3 in real time; input the video streams into a pre-trained lightweight deep learning recognition engine to identify the type and probability of the group stress behaviors; project and display the recognition results in the form of an augmented reality layer; After step S5: Obtain the moment when the stress occurs. When to implement effective environmental control adjustments with users Calculate the stress response time score The calculation expression is: ; in The preset time weighting coefficient; Obtaining the core body temperature of pigs The curve showing the change over time is used to calculate the physiological recovery index. The calculation expression is: ; in This is the normal core body temperature value. It is a preset small positive number; Obtain the power consumption corresponding to environmental control operations Calculate environmental energy efficiency score The calculation expression is: ; in This is the baseline energy consumption value.
[0015] This invention also proposes a system for simulating and alleviating stress in pigs based on multidimensional environmental parameters, used to implement the method described in any of the above-mentioned methods. The system includes: The digital twin environment engine module is configured to construct the digital twin environment of the pigsty. It uses a multi-physics coupling algorithm to simulate and update the multi-dimensional environmental parameters in the pigsty in real time. The multi-dimensional environmental parameters include the effective ambient temperature, the conductive ambient ground temperature, and the ammonia concentration in the air. The pig intelligent agent simulation module is configured to construct multiple pig intelligent agents. Each pig intelligent agent obtains multi-dimensional environmental parameters updated by the digital twin environment engine module and calculates its own core body temperature changes based on the physiological energy equation to update its physiological state. Based on updated physiological states, an improved Boids swarm algorithm is used to drive multiple pig agents to exhibit emergent swarm behavior. The cohesion weight in the improved Boids swarm algorithm is dynamically adjusted in real time according to multi-dimensional environmental parameters: when the effective ambient temperature is below the lower critical temperature, the cohesion weight increases non-linearly with increasing temperature difference, driving pig agents to move towards the group center to simulate huddling behavior; when the effective ambient temperature is above the upper critical temperature, the cohesion weight decays to a negative value, driving pig agents to disperse to simulate heat dissipation behavior; when the ammonia concentration exceeds a safe threshold, negative feedback decay is applied to the cohesion weight and a random noise vector is superimposed to simulate social disturbance behavior. The virtual interaction and environmental control module is configured to respond to the environmental control operations input by the user through the virtual central control interface and update the multi-dimensional environmental parameters in the digital twin environment engine module. The closed-loop feedback driving module is configured to input the updated multi-dimensional environmental parameters from the virtual interaction and environmental control module back into the pig agent simulation module, repeatedly executing the operations of the pig agent simulation module to drive the pig agent to transition from group stress behavior to comfortable state behavior.
[0016] The present invention also proposes a terminal device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. When the processor executes the computer program, it implements the steps of the method for simulating and relieving pig stress based on multidimensional environmental parameters as described above.
[0017] The present invention also proposes a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the method for simulating and relieving pig stress based on multidimensional environmental parameters as described above.
[0018] Compared with the prior art, the beneficial effects of the present invention are as follows: (1) By constructing a completely virtual digital twin environment for pigsties and intelligent pig agents, all stress behaviors (including extreme heat stress, ammonia poisoning, etc.) are reproduced in the simulation space, while allowing trainees to repeatedly perform "incorrect operation" training without causing real economic losses.
[0019] (2) Based on the improved Boids population algorithm and physiological energy equation, the system can drive pig agents to exhibit typical stress behaviors such as huddling, dispersing, tail biting, and panting in real time according to the instantaneous changes of multidimensional environmental parameters. Trainees can observe the behavioral evolution process simultaneously. Combined with a virtual camera and a deep learning recognition engine, the system can also actively label the stress type and probability, helping trainees compare the differences between visual observation and AI recognition, and significantly improve the sensitivity to early signs of stress (such as mild hyperactivity and social disorganization).
[0020] (3) The system deeply couples the modified Bjerg model, ammonia differential kinetic equation, cold stress square enhancement, heat stress Sigmoid decay to negative value, and ammonia negative feedback + random noise physical / biological models with the Boids algorithm. Each time the trainee operates the virtual central control interface (such as adjusting the fan or turning on the wet curtain), the environmental physical field is updated in real time, and the pig agent dynamically transitions from a stress state to a comfortable state. This closed-loop mechanism allows the trainee to intuitively witness the causal chain of "increased ventilation → enhanced heat dissipation from the body surface → disappearance of panting behavior".
[0021] (4) The system automatically records the stress response time, the user's effective adjustment time, the core body temperature change curve, and the energy consumption of the environmental control equipment, and calculates the stress response timeliness score, physiological recovery index, and environmental energy efficiency score accordingly. The three indicators objectively evaluate the trainee's operation from three dimensions: reaction speed, physiological recovery quality, and energy-saving awareness.
[0022] (5) The system incorporates antagonistic logic between temperature and ammonia (e.g., closing windows for insulation in winter can lead to ammonia buildup). Trainees must find a balance between "preventing the effective ambient temperature from falling below the lower critical temperature" and "ensuring the ammonia concentration is below the safe threshold" and calculate the minimum ventilation volume. This design accurately replicates the complex scenario of mutual constraints between environmental control parameters in real pig farms, effectively training trainees' comprehensive decision-making abilities. Attached Figure Description
[0023] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments, taken with reference to the accompanying drawings: Figure 1 This is a flowchart of a method for simulating and alleviating stress in pigs based on multidimensional environmental parameters; Figure 2 This is a schematic diagram of a pig stress simulation and relief system based on multidimensional environmental parameters; Figure 3 This is a schematic diagram of the structure of a computer system suitable for implementing the embodiments of the present invention. Detailed Implementation
[0024] The present invention will now be described in further detail with reference to the accompanying drawings and 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.
[0025] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0026] Figure 1 A flowchart illustrating the method for simulating and alleviating pig stress based on multidimensional environmental parameters, provided by this invention, is shown. (Reference) Figure 1 The method includes the following steps: S1. Construct a digital twin environment for the pigsty. Simulate and update multi-dimensional environmental parameters in the pigsty in real time through a multi-physics coupling algorithm. The multi-dimensional environmental parameters include effective ambient temperature, conductive ambient ground temperature, and ammonia concentration in the air.
[0027] Step S1 specifically includes the following sub-steps S111 to S113 (effective ambient temperature simulation) and S121 to S124 (air mass ammonia concentration simulation). Furthermore, for the conduction of ambient ground temperature and airflow field, a ground conduction heat flow model and a simplified computational fluid dynamics model are used for simulation, respectively, and the specific process is described below.
[0028] S111. Obtain the real-time dry-bulb temperature inside the pigsty. and local wind speed .
[0029] in, This indicates the real-time dry-bulb temperature inside the pigsty, in degrees Celsius (°C). This represents local wind speed, measured in meters per second (m / s). This data can be collected via virtual sensors or calculated using computational fluid dynamics (CFD) models.
[0030] The system uses Effective Ambient Temperature (EET) as the core indicator for evaluating the heat load on pigs. EET describes the pigs' actual perceived heat exchange level by integrating air temperature, wind speed, and radiant heat. Its calculation uses a modified Bjerg model, as detailed below: S112, Based on real-time dry-bulb temperature and local wind speed The effective ambient temperature was calculated using the modified Bjerg model. The calculation formula is: ; in, This indicates the effective ambient temperature, expressed in degrees Celsius (°C). The wind speed significance constant is negative, and the system defaults to . Its negative value represents the cooling effect brought about by the increase in wind speed; The critical cancellation temperature, in degrees Celsius (°C), is set to [value missing] in this embodiment. ; The wind speed power-law exponent is given by a value of [value missing]. This reflects the physical characteristic that the wind-cooling effect decreases marginally with increasing wind speed; The reference wind speed, in meters per second (m / s), represents a static environment with imperceptible drafts, and its value is [value missing]. ; Indicates local wind speed of Power; Indicates reference wind speed of Power of 1.
[0031] S113, Based on real-time dry-bulb temperature Related to pig skin temperature and critical offset temperature The relationship between wind speed and effective ambient temperature determines the logic for evaporative cooling pad activation: when Below the typical skin temperature of pigs )hour, Increase local wind speed make Reduce (forward cooling); when Above the pig's skin temperature but below the critical offset temperature At this time, convective cooling stops, and local wind speed is increased. Do not Changes have occurred (invalid region); when Above the critical offset temperature hour, Increase local wind speed make Raise the temperature (hot air effect) and activate the virtual evaporative cooling pad to lower the temperature. ,make The value is restored to positive, thus allowing high wind speeds to regain their cooling gain.
[0032] To address the lying-down behavior of pigs, the system establishes a ground conduction heat flow model to describe the heat exchange between the pigs and the ground. The specific formula is as follows:
[0033] in, This indicates the amount of heat dissipated through conduction, and the unit is watts (W). This represents the surface area of a pig, in square meters (m²). 2 ); Indicates the percentage of the area in contact with the ground; This represents the core body temperature of a pig, in degrees Celsius (°C). The default value is [value missing]. ; This indicates the ground temperature, expressed in degrees Celsius (°C). This indicates the thermal resistance of pig tissue, measured in square meters per Kelvin per watt (m²). 2 (·K / W) This indicates the thermal resistance of the floor material (such as cement, underlayment, underfloor heating board), measured in square meters Kelvin per watt (m²). 2 ·K / W). When the ground temperature When too low, The increase in surface area triggers behaviors in the agent, such as lying down or huddling together to reduce contact with the ground. This model directly drives the logic that pigs huddle together to reduce heat loss from contact with the ground when it is cold, and seek out cool ground to lie on when it is hot.
[0034] The system uses an ANIPRO dynamic model to simulate ammonia volatilization in manure ditches, slatted floors, and pig excretion points, generating ammonia source items. Based on this, the following sub-steps are used to calculate the dynamic changes in ammonia concentration within the building: S121. Obtain the ammonia source item determined by the amount of pig excrement. Real-time ventilation rate inside the dormitory and the total volume of the pigsty .
[0035] in, This indicates the ammonia source item, with units of ppm / s, which is dynamically determined by the amount of pig excrement and the condition of the manure ditch. This indicates the real-time ventilation rate inside the building, expressed in cubic meters per second (m³ / s). 3 / s); This indicates the total volume of the pigsty, expressed in cubic meters (m³). 3 ).
[0036] S122. The rate of change of ammonia concentration with time is calculated using the differential kinetic equation, expressed as:
[0037] in, This represents the rate of change of ammonia concentration over time, expressed in ppm / s. This indicates the current ammonia concentration in the building, expressed in ppm.
[0038] S123. Integrate the rate of change over time to obtain the current ammonia concentration. The integral can be updated frame-by-frame using numerical methods (such as the Euler method or the fourth-order Runge-Kutta method).
[0039] S124, when the current ammonia concentration When the safety threshold is exceeded, the fog effect and pig mucosal stress effect in the virtual rendering layer are triggered, increasing the probability of aggressive behavior in pigs; in this embodiment, the safety threshold is set to... The probability of aggressive behavior (such as tail biting) occurring is increased from the default value. Upgraded to .
[0040] For airflow field (local wind speed) The system integrates a simplified computational fluid dynamics algorithm to simulate wind speed distribution at different altitudes. The formula for the wind speed profile as a function of altitude is: ; in, Indicates height Local wind speed at a location, expressed in meters per second (m / s); Indicates the height above the ground, in meters (m); This indicates the frictional speed, measured in meters per second (m / s). This represents the von Kármán constant, with a value of [value missing]. ; This indicates the surface roughness, measured in meters (m). The value depends on the type of pigsty floor (e.g., approximately [value missing] for a cement floor). The solution algorithm employs a second-order accurate SIMPLE algorithm for pressure-velocity coupling, ensuring that the airflow field refresh delay is less than [a certain value] during wind turbine control interactions. .
[0041] S2. Construct multiple pig agents. Each pig agent obtains the multidimensional environmental parameters updated in step S1 and calculates its own core body temperature change based on the physiological energy equation to update its physiological state.
[0042] Each pig agent is an independent agent, and the system outputs the results from step S1. , , and local wind speed Parameters such as these are substituted into the physiological energy equation to calculate core body temperature changes. :
[0043] in, This represents the change in core body temperature per frame, in degrees Celsius (°C). This represents the total energy production of pigs, measured in watts (W), and is calculated based on factors such as feed intake and basal metabolic rate. This represents the amount of heat dissipated through conduction (provided by the ground heat transfer model), and the unit is watts (W). This represents convective heat loss, measured in watts (W), and is related to local wind speed. and Related; This represents the amount of heat dissipated by radiation, and the unit is watt (W). This represents the amount of heat dissipated through evaporation (including heat dissipation through respiration), and the unit is watts (W). This indicates the specific heat capacity of pigs, measured in joules per kilogram (J / kg Kelvin). ); This indicates the pig's weight, in kilograms (kg). The current core body temperature is also displayed. Plus The updated core body temperature is obtained. When the core body temperature deviates from the normal range... When the preset threshold is exceeded, a status warning is triggered.
[0044] S3. Based on the physiological state updated in step S2, the improved Boids swarm algorithm is used to drive multiple pig agents to exhibit group behavior. The cohesion weight in the improved Boids swarm algorithm is dynamically adjusted in real time according to multi-dimensional environmental parameters: when the effective ambient temperature is below the lower critical temperature, the cohesion weight increases non-linearly with increasing temperature difference, driving pig agents to move towards the group center to simulate huddling behavior; when the effective ambient temperature is above the upper critical temperature, the cohesion weight decays to a negative value, driving pig agents to disperse to simulate heat dissipation behavior; when the ammonia concentration exceeds the safety threshold, negative feedback decay is applied to the cohesion weight and a random noise vector is superimposed to simulate social disturbance behavior.
[0045] In the simulation engine, the final motion vector of each virtual pig agent (without added random noise) is determined by the weighted sum of three basic behavioral vectors: separation, alignment, and environment-driven cohesion.
[0046] in, This represents the regular velocity vector when it is not subject to random perturbation; , Fixed separation and alignment weight coefficients; , , These represent the separation, alignment, and standard cohesion direction vectors, respectively; This is a dynamic cohesion weight that is adjusted in real time by environmental parameters. Its core logic is: the greater the environmental pressure (e.g., extreme cold), the higher the cohesion weight, driving pigs to huddle together towards the group center; the higher the environmental temperature, the lower the cohesion weight, or even it turns negative (repulsion), driving pigs to disperse. Adjustments are made in three ways depending on the environmental parameters.
[0047] Scenario 1: Increased cohesion (clustering behavior) under cold stress, while also including the independent influence of the conduction of ambient ground temperature. First, based on the weight of the pig Calculate the lower critical temperature :
[0048] in, This indicates the lower critical temperature, expressed in degrees Celsius (°C). This indicates the weight of the pig, expressed in kilograms (kg). Or due to ground temperature If you feel cold due to excessively low temperatures, perform the following sub-steps: S311. Obtain the current effective ambient temperature. and basic cohesion parameters ;in The basic cohesion parameter, typically valued at 100%. .
[0049] S312. Calculate the enhanced cohesion weight using the following formula. :
[0050] in, This is the cold stress sensitivity coefficient, with a value range of... ; This refers to the temperature difference, expressed in degrees Celsius (°C). When the ground temperature... When the temperature is too low, the temperature difference can be converted into a larger perceived temperature difference through conduction and heat dissipation, which also triggers a quadratic enhancement.
[0051] When LCT When the difference in EET increases, the cohesion weight increases quadratically, driving the agents to ignore convective heat dissipation space and forcibly move towards the group center, forming a high-density clustering behavior to reduce exposed surface area and maintain body temperature.
[0052] S313, Enhanced cohesion weight As a cohesion weight coefficient in the improved Boids swarm algorithm, it drives pig agents to move closer to the center of the group (clustering), thereby reducing heat dissipation from exposed body surfaces.
[0053] when When the temperature is high or the total ambient heat load is too large, the system adjusts in reverse to lower the temperature: Approaching The agents are no longer attracted to the center and instead disperse randomly; at the same time, the separation force coefficient is increased to promote air convection by increasing the spacing between individuals. If a locally cooled floor (such as a cold water plate) is simulated, the system will superimpose a preference force toward the cool floor, driving the pigs to disperse and lie in that area.
[0054] Scenario 2: Reduced cohesion under thermal stress (heat dissipation behavior) Introducing an upper limit critical temperature For adult fattening pigs, Usually set at For newborn piglets, Set at .when When this happens, execute the following sub-steps: S321. Obtain the current effective ambient temperature. and basic cohesion parameters .
[0055] S322. Calculate the attenuated cohesion weight using an attenuation model based on the Sigmoid function. The calculation formula is:
[0056] in, The maximum repulsion gain has a range of values. This is used to control the ablation strength of cohesion weight under extreme thermal loads, so that... exist When extremely high, it becomes a negative value (repulsion); The behavior steepness coefficient reflects the rate of response of pigs to stressors. The higher the k value, the more sensitive and decisive the pigs are to the increase in temperature, and the more sudden the pig herd switches from normal socialization to full dispersal. The stress midpoint threshold is typically set to [value]. .
[0057] S323, Adjust the attenuated cohesion weight As a cohesion weight coefficient in the improved Boids swarm algorithm, it drives the dispersion of pig agents.
[0058] Specifically, once EET exceeds UCT, the previously clustered pigs will quickly disperse, prioritizing cool locations such as manure areas and air inlets to lie on their sides, maximizing the convective heat transfer area between their skin and the air. This formula establishes a closed loop between the environmental meteorological field and the multi-agent motion field through EET, enabling students to recognize that when the pigs no longer cluster and exhibit disorderly dispersion and large-scale lying on their sides, it signifies that EET has exceeded the critical point. Students must increase the local wind speed u (using the wind chill effect to correct perceived temperature) or activate cooling equipment (such as evaporative cooling pads, misting / dripping cooling, etc.) to make the formula... The stress level returns to positive, thus relieving the stress.
[0059] Scenario 3: Social disturbances caused by excessive ammonia levels (including negative feedback attenuation of cohesion and random noise injection) Unlike the orderly regulation of cohesion by temperature and humidity (such as huddling together neatly in cold weather), ammonia concentration, as a strong mucosal irritant and stress inducer, can cause tearing of the eyes, respiratory inflammation, and restlessness in pigs. This physiological discomfort is mapped as a social interference factor at the algorithmic level, which disrupts the pigs' original homeostasis of tending to gravitate towards the center.
[0060] When the ammonia concentration exceeds the safety threshold, the following sub-steps are executed: S331. Obtain the current ammonia concentration. and basic cohesion parameters .
[0061] S332, when the current ammonia concentration Exceeding the safety threshold When the attenuation of cohesion weight is calculated using the following formula, :
[0062] in, The stress sensitivity coefficient represents the pigs' sensitivity to changes in ammonia levels. The preset safety threshold, typically valued at... .when When the formula is not triggered, cohesion is maintained. .
[0063] S333, the attenuated cohesion weight As a cohesion weight coefficient in the improved Boids swarm algorithm, it is used to calculate the regular velocity vector. (The speed of collective will without random perturbation).
[0064] S334. Calculate the noise intensity according to the following formula. :
[0065] in, The preset maximum volatility coefficient represents the maximum physiological tremor amplitude allowed by the system; Environmental limit concentration (e.g.) ).
[0066] S335, Generation follows a uniform distribution random scalar Construct a random noise vector .
[0067] S336, Transfer the random noise vector Superimposed on the regular velocity vector The updated resultant velocity vector is obtained from the above.
[0068] The combined velocity vector drives the pig agent to exhibit social perturbation behaviors such as disorganization, hyperactivity, or mutual aggression.
[0069] The combination of the two formulas achieves a synergistic effect of steady-state disruption and noise injection: the former (cohesion decay) causes the pig herd to scatter, while the latter (random disturbance) causes individual pigs to become disorganized. This logical coupling can accurately reproduce the typical stress symptoms in real pig farms when ammonia levels are too high. Instead of remaining still and huddled together, the pigs exhibit frequent collisions, scrambling for position, and disorganization. The pigs' movement paths are no longer smooth, but instead show slight tremors or sudden changes in direction. These high-frequency micro-movements are identified as abnormal stress judders in the AI recognition module, serving as visual cues for students to judge air quality.
[0070] Beyond the three stress conditions mentioned above (cold stress, heat stress, and excessive ammonia), antagonistic effects also exist between environmental parameters. The interaction between temperature and ammonia is the most typical and has significant implications for teaching and training. For example, in winter, ventilation needs to be closed to maintain warmth (which reduces cohesion driven by temperature differences), but closing ventilation leads to ammonia accumulation (increasing random disturbances and aggression). Students will observe that although the pigs don't huddle together, they exhibit abnormal hyperactivity and aggression due to ammonia stimulation. This forces students to calculate the minimum ventilation volume, finding a balance between cohesion (for warmth) and air quality (for ammonia control), i.e., ensuring adequate ventilation without causing the EET (early temperature regulation) to fall below the LCT (inducing huddling). (Noise vector removal). When the system simultaneously detects that the effective ambient temperature (EET) is below the lower critical temperature (LCT) and the ammonia concentration... When the safety threshold (20 ppm) is exceeded, the system activates the minimum ventilation decision logic to determine the ventilation volume required for heat balance. Carbon dioxide control ventilation volume and humidity control ventilation The maximum value of the three values is used as the current airflow. ; in, The required ventilation volume (m³) for controlling the temperature difference based on thermal balance 3 / s); To ensure the safety of the dormitory concentration below Required ventilation volume (m) 3 / s); To maintain relative humidity at Required ventilation volume (m) 3 / s). This decision-making logic forces students to find a balance between insulation needs and air quality, that is, without making the air quality worse. Break Under the premise of ensuring .
[0071] Furthermore, the local wind speed u does not directly affect the cohesion weight. Instead, it indirectly affects the perceived temperature (EET) by modifying the effective ambient temperature (EET). As mentioned earlier, the system uses a modified Bjerg model to calculate the EET, which reflects the influence of wind speed on perceived temperature. For example, even if the air temperature is constant, when the local wind speed changes from... Rise to At this time, EET will drop significantly, possibly falling below LCT. Specifically, this can be divided into the following two scenarios: Cross-ventilation stress scenario: When students excessively turn on the fans, causing a local wind speed u to increase and the EET to fall below LCT, the system will instantly increase the cohesion weight, triggering a quadratic enhancement as described in scenario one above, causing the pigs to quickly huddle towards the leeward corner. Students must reduce the fan frequency to counteract this cohesion gain.
[0072] Assisted heat dissipation to alleviate scenarios (high-temperature environments): Convection cooling stage (when) Below the typical value of pig skin temperature (Time): Increasing u can accelerate convective heat transfer, effectively reduce EET, and make Once the negative value (rejection) returns to a positive value (rejection disappears), the pig herd resumes normal behaviors such as walking and feeding.
[0073] Hot air effect stage (when Higher than the pig's skin temperature, for example reaching At this time: increasing u will actually increase EET, at which point convective cooling will fail, and latent heat (evaporative cooling) must be relied upon. The system supports students in relieving extreme stress through the following operations: Turn on the evaporative cooling pad: It absorbs heat from the air through water evaporation, which can lower the temperature of the incoming air. ,make The temperature drops below the pig's skin temperature, restoring convective heat dissipation efficiency.
[0074] Spray / drip cooling: Directly wets the pig's skin, and high wind speed drives the evaporation of moisture from the skin surface. Its cooling effect is far greater than the warming effect brought by convection heat, significantly reducing EET.
[0075] Lowering the ambient temperature: By using cold water flooring or cooling bedding, heat is directly transferred from the pig's body to the ground through the temperature difference.
[0076] These operations can all reduce EET, making Restore the positive value, thus allowing high wind speed to regain its cooling gain.
[0077] S4. In response to the environmental control operation input by the user through the virtual central control interface, update the multi-dimensional environmental parameters in the digital twin environment in step S1. Users can adjust the fan (change) through the virtual central control interface. ), wet curtain pump (reducing This includes parameters such as the heater and the opening degree of the air inlet. After receiving the adjustment command, the system updates the corresponding parameters in the digital twin environment of step S1. For example, when the evaporative cooling pad is turned on, the system reduces the air intake based on the principle of adiabatic cooling. ,make Return to positive value.
[0078] S5. The updated multidimensional environmental parameters from step S4 are input again into the pig agent from step S2. Steps S2 and S3 are repeated to drive the pig agent to transition from group stress behavior to a comfortable state. The system forms a closed-loop feedback: the updated environmental parameters re-participate in physiological calculations and behavioral decisions, and the agent gradually transitions from a stress state (huddling, panting, aggression, etc.) to a comfortable state (normal feeding, socialization). This process continues until the core body temperature of all agents returns to normal. The nearby stress response disappeared.
[0079] In a specific embodiment, after step S3, the system further performs the following operations: It invokes a virtual camera array integrated into the virtual simulation scene to collect video streams of the group stress behaviors emerging in step S3 in real time, simulating the data collection process for pig farm monitoring. The video streams are input to a pre-trained lightweight deep learning recognition engine. The system runs an optimized deep learning recognition engine—PigStressNet—in the background. This engine uses a lightweight YOLOv8n as its backbone network and combines a normalization-based attention module (NAM) to enhance sensitivity to stress features (such as body tremors and localized skin redness). The engine takes image frames collected by the virtual camera as input, and after downsampling and normalization preprocessing, outputs bounding boxes and confidence scores for each behavior category. Recognizable behavior types include huddling, panting, tail biting, and playing, with each behavior corresponding to different stress judgment weights. PigStressNet is pre-trained using a labeled dataset of pig stress behaviors, and the trained model can perform inference in real time within the virtual simulation scene. The recognition results are projected onto the user terminal (such as a VR headset) in the form of an augmented reality (AR) layer to help students compare the differences between visual observation and AI recognition.
[0080] To further illustrate the specific functions of the AI recognition engine, the table below lists the main stress behavior categories that the system can detect, their corresponding typical visual features, stress judgment weights, and recommended environmental control operation suggestions:
[0081] This table allows trainees to more intuitively understand the AI recognition logic and environmental control strategies corresponding to different stress behaviors, thereby improving teaching effectiveness.
[0082] In a specific embodiment, after step S5, the system automatically performs the following quantitative evaluation: Get the moment of stress generation When to implement effective environmental control adjustments with users Calculate the stress response time score The calculation expression is: ; in, The time of stress response (in seconds). The time (in seconds) for users to implement effective environmental control adjustments. This is a preset time weighting coefficient.
[0083] Obtaining the core body temperature of pigs The curve showing the change over time is used to calculate the physiological recovery index. The calculation expression is:
[0084] in, The core body temperature (°C) is expressed as a function of time. Normal core body temperature ( ), For preset small positive numbers (such as The smaller the integral value, the faster the recovery.
[0085] Obtain the power consumption corresponding to environmental control operations Calculate environmental energy efficiency score The calculation expression is:
[0086] in, This represents actual electricity consumption (kilowatt-hours). This is the baseline energy consumption value (the average energy consumption of normal operation under the same stress conditions). Excessive ventilation or overheating will cause a significant drop in the score.
[0087] Figure 2 A schematic diagram of a swine stress simulation and relief system 200 based on multidimensional environmental parameters is shown. The system includes: Digital Twin Environment Engine Module 210: Configured to construct the digital twin environment of the pigsty, it simulates and updates the multi-dimensional environmental parameters in the pigsty in real time through a multi-physics coupling algorithm. The multi-dimensional environmental parameters include the effective ambient temperature, the conductive ambient ground temperature, and the ammonia concentration in the air.
[0088] The pig agent simulation module 220 is configured to construct multiple pig agents. Each pig agent acquires multi-dimensional environmental parameters updated by the digital twin environment engine module and calculates its own core body temperature change based on the physiological energy equation to update its physiological state. Based on the updated physiological state, the improved Boids swarm algorithm drives the multiple pig agents to exhibit group behavior. The cohesion weight in the improved Boids swarm algorithm is dynamically adjusted in real time according to the multi-dimensional environmental parameters: when the effective environmental temperature is below the lower critical temperature, the cohesion weight increases non-linearly with the increase of temperature difference, driving the pig agents to move towards the group center to simulate swarming behavior; when the effective environmental temperature is above the upper critical temperature, the cohesion weight decays to a negative value, driving the pig agents to disperse to simulate heat dissipation behavior; when the ammonia concentration exceeds the safety threshold, negative feedback decay is applied to the cohesion weight and a random noise vector is superimposed to simulate social disturbance behavior.
[0089] Virtual Interaction and Environmental Control Module 230: Configured to respond to environmental control operations input by the user through the virtual central control interface, and update the multi-dimensional environmental parameters in the digital twin environment engine module.
[0090] Closed-loop feedback drive module 240: Configured to re-input the multi-dimensional environmental parameters updated by the virtual interaction and environmental control module into the pig intelligent agent simulation module, and repeatedly execute the operation of the pig intelligent agent simulation module to drive the pig intelligent agent to transition from group stress behavior to comfortable state behavior.
[0091] In a specific embodiment, the system also includes a virtual vision and AI recognition module: configured to acquire video streams and identify stress behaviors through a deep learning model. A multi-dimensional assessment module: configured to calculate timeliness scores, recovery indices, and energy efficiency scores.
[0092] To more clearly illustrate the application effect of this invention in actual teaching and training, the implementation process of this invention will be further described below in conjunction with two typical stress scenarios.
[0093] Scenario 1: Emergency Environmental Control During an Extreme Heatwave (Summer Scenario) Initial state: ambient temperature relative humidity The system automatically simulates a frequency converter failure caused by excessive circuit load, causing both main fans to stop operating. A sharp increase in temperature. Behavioral signs: The pigs stop eating, adult pigs lie on their sides looking for water or moist feces on the ground, their breathing rate increases sharply, and the core body temperature of some pigs approaches [a certain level]. Student operation logic: 1) Click on the virtual electrical box to perform virtual repair; 2) After repair, manually adjust the fan power to... 3) Turn on the evaporative cooling pump, calculate the adiabatic cooling effect, and... Pull back to The following, combined with high wind speeds to generate effective The decrease made The respiratory rate returned to positive values. Results feedback: The system showed a downward trend in THI, the pig model changed from a lateral recumbent position to an upright position, and the respiratory rate... The simulation returned to normal within seconds.
[0094] Scenario 2: Latent ammonia stress in enclosed pigsties during winter Initial state: To maintain warmth, the air inlet regulators were excessively closed, resulting in a slightly negative pressure environment in the pigsty and insufficient ventilation. Ammonia concentration rose to... The pigs' core body temperature was normal, but they exhibited frequent aggressive behavior (the probability of tail biting increased from...). Rise to The AI recognition layer issues an abnormal activity alert. Student operation logic: A balance must be found between insulation and ventilation, gradually increasing the minimum ventilation opening. If the opening is too high, the system warns of cold stress risk; if it is too low, the ammonia concentration remains high. Students need to find a balance that allows for optimal ventilation. and The optimal solution.
[0095] The present invention also proposes a terminal device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. When the processor executes the computer program, it implements the steps of the method for simulating and relieving pig stress based on multidimensional environmental parameters as described above.
[0096] The present invention also proposes a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the method for simulating and relieving pig stress based on multidimensional environmental parameters as described above.
[0097] The following is for reference. Figure 3 It shows a schematic diagram of the structure of a computer system 300 suitable for implementing terminal devices or servers of the present invention. Figure 3 The terminal device or server shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0098] like Figure 3As shown, the computer system 300 includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 302 or programs loaded from storage section 308 into random access memory (RAM) 303. The RAM 303 also stores various programs and data required for the operation of the computer system 300. The CPU 301, ROM 302, and RAM 303 are interconnected via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0099] The following components are connected to I / O interface 305: an input section 306 including a keyboard, mouse, etc.; an output section 307 including a liquid crystal display (LCD) and speakers, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN card and a modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to I / O interface 305 as needed. A removable medium 311, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 310 as needed so that computer programs read from it can be installed into storage section 308 as needed.
[0100] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 309, and / or installed from removable medium 311. When the computer program is executed by central processing unit (CPU) 301, it performs the functions defined in the methods of this invention. It should be noted that the computer-readable medium described in this invention can be a computer-readable signal medium or a computer-readable medium or any combination thereof. The computer-readable medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this invention, a computer-readable medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0101] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0102] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0103] The above description is merely a preferred embodiment of the present invention and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention is not limited to the specific combination of the above-described technical features, but also includes other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions disclosed in this invention.
Claims
1. A method for simulating and alleviating stress in pigs based on multidimensional environmental parameters, characterized in that, Includes the following steps: S1. Construct a digital twin environment for the pigsty, and simulate and update the multi-dimensional environmental parameters in the pigsty in real time through a multi-physics coupling algorithm. The multi-dimensional environmental parameters include the effective ambient temperature, the conductive ambient ground temperature, and the ammonia concentration in the air. S2. Construct multiple pig intelligent agents. Each pig intelligent agent obtains the multi-dimensional environmental parameters updated in step S1 and calculates its own core body temperature change based on the physiological energy equation to update its physiological state. S3. Based on the physiological state updated in step S2, the improved Boids swarm algorithm is used to drive the multiple pig agents to exhibit group behavior. The cohesion weight in the improved Boids swarm algorithm is dynamically adjusted in real time according to the multidimensional environmental parameters: when the effective ambient temperature is below the lower critical temperature, the cohesion weight increases non-linearly with increasing temperature difference, driving the pig agents to move towards the group center to simulate swarming behavior; when the effective ambient temperature is above the upper critical temperature, the cohesion weight decays to a negative value, driving the pig agents to disperse to simulate heat dissipation behavior; when the ammonia concentration exceeds a safety threshold, negative feedback decay is applied to the cohesion weight and a random noise vector is superimposed to simulate social disturbance behavior. S4. In response to the environmental control operation input by the user through the virtual central control interface, update the multi-dimensional environmental parameters in the digital twin environment in step S1. S5. Input the updated multidimensional environmental parameters from step S4 back into the pig agent from step S2, and repeat steps S2 and S3 to drive the pig agent to transition from the group stress behavior to the comfortable state behavior.
2. The method for simulating and alleviating stress in pigs based on multidimensional environmental parameters according to claim 1, characterized in that, In step S1, the effective ambient temperature EET is simulated and updated, which specifically includes the following sub-steps: S111. Obtain the real-time dry-bulb temperature inside the pigsty. and local wind speed ; S112, Based on the real-time dry-bulb temperature and local wind speed The effective ambient temperature (EET) is calculated using the modified Bjerg model. The calculation formula is as follows: ; in For reference base wind speed, The significance constant for wind speed is negative. The critical cancellation temperature, The wind speed power-law index. Indicates local wind speed of Power of 1 Indicates reference wind speed of Power; S113, when the real-time dry-bulb temperature When the temperature is below the critical offset temperature d, the local wind speed u is increased to reduce the effective ambient temperature EET; when the real-time dry-bulb temperature When the temperature exceeds the critical offsetting temperature d, the local wind speed u is increased to raise the effective ambient temperature EET, and a virtual wet curtain is activated to reduce the real-time dry-bulb temperature. .
3. The method for simulating and alleviating stress in pigs based on multidimensional environmental parameters according to claim 1, characterized in that, In step S1, the ammonia concentration in the air is simulated and updated, specifically including the following sub-steps: S121. Obtain the ammonia source item determined by the amount of pig excrement. Real-time ventilation rate inside the dormitory and the total volume of the pigsty ; S122. The rate of change of ammonia concentration with time is calculated using the differential kinetic equation, expressed as: ; S123. Integrate the rate of change over time to obtain the current ammonia concentration. ; S124, when the current ammonia concentration When the safety threshold is exceeded, the fog effect and the pig mucosal stress effect in the virtual rendering layer are triggered, and the probability of aggressive behavior in pigs is increased.
4. The method for simulating and alleviating stress in pigs based on multidimensional environmental parameters according to claim 1, characterized in that, In step S3, when the effective ambient temperature is below the lower critical temperature, the cohesion weight is nonlinearly increased with increasing temperature difference, driving the pig agents to move towards the group center to simulate huddling behavior. This specifically includes the following sub-steps: S311. Obtain the current effective ambient temperature. and basic cohesion parameters ; S312. Calculate the enhanced cohesion weight using the following formula. : ; in This is the cold stress sensitivity coefficient. This is the lower critical temperature. S313, The enhanced cohesion weight As a cohesion weight coefficient in the improved Boids swarm algorithm, it drives pig agents to move closer to the swarm center.
5. The method for simulating and alleviating pig stress based on multidimensional environmental parameters according to claim 1, characterized in that, In step S3, when the effective ambient temperature is higher than the upper limit critical temperature, the cohesion weight is decayed to a negative value, driving the pig agent to disperse to simulate heat dissipation behavior. This specifically includes the following sub-steps: S321. Obtain the current effective ambient temperature. and basic cohesion parameters ; S322. Calculate the attenuated cohesion weight using an attenuation model based on the Sigmoid function. The calculation formula is: ; in The maximum repulsion gain is used to control the attenuation of cohesion weights under thermal stress. This is the behavioral steepness coefficient. The stress midpoint threshold; S323, the attenuated cohesion weight As a cohesion weight coefficient in the improved Boids swarm algorithm, it drives the dispersion of pig agents.
6. The method for simulating and alleviating stress in pigs based on multidimensional environmental parameters according to claim 1, characterized in that, In step S3, when the ammonia concentration exceeds a safety threshold, a negative feedback attenuation is applied to the cohesion weight and a random noise vector is superimposed to simulate social disturbance behavior. This specifically includes the following sub-steps: S331. Obtain the current ammonia concentration. and basic cohesion parameters ; S332, when the current ammonia concentration Exceeding the safety threshold When the attenuation of cohesion weight is calculated using the following formula, the weight of cohesion after attenuation is determined : ; in The stress sensitivity coefficient The preset safety threshold; S333, the attenuated cohesion weight As a cohesion weight coefficient in the improved Boids swarm algorithm, it is used to calculate the regular velocity vector. ; S334. Calculate the noise intensity according to the following formula. : ; Where σ is the preset maximum volatility coefficient. This is the environmental limit concentration; S335, Generation follows a uniform distribution Construct a random noise vector from a random scalar. S336, the random noise vector Superimposed on the regular velocity vector The resultant velocity vector is obtained from the above. This is to drive pig agents to exhibit socially disruptive behaviors such as disorganization, hyperactivity, or mutual aggression.
7. The method for simulating and alleviating pig stress based on multidimensional environmental parameters according to claim 1, characterized in that, It also includes the following steps: After step S3: invoke the virtual camera array integrated in the virtual simulation scene to collect video streams of the group stress behaviors that emerge in step S3 in real time; input the video streams into a pre-trained lightweight deep learning recognition engine to identify the type and probability of the group stress behaviors; project and display the recognition results in the form of an augmented reality layer; After step S5: Obtain the moment when the stress occurs. When to implement effective environmental control adjustments with users Calculate the stress response time score The calculation expression is: ; in The preset time weighting coefficient; Obtaining the core body temperature of pigs The curve showing the change over time is used to calculate the physiological recovery index. The calculation expression is: ; in This is the normal core body temperature value. It is a preset small positive number; Obtain the power consumption corresponding to environmental control operations Calculate environmental energy efficiency score The calculation expression is: ; in This is the baseline energy consumption value.
8. A system for simulating and alleviating stress in pigs based on multidimensional environmental parameters, used to implement the method as described in any one of claims 1 to 7, characterized in that, The system includes: The digital twin environment engine module is configured to construct a digital twin environment for the pigsty. It uses a multiphysics coupling algorithm to simulate and update multidimensional environmental parameters in the pigsty in real time. These multidimensional environmental parameters include effective ambient temperature, conductive ambient ground temperature, and ammonia concentration in the air. The pig intelligent agent simulation module is configured to construct multiple pig intelligent agents. Each pig intelligent agent obtains multi-dimensional environmental parameters updated by the digital twin environment engine module and calculates its own core body temperature changes based on the physiological energy equation to update its physiological state. Based on updated physiological states, an improved Boids swarm algorithm is used to drive the emergence of swarm behavior in the multiple pig agents. The cohesion weight in the improved Boids swarm algorithm is dynamically adjusted in real time according to the multidimensional environmental parameters: when the effective ambient temperature is below the lower critical temperature, the cohesion weight increases non-linearly with increasing temperature difference, driving the pig agents to move towards the group center to simulate huddling behavior; when the effective ambient temperature is above the upper critical temperature, the cohesion weight decays to a negative value, driving the pig agents to disperse to simulate heat dissipation behavior; when the ammonia concentration exceeds a safety threshold, negative feedback decay is applied to the cohesion weight and a random noise vector is superimposed to simulate social disturbance behavior. The virtual interaction and environmental control module is configured to respond to the environmental control operations input by the user through the virtual central control interface and update the multi-dimensional environmental parameters in the digital twin environment engine module. The closed-loop feedback driving module is configured to input the updated multi-dimensional environmental parameters from the virtual interaction and environmental control module back into the pig agent simulation module, repeatedly executing the operations of the pig agent simulation module to drive the pig agent to transition from the group stress behavior to the comfortable state behavior.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method for simulating and relieving pig stress based on multidimensional environmental parameters as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the method for simulating and relieving stress in pigs based on multidimensional environmental parameters as described in any one of claims 1 to 7.