Next Article in Journal
European LNG Import Network Analysis and Investigation of Supply Security
Previous Article in Journal
Numerical Analysis of Gas Flow Distribution Characteristics in a 5 kW Molten Carbonate Fuel Cell Stack
Previous Article in Special Issue
Transfer Learning for the Prediction of Energy Performance of Water-Cooled Electric Chillers: Grey-Box Models Versus Deep Neural Network (DNN) Models
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Predictive Modeling of Energy Consumption for Cooling Ventilation in Livestock Buildings: A Machine Learning Approach

by
Carlos Alejandro Perez Garcia
,
Patrizia Tassinari
,
Daniele Torreggiani
and
Marco Bovo
*
Department of Agricultural and Food Sciences, University of Bologna, Viale G. Fanin 48, 40127 Bologna, Italy
*
Author to whom correspondence should be addressed.
Energies 2025, 18(3), 633; https://doi.org/10.3390/en18030633
Submission received: 19 December 2024 / Revised: 15 January 2025 / Accepted: 28 January 2025 / Published: 30 January 2025
(This article belongs to the Special Issue Machine Learning for Energy Load Forecasting)

Abstract

:
This research developed a predictive model using NeuralProphet to estimate energy consumption in the ventilation system of a dairy cattle farm. The necessity for energy management in livestock farming has increased due to the growing energy demands associated with climate control systems. Approximately two years of historical energy consumption data, collected through a smart monitoring system deployed on the farm, were utilized as the primary input for the NeuralProphet model to predict long-term trends and seasonal variations. The computational results demonstrated satisfactory performance, achieving a coefficient of determination (R2) of 0.85 and a mean absolute error (MAE) of 27.47 kWh. The model effectively captured general trends and seasonal patterns, providing valuable insights into energy usage under existing operational conditions. However, short-term fluctuations were less accurately predicted due to the exclusion of exogenous climatic variables, such as temperature and humidity. The proposed model demonstrated superiority over traditional approaches in its capacity to forecast long-term energy demand, providing critical support for energy management and strategic decision-making in dairy farm operations.

1. Introduction

1.1. Current State-of-the-Art

Dairy farming is an energy-intensive sector within agriculture, particularly in maintaining optimal environmental conditions for livestock welfare and productivity. During the hotter months of the year, unsuitable microclimatic conditions can significantly impact animal welfare. While natural ventilation is commonly employed in livestock production for swine and poultry [1,2], dairy barns in the Mediterranean region are typically equipped with mechanical ventilation systems [3,4,5]. This is primarily due to the fact that prolonged exposure to elevated temperatures can have a negative effect on milk production, compromise cow health, and decrease overall farm productivity. This is further exacerbated by the increasing frequency and intensity of heat waves affecting the area, which contributes significantly to increased energy consumption by ventilation systems.
Mechanical ventilation plays a critical role in facilitating heat dissipation from the animals, thereby alleviating thermal stress and preventing declines in welfare, health, and productivity [6]. A comprehensive evaluation of the effects of these systems has been conducted, encompassing both natural and mechanical components, as well as the frequency of utilization and the cost-effectiveness of its availability [7,8,9]. This increased energy demand highlights a critical area for efficiency improvements, particularly through predictive systems that optimize energy use and reduce costs [10].
Food security, alongside animal welfare, constitutes one of the principal pillars of precision livestock farming, especially in the face of environmental degradation and population growth. In this context, the use of heating, ventilation, and air-conditioning (HVAC) systems to maintain indoor thermal environments has become standard practice in livestock operations to mitigate the adverse effects of heat stress. Elevated thermal stress, resulting from sensitivity to the indoor thermal environment, can lead to reduced feed intake and altered hormone secretion that promotes protein synthesis, thereby diminishing livestock weight gain and feed efficiency [11,12].
Higher relative humidity complicates the regulation of body temperature, as elevated humidity levels reduce sweat evaporation. Consequently, even at the same temperature, the degree of heat stress may vary depending on humidity levels. The National Research Council (NRC) introduced the Temperature-Humidity Index (THI) [13], which is based on indoor air temperature and relative humidity, to quantitatively express thermal stress in livestock. The THI facilitates the evaluation of thermal stress in indoor environments by combining temperature and humidity factors through empirical equations. This index is instrumental in quantitatively assessing environmental factors that impact livestock health, productivity, and welfare, thereby playing a crucial role in establishing effective environmental management and control strategies to enhance the indoor conditions of livestock facilities [14].
However, studies related to facility device control methods that employ THI are scarce, particularly regarding the management of indoor THI through the application of HVAC systems. Conventional HVAC control in livestock buildings predominantly relies on straightforward methods, often based solely on indoor THI thresholds. This approach lacks the comprehensive use of advanced predictive models to optimize energy consumption while maintaining optimal environmental conditions. Addressing this gap, the present study explores the application of machine learning techniques to forecast energy consumption in dairy farm ventilation systems, aiming to enhance efficiency and sustainability in energy use.

1.2. Energy Demand in Dairy Farms

Dairy farms have a significant energy demand, primarily driven by the need for milking, cooling milk, feeding livestock, and maintaining environmental controls. Overall, in a livestock building not equipped with a ventilation system, most of the electricity consumption is represented by the milking systems (between 20% and 25% of total yearly electricity consumption), milk refrigeration (17–20%) and water heating (14–15%). Water pumping, including irrigation, can represent about 12–13% of the electrical demand, while 12–14% is required for lighting and 3–4% for automatized animal brushing. Manure removal calls for a fraction of 4–5% of energy assessed for slurry management, while the remaining percentage is mainly related to minor operations. After the introduction of ventilation systems, the energy demand can increase up to 40% [15,16,17,18]. In fact, milking systems and milk cooling equipment are among the largest energy consumers, requiring reliable electricity to ensure product quality and safety.
The efficient use of energy resources is a significant challenge in nearly all sectors, particularly in the context of livestock farming. Ensuring sustainable food production to meet growing demands while maintaining favorable environmental conditions for future generations is imperative. The adoption of renewable energy sources offers a viable solution to this issue; however, the availability of these resources is strongly influenced by geographic location, climatic conditions, and other factors. Consequently, regardless of the energy source utilized, prioritizing the efficient use of energy remains paramount. Modern technologies, including variable speed drives and energy-efficient lighting, also play a crucial role in reducing energy consumption.

1.3. Applying IoT and Machine Learning for Energy Management Optimization

The recent integration of Internet of Things (IoT) technologies has significantly enhanced environmental monitoring within dairy barns, facilitating real-time and distributed data collection at a substantially lower cost compared to traditional sensor systems. This technological advancement has led to the widespread adoption of IoT solutions in dairy farming operations, enabling continuous monitoring of critical parameters such as temperature, humidity, and energy consumption. This detailed monitoring facilitates a comprehensive understanding of the variables relevant to farm management, including energy consumption, and enables the identification of inefficiencies. Furthermore, the comprehensive datasets obtained can serve as essential inputs for predictive models aimed at optimizing energy usage.
Concurrently, advancements in machine learning (ML) have catalyzed a paradigm shift in predictive control for energy systems, transcending the limitations of conventional control strategies [19,20]. By utilizing historical environmental data, predictive ML models can accurately forecast energy demand and anticipate operational requirements with enhanced precision. Shine et al. [21] investigated the application of multiple linear regression (MLR) to assess the impact of diverse factors on electricity and water consumption in dairy farms. These factors include milk production, herd size, infrastructural equipment, managerial procedures, and environmental conditions. Their analysis employed data collected from 58 pasture-based Irish commercial dairy farms over three years (2014–2016) using remote monitoring systems. The study demonstrated that electricity consumption could be predicted with greater accuracy than water consumption, highlighting key predictors such as milk production and the total number of dairy cows for electricity consumption. Contemporaneously, Shine et al. [22] employed an SVM model trained on empirical data from 56 dairy farms to predict and analyze annual electricity consumption across individual farms. The SVM demonstrated strong predictive accuracy, achieving a relative prediction error (RPE) of 10.4% for annual farm-level electricity consumption.
In their subsequent study, Shine et al. [23] evaluated the applicability of several ML algorithms, including support vector machines, CART decision trees, random forest ensembles, and artificial neural networks, to predict monthly electricity consumption in dairy farms. Their approach entailed the employment of backward sequential variable selection, a strategy designed to exclude variables that exhibited minimal predictive value. In addition, they incorporated hyperparameter tuning and nested cross-validation to assess the capability of each model in forecasting unseen electricity consumption. The study further underscores the superior predictive accuracy of ML algorithms in comparison to conventional statistical methods, such as MLR. This enhancement can be attributed to the capacity of ML to model non-linear relationships and interactions among input variables, thereby conferring greater flexibility in the presence of multicollinearity, non-standard distributions, missing points, and complex patterns. These attributes render ML algorithms particularly well-suited for energy demand forecasting in dairy farms, where input data frequently exhibit such characteristics.
Sefeedpari et al. [24] developed an artificial neural network (ANN) model to assess energy input–output relationships in Iranian dairy farms. The study utilized data collected from 50 farms via a questionnaire-based approach and optimized an ANN model with a single hidden layer containing 16 neurons, employing the Levenberg–Marquardt training algorithm. This configuration demonstrated strong predictive performance, with a coefficient of determination (R2) of 0.88 and a root mean square error (RMSE) of 0.015, highlighting its accuracy in forecasting energy output from milk production systems. While the ANN model effectively predicted energy consumption for individual dairy farms, its application at a larger scale may require addressing challenges associated with the extensive input variables necessary for accurate predictions, which may not always be readily available without specialized monitoring equipment.
Moreover, Sefeedpari et al. [25] explored the potential of an adaptive neural–fuzzy inference system (ANFIS) to model energy output based on fossil fuel and electricity inputs. Utilizing data from 50 dairy farms in Tehran province, the study demonstrated that the ANFIS model exhibited comparable accuracy to traditional linear regression, with superior performance metrics across several error measurements, including the coefficient of determination (R2), the root mean square error (RMSE), and the mean absolute percentage error (MAPE). These findings further support the efficacy of advanced predictive models in optimizing energy usage within dairy farm operations.
Time series forecasting models, such as NeuralProphet—an extension of the Prophet model originally developed by Facebook—are particularly prominent due to their robust ability to manage seasonality and trend components effectively [26]. These sophisticated models enable the development of anticipatory control strategies, whereby ventilation systems can dynamically adjust in response to forecasted environmental conditions. This approach not only optimizes energy consumption by minimizing unnecessary usage but also promotes animal welfare by maintaining optimal environmental conditions. Thus, the synergy between IoT and ML technologies is pivotal in advancing control systems, leading to more resilient and efficient energy management solutions in dairy farming.
The main objective of this research is to develop a predictive model for the energy consumption of the ventilation system in a dairy cattle farm. The study employs NeuralProphet as the modeling framework, utilizing approximately two years of historical data collected through a smart monitoring system deployed on the farm. By leveraging the long-term predictions provided by the NeuralProphet model, the study aims to estimate the behavior of the target variable, thereby supporting informed administrative decision-making.

2. Materials and Methods

2.1. Description of the Case Study Farm

The dataset employed in this study was collected in a farm, strategically located in San Pietro in Casale, Bologna, within the Emilia-Romagna region of Italy (coordinates: 44.716038° N, 11.451233° E; elevation: 10 m above sea level). The farm building spans 80.0 m in length and 42.32 m in width, featuring an architecturally sophisticated variable-height roof. The roof height varies from 4.0 m at the building’s sides to a substantial 12.15 m at the gable peak (Figure 1). This design is intentional, facilitating optimal ventilation and airflow distribution throughout the facility, which is crucial for maintaining a stable and comfortable indoor environment for the livestock. The variable-height structure aids in mitigating heat accumulation, thereby reducing the reliance on mechanical ventilation systems and enhancing overall energy efficiency. The ventilation system is currently composed of 14 fans with horizontal axes operating along the two feeding lanes (i.e., 7 per lane) and 10 fans with vertical axis distributed on two lines and placed over the resting area. In the center of the barn there is a probe which measures, in real-time, temperature and relative humidity, and, thanks to these measurements, realized every 1 min, the instantaneous value THI can be calculated. Obviously, the value can be considered a representative average value of the whole situation within the barn, and on the basis of this value proper actions for the functioning of the ventilation system are taken.

2.2. Data Acquisition and Processing Framework

A monitoring system was implemented in the farm, and it is centered around a Raspberry Pi 3 device, functioning as a gateway for continuous environmental data acquisition. Through a Modbus/TCP connection, this gateway retrieves both the indoor Temperature-Humidity Index (THI) measurements of the probe and the control signals from a Programmable Logic Controller (PLC). The PLC applies a predefined control algorithm to compute fan speed percentages, adjusting ventilation rates based on THI thresholds, which are applied to the THI level obtained by the probe installed in the barn. Specifically, when the THI surpasses a maximum limit, the fans operate at full capacity; if THI is below a minimum threshold, the fans remain off; and, for intermediate THI values, the fan speed is linearly interpolated between the minimum and maximum settings. This approach ensures that the ventilation system dynamically responds to varying indoor conditions, thereby aiming to reduce heat stress in dairy cattle and improve animal welfare.
Once collected, the THI values and corresponding fan speed percentages are packaged and transmitted via a LoRaWAN communication protocol to a remote server. There, the data are stored in an InfluxDB database, enabling robust long-term retention and efficient querying of high-resolution time series information. A Grafana-based visualization layer provides stakeholders with accessible, real-time dashboards for monitoring energy consumption trends, environmental conditions, and system performance metrics. Figure 2 presents an overview of the smart monitoring system, illustrating the interaction among farm-level components, data transmission protocols, and server-side data handling and visualization tools.
Figure 3 showcases the time series of indoor THI measurements (top) alongside the calculated fan speed percentages (bottom). The data confirm that THI values peak during the summer months of June, July, and August (a period coinciding with the highest environmental temperatures in Italy). Consequently, the control algorithm frequently sets the ventilation system to operate near or at full capacity, mitigating potential heat stress in the herd. In contrast, THI remains below the critical threshold (60) for the majority of the other months, reflecting cooler indoor environments and minimal fan activity. From November to March, the ventilation fans are generally inactive, except for a notable instance in December 2023, when unexpectedly high internal temperatures triggered the system. This anomaly may be attributed to the gradual increase in global temperatures linked to climate change, underscoring the importance of adaptive and predictive control strategies.

2.3. Energy Load Analysis

Quantifying energy consumption from the calculated fan speed percentages involves applying a proportional approach. Each fan in the system is rated at 0.75 kW. At any given timestep, the percentage of maximum fan speed is used to determine the fraction of the fan’s rated power currently being drawn. This value is then multiplied by the total number of fans (30) to obtain the instantaneous power demand. By integrating these values over time, we can determine the cumulative energy consumption, which amounts to approximately 40,000 kWh per year, which is in line with the farm’s billing reports.
Figure 4 depicts the time series of computed energy consumption. Its trends and seasonal patterns closely align with those observed in Figure 3, as the underlying control algorithm directly correlates fan operational intensity with indoor THI fluctuations. As all fans possess identical performance characteristics, the system’s collective energy consumption is proportional to the aggregated fan speed signals. Consequently, periods of elevated THI are associated with increased energy consumption, which highlights the direct relationship between environmental conditions, ventilation response, and the farm’s overall electrical load.
To understand the underlying patterns influencing energy consumption, it is essential to decompose the time series into its fundamental components—trend, seasonal, and residual elements. This study employs a well-established time series decomposition method that applies an additive model over an annual cycle. By setting the period to one year, the analysis assumes that the principal recurring patterns are linked to seasonal environmental conditions. The selection of an additive model is justified not only by the comparatively constant magnitude of seasonal fluctuations, but also by the presence of zero-value observations in the dataset, which limit the applicability of a multiplicative framework.
Figure 5 illustrates the seasonal decomposition of daily energy consumption, providing critical insights into the structure and behavior of the time series data. The decomposition is presented in four panels to differentiate between the original signal, underlying trend, seasonality, and residuals. The first panel displays the original daily energy consumption measurements, which combine short-term fluctuations with longer-term behavioral trends. This signal captures both transient changes and overarching consumption dynamics across the observation period. The second panel highlights the long-term trend component, which reflects the baseline evolution of energy consumption. Specifically, between May and November of each year, the trend demonstrates a linear growth pattern that is progressively higher compared to the preceding year. This observation underscores a steady and continuous increase in energy consumption over time, likely driven by growing operational demands of ventilation systems or incremental changes in farm infrastructure and management practices. The third panel isolates the seasonal component, revealing a well-defined annual cyclical pattern. Energy consumption peaks prominently during warmer periods, which likely aligns with increased ventilation and cooling needs, while cooler periods coincide with noticeable reductions in energy usage. This seasonal behavior reinforces the critical role of environmental conditions in shaping the temporal variability of daily energy demands. The pronounced seasonality aligns with expected patterns observed in farms where temperature-driven ventilation systems account for a significant proportion of overall energy usage.
Finally, the bottom panel presents the residuals, representing the unexplained portion of the data after accounting for both the trend and seasonal components. The residuals remain relatively stable and moderate throughout the observed period, suggesting that the decomposition effectively captures the dominant factors influencing energy consumption. Nevertheless, certain fluctuations persist, attributable to stochastic variations in internal environmental conditions within the farm. These variations are mainly influenced by external environmental variables. It should be noted that these exogenous variables have not been included in the current phase of the analysis, as the focus of this work is on the analysis of energy consumption at a large-scale temporal resolution.

2.4. Development of the Predictive Model

NeuralProphet, an extension of the Prophet algorithm developed at Facebook, was specifically designed for time series forecasting [26]. This model combines the strengths of traditional statistical algorithms, such as ARIMA and GARCH, which are valued for their mathematical interpretability, with the robust predictive power of neural network models, which effectively capture complex patterns but often lack transparency. This hybrid approach achieves a balance between the two, making it suitable for practical applications where the rationale behind predictions is critical.
A feature that sets NeuralProphet apart from other models is its modular architecture. This architecture allows the model to be built from distinct components, each of which contributes additively to the overall forecast. These components can be adapted to scale with the trend, introducing multiplicative effects that enhance the model’s adaptability to varying data dynamics. Furthermore, NeuralProphet is capable of forecasting multiple future time steps simultaneously, defined by the forecast horizon h. This capability enables the model to efficiently produce predictions over a defined time span, dynamically adjusting to changes in input data, as expressed in Equation (1).
y ^ t + k 1 = T t + k 1 + S t + k 1 + E t + k 1 + F t + k 1 + A t + k 1 + L t + k 1   k   1 ,   h
where:
  • y ^ t + k 1 is the predicted value;
  • T: trend at time t;
  • S: seasonal effects at time t;
  • E: event holiday at time t;
  • F: regression effects at time t for future-known exogenous variables;
  • A: auto-regression effects at time t based on past observations;
  • L: regression effects at time t for lagged observations of exogenous variables.
The model was configured to reflect the temporal characteristics and specificities of the data. However, it is important to note that, in the context of the present application, the E component was not considered due to its lack of impact on the target variable. Conversely, the F and L components, despite being elements that enhance the predictive model’s performance, were not incorporated into this initial modeling approach. Yearly seasonality was enabled to capture the pronounced annual fluctuations driven by climatic cycles and their influence on ventilation demand. In contrast, both weekly and daily seasonality were deactivated. This decision stemmed from the nature of the system’s control strategy, which is threshold-based rather than following a strict daily or weekly routine, thereby minimizing the risk of overfitting to transient patterns.
A total of 100 changepoints were set to allow the model to capture gradual and abrupt shifts in the baseline trend over the extended observation period. This parameterization accounts for potential regime changes, such as evolving management practices or variations in external environmental conditions, while maintaining computational efficiency. Training was performed with a batch size of 32 over 50 epochs, ensuring a balance between training time and the ability of the model to generalize effectively.
No lagged terms (n_lags = 0) were introduced into the model. This choice directs the model’s focus toward identifying long-term trends and seasonal dynamics rather than short-term autocorrelations, thereby aligning the analysis with the broader temporal structures inherent in energy expenditure data.
The seasonality regularization coefficient was set to 0.1, which moderates the model’s ability to capture complex seasonal patterns and reduces the risk of overfitting to noise or spurious seasonality. Additive annual seasonality was enabled (yearly_seasonality = True), which allows seasonal effects to scale linearly with the underlying trend. This configuration is consistent with the intuitive understanding that energy consumption patterns exhibit annual fluctuations that add to the baseline consumption levels. Weekly and daily seasonality components were excluded (weekly_seasonality = False; daily_seasonality = False), reflecting the focus on capturing the dominant annual cycles relevant to agricultural energy demand.
A learning rate of 0.008 was chosen to ensure gradual parameter updates and to promote stable convergence of the model during the training process. The adoption of a linear growth model ensures that the baseline trend evolves in a steady and interpretable manner over time. By configuring these parameters, the model emphasizes long-term seasonal and trend dynamics, providing robust predictions of energy consumption patterns while avoiding overfitting to short-term anomalies or noise.

2.5. Training and Validation

The forecasting model was trained and validated by partitioning the dataset into two subsets: the first 80% of the data was allocated for training, and the remaining 20% was reserved for validation. This division was accomplished using an 80/20 time-based split to preserve the chronological integrity of the data. During the training process, the model parameters were iteratively adjusted to minimize forecast errors on the training set, while the validation subset served as an independent benchmark to evaluate the generalization capabilities of the model. NeuralProphet automatically calculates and stores several key performance metrics as outputs of the fitting process. Two of the most commonly used metrics in time series forecasting are mean absolute error (MAE), which measures the average magnitude of the errors between the predicted values and the actual values (Equation (2)) and Root Mean Squared Error (RMSE), which provides a measure of the standard deviation of the residuals (prediction errors) (Equation (3)).
M A E = 1 T i = 1 T y i y ^ i
R M S E = 1 T i = 1 T y i y ^ i 2

3. Results and Discussion

The proposed neural prophet model was trained, and its performance was evaluated using the above-mentioned evaluation metrics (Table 1). The model demonstrated satisfactory performance, with an MAE value of approximately 27.47 kWh and an RMSE of around 38.2 kWh. This is notable, considering the average daily energy consumption is approximately 127 kWh. The model’s predictions were found to be approximately 21% off, on average, as indicated by the MAE value.
To further evaluate the predictive capabilities of the model, Figure 6 displays the comparison between actual and forecasted energy consumption values on the validation subset (from 1 January 2024, through 31 July 2024). In this visualization, the blue line represents the observed data, while the orange line corresponds to the model’s forecasts. Although the general trends are reasonably captured, the model’s predictions do not fully replicate the short-term oscillations observed in the real data. This discrepancy can be attributed to the model’s exclusive reliance on historical energy consumption patterns, as no external environmental variables were included as exogenous inputs. Since fan operation is highly sensitive to stochastic climate parameters (temperature and humidity in particular) the absence of such information limits the model’s ability to capture abrupt fluctuations in energy usage. Nevertheless, the calculated coefficient of determination (R2) of 0.85 suggests that the predictions provide a satisfactory level of accuracy for this specific application context where the environmental variables can drastically alter energy consumption.
The findings of this study align with Sefeedpari et al. [24], who developed an ANN model for energy consumption prediction in dairy farms and achieved a similar degree of predictive accuracy, with an R2 value of 0.88. While their model was customized for individual farms and incorporated a more extensive array of input variables, such as infrastructure and herd size, the implementation of the Levenberg–Marquardt training algorithm in their work ensured high performance; however, it necessitated specialized data collection efforts. This tradeoff underscores the distinction between models like NeuralProphet, which rely on minimal input features, and more complex frameworks that necessitate extensive data acquisition.
Furthermore, the absence of exogenous inputs in this study mirrors the limitations noted in Shine et al. [21], where multiple linear regression models also struggled to accurately predict energy consumption without accounting for environmental variables such as temperature and humidity. Conversely, Shine et al. [22] demonstrated the potential of advanced ML algorithms, including SVM and random forests, which incorporated external predictors to enhance forecasting precision. These findings underscore the potential for enhancing the NeuralProphet model by integrating environmental data to account for the dynamic and stochastic nature of energy usage in dairy farms.

3.1. Trend and Seasonality Forecast Analysis

In this segment, the long-term energy consumption forecasts produced by the NeuralProphet model are examined. This examination builds upon the data acquisition framework, modeling methodologies, and validation approaches outlined in the preceding sections. The analysis focuses on predictions spanning from August to December 2024 and extending throughout 2025. These forecasts offer critical insights into the anticipated trajectory of energy demands, assuming the continuation of existing operational practices and prevailing environmental conditions.
In order to analyze the underlying components of the forecast, the model’s results were decomposed and visualized using the “plot_parameters” function. Figure 7, illustrating the trend, trend rate change, and annual seasonality, offers insights into the anticipated evolution of energy consumption patterns. The upper section of the figure illustrates the long-term trend component, which demonstrates a progressive upward trajectory. The initial phase, spanning from October 2021 to early 2022, is characterized by a slight decline and stabilization in the trend, which is followed by a steady increase from mid-2022 onwards. A more pronounced increase is observed between mid-2023 and the forecast horizon of 2024. This behavior is consistent with the previously identified seasonal and operational patterns, reflecting the combined influence of environmental conditions and facility demands.
Moreover, during the colder months, the trend component exhibits brief periods of stabilization, indicative of reduced energy demand. This is consistent with the earlier analysis which highlighted decreased ventilation requirements during lower temperatures. The middle section, representing the trend rate change, underscores these gradual shifts, capturing both positive and negative variations that contribute to the overall trajectory. Lastly, the annual seasonality component reveals a clear cyclical pattern, with higher energy consumption consistently occurring between May and November. This seasonal behavior aligns perfectly with the earlier findings, reinforcing the relationship between increased ventilation demands and warmer periods.
The lower section of the figure offers insight into the annual seasonality component, which evinces a discernible cyclical pattern. Energy consumption exhibits a predictable seasonal variation, reaching its highest levels between May and November each year. This seasonal peak coincides with periods of elevated ventilation demands during warmer months, when environmental conditions necessitate increased energy usage for maintaining optimal operational and animal welfare conditions. Conversely, energy demand declines during the colder months, reflecting a natural reduction in cooling requirements. The smooth and consistent shape of the seasonal curve demonstrates the model’s efficacy in capturing this periodic behavior.
To support the interpretation of the model’s predictions, Figure 8 presents both the observed time series used as training data and the forecasted values. In accordance with the model’s identified seasonal and trend features, the forecast indicates a decline in energy consumption for the rest of 2024, reaching near-zero levels in November. In contrast, the model predicts an increase in energy consumption during the summer of 2025, with peak values occurring between July and August. This is consistent with the observation that the hottest months of the year in this hemisphere occur during this period.
It is important to note, however, that the forecasted series does not reproduce the sub-annual seasonality with exact precision. This limitation is primarily attributed to the absence of incorporation of variations in climatic parameters into the current model. In order to achieve a more precise forecast, it would be necessary to incorporate predictive models for climatic variables as exogenous inputs. This limitation will be addressed in future research activities, as the objective of this initial study was to focus on long-term energy consumption predictions.

3.2. Yearly Energy Consumption Analysis

Figure 9 presents a bar plot depicting the total energy consumed for the years 2022 to 2025, which is used to assess the yearly energy consumption trends. The measured values for 2022 (40,475 kWh), 2023 (40,909 kWh) and the actual energy consumption up to the end of July 2024 (26,294 kWh) are indicated in light blue. Furthermore, the anticipated energy consumption for the remaining months of 2024 was projected using the predictive model, resulting in an estimated 17,700 kWh. This results in total forecasted energy consumption for 2024 of 43,995 kWh. The predictive model indicates that energy consumption will continue to increase in 2025, reaching 46,432 kWh. A blue trend line superimposed on the bar plot illustrates the positive slope of the trend, which is consistent with the previously analyzed long-term trajectory. This reinforces the observation of a steady upward trend in yearly energy demand.
The values presented in Table 2 summarize the yearly energy needs during the monitored period, reflecting both measured and forecasted consumption. The table illustrates a consistent upward trend in energy demand over time, largely attributable to climatic conditions and the associated ventilation requirements.
The results indicate a gradual increase in yearly energy demand, with values of 40,475 kWh in 2022, 40,909 kWh in 2023, 43,994 kWh in 2024, and 46,431 kWh in 2025. It is noteworthy that the energy demand for 2024 comprises two distinct contributions: the first, which was measured from January to July, and the second, which was forecasted by the model for August to December. Similarly, the value for 2025 is entirely based on the model’s predictions.
In the absence of changes in environmental control strategies or operational practices, the observed trend suggests that energy consumption will likely continue to grow. In particular, the estimated annual growth rates in energy demand are 1.07% for 2023, 7.54% for 2024, and 5.54% for 2025. These findings underscore the necessity for optimized energy management and control strategies to mitigate the rising energy requirements driven by external climatic conditions and ventilation demands.

4. Conclusions

This study successfully developed a predictive model for the energy consumption of a ventilation system in a dairy cattle farm using NeuralProphet. The model utilized approximately two years of historical energy consumption data collected through a smart monitoring system and demonstrated satisfactory predictive performance, with an R2 value of 0.85 and an MAE of 27.47 kWh. The results highlight the model’s capability to capture long-term trends and seasonal patterns in energy demand, providing critical insights into the behavior of energy consumption under current operational practices and environmental conditions.
The energy consumption outlook for the latter half of 2024 and 2025 indicates a persistent upward trend, with significant seasonal peaks during the warmer months (May to November). The observed annual growth rates of 7.54% in 2024 and 5.54% in 2025 underscore the increasing energy demands driven by climatic factors and ventilation requirements. While the model demonstrated proficiency in capturing general trends and seasonal variations, its inability to replicate short-term fluctuations underscores the necessity to incorporate climatic parameters, such as temperature and humidity, as exogenous inputs in subsequent model iterations.
Future research will center on the development of hybrid models that integrate structural characteristics of the farm (e.g., building layout, insulation, and ventilation systems) with external environmental variables (e.g., temperature, humidity, and wind speed) as exogenous inputs. By combining these elements, hybrid models are expected to provide a more accurate and holistic representation of energy consumption dynamics. Additionally, the integration of projected environmental variables, sourced from weather forecasting systems, can significantly improve the real-time applicability of energy predictions. This capability would allow for proactive energy management strategies, such as adjusting ventilation schedules or preparing for peak energy demand periods based on anticipated weather conditions. These advancements are expected to support more efficient resource allocation and cost management while enhancing the sustainability of farm operations.

Author Contributions

Conceptualization, C.A.P.G., P.T., D.T. and M.B.; Methodology, C.A.P.G., P.T., D.T. and M.B.; Validation, M.B.; Formal analysis, C.A.P.G.; Investigation, C.A.P.G.; Data curation, M.B.; Writing—original draft, C.A.P.G. and M.B.; Writing—review & editing, P.T. and D.T.; Supervision, P.T.; Funding acquisition, P.T. All authors have read and agreed to the published version of the manuscript.

Funding

This research was carried out within the Agritech National Research Center and received funding from the European Union Next-GenerationEU (PIANO NAZIONALE DI RIPRESA E RESILIENZA (PNRR)—MISSIONE 4 COMPONENTE 2, INVESTIMENTO 1.4—D.D. 1032 17/06/2022, CN00000022). This manuscript reflects only the authors’ views and opinions, neither the European Union nor the European Commission can be considered responsible for them.

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the authors on request.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Bovo, M.; Santolini, E.; Barbaresi, A.; Tassinari, P.; Torreggiani, D. Assessment of Geometrical and Seasonal Effects on the Natural Ventilation of a Pig Barn Using CFD Simulations. Comput. Electron. Agric. 2022, 193, 106652. [Google Scholar] [CrossRef]
  2. Costantino, A.; Fabrizio, E.; Biglia, A.; Cornale, P.; Battaglini, L. Energy Use for Climate Control of Animal Houses: The State of the Art in Europe. Energy Procedia 2016, 101, 184–191. [Google Scholar] [CrossRef]
  3. Ji, B.; Banhazi, T.; Perano, K.; Ghahramani, A.; Bowtell, L.; Wang, C.; Li, B. A Review of Measuring, Assessing and Mitigating Heat Stress in Dairy Cattle. Biosyst. Eng. 2020, 199, 4–26. [Google Scholar] [CrossRef]
  4. Hut, P.R.; Scheurwater, J.; Nielen, M.; van den Broek, J.; Hostens, M.M. Heat Stress in a Temperate Climate Leads to Adapted Sensor-Based Behavioral Patterns of Dairy Cows. J. Dairy Sci. 2022, 105, 6909–6922. [Google Scholar] [CrossRef]
  5. Mondaca, M.R. Ventilation Systems for Adult Dairy Cattle. Vet. Clin. N. Am. Food Anim. Pract. 2019, 35, 139–156. [Google Scholar] [CrossRef]
  6. Yan, G.; Li, H.; Shi, Z. Evaluation of Thermal Indices as the Indicators of Heat Stress in Dairy Cows in a Temperate Climate. Animals 2021, 11, 2459. [Google Scholar] [CrossRef]
  7. Mondaca, M.R.; Cook, N.B. Modeled Construction and Operating Costs of Different Ventilation Systems for Lactating Dairy Cows. J. Dairy Sci. 2019, 102, 896–908. [Google Scholar] [CrossRef]
  8. Leliveld, L.M.C.; Brandolese, C.; Grotto, M.; Marinucci, A.; Fossati, N.; Lovarelli, D.; Riva, E.; Provolo, G. Real-Time Automatic Integrated Monitoring of Barn Environment and Dairy Cattle Behaviour: Technical Implementation and Evaluation on Three Commercial Farms. Comput. Electron. Agric. 2024, 216, 108499. [Google Scholar] [CrossRef]
  9. Collier, R.J.; Dahl, G.E.; VanBaale, M.J. Major Advances Associated with Environmental Effects on Dairy Cattle. J. Dairy Sci. 2006, 89, 1244–1253. [Google Scholar] [CrossRef]
  10. Barbaresi, A.; Bovo, M.; Torreggiani, D. The Dual Influence of the Envelope on the Thermal Performance of Conditioned and Unconditioned Buildings. Sustain. Cities Soc. 2020, 61, 102298. [Google Scholar] [CrossRef]
  11. Upton, J.; Humphreys, J.; Groot Koerkamp, P.W.G.; French, P.; Dillon, P.; De Boer, I.J.M. Energy Demand on Dairy Farms in Ireland. J. Dairy Sci. 2013, 96, 6489–6498. [Google Scholar] [CrossRef] [PubMed]
  12. Li, S.; Research Associate, P.; Lee, C.N.; Collier, R.J.; Reno, N. Evaluation of thermal stress indices for cattle. In Proceedings of the 2009 ASABE Annual International Meeting, Reno, NV, USA, 21–24 June 2009. [Google Scholar]
  13. National Research Council A Guide to Environmental Research on Animals; National Academy of Sciences: Washington, DC, USA, 1971.
  14. Dikmen, S.; Hansen, P.J. Is the Temperature-Humidity Index the Best Indicator of Heat Stress in Lactating Dairy Cows in a Subtropical Environment? J. Dairy Sci. 2009, 92, 109–116. [Google Scholar] [CrossRef] [PubMed]
  15. Lovarelli, D.; Bovo, M.; Giannone, C.; Santolini, E.; Tassinari, P.; Guarino, M. Reducing Life Cycle Environmental Impacts of Milk Production through Precision Livestock Farming. Sustain. Prod. Consum. 2024, 51, 303–314. [Google Scholar] [CrossRef]
  16. Frorip, J.; Kokin, E.; Praks, J.; Poikalainen, V.; Ruus, A.; Veermäe, I.; Lepasalu, L.; Schäfer, W.; Mikkola, H.; Ahokas, J. Energy Consumption in Animal Production-Case Farm Study. Agron. Res. 2012, 10, 39–48. [Google Scholar]
  17. Rossi, P.; Gastaldo, A. Consumi Energetici in Allevamenti Bovini Da Latte. Inf. Agrar. 2012, 3, 45–47. [Google Scholar]
  18. Shine, P.; Upton, J.; Sefeedpari, P.; Murphy, M.D. Energy Consumption on Dairy Farms: A Review of Monitoring, Prediction Modelling, and Analyses. Energies 2020, 13, 1288. [Google Scholar] [CrossRef]
  19. Hietaharju, P.; Ruusunen, M.; Leiviskä, K. A Dynamic Model for Indoor Temperature Prediction in Buildings. Energies 2018, 11, 1477. [Google Scholar] [CrossRef]
  20. Deb, C.; Zhang, F.; Yang, J.; Lee, S.E.; Shah, K.W. A Review on Time Series Forecasting Techniques for Building Energy Consumption. Renew. Sustain. Energy Rev. 2017, 74, 902–924. [Google Scholar] [CrossRef]
  21. Shine, P.; Scully, T.; Upton, J.; Murphy, M.D. Multiple Linear Regression Modelling of On-Farm Direct Water and Electricity Consumption on Pasture Based Dairy Farms. Comput. Electron. Agric. 2018, 148, 337–346. [Google Scholar] [CrossRef]
  22. Shine, P.; Scully, T.; Upton, J.; Murphy, M.D. Annual Electricity Consumption Prediction and Future Expansion Analysis on Dairy Farms Using a Support Vector Machine. Appl. Energy 2019, 250, 1110–1119. [Google Scholar] [CrossRef]
  23. Shine, P.; Murphy, M.D.; Upton, J.; Scully, T. Machine-Learning Algorithms for Predicting on-Farm Direct Water and Electricity Consumption on Pasture Based Dairy Farms. Comput. Electron. Agric. 2018, 150, 74–87. [Google Scholar] [CrossRef]
  24. Sefeedpari, P.; Rafiee, S.; Akram, A. Application of Artificial Neural Network to Model the Energy Output of Dairy Farms in Iran. Int. J. Energy Technol. Policy 2013, 9, 82–91. [Google Scholar] [CrossRef]
  25. Sefeedpari, P.; Rafiee, S.; Akram, A.; Komleh, S.H.P. Modeling Output Energy Based on Fossil Fuels and Electricity Energy Consumption on Dairy Farms of Iran: Application of Adaptive Neural-Fuzzy Inference System Technique. Comput. Electron. Agric. 2014, 109, 80–85. [Google Scholar] [CrossRef]
  26. Triebe, O.; Hewamalage, H.; Pilyugina, P.; Laptev, N.; Bergmeir, C.; Rajagopal, R. NeuralProphet: Explainable Forecasting at Scale. arXiv 2021, arXiv:2111.15397. [Google Scholar]
Figure 1. Layout of the livestock building.
Figure 1. Layout of the livestock building.
Energies 18 00633 g001
Figure 2. Overview of the Monitoring System.
Figure 2. Overview of the Monitoring System.
Energies 18 00633 g002
Figure 3. Time series of indoor THI measurements (top) and corresponding fan speed percentages (bottom).
Figure 3. Time series of indoor THI measurements (top) and corresponding fan speed percentages (bottom).
Energies 18 00633 g003
Figure 4. Time Series of Estimated Energy Consumption.
Figure 4. Time Series of Estimated Energy Consumption.
Energies 18 00633 g004
Figure 5. Seasonal Decomposition of Energy Consumption.
Figure 5. Seasonal Decomposition of Energy Consumption.
Energies 18 00633 g005
Figure 6. Actual vs. forecasted energy consumption on the 2024 validation subset.
Figure 6. Actual vs. forecasted energy consumption on the 2024 validation subset.
Energies 18 00633 g006
Figure 7. Forecast energy consumption components.
Figure 7. Forecast energy consumption components.
Energies 18 00633 g007
Figure 8. Long-term energy consumption forecast.
Figure 8. Long-term energy consumption forecast.
Energies 18 00633 g008
Figure 9. Bar plot of energy consumption for the years 2022 to 2025.
Figure 9. Bar plot of energy consumption for the years 2022 to 2025.
Energies 18 00633 g009
Table 1. Performance Metrics of the Trained NeuralProphet Model.
Table 1. Performance Metrics of the Trained NeuralProphet Model.
MAERMSELoss
27.470238.20810.0241
Table 2. Yearly energy need during the monitored period.
Table 2. Yearly energy need during the monitored period.
2022202320242025
40,475 kWh (*)40,909 kWh (*)43,995 kWh =
26,294 (*) + 17,700 (**)
46,431 kWh (**)
(*): measured; (**): forecasted by the model.
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.

Share and Cite

MDPI and ACS Style

Perez Garcia, C.A.; Tassinari, P.; Torreggiani, D.; Bovo, M. Predictive Modeling of Energy Consumption for Cooling Ventilation in Livestock Buildings: A Machine Learning Approach. Energies 2025, 18, 633. https://doi.org/10.3390/en18030633

AMA Style

Perez Garcia CA, Tassinari P, Torreggiani D, Bovo M. Predictive Modeling of Energy Consumption for Cooling Ventilation in Livestock Buildings: A Machine Learning Approach. Energies. 2025; 18(3):633. https://doi.org/10.3390/en18030633

Chicago/Turabian Style

Perez Garcia, Carlos Alejandro, Patrizia Tassinari, Daniele Torreggiani, and Marco Bovo. 2025. "Predictive Modeling of Energy Consumption for Cooling Ventilation in Livestock Buildings: A Machine Learning Approach" Energies 18, no. 3: 633. https://doi.org/10.3390/en18030633

APA Style

Perez Garcia, C. A., Tassinari, P., Torreggiani, D., & Bovo, M. (2025). Predictive Modeling of Energy Consumption for Cooling Ventilation in Livestock Buildings: A Machine Learning Approach. Energies, 18(3), 633. https://doi.org/10.3390/en18030633

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop