# Predicting Ventilation Rate in a Naturally Ventilated Dairy Barn in Wind-Forced Conditions Using Machine Learning Techniques

^{1}

^{2}

^{3}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Materials and Methods

#### 2.1. CFD Simulation

#### 2.1.1. Computational Domain, Mesh Distribution, and Boundary Condition

_{ref}is the reference height from the ground, m, and z

_{ref}= 10 m in this study; U

_{z}and U

_{ref}are the vertical mean velocity magnitude in local height z and reference height z

_{ref}, m s

^{−1}; α is the power-law exponent, =0.14 in this study; k

_{z}is the turbulent kinetic energy at local height z, m

^{2}s

^{−2}; U

^{*}is the friction velocity, m s

^{−1}; κ is the von Karman Constant, 0.40–0.42; z

_{0}is terrain roughness length, m, =0.03 m in this study; C

_{μ}is a model constant, =0.09 in this study; ε

_{z}is the turbulence energy dissipation rate, m

^{2}s

^{−3}.

_{0}and α were set to be 0.03 m and 0.14, respectively [22]. The bottom boundary (deemed as ground) was set as a no-slip wall boundary. The top boundary (deemed as the sky) was set as a symmetry plane. The downstream boundaries were set as pressure outlets with zero static pressure. The walls of the dairy building were set as smooth wall boundaries.

#### 2.1.2. Governing Equation, Turbulence Models, and Simulation Scheme

^{−3}, which was set to be constant at 1.2 kg m

^{−3}, because the air was treated as incompressible gas in this study; u is the velocity, ms

^{−1}; Φ represents the common variables of interest, i.e., velocity, m s

^{−1}, temperature, K, species (such as moisture), turbulent kinetic energy, m

^{2}s

^{−2}, and its dissipation rate, m

^{2}s

^{−3}; ΓΦ is the transport coefficient dependent on Φ, and S

_{Φ}is the source term dependent on Φ.

^{−4}; and (2) the monitored value (the air velocity at the ridge opening) was stable (relative difference of less than 0.5% within 100 iterations). Enhanced wall treatment was enabled in the simulations using the k-ε models, and the area-weighted average values of Y

^{+}in all the simulation cases were kept within the required range (Y

^{+}> 30). Ansys Fluent (ANSYS, Inc., Pittsburgh, PA, USA) was used to run all the simulations in this study.

#### 2.1.3. Experimental Data for CFD Model Validation

#### 2.1.4. Determination of Independent and Response Variables

#### 2.1.5. Simulated Data Acquisition

^{3}s

^{−1}; ${\overline{\mathrm{v}}}_{1\_\mathrm{i}}$, ${\overline{\mathrm{v}}}_{2\_\mathrm{i}}$, and ${\overline{\mathrm{v}}}_{\mathrm{R}}$ represent the area-averaged velocity normal to the opening i in sidewall opening 1, the opening i in sidewall opening 2, and the ridge opening, respectively, all in m s

^{−1}; S

_{1_i}, S

_{2_i}, and S

_{R}represent the area of the opening i in sidewall opening 1, the opening i in sidewall opening 2, and the ridge opening, respectively, all in m

^{2}.

#### 2.2. Development of Ventilation Predictive Models

#### 2.2.1. Dataset Construction

#### 2.2.2. Determination of Modeling Scheme

#### 2.2.3. Algorithm for Machine Learning

- (1)
- Deep Neural Networks (DNN)

_{l}and s

_{l}is the number of neurons in the l-th layer; l = 2, 3, …, n

_{l}, and n

_{l}is the number of layers; x

_{i}is the value of the i-th input; ${\mathrm{a}}_{\mathrm{i}}^{\left(1\right)}$ is the output of the i-th neuron in the l-th layer; ${\mathsf{\theta}}_{\mathrm{ij}}^{\left(\mathrm{l}-1\right)}$ is the connecting weight from the j-th neuron in the (l − 1)-th layer to the i-th neuron in the l-th layer; ${\mathrm{b}}_{\mathrm{i}}^{\mathrm{l}-1}$ is the bias of the i-th neuron in the (l − 1)-th layer; g(.) is the activation function; ${\widehat{\mathrm{y}}}_{\mathrm{i}}$ is the value of the i-th neuron in the output layer; n

_{l}is the total number of layers except the input layer.

- (2)
- Support Vector Regression (SVR)

- (3)
- Random forest (RF)

#### 2.2.4. Evaluation Metrics

^{2}, Equation (11)) and mean absolute percentage error (MAPE, Equation (12)) were used as the two indicators for the model comparison. The closer R

^{2}is to 1, the higher the correlation of the predictive model with the CFD simulation results. The lower the value of MAPE, the better the model’s prediction. The predictive model could be deemed valid as long as the MAPE < 5% in this study.

_{i}are the predicted and simulated value of the ventilation rate, respectively, both in m

^{3}h

^{−3}; N is the number of compared cases; $\overline{{\mathrm{Q}}_{\mathrm{i}}}$ is the average value of all CFD-simulated ventilation rates in the N cases in m

^{3}h

^{−3}.

## 3. Results and Discussion

#### 3.1. CFD Model Validation

#### 3.2. Evaluation of Different Machine Learning Algorithms

^{2}and MAPE for the three machine learning algorithms. In Scheme 1, the R

^{2}and MAPE of the test sets using the DNN algorithm were 0.979 and 20.1, respectively. R

^{2}using the DNN algorithm was higher than with the SVR and RF algorithms. The MAPE of the DNN algorithm was lower than those of the SVR and RF algorithms. The MAPEs of the test sets for the DNN and SVR algorithms were similar to the MAPE of the training set. However, the RF algorithm had overfitting. Compared with the effects of different algorithms on Scheme 2, the results were similar in Scheme 1. A similar rank for the prediction performance of these algorithms was reported in other studies [13,38,39]. Therefore, the DNN algorithm was selected for the other Schemes.

#### 3.3. Comparison of Single and Multiple Outputs

^{2}and MAPE values between the training and the test sets were less than 0.002 and 0.9%, respectively, indicating that no overfitting occurred in the modeling. The R

^{2}value in Scheme 1 (R

^{2}= 0.979) was lower than that of Scheme 2 (R

^{2}= 0.996), and the MAPE value of Scheme 1 (MAPE = 20.1%) was higher than that of Scheme 1 (MAPE = 7.7%), indicating that multiple outputs could be better than a single output in ventilation rate prediction. Usually, the effects of a single output and multiple outputs on predictive accuracy would be similar if the outputs were independent of each other [40]. Considering that the outputs (the 15 area-averaged air velocities) in Scheme 2 were related to each other, the multiple outputs were more suitable for establishing a ventilation rate predictive model in dairy barns. Thus, the multiple outputs were subsequently adopted in Schemes 3 and 4.

#### 3.4. The Impact of Real-Time In-Barn Air Velocity Measurement

^{2}and MAPE values of the three modeling schemes (Schemes 2–4). The maximum coefficients of determination, R

^{2}, for the three modeling schemes were all greater than 0.99, indicating that more than 99% of the numerically simulated ventilation rates could be predicted based on the model inputs in this study. In other words, the model inputs and the ventilation rates predicted had a high correlation with the numerically simulated result.

#### 3.5. Effect of Anemometer Placement

_{4}Y

_{6}Z

_{1}) as an additional model input in Scheme 3 could improve the MAPE value by 3.3%. This is because the monitoring point X

_{4}Y

_{6}Z

_{1}is located in the central area of the left part of the windward side opening where the monitored air velocity could be highly related to the external wind conditions.

#### 3.6. Limitations and Perspectives

## 4. Conclusions

- (1)
- The R
^{2}value of the DNN algorithm was greater than those of the SVR and RF algorithms. The MAPE value of the DNN algorithm was greater than those of the SVR and RF algorithms. The DNN algorithm was more suitable for the ventilation rate prediction of a dairy barn. - (2)
- The R
^{2}value of Scheme 2 was greater than that of Scheme 1 and the MAPE value of Scheme 2 was smaller than that of Scheme 1. Using the air velocities at the openings as the modeling outputs was more suitable for the ventilation rate prediction of the dairy barn than using the ventilation rate directly as the model output. - (3)
- Among the three modeling schemes, the MAPE of the prediction decreased from 7.7% for Scheme 2 to 4.4% for Scheme 3 and 3.1% for Scheme 4. Adding indoor monitoring points as the model inputs could improve the predictive accuracy. The predictive accuracy increased as the number of indoor monitoring points increased. However, adding two indoor air velocities improved the accuracy of the scheme with one indoor air velocity by 1.3%.
- (4)
- Due to the height and the operating strategies of the sidewall openings, selecting the velocities of the monitoring points at the lower layer as the model inputs performed generally better than selecting those at the top layer.
- (5)
- Scheme 3 with the velocities at one point added in the model inputs was recommended. The velocities at the monitoring point X
_{4}Y_{6}Z_{1}were recommended for the model inputs when the wind direction is 0–180°.

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## References

- Seedorf, J.; Hartung, J.; Schröder, M.; Linkert, K.H.; Pedersen, S.; Takai, H.; Johnsen, J.O.; Metz, J.H.M.; Groot Koerkamp, P.W.G.; Uenk, G.H.; et al. A Survey of Ventilation Rates in Livestock Buildings in Northern Europe. J. Agric. Eng. Res.
**1998**, 70, 39–47. [Google Scholar] [CrossRef][Green Version] - Tomasello, N.; Valenti, F.; Cascone, G.; Porto, S.M.C. Development of a CFD Model to Simulate Natural Ventilation in a Semi-Open Free-Stall Barn for Dairy Cows. Buildings
**2019**, 9, 183. [Google Scholar] [CrossRef][Green Version] - Shen, X.; Zhang, G.; Bjerg, B. Investigation of response surface methodology for modelling ventilation rate of a naturally ventilated building. Build. Environ.
**2012**, 54, 174–185. [Google Scholar] [CrossRef] - Shen, X.; Zhang, G.; Bjerg, B. Assessments of experimental designs in response surface modelling process: Estimating ventilation rate in naturally ventilated livestock buildings. Energy Build.
**2013**, 62, 570–580. [Google Scholar] [CrossRef] - Fagundes, B.; Damasceno, F.A.; Andrade, R.R.; Saraz, J.A.O.; Barbari, M.; Vega, F.A.O.; Nascimento, J.A.C. Comparison of airflow homogeneity in Compost Dairy Barns with different ventilation systems using the CFD model. Agron. Res.
**2020**, 18, 788–796. [Google Scholar] [CrossRef] - Pakari, A.; Ghani, S. Comparison of different mechanical ventilation systems for dairy cow barns: CFD simulations and field measurements. Comput. Electron. Agric.
**2021**, 186, 106207. [Google Scholar] [CrossRef] - Shen, X.; Zhang, G.; Bjerg, B. Comparison of different methods for estimating ventilation rates through wind driven ventilated buildings. Energy Build.
**2012**, 54, 297–306. [Google Scholar] [CrossRef] - Yi, Q.; Wang, X.; Zhang, G.; Li, H.; Janke, D.; Amon, T. Assessing effects of wind speed and wind direction on discharge coefficient of sidewall opening in a dairy building model—A numerical study. Comput. Electron. Agric.
**2019**, 162, 235–245. [Google Scholar] [CrossRef] - Yi, Q.; Zhang, G.; Li, H.; Wang, X.; Janke, D.; Amon, B.; Hempel, S.; Amon, T. Estimation of opening discharge coefficient of naturally ventilated dairy buildings by response surface methodology. Comput. Electron. Agric.
**2020**, 169, 105224. [Google Scholar] [CrossRef] - Ayata, T.; Arcaklıoğlu, E.; Yıldız, O. Application of ANN to explore the potential use of natural ventilation in buildings in Turkey. Appl. Therm. Eng.
**2007**, 27, 12–20. [Google Scholar] [CrossRef] - Ferreira, P.M.; Faria, E.A.; Ruano, A.E. Neural network models in greenhouse air temperature prediction. Neurocomputing
**2002**, 43, 51–75. [Google Scholar] [CrossRef][Green Version] - Becker, C.A.; Aghalari, A.; Marufuzzaman, M.; Stone, A.E. Predicting dairy cattle heat stress using machine learning techniques. J. Dairy Sci.
**2021**, 104, 501–524. [Google Scholar] [CrossRef] - Liu, Y.; Zhuang, Y.; Ji, B.; Zhang, G.; Rong, L.; Teng, G.; Wang, C. Prediction of laying hen house odor concentrations using machine learning models based on small sample data. Comput. Electron. Agric.
**2022**, 195, 106849. [Google Scholar] [CrossRef] - Arulmozhi, E.; Basak, J.K.; Sihalath, T.; Park, J.; Kim, H.T.; Moon, B.E. Machine Learning-Based Microclimate Model for Indoor Air Temperature and Relative Humidity Prediction in a Swine Building. Animals
**2021**, 11, 222. [Google Scholar] [CrossRef] - Chen, Y.; Tong, Z.; Zheng, Y.; Samuelson, H.; Norford, L. Transfer learning with deep neural networks for model predictive control of HVAC and natural ventilation in smart buildings. J. Clean. Prod.
**2020**, 254, 119866. [Google Scholar] [CrossRef] - Gan, V.J.L.; Wang, B.; Chan, C.M.; Weerasuriya, A.U.; Cheng, J.C.P. Physics-based, data-driven approach for predicting natural ventilation of residential high-rise buildings. Build. Simul.
**2022**, 15, 129–148. [Google Scholar] [CrossRef] - Jing, G.; Cai, W.; Chen, H.; Zhai, D.; Cui, C.; Yin, X. An air balancing method using support vector machine for a ventilation system. Build. Environ.
**2018**, 143, 487–495. [Google Scholar] [CrossRef] - Li, Q.Y.; Han, J.; Lu, L. A Random Forest Classification Algorithm Based Personal Thermal Sensation Model for Personalized Conditioning System in Office Buildings. Comput. J.
**2021**, 64, 500–508. [Google Scholar] [CrossRef] - Franke, J.; Hellsten, A.; Schlunzen, K.H.; Carissimo, B. The COST 732 Best Practice Guideline for CFD simulation of flows in the urban environment: A summary. Int. J. Environ. Pollut.
**2011**, 44, 419. [Google Scholar] [CrossRef] - Tominaga, Y.; Mochida, A.; Yoshie, R.; Kataoka, H.; Nozu, T.; Yoshikawa, M.; Shirasawa, T. AIJ guidelines for practical applications of CFD to pedestrian wind environment around buildings. J. Wind Eng. Ind. Aerodyn.
**2008**, 96, 1749–1761. [Google Scholar] [CrossRef] - Wu, W.; Zhai, J.; Zhang, G.; Nielsen, P.V. Evaluation of methods for determining air exchange rate in a naturally ventilated dairy cattle building with large openings using computational fluid dynamics (CFD). Atmos. Environ.
**2012**, 63, 179–188. [Google Scholar] [CrossRef] - Wieringa, J. Updating the Davenport roughness classification. J. Wind Eng. Ind. Aerodyn.
**1992**, 41, 357–368. [Google Scholar] [CrossRef] - Rong, L.; Nielsen, P.V.; Bjerg, B.; Zhang, G. Summary of best guidelines and validation of CFD modeling in livestock buildings to ensure prediction quality. Comput. Electron. Agric.
**2016**, 121, 180–190. [Google Scholar] [CrossRef] - Patankar, S. Numerical Heat Transfer and Fluid Flow; CRC Press: Washington, DC, USA; Hemisphere Publishing Corp.: London, UK, 1980; p. 210. [Google Scholar]
- Yi, Q.; König, M.; Janke, D.; Hempel, S.; Zhang, G.; Amon, B.; Amon, T. Wind tunnel investigations of sidewall opening effects on indoor airflows of a cross-ventilated dairy building. Energy Build.
**2018**, 175, 163–172. [Google Scholar] [CrossRef] - Yi, Q.; Zhang, G.; König, M.; Janke, D.; Hempel, S.; Amon, T. Investigation of discharge coefficient for wind-driven naturally ventilated dairy barns. Energy Build.
**2018**, 165, 132–140. [Google Scholar] [CrossRef] - Yi, Q.; Li, H.; Wang, X.; Zong, C.; Zhang, G. Numerical investigation on the effects of building configuration on discharge coefficient for a cross-ventilated dairy building model. Biosyst. Eng.
**2019**, 182, 107–122. [Google Scholar] [CrossRef] - Maharani, D.; Murfi, H. Deep Neural Network For Structured Data—A Case Study Of Mortality Rate Prediction Caused By Air Quality. In Proceedings of the 2nd International Conference on Data and Information Science (ICoDIS), Bandung, Indonesia, 15–16 November 2018. [Google Scholar]
- Shen, Z.; Pan, P.; Zhang, D.; Huang, S. Rapid Structural Safety Assessment Using a Deep Neural Network. J. Earthq. Eng.
**2022**, 26, 2625–2641. [Google Scholar] [CrossRef] - Srivastava, N.; Hinton, G.; Krizhevsky, A.; Sutskever, I.; Salakhutdinov, R. Dropout: A Simple Way to Prevent Neural Networks from Overfitting. J. Mach. Learn. Res.
**2014**, 15, 1929–1958. [Google Scholar] - Smola, A.J.; Scholkopf, B. A tutorial on support vector regression. Stat. Comput.
**2004**, 14, 199–222. [Google Scholar] [CrossRef][Green Version] - Vens, C.; Van Assche, A.; Blockeel, H.; Dzeroski, S. First order random forests with complex aggregates. In Inductive Logic Programming, Proceedings; Camacho, R., King, R., Srinivasan, A.S., Eds.; Lecture Notes in Artificial Intelligence; Springer: Berlin/Heidelberg, Germany, 2004; Volume 3194, pp. 323–340. [Google Scholar]
- Verikas, A.; Gelzinis, A.; Bacauskiene, M. Mining data with random forests: A survey and results of new tests. Pattern Recognit.
**2011**, 44, 330–349. [Google Scholar] [CrossRef] - Morsing, S.; Ikeguchi, A.; Bennetsen, J.C.; Strom, J.S.; Ravn, P.; Okushima, L. Wind induced isothermal airflow patterns in a scale model of a naturally ventilated swine barn with cathedral ceiling. Appl. Eng. Agric.
**2002**, 18, 97–101. [Google Scholar] [CrossRef] - Nosek, S.; Klukova, Z.; Jakubcova, M.; Yi, Q.; Janke, D.; Demeyer, P.; Janour, Z. The impact of atmospheric boundary layer, opening configuration and presence of animals on the ventilation of a cattle barn. J. Wind. Eng. Ind. Aerodyn.
**2020**, 201, 104185. [Google Scholar] [CrossRef] - Evola, G.; Popov, V. Computational analysis of wind driven natural ventilation in buildings. Energy Build.
**2006**, 38, 491–501. [Google Scholar] [CrossRef] - Ntinas, G.K.; Shen, X.; Wang, Y.; Zhang, G. Evaluation of CFD turbulence models for simulating external airflow around varied building roof with wind tunnel experiment. Build. Simul.
**2018**, 11, 115–123. [Google Scholar] [CrossRef] - Gorczyca, M.T.; Milan, H.F.M.; Campos Maia, A.S.; Gebremedhin, K.G. Machine learning algorithms to predict core, skin, and hair-coat temperatures of piglets. Comput. Electron. Agric.
**2018**, 151, 286–294. [Google Scholar] [CrossRef][Green Version] - Huang, J.-C.; Tsai, Y.-C.; Wu, P.-Y.; Lien, Y.-H.; Chien, C.-Y.; Kuo, C.-F.; Hung, J.-F.; Chen, S.-C.; Kuo, C.-H. Predictive modeling of blood pressure during hemodialysis: A comparison of linear model, random forest, support vector regression, XGBoost, LASSO regression and ensemble method. Comput. Methods Programs Biomed.
**2020**, 195, 105536. [Google Scholar] [CrossRef] [PubMed] - Dayal, B.S.; MacGregor, J.F. Multi-output process identification. J. Process Control
**1997**, 7, 269–282. [Google Scholar] [CrossRef]

**Figure 1.**The flow chart of this study. CFD represented computational fluid dynamics; DNN, SVR, and RF represented deep neural networks, support vector regression and random forest algorithms, respectively; S1, S2, S3, and S4 denote the modeling schemes 1, 2, 3, and 4, respectively; WC and OS represented the wind condition and opening size, respectively; SO and MO represented the single output and the multiple outputs, respectively; 1P and 2P represented the velocities at one indoor point and two indoor points, respectively.

**Figure 2.**(

**a**) The computational domain and the geometry of the dairy cattle building, and (

**b**) mesh distribution of the computational domain.

**Figure 3.**Outside view (

**a**) and inside view (

**b**) of the wind tunnel and the experimental setup, and the measuring locations (

**c**).

**Figure 4.**The division of the sidewall openings in the naturally ventilated dairy cattle barn. O1-1 is the first part of the sidewall openings1 divided into 7 parts, and other O1-x are named in this way. O2-1 is the first part of the sidewall openings2 divided into 7 parts, and other O2-x are named in this way. The OR is the ridge opening.

**Figure 5.**Distribution of the air velocity measuring points in the dairy cattle barn. The measurement points are divided into two layers, i.e., the top layer and bottom layer, with 96 measurement points in each layer.

**Figure 6.**Airflow distribution pattern under (

**a**) Realizable k-ε (RKE), (

**b**) RE-Normalization Group k-ε (RNG), and (

**c**) Standard k-ε (SKE) models.

**Figure 7.**Comparison of simulated velocities under three turbulence models with the measured velocities in the wind tunnel experiment.

**Figure 8.**Comparison of the regression plots of the training and test sets of Schemes 1 and 2: (

**a**) is the regression analysis of the training set of Scheme 1, (

**b**) is the regression analysis of the test set of Scheme 1, (

**c**) is the regression analysis of the training set of Scheme 2, and (

**d**) is the regression analysis of the test set of Scheme 2.

**Figure 9.**Distribution of MAPE of the predictive model in Scheme 3 at each monitoring point in the bottom layer (

**a**) and the top layer (

**b**). The average MAPE from X

_{1}Y

_{1}Z

_{1}to X

_{8}Y

_{6}Z

_{1}was 7.5%. The mean MAPE of X

_{9}Y

_{1}Z

_{1}to X

_{16}Y

_{6}Z

_{1}was 7.9%. The mean MAPE of X

_{1}Y

_{1}Z

_{2}to X

_{8}Y

_{6}Z

_{2}was 8.0%. The average MAPE from X

_{9}Y

_{1}Z

_{2}to X

_{16}Y

_{6}Z

_{2}was 7.9%. The lowest MAPE point was X

_{4}Y

_{6}Z

_{1}, which was 4.39%.

Item | Total Number of Meshes in Each Case | ||
---|---|---|---|

~6.3 Million | ~3.1 Million | ~1.5 Million | |

${\overline{\mathit{v}}}_{\mathbf{01}}$, m s^{−1} | 2.313 | 2.310 | 2.291 |

Relative difference, % | 0 | 0.1 | 1.0 |

Item | Line1 | Line2 | Line3 | Line4 | Line5 | Line6 | Line7 | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

Y, m | v, m s^{−1} | Y, m | v, m s^{−1} | Y, m | v, m s^{−1} | Y, m | v, m s^{−1} | Y, m | v, m s^{−1} | Y, m | v, m s^{−1} | Y, m | v, m s^{−1} | |

P1 | 0.008 | 2.93 ± 0.87 | 0.016 | 0.35 ± 0.19 | 0.016 | −0.12 ± 0.43 | 0.016 | −0.11 ± 0.59 | 0.016 | −0.22 ± 0.47 | 0.016 | −0.36 ± 0.41 | 0.008 | −0.32 ± 1.16 |

P2 | 0.016 | 3.41 ± 0.90 | 0.032 | −0.02 ± 0.28 | 0.032 | −0.17 ± 0.46 | 0.032 | −0.01 ± 0.59 | 0.032 | −0.10 ± 0.46 | 0.032 | −0.04 ± 0.38 | 0.016 | −0.36 ± 1.18 |

P3 | 0.024 | 3.70 ± 0.92 | 0.05 | −0.17 ± 0.24 | 0.048 | −0.31 ± 0.40 | 0.048 | −0.07 ± 0.53 | 0.048 | 0.07 ± 0.47 | 0.05 | 0.22 ± 0.38 | 0.024 | −0.41 ± 1.16 |

P4 | 0.032 | 3.84 ± 0.90 | 0.064 | −0.22 ± 0.23 | 0.068 | −0.46 ± 0.42 | 0.068 | −0.11 ± 0.49 | 0.068 | 0.15 ± 0.47 | 0.064 | 0.49 ± 0.37 | 0.032 | −0.27 ± 1.19 |

P5 | 0.04 | 4.16 ± 0.93 | 0.072 | −0.27 ± 0.22 | 0.08 | −0.54 ± 0.42 | 0.08 | −0.22 ± 0.49 | 0.08 | 0.21 ± 0.45 | 0.072 | 0.55 ± 0.43 | 0.04 | −0.34 ± 1.14 |

P6 | 0.048 | 4.25 ± 0.92 | 0.08 | −0.25 ± 0.33 | 0.096 | −0.47 ± 0.52 | 0.096 | −0.25 ± 0.47 | 0.096 | 0.31 ± 0.47 | 0.08 | 0.93 ± 0.38 | 0.048 | −0.20 ± 1.19 |

P7 | 0.068 | 4.51 ± 0.93 | 0.088 | 0.19 ± 0.95 | 0.112 | −0.30 ± 0.72 | 0.112 | −0.33 ± 0.48 | 0.112 | 0.43 ± 0.48 | 0.088 | 1.42 ± 0.40 | 0.068 | 0.07 ± 1.25 |

P8 | 0.08 | 4.64 ± 0.87 | 0.092 | 1.48 ± 1.60 | 0.135 | 0.51 ± 0.99 | 0.135 | −0.23 ± 0.56 | 0.135 | 0.66 ± 0.53 | 0.092 | 1.58 ± 0.40 | 0.08 | 0.10 ± 1.30 |

P9 | 0.096 | 4.80 ± 0.88 | 0.096 | 3.80 ± 1.72 | 0.14 | 0.70 ± 0.99 | 0.14 | −0.20 ± 0.53 | 0.14 | 0.77 ± 0.49 | 0.096 | 1.67 ± 0.39 | 0.096 | 0.50 ± 1.39 |

P10 | 0.112 | 4.96 ± 0.93 | 0.099 | 5.05 ± 1.37 | 0.16 | 1.68 ± 1.16 | 0.16 | 0.01 ± 0.59 | 0.16 | 0.99 ± 0.57 | 0.099 | 1.75 ± 0.39 | 0.112 | 1.01 ± 1.43 |

P11 | 0.135 | 5.28 ± 0.89 | 0.105 | 5.84 ± 1.00 | 0.17 | 2.33 ± 1.17 | 0.18 | 0.31 ± 0.67 | 0.17 | 1.16 ± 0.58 | 0.105 | 1.68 ± 0.37 | 0.135 | 1.70 ± 1.57 |

P12 | 0.16 | 5.43 ± 0.88 | 0.112 | 3.69 ± 1.63 | 0.18 | 2.95 ± 1.08 | 0.2 | 0.69 ± 0.77 | 0.18 | 1.29 ± 0.63 | 0.112 | 1.41 ± 0.39 | 0.16 | 2.84 ± 1.6 |

P13 | 0.18 | 5.68 ± 0.87 | 0.135 | 3.76 ± 1.21 | 0.19 | 3.29 ± 0.99 | 0.22 | 0.97 ± 0.79 | 0.19 | 1.28 ± 0.62 | 0.135 | −0.49 ± 1.23 | 0.18 | 3.67 ± 1.52 |

P14 | 0.2 | 5.79 ± 0.87 | 0.14 | 4.31 ± 1.13 | 0.21 | 5.07 ± 0.89 | 0.23 | 1.03 ± 0.84 | 0.21 | −0.19 ± 0.66 | 0.14 | −0.31 ± 1.30 | 0.2 | 4.27 ± 1.41 |

P15 | 0.23 | 5.95 ± 0.84 | 0.16 | 4.87 ± 0.87 | 0.23 | 5.46 ± 0.87 | 0.24 | 1.10 ± 0.86 | 0.23 | −0.14 ± 0.67 | 0.16 | 0.45 ± 1.32 | 0.23 | 4.62 ± 1.33 |

P16 | 0.26 | 6.19 ± 0.86 | 0.18 | 5.14 ± 0.82 | 0.26 | 5.93 ± 0.82 | 0.26 | 0.65 ± 0.84 | 0.26 | 0.26 ± 1.02 | 0.18 | 0.90 ± 1.38 | 0.26 | 4.85 ± 1.38 |

P17 | 0.29 | 6.30 ± 0.86 | 0.2 | 5.33 ± 0.84 | 0.29 | 6.23 ± 0.83 | 0.27 | 2.27 ± 0.44 | 0.29 | 2.45 ± 1.68 | 0.2 | 1.19 ± 1.39 | 0.29 | 5.43 ± 1.47 |

P18 | 0.32 | 6.59 ± 0.82 | 0.23 | 5.78 ± 0.83 | 0.32 | 6.47 ± 0.82 | 0.29 | 7.18 ± 0.84 | 0.32 | 7.15 ± 1.24 | 0.23 | 1.65 ± 1.50 | 0.32 | 6.18 ± 1.4 |

P19 | 0.35 | 6.68 ± 0.81 | 0.26 | 5.99 ± 0.81 | 0.35 | 6.71 ± 0.80 | 0.3 | 7.32 ± 0.81 | 0.35 | 7.85 ± 0.74 | 0.26 | 2.51 ± 1.68 | 0.35 | 6.82 ± 1.19 |

P20 | 0.38 | 6.85 ± 0.76 | 0.29 | 6.29 ± 0.80 | 0.38 | 6.87 ± 0.79 | 0.32 | 7.32 ± 0.77 | 0.38 | 7.82 ± 0.73 | 0.29 | 4.32 ± 1.83 | 0.38 | 7.22 ± 1.00 |

P21 | 0.42 | 7.03 ± 0.77 | 0.32 | 6.32 ± 0.81 | 0.42 | 7.11 ± 0.77 | 0.35 | 7.46 ± 0.78 | 0.42 | 7.92 ± 0.72 | 0.32 | 6.26 ± 1.57 | 0.42 | 7.43 ± 0.84 |

P22 | 0.35 | 6.67 ± 0.79 | 0.38 | 7.61 ± 0.74 | 0.35 | 7.49 ± 0.95 | ||||||||

P23 | 0.38 | 6.84 ± 0.77 | 0.42 | 7.66 ± 0.74 | 0.38 | 7.71 ± 0.79 | ||||||||

P24 | 0.42 | 6.97 ± 0.81 | 0.42 | 7.83 ± 0.75 |

Variables (Unit) | Value |
---|---|

WS ^{1} (m s^{−1}) | 3, 5, 7, 9 |

WD ^{2} (°) | 0, 30, 45, 60, 120, 135, 150 |

O1 ^{3} (m) | 0.6, 1.2, 1.8, 2.4, 3, 3.6, 4 |

O2 ^{3} (m) | 0.6, 1.2, 1.8, 2.4, 3, 3.6, 4 |

^{1}WS = wind speed.

^{2}WD = wind direction, normal to the sidewall opening was set to be 0°.

^{3}O1 and O2 are the sidewall openings indicated in Figure 2a.

**Table 4.**Information on the modeling schemes with different combinations of model inputs and outputs.

Modeling Scheme | Number of Inputs | Number of Outputs | Number of Cases |
---|---|---|---|

Scheme 1 | 4 | 1 | 196 ^{1} × 1 |

Scheme 2 | 4 | 15 | 196 × 1 |

Scheme 3 | 7 | 1 or 15 ^{2} | 196 × 192 |

Scheme 4 | 10 | 1 or 15 | 196 × 36,672 |

^{1}196 represents the number of simulation cases in CFD simulation.

^{2}The number of outputs of Schemes 3 and 4 needed to be further determined based on the results from the evaluation of Schemes 1 and 2.

Scheme No. | Item | Training Set (80%) | Test Set (20%) | ||||
---|---|---|---|---|---|---|---|

DNN | SVR | RF | DNN | SVR | RF | ||

Scheme 1 | R^{2} | 0.980 | 0.908 | 0.986 | 0.979 | 0.885 | 0.975 |

MAPE (%) | 19.3 | 23.8 | 13.5 | 20.1 | 23.2 | 21.0 | |

Scheme 2 | R^{2} | 0.998 | 0.993 | 0.978 | 0.996 | 0.992 | 0.965 |

MAPE (%) | 6.8 | 9.6 | 16.5 | 7.7 | 10.5l | 21.6 |

Item | Scheme 2 | Scheme 3 | Scheme 4 |
---|---|---|---|

R^{2} | 0.996 | 0.998 | 0.999 |

MAPE (%) | 7.7 | 4.4 | 3.1 |

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |

© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Cao, M.; Yi, Q.; Wang, K.; Li, J.; Wang, X.
Predicting Ventilation Rate in a Naturally Ventilated Dairy Barn in Wind-Forced Conditions Using Machine Learning Techniques. *Agriculture* **2023**, *13*, 837.
https://doi.org/10.3390/agriculture13040837

**AMA Style**

Cao M, Yi Q, Wang K, Li J, Wang X.
Predicting Ventilation Rate in a Naturally Ventilated Dairy Barn in Wind-Forced Conditions Using Machine Learning Techniques. *Agriculture*. 2023; 13(4):837.
https://doi.org/10.3390/agriculture13040837

**Chicago/Turabian Style**

Cao, Mengbing, Qianying Yi, Kaiying Wang, Jiangong Li, and Xiaoshuai Wang.
2023. "Predicting Ventilation Rate in a Naturally Ventilated Dairy Barn in Wind-Forced Conditions Using Machine Learning Techniques" *Agriculture* 13, no. 4: 837.
https://doi.org/10.3390/agriculture13040837