2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

Forecasting Energy Consumption of Wastewater Treatment Plants with a

Transfer Learning Approach for Sustainable Cities (2021)

Abstract:

A major challenge of today’s society is to make large urban centres more sustainable.
.‫چالش اصلی جامعه امروزی پایدار کردن مراکز شهری بزرگ است‬

Improving the energy efficiency of the various infrastructures that make up cities is one
aspect being considered when improving their sustainability, with Wastewater
Treatment Plants (WWTPs) being one of them.
‫بهبود بهره وری انرژی زیرساخت های مختلفی که شهرها را تشکیل می دهند یکی از جنبه هایی است که در هنگام‬
.‫) است‬WWTPs( ‫ که یکی از آنها کارخانه های تصفیه فاضالب‬،‫بهبود پایداری آنها مورد توجه قرار می گیرد‬

Consequently, this study aims to conceive, tune, and evaluate a set of candidate deep
learning models with the goal being to forecast the energy consumption of a WWTP,
following a recursive multi-step approach.
‫ تنظیم و ارزیابی مجموعه‌ای از مدل‌های یادگیری عمیق نامزد با هدف پیش‌بینی‬،‫ این مطالعه با هدف تصور‬،‫در نتیجه‬
.‫ انجام می‌شود‬،‫ به دنبال یک رویکرد چند مرحله‌ای بازگشتی‬،WWTP ‫مصرف انرژی یک‬

Three distinct types of models were experimented, in particular, Long Short-Term


Memory networks (LSTMs), Gated Recurrent Units (GRUs), and uni-dimensional
Convolutional Neural Networks (CNNs).
‫ واحدهای بازگشتی دردار‬،)LSTM( ‫ شبکه‌های حافظه کوتاه‌مدت‬،‫ به‌ویژه‬،‫سه نوع متمایز از مدل‌ها آزمایش شدند‬
.)CNN( ‫ و شبکه‌های عصبی کانولوشنال تک بعدی‬،)GRU(

Uni- and multi-variate settings were evaluated, as well as different methods for
handling outliers.
.‫تنظیمات تک متغیره و چند متغیره و همچنین روش‌های مختلف برای رسیدگی به موارد پرت مورد ارزیابی قرار گرفت‬

Promising forecasting results were obtained by CNN based models, being this
difference statistically significant when compared to LSTMs and GRUs,
GRU ‫ و‬LSTM ‫ که این تفاوت در مقایسه با‬،‫ به‌دست آمد‬CNN ‫نتایج امیدوارکننده پیش‌بینی توسط مدل‌های مبتنی بر‬
.‫از نظر آماری معنی‌دار است‬

with the best model presenting an approximate overall error of 630 kWh when on a
multi-variate setting.
.‫ کیلووات ساعت را هنگام تنظیم چند متغیره ارائه می دهد‬630 ‫با بهترین مدل که خطای کلی تقریبی‬

Finally, to overcome the problem of data scarcity in WWTPs, transfer learning


processes were implemented, with promising results being achieved when using a
pre-trained uni-variate CNN model, with the overall error reducing to 325 kWh.
‫ با نتایج امیدوارکننده ای که هنگام‬،‫ فرآیندهای یادگیری انتقال‬،‫ها‬WWTP ‫ برای غلبه بر مشکل کمبود داده در‬،‫در نهایت‬
‫ به دست‬،‫ کیلووات ساعت‬325 ‫ با کاهش خطای کلی به‬،‫ تک متغیره از پیش آموزش دیده‬CNN ‫استفاده از یک مدل‬
.‫ اجرا شد‬،‫آمد‬

1. Introduction

Over the years, there has been an increase in global urbanisation through a greater
concentration of people in small spaces.
.‫ افزایش شهرنشینی جهانی از طریق تمرکز بیشتر مردم در فضاهای کوچک وجود داشته است‬،‫در طول سال ها‬

According to the World Urbanisation Perspectives report carried out in 2017 by the
United Nations on the number of people living in urban and rural areas worldwide, it
was found that 4.1 billion people already lived in urban areas [1].
‫ توسط سازمان ملل متحد در مورد تعداد افراد ساکن در‬2017 ‫بر اساس گزارش چشم انداز شهرنشینی جهان که در سال‬
‫ میلیارد نفر قبالً در مناطق شهری زندگی می‬4.1 ‫ مشخص شد که‬،‫مناطق شهری و روستایی در سراسر جهان انجام شد‬
.‫کردند‬

In fact, cities have a fundamental role in sustainable development, namely related to


economic and environmental concerns.
.‫ یعنی مرتبط با دغدغه های اقتصادی و زیست محیطی‬،‫در واقع شهرها نقشی اساسی در توسعه پایدار دارند‬

With the increase in energy consumption, concerns about the energy sector have
expanded substantially.
.‫ نگرانی ها در مورد بخش انرژی به طور قابل توجهی گسترش یافته است‬،‫با افزایش مصرف انرژی‬

Although there has been a greater awareness of the impact of non-renewable energy
sources on the planet and the high emission of greenhouse gases,
‫اگرچه آگاهی بیشتری از تأثیر منابع انرژی تجدید ناپذیر بر روی کره زمین و انتشار باالی گازهای گلخانه ای وجود‬
،‫دارد‬
if concrete and imperative measures are not applied, this problem will only worsen.
.‫ این مشکل بدتر خواهد شد‬،‫اگر اقدامات ملموس و ضروری اعمال نشود‬

Thus, over the years, the term energy efficiency has become increasingly important
and indispensable.
.‫ اصطالح بهره وری انرژی به طور فزاینده ای مهم و ضروری شده است‬،‫ در طول سال ها‬،‫بنابراین‬

Energy efficiency can help reduce energy production and, consequently, reduce
greenhouse gas emissions and preserve fossil fuel resources, ensuring a notable
contribution to reducing environmental problems on our planet
‫بهره وری انرژی می تواند به کاهش تولید انرژی و در نتیجه کاهش انتشار گازهای گلخانه ای و حفظ منابع سوخت‬
.‫فسیلی کمک کند و کمک قابل توجهی را در کاهش مشکالت زیست محیطی در سیاره ما تضمین کند‬

There are several infrastructures where energy consumption is high in a city, with
Wastewater Treatment Plants (WWTPs) being one of them.
‫ تصفیه خانه‬،‫ که یکی از آنها‬،‫زیرساخت های متعددی وجود دارد که مصرف انرژی در آن ها در یک شهر باال است‬
.‫) است‬WWTPs( ‫های فاضالب‬

In a WWTP, achieving a high energy efficiency level has become an increasingly


important topic [3].
.]3[ ‫ دستیابی به سطح بازده انرژی باال به یک موضوع مهم تبدیل شده است‬،WWTP ‫در یک‬

WWTPs, with the execution of their functions, demand high levels of energy, reflecting
about 7% of all energy consumed worldwide [4].
‫ از کل انرژی مصرف شده‬٪7 ‫ به سطوح باالیی از انرژی نیاز دارند که منعکس کننده حدود‬،‫ها با اجرای وظایف خود‬
4[ ‫]در سراسر جهان است‬.

In Portugal, about 4% of the consumed electricity is urban water cycle’s responsibility,


with approximately 25% of that energy being used in WWTPs
‫ درصد از آن انرژی در‬25 ً ‫ درصد از برق مصرفی به عهده چرخه آب شهری است که تقریبا‬4 ‫ حدود‬،‫در پرتغال‬
.‫ ها استفاده می شود‬WWTP

Reducing energy consumption, emission of greenhouse gases and operating costs


has been one of the main concerns of WWTP managers, who have been adopting
more efficient equipment and technologies [6,7].
‫ بوده‬WWTP ‫ انتشار گازهای گلخانه‌ای و هزینه‌های عملیاتی یکی از دغدغه‌های اصلی مدیران‬،‫کاهش مصرف انرژی‬
.]6،7[ ‫است که تجهیزات و فناوری‌های کارآمدتری را به کار می‌گیرند‬

Hence, a WWTP must always consider the efficient management of all its resources,
including energy.
.‫ همیشه باید مدیریت کارآمد تمام منابع خود از جمله انرژی را در نظر بگیرد‬WWTP ‫ یک‬،‫از این رو‬

Currently, in most WWTPs, low levels of energy efficiency performance are found.
.‫ سطوح پایینی از عملکرد بازده انرژی یافت می شود‬،‫ها‬WWTP ‫ در اکثر‬،‫در حال حاضر‬

In fact, several factors influence the consumed energy in this type of facilities,
depending on their characteristics and the types of treatments being applied. In
general, the lack of energy efficiency is due to [8]:
‫ بر انرژی مصرفی در این نوع‬،‫در واقع عوامل متعددی بسته به ویژگی‌های آن‌ها و نوع درمان‌های مورد استفاده‬
:‫] است‬8[ ‫ عدم بهره وری انرژی به دلیل‬،‫ به طور کلی‬.‫تأسیسات تأثیر می‌گذارند‬

• A growing need for water recycling due to the scarcity of this resource;
‫نیاز روزافزون به بازیافت آب به دلیل کمبود این منبع؛‬

• Types of motors and pumps that are used;


;‫انواع موتور و پمپ های مورد استفاده‬

• Higher requirements on discharge parameters in the treated effluent;


.‫الزامات باالتر در مورد پارامترهای تخلیه در پساب تصفیه شده‬

• Water pumping processes, which require high energy consumption;


.‫• فرآیندهای پمپاژ آب که نیاز به مصرف انرژی باالیی دارند‬

• Absence of energy recovery mechanisms;


‫عدم وجود مکانیسم های بازیابی انرژی؛‬

• Low efficiency in operations, mixing, and aeration systems;


‫ اختالط و سیستم های هوادهی؛‬،‫راندمان پایین در عملیات‬

• Influent flow.
‫جریان نفوذی‬
1.1. State of the Art
‫مدرن‬

A study carried out by Li et al. [9] aimed at predicting energy consumption in a WWTP
through the use of a Radial Basis Function (RBF) neural network.
‫ از طریق استفاده‬WWTP ‫] با هدف پیش‌بینی مصرف انرژی در یک‬9[ .‫مطالعه ای که توسط لی و همکاران انجام شد‬
.)RBF( ‫از یک شبکه عصبی تابع پایه شعاعی‬

To evaluate the conceived models, they compared these with a Multi-variate Linear
Regression (MLR) model.
.‫) مقایسه می‌کنند‬MLR( ‫ آنها این مدل‌ها را با یک مدل رگرسیون خطی چند متغیره‬،‫برای ارزیابی مدل‌های تصور شده‬

The data were based on a WWTP located in China, with daily periodicity.
.‫ با تناوب روزانه بود‬،‫ واقع در چین‬WWTP ‫داده ها بر اساس یک‬

The data collected corresponded to 360 records, between December 2015 and
December 2016, with six invalid records removed.
‫ مطابقت داشت و شش رکورد نامعتبر‬،2016 ‫ و دسامبر‬2015 ‫ بین دسامبر‬،‫ رکورد‬360 ‫داده‌های جمع‌آوری‌شده با‬
.‫حذف شد‬

To decide which features were given as input to the model, the authors used the Fuzzy
C-Means (FCM) method. This method identified three indicators:
C-Means ‫ نویسندگان از روش فازی‬،‫برای تصمیم گیری اینکه کدام ویژگی به عنوان ورودی به مدل داده می شود‬
:‫ این روش سه شاخص را شناسایی کرد‬.‫() استفاده کردند‬FCM

the influential charge, the Chemical Oxygen Demand (COD), and the total nitrogen
removed.
.‫) و نیتروژن کل حذف شده است‬COD( ‫ تقاضای اکسیژن شیمیایی‬،‫بار تأثیرگذار‬

The authors defined the FCM hyperparameters without any search for the best value
for each of them, such as the number of iterations or clusters.
‫ مانند تعداد تکرارها یا‬،‫ را بدون جستجو برای بهترین مقدار برای هر یک از آنها‬FCM ‫نویسندگان فراپارامترهای‬
.‫ تعریف کردند‬،‫خوشه‌ها‬

Each of these selected indicators was used, one at a time, as input to the RBF model.
.‫ استفاده شد‬RBF ‫ به عنوان ورودی به مدل‬،‫ یکی در یک زمان‬،‫هر یک از این شاخص های انتخاب شده‬
The authors used min relative error, max relative error, and mean absolute percentage
error (MAPE) for performance measurement metrics.
‫) برای معیارهای سنجش‬MAPE( ‫ حداکثر خطای نسبی و میانگین درصد مطلق خطا‬،‫نویسندگان از حداقل خطای نسبی‬
.‫عملکرد استفاده کردند‬

In total, the authors developed four models with different inputs, three of them for each
set of selected indicators and another with the total data.
‫ سه مدل برای هر مجموعه از شاخص‌های‬،‫ نویسندگان چهار مدل را با ورودی‌های مختلف توسعه دادند‬،‫در مجموع‬
.‫انتخاب‌شده و دیگری با کل داده‌ها‬

Using only data from each indicator’s subset, the RBF model performed better than the
MLR model.
.‫ عمل کرد‬MLR ‫ بهتر از مدل‬RBF ‫ مدل‬،‫تنها با استفاده از داده های زیر مجموعه هر شاخص‬

On the contrary, the MLRM model performed better when using the total dataset as
input.
.‫ هنگام استفاده از کل مجموعه داده به عنوان ورودی بهتر عمل کرد‬MLRM ‫ مدل‬،‫برعکس‬

Overall, both models performed better when using only the data subset of the
indicators.
.‫ عملکرد بهتری داشتند‬،‫ هر دو مدل زمانی که فقط از زیرمجموعه داده های شاخص ها استفاده می کردند‬،‫به طور کلی‬

Harrou et al. [10] conducted a study to make short-term forecasts of energy


consumption in a WWTP, using statistical and Deep Learning (DL) models.
‫ با استفاده از‬WWTP ‫] مطالعه ای را برای پیش بینی های کوتاه مدت مصرف انرژی در یک‬10[ ‫هارو و همکاران‬
.‫) انجام داد‬DL( ‫مدل های آماری و یادگیری عمیق‬

The data used in this study are between 2010 and 2017, belonging to a WWTP in
Saudi Arabia.
‫ در عربستان سعودی‬WWTP ‫ متعلق به یک‬2017 ‫ و‬2010 ‫داده های مورد استفاده در این مطالعه بین سال های‬
.‫است‬

In total, the authors used six statistical models, such as the Auto-regressive Integrated
Moving Average (ARIMA) or the Ordinary Least Square (OLS).
‫) یا حداقل‬ARIMA( ‫ نویسندگان از شش مدل آماری مانند میانگین متحرک یکپارچه رگرسیون خودکار‬،‫در مجموع‬
.‫) استفاده کردند‬OLS( ‫مربع معمولی‬

Two types of networks were based on DL models, Long Short-Term Memory (LSTM)
and Gated Recurrent Units (GRU).
)GRU( ‫) و واحدهای بازگشتی دردار‬LSTM( ‫ حافظه کوتاه‌مدت بلند مدت‬،DL ‫دو نوع شبکه بر اساس مدل‌های‬
.‫بودند‬

The models conceived by the authors used a uni-variate approach, where only the
feature they intend to forecast, the energy consumption, is given as input to the
different candidate models.
‫ که در آن تنها ویژگی‌ای که آنها قصد‬،‫مدل‌های ابداع‌ شده توسط نویسندگان از یک رویکرد تک متغیره استفاده کردند‬
.‫ به عنوان ورودی به مدل‌های مختلف کاندید داده می‌شود‬،‫ یعنی مصرف انرژی‬،‫پیش‌بینی دارند‬

The data were normalised between 0 and 1 for all conceived models. There was no
particular attention to the case of LSTM networks working internally with a hyperbolic
tangent.
‫ که به صورت‬LSTM ‫ توجه خاصی به مورد شبکه های‬.‫ برای همه مدل های تصور شده نرمال شد‬1 ‫ و‬0 ‫داده ها بین‬
.‫داخلی با مماس هایپربولیک کار می کنند وجود نداشت‬

Throughout the manuscript, no cross-validation or overfitting control techniques are


mentioned in the conceived models.
.‫ هیچ تکنیک کنترل متقاطع یا تطبیق بیش از حد در مدل‌های طراحی شده ذکر نشده است‬،‫در سرتاسر نسخه خطی‬

Regarding the evaluation metrics of the models, the authors used four, i.e., MAPE,
Mean Absolute Error (MAE), Root Mean Square Error (RMSE), and Root Mean
Squared Log Error (RMSLE).
‫ میانگین خطای مطلق‬،MAPE ‫ یعنی‬،‫ نویسندگان از چهار معیار استفاده کردند‬،‫با توجه به معیارهای ارزیابی مدل‌ها‬
.)RMSLE( ‫ و ریشه میانگین مربعات خطای گزارش‬،)RMSE( ‫ ریشه میانگین مربعات خطا‬،)MAE(

By observing the obtained results, the authors verified that the statistical-based models
slightly outperformed the DL models, with ARIMA getting a MAPE of 2.29%, while the
best DL model, LSTMs, presented a MAPE of 2.42%.
‫ با‬،‫ هستند‬DL ‫ نویسندگان تأیید کردند که مدل‌های مبتنی بر آمار کمی بهتر از مدل‌های‬،‫با مشاهده نتایج به‌دست‌آمده‬
.‫ را ارائه کرد‬DL، LSTMs، MAPE 2.42٪ ‫ در حالی که بهترین مدل‬،ARIMA MAPE 2.29٪

The authors also verified that the models’ parameters were updated recursively, given
a better performance than the models with no updates.
‫نویسندگان همچنین تأیید کردند که پارامترهای مدل‌ها به صورت بازگشتی به‌روزرسانی می‌شوند و عملکرد بهتری نسبت‬
.‫به مدل‌های بدون به‌روزرسانی دارند‬

However, they concluded that the DL models could provide forecast results with more
significant performance when applying more data.
‫ می‌توانند نتایج پیش‌بینی را با عملکرد قابل توجه‌تری در هنگام‬DL ‫ آنها به این نتیجه رسیدند که مدل‌های‬،‫با این حال‬
.‫اعمال داده‌های بیشتر ارائه دهند‬

No reference was made regarding fitting times.


.‫هیچ اشاره ای در رابطه با زمان مناسب صورت نگرفت‬

The study carried out by Huang et al. [11] had as objective the construction of an
energy consumption model in a WWTP based on Elman Neural Network-Energy
Consumption Model (ENN-ECM) to identify the relationship between energy
consumption and the quality of the effluent.
‫ بر‬WWTP ‫] به عنوان هدف ساخت یک مدل مصرف انرژی در یک‬11[ .‫مطالعه انجام شده توسط هوانگ و همکاران‬
‫) برای شناسایی رابطه بین مصرف انرژی و کیفیت‬ENN-ECM( ‫مصرف انرژی‬-‫اساس مدل شبکه عصبی المان‬
.‫پساب بود‬

The benchmark simulation model (BSM1) was used to compare the authors’ model
results. Both models were based on data related to an activated sludge model, being
obtained from BSM1, which provided data for a period of two weeks in 15-minutes time
intervals.
‫ هر دو مدل بر اساس داده‌های مربوط‬.‫) استفاده شد‬BSM1( ‫برای مقایسه نتایج مدل نویسندگان از مدل شبیه‌سازی معیار‬
‫ دقیقه ارائه‬15 ‫ که داده‌ها را برای مدت دو هفته در فواصل زمانی‬،‫ به‌دست آمد‬BSM1 ‫به یک مدل لجن فعال بود که از‬
.‫می‌کرد‬
Firstly, the authors used the energy consumption model to verify which effluent
characteristics had a more significant relationship with the characteristics related to
energy consumption.
‫ نویسندگان از مدل مصرف انرژی برای تأیید اینکه کدام ویژگی پساب رابطه معنی‌داری با ویژگی‌های مربوط‬،‫در ابتدا‬
.‫ استفاده کردند‬،‫به مصرف انرژی دارد‬

Then, they implemented the ENN-ECM with five characteristics of the effluent obtained
from the energy consumption model to forecast four energy consumption parameters.
‫ را با پنج ویژگی پساب حاصل از مدل مصرف انرژی برای پیش‌بینی چهار پارامتر مصرف انرژی‬ENN-ECM ‫سپس‬
.‫پیاده‌سازی کردند‬

The network architecture, namely the number of layers, was obtained through
empirical formulas and the Kolmogorov theorem.
.‫ از طریق فرمول های تجربی و قضیه کولموگروف به دست آمد‬،‫ یعنی تعداد الیه ها‬،‫معماری شبکه‬

The authors concluded that the ENN-ECM model obtained better performance
concerning energy consumption with the analysis of the obtained results.
‫ عملکرد بهتری در مورد‬،‫ با تجزیه و تحلیل نتایج به‌دست‌آمده‬ENN-ECM ‫نویسندگان به این نتیجه رسیدند که مدل‬
.‫مصرف انرژی به دست آورد‬

Ramli et al. [12] conducted a study to forecast energy consumption in a WWTP in


Malaysia using an ARIMA model. To compare the obtained results, the authors used a
linear regression method.
‫ در مالزی با استفاده از مدل‬WWTP ‫] مطالعه ای را برای پیش بینی مصرف انرژی در یک‬12[ ‫رملی و همکاران‬
.‫ نویسندگان از روش رگرسیون خطی استفاده کردند‬،‫ برای مقایسه نتایج به دست آمده‬.‫ انجام داد‬ARIMA

The data used in this study were based on four years of active power in the WWTP. To
achieve the best ARIMA model, the authors used the Time Series Modeler,
incorporated in the SPSS software, obtaining the values (0, 1, 0) for ARIMA’s
parameters.
‫ برای دستیابی به بهترین مدل‬.‫ بود‬WWTP ‫داده های مورد استفاده در این مطالعه بر اساس چهار سال توان فعال در‬
‫ استفاده کردند و‬،‫ گنجانده شده است‬SPSS ‫ که در نرم افزار‬Time Series Modeler ‫ نویسندگان از‬،ARIMA
.‫ به دست آوردند‬ARIMA ‫) را برای پارامترهای‬0 ،1 ،0( ‫مقادیر‬
The results allowed the authors to verify that the ARIMA model obtained better
performance than the linear regression with an RMSE of 55.59, compared to 67.51,
respectively.
RMSE ‫ عملکرد بهتری نسبت به رگرسیون خطی با‬ARIMA ‫نتایج به نویسندگان اجازه داد تا تأیید کنند که مدل‬
.‫ به دست آورده است‬67.51 ‫ در مقایسه با‬55.59

The authors further concluded that it was possible to increase energy efficiency by
10% of energy recovery, which could reduce the cost of electricity in the studied
WWTP.
‫ درصد بازیافت انرژی امکان پذیر است که‬10 ‫نویسندگان همچنین به این نتیجه رسیدند که افزایش بهره وری انرژی تا‬
.‫ مورد مطالعه کاهش دهد‬WWTP ‫می تواند هزینه برق را در‬

Another study carried out by Maki et al. [13] aimed to forecast the total energy
consumption of a WWTP and the consumption in different processes, using a Markov
switching model.
‫ با هدف پیش‌بینی کل‬،‫] با استفاده از مدل سوئیچینگ مارکوف‬13[ .‫مطالعه دیگری که توسط مکی و همکاران انجام شد‬
.‫ و مصرف در فرآیندهای مختلف انجام شد‬WWTP ‫مصرف انرژی یک‬

The data were collected by applying several sensors connected to a WWTP energy
distribution network in Japan and transmitted over a 3G line.
‫ در ژاپن جمع آوری و از طریق یک خط‬WWTP ‫داده ها با استفاده از چندین حسگر متصل به شبکه توزیع انرژی‬
.‫ منتقل شدند‬3G

The data collection was carried out between March 2015, and March 2017, with a
1-min periodicity.
.‫ دقیقه ای انجام شد‬1 ‫ با تناوب‬2017 ‫ تا مارس‬2015 ‫جمع آوری داده ها بین مارس‬

The authors then grouped the data into an hourly periodicity. In addition to the forecast
of total energy consumption at the WWTP, the authors also forecast the energy
consumption in the water treatment, sludge treatment, and auxiliary facilities
processes.
‫ عالوه بر پیش‌بینی کل مصرف انرژی در‬.‫سپس نویسندگان داده ها را در یک دوره تناوب ساعتی گروه بندی کردند‬
.‫ تصفیه لجن و تأسیسات کمکی را نیز پیش‌بینی کردند‬،‫ نویسندگان مصرف انرژی در فرآیندهای تصفیه آب‬،WWTP
Additionally, as the sum of the three identified processes’ energy consumed did not
coincide with the total energy consumed in the WWTP, they made the forecast for the
remaining operations, marked as “others”.
‫ از آنجایی که مجموع انرژی مصرف شده سه فرآیند شناسایی شده با کل انرژی مصرف شده در‬،‫عالوه بر این‬
.‫ آنها پیش بینی عملیات باقی مانده را انجام دادند که به عنوان "دیگر" مشخص شده بودند‬،‫ منطبق نبود‬WWTP

An analysis was made of energy consumption over time, where it was possible to
verify that there is greater energy consumption in summer than winter.
‫ که در آن تأیید شد که مصرف انرژی در تابستان بیشتر از‬،‫تجزیه و تحلیلی از مصرف انرژی در طول زمان انجام شد‬
.‫زمستان است‬

In addition to the data collected by the sensors, the authors added six more features to
be used in the conceived model: holidays, office hours, temperature, humidity, wind
speed, and the previous five hours of energy consumption.
‫ نویسندگان شش ویژگی دیگر را برای استفاده در مدل مورد نظر‬،‫عالوه بر داده‌های جمع‌آوری‌شده توسط حسگرها‬
.‫ سرعت باد و مصرف انرژی در پنج ساعت قبلی‬،‫ رطوبت‬،‫ دما‬،‫ ساعات اداری‬،‫ تعطیالت‬:‫اضافه کردند‬

Only 1 week was considered as input. With the obtained results, the authors found
that, except for the sludge treatment and auxiliary facilities, the values were below
10%.
‫ نویسندگان دریافتند که به جز تصفیه لجن و‬،‫ با نتایج به‌دست‌آمده‬.‫ هفته به عنوان ورودی در نظر گرفته شد‬1 ‫فقط‬
.‫ درصد است‬10 ‫ مقادیر زیر‬،‫تأسیسات کمکی‬

Besides, the relationships between the variables that affect the energy consumption
forecast equation were verified in each process.
.‫ روابط بین متغیرهایی که بر معادله پیش‌بینی مصرف انرژی تأثیر می‌گذارند در هر فرآیند تأیید شد‬،‫عالوه بر این‬

The authors then concluded that an increase in the WWTP’s energy consumption,
together with the increase in seasonal temperatures, leads to a rise between 0.1% and
0.2% for each 1 ◦C in temperature.
‫ منجر به‬،‫ همراه با افزایش دمای فصلی‬،WWTP ‫سپس نویسندگان به این نتیجه رسیدند که افزایش مصرف انرژی‬
.‫ در دما می شود‬C◦1 ‫ برای هر‬٪0.2 ‫ و‬٪0.1 ‫افزایش بین‬
Oulebsir et al. [14] conducted a study where they conceived an Artificial Neural
Network (ANN) to create an energy consumption model in a WWTP using the active
sludge process.
‫) برای ایجاد یک مدل‬ANN( ‫] مطالعه ای را انجام دادند که در آن یک شبکه عصبی مصنوعی‬14[ ‫اولبسیر و همکاران‬
.‫ با استفاده از فرآیند لجن فعال طراحی کردند‬WWTP ‫مصرف انرژی در یک‬

The authors used data provided by a WWTP in Algeria between January 2006 and
March 2016.
.‫ استفاده کردند‬2016 ‫ تا مارس‬2006 ‫ در الجزایر بین ژانویه‬WWTP ‫نویسندگان از داده های ارائه شده توسط‬

In this study, the authors use four parameters: (1) the Biological Oxygen Demand
(BOD5), (2) the COD, (3) suspended solids and (4) ammonium.
)BOD5)، (2) COD، (3( ‫) نیاز بیولوژیکی اکسیژن‬1( :‫ نویسندگان از چهار پارامتر استفاده می‌کنند‬،‫در این مطالعه‬
.‫) آمونیوم‬4( ‫مواد جامد معلق و‬

In addition, they also use the water temperature, and flow of the influent, the flow of
recirculated sludge, and the total consumed energy.
‫ جریان لجن چرخشی و کل انرژی مصرف شده استفاده می‬،‫ آنها همچنین از دمای آب و جریان ورودی‬،‫عالوه بر این‬
.‫کنند‬

The authors applied a set of methods to clean the dataset, keeping 318 days of
observations even though the original dataset had 10 years of data.
‫ روز مشاهدات را حفظ‬318 ‫نویسندگان مجموعه‌ای از روش‌ها را برای تمیز کردن مجموعه داده‌ها به کار بردند و‬
.‫ سال داده بود‬10 ‫ حتی اگر مجموعه داده اصلی دارای‬،‫کردند‬

The different ANNs had six hidden layers with a total of 200 neurons each.
.‫ نورون بودند‬200 ‫شبکه های عصبی مصنوعی مختلف دارای شش الیه مخفی با مجموع‬

The architecture of the models was established using the trial-and-error method.
.‫معماری مدل ها با استفاده از روش آزمون و خطا ایجاد شد‬
In each conceived model, data were divided into 80% for training and 20% for testing,
without using a time series crossvalidator.
‫ بدون استفاده از اعتبارسنجی‬،‫ درصد برای آزمایش‬20 ‫ درصد برای آموزش و‬80 ‫ داده ها به‬،‫در هر مدل تصور شده‬
.‫متقاطع سری زمانی تقسیم شدند‬

The authors confirmed that the pollution load contributes more significantly to
forecasting energy consumption than the removal efficiency.
‫نویسندگان تأیید کردند که بار آلودگی به طور قابل توجهی در پیش بینی مصرف انرژی نسبت به راندمان حذف کمک‬
.‫می کند‬

The authors also applied the kmeans algorithm, observing three clusters.
‫ با مشاهده سه خوشه استفاده کردند‬kmeans ‫نویسندگان همچنین از الگوریتم‬

The authors were thus able to verify three classes of energy consumption:
under-consumption, over-consumption, and optimal consumption.
.‫ مصرف بیش از حد و مصرف بهینه‬،‫ کم مصرف‬:‫بنابراین نویسندگان توانستند سه دسته از مصرف انرژی را تأیید کنند‬

As an overall conclusion, it can be said that some studies have already considered the
use of DL models to forecast energy consumption in a WWTP.
‫ را برای پیش بینی‬DL ‫ می توان گفت که برخی از مطالعات قبالً استفاده از مدل های‬،‫به عنوان یک نتیجه گیری کلی‬
.‫ در نظر گرفته اند‬WWTP ‫مصرف انرژی در یک‬

Typically, studies follow a single-step approach, i.e., they only forecast consumption
value for the next day.
‫ یعنی فقط ارزش مصرف را برای روز بعد‬،‫ مطالعات از یک رویکرد تک مرحله ای پیروی می کنند‬،‫به طور معمول‬
.‫پیش بینی می کنند‬

Furthermore, it is usual to find studies that do not consider certain aspects of time
series problems, such as using an appropriate cross-validator, not breaking the time
series when removing missing values or missing timesteps, or even when searching
the best hyperparameters.
‫ مانند‬،‫ معموالً مطالعاتی یافت می‌شود که جنبه‌های خاصی از مسائل سری زمانی را در نظر نمی‌گیرند‬،‫عالوه بر این‬
‫ عدم شکستن سری‌های زمانی هنگام حذف مقادیر از دست رفته یا گام‌های زمانی‬،‫استفاده از اعتبارسنجی متقابل مناسب‬
.‫ یا حتی هنگام جستجوی بهترین هایپرپارامترها‬،‫از دست رفته‬
In addition, it is not easy to understand the existence of overfitting as learning curves
are not analysed.
.‫ درک وجود بیش از حد برازش آسان نیست زیرا منحنی های یادگیری تجزیه و تحلیل نمی شوند‬،‫عالوه بر این‬

All this may lead to significant problems when deploying the best candidate model in a
real-life scenario.
.‫همه اینها ممکن است در هنگام استقرار بهترین مدل کاندید در یک سناریوی واقعی منجر به مشکالت قابل توجهی شود‬

1.2. Goals, Research Questions, and Paper Structure


‫ سواالت تحقیق و ساختار مقاله‬،‫ اهداف‬.1.2

This work aims to conceive, tune, and evaluate a set of candidate DL models to
forecast energy consumption in a WWTP, going from recurrent to convolutional
candidates.
‫ کاندید برای پیش‌بینی مصرف انرژی در یک‬DL ‫ تنظیم و ارزیابی مجموعه‌ای از مدل‌های‬،‫هدف این کار تصور‬
.‫ است که از حالت تکراری به کاندیدای کانولوشنی می‌رود‬WWTP

In addition, the goal is to implement a recursive multi-step approach to forecast the


next two days, providing a stronger understanding of future patterns.
‫ هدف اجرای یک رویکرد چند مرحله ای بازگشتی برای پیش بینی دو روز آینده است که درک قوی تری‬،‫عالوه بر این‬
.‫از الگوهای آینده ارائه می دهد‬

We also aim to experiment two different methods for outliers’ handling and the
performance of the candidates in uniand multi-variate settings.
‫همچنین هدف ما آزمایش دو روش مختلف برای مدیریت پرت و عملکرد نامزدها در تنظیمات تک متغیره و چند متغیره‬
.‫است‬

Then, as last goal, we aim to evaluate the best candidate model in a WWTP with a low
volume of data.
.‫ با حجم کم داده است‬WWTP ‫ هدف ما ارزیابی بهترین مدل کاندید در یک‬،‫ به عنوان آخرین هدف‬،‫سپس‬

For that, we are required to apply transfer learning processes, overcoming the problem
of data scarcity.
.‫ ما باید فرآیندهای یادگیری انتقالی را اعمال کنیم و بر مشکل کمبود داده غلبه کنیم‬،‫برای آن‬
This study uses data provided by a Portuguese water company. The elicited goals can
be translated into the following research questions:
‫ اهداف استخراج شده را می توان به‬.‫این مطالعه از داده های ارائه شده توسط یک شرکت آب پرتغالی استفاده می کند‬
:‫سواالت تحقیق زیر ترجمه کرد‬

1. Do recurrent neural networks have a better performance when forecasting energy


consumption in a WWTP than convolutional ones?
‫ نسبت به شبکه های کانولوشن‬WWTP ‫ آیا شبکه های عصبی مکرر هنگام پیش بینی مصرف انرژی در یک‬.1
‫عملکرد بهتری دارند؟‬

2. Which features facilitate the process of forecasting energy consumption in a


WWTP?
‫ را تسهیل می کند؟‬WWTP ‫ کدام ویژگی فرآیند پیش بینی مصرف انرژی در یک‬.2

3. Is it possible to apply transfer learning processes, with the goal being to use a
pretrained model to forecast the energy consumption of a WWTP with low volumes of
data?
‫ آیا می توان فرآیندهای یادگیری انتقالی را با هدف استفاده از یک مدل از پیش آموزش دیده برای پیش بینی مصرف‬.3
‫ با حجم کم داده اعمال کرد؟‬WWTP ‫انرژی یک‬

The remainder of this manuscript is structured in three more sections.


.‫باقیمانده این نسخه در سه بخش دیگر تنظیم شده است‬

Section 2 describes the materials and methods, namely the collection, exploration, and
pre-processing of data, the developed DL models, and the conducted experiments.
‫ توسعه یافته و آزمایش های‬DL ‫ مدل های‬،‫ اکتشاف و پیش پردازش داده ها‬،‫ یعنی جمع آوری‬،‫ مواد و روش ها‬2 ‫بخش‬
.‫انجام شده را شرح می دهد‬

Section 3 is responsible for summarising the obtained results, as well as their


interpretation.
.‫ وظیفه جمع بندی نتایج به دست آمده و همچنین تفسیر آنها را بر عهده دارد‬3 ‫بخش‬

Finally, Section 4 discusses the obtained results and gathers the conclusions drawn
from this study
‫ نتایج به دست آمده را مورد بحث قرار می دهد و نتایج حاصل از این مطالعه را جمع آوری می کند‬4 ‫ بخش‬،‫در نهایت‬
2. Materials and Methods

The following lines describe the materials and methods used throughout this study,
including collecting, exploring, and treating data.
‫ و پردازش داده‌ها را شرح‬،‫ کاوش‬،‫ از جمله جمع‌آوری‬،‫خطوط زیر مواد و روش‌های مورد استفاده در این مطالعه‬
.‫می‌دهند‬

Additionally, the models used throughout the work are described, as well as the
evaluation metrics, the used technologies, and the designed experiments.
‫ فناوری‌های مورد استفاده و‬،‫ و همچنین معیارهای ارزیابی‬،‫ مدل‌های مورد استفاده در سراسر کار‬،‫عالوه بر این‬
.‫آزمایش‌های طراحی‌شده شرح داده شده‌اند‬

2.1. Dataset

The data used in this study took into account three different datasets.
.‫داده های مورد استفاده در این مطالعه سه مجموعه داده مختلف را در نظر گرفته است‬

Dataset one was related to energy consumption while the second dataset described
the volume of the flow of water at the entrance of a WWTP.
‫مجموعه داده یک مربوط به مصرف انرژی بود در حالی که مجموعه داده دوم حجم جریان آب را در ورودی یک‬
.‫ توصیف می کرد‬WWTP

The third dataset described the climatological conditions.


.‫مجموعه داده سوم شرایط اقلیمی را توصیف می کند‬

The first two datasets were made available by a Portuguese wastewater company and
were related to a single WWTP.
.‫ بود‬WWTP ‫دو مجموعه داده اول توسط یک شرکت فاضالب پرتغالی در دسترس قرار گرفت و مربوط به یک‬

Regarding the energy consumption value, which is the target feature, there is an
intrinsic relationship between the different processes present in a WWTP and the
required energy (typically, the larger the WWTP, the greater its energy consumption).
‫ یک رابطه ذاتی بین فرآیندهای مختلف موجود در یک‬،‫ که ویژگی هدف است‬،‫با توجه به مقدار مصرف انرژی‬
‫ مصرف انرژی آن نیز بیشتر‬،‫ بزرگتر باشد‬WWTP ‫ هر چه‬،‫ و انرژی مورد نیاز وجود دارد (معموال‬WWTP
.)‫است‬
However, this relation was captured and described in the time series in itself as the
values were a snapshot of the state of the WWTP.
WWTP ‫ این رابطه به خودی خود در سری زمانی ثبت و توصیف شد زیرا مقادیر تصویری از وضعیت‬،‫با این حال‬
.‫بودند‬

The third dataset was collected using the Open Weather Map API, and contains
climatological data regarding the same city where the WWTP was located.
‫ جمع‌آوری شد و حاوی داده‌های اقلیم‌شناسی مربوط به‬Open Weather Map API ‫مجموعه داده سوم با استفاده از‬
.‫ در آن قرار داشت‬WWTP ‫همان شهری است که‬

All datasets contained observations belonging to the period between January 2016 to
May 2020.
.‫ بودند‬2020 ‫ تا مه‬2016 ‫همه مجموعه داده ها شامل مشاهدات مربوط به دوره بین ژانویه‬

Figure 1 illustrates the WWTP layout used in this study. This WWTP was based on
four main stages:
:‫ بر اساس چهار مرحله اصلی بود‬WWTP ‫ این‬.‫ مورد استفاده در این مطالعه را نشان می دهد‬WWTP ‫ طرح‬1 ‫شکل‬

preliminary, primary, secondary and tertiary treatments. In addition, there was also a
line responsible for the sludge treatment.
.‫ یک خط نیز مسئول تصفیه لجن بود‬،‫ عالوه بر این‬.‫ ثانویه و ثالثیه‬،‫ اولیه‬،‫درمان های اولیه‬

The preliminary treatment, which included bar screening, was accountable for
removing solids and materials of greater volume, an essential step in the WWTP
process since some of these objects could damage some equipment in the following
steps.
‫ یک گام اساسی در فرآیند‬،‫ برای حذف جامدات و مواد با حجم بیشتر‬،‫ که شامل غربالگری میله‌ها بود‬،‫عملیات اولیه‬
.‫ زیرا برخی از این اشیاء می‌توانند در مراحل زیر به برخی تجهیزات آسیب برسانند‬،‫ بود‬WWTP

The primary treatment, which included the primary classifier, aimed to remove the
smaller volume solids, namely the suspended solids, from the previous stage and the
organic matter present.
‫ از مرحله قبل و‬،‫ یعنی جامدات معلق‬،‫ با هدف حذف جامدات با حجم کمتر‬،‫ که شامل طبقه‌بندی‌کننده اولیه بود‬،‫تیمار اولیه‬
.‫مواد آلی موجود انجام شد‬
In the secondary treatment, two processes were included, the aeration tank and the
secondary classifier.
.‫ مخزن هوادهی و طبقه‌بندی ثانویه گنجانده شد‬،‫ دو فرآیند‬،‫در تصفیه ثانویه‬

This stage aimed to remove biodegradable organic matter from wastewater, in addition
to suspended solids and nutrients, such as nitrogen.
‫ عالوه بر مواد جامد معلق و مواد مغذی مانند نیتروژن‬،‫هدف این مرحله حذف مواد آلی زیست تخریب پذیر از فاضالب‬
.‫بود‬

Finally, the tertiary treatment was responsible for removing the remaining suspended
solids resulting from the previous stages.
.‫ تیمار سوم وظیفه حذف جامدات معلق باقیمانده حاصل از مراحل قبلی را بر عهده داشت‬،‫در نهایت‬

The sludge produced in the primary and secondary treatment was inserted in the
sludge treatment line.
.‫لجن تولید شده در تیمار اولیه و ثانویه در خط تصفیه لجن وارد شد‬

This line was responsible for dewatering and disinfecting the sludge, reusing it as an
energy source.
.‫این خط وظیفه آبگیری و ضد عفونی لجن و استفاده مجدد از آن را به عنوان منبع انرژی بر عهده داشت‬
2.1.1. Data Exploration
‫ کاوش داده ها‬.2.1.1

The energy consumption dataset comprised two features: the energy consumption
value (in kWh) and the corresponding timestamp, making 1522 records with a daily
periodicity.
‫ مقدار مصرف انرژی (بر حسب کیلووات ساعت) و مهر زمانی‬:‫مجموعه داده مصرف انرژی شامل دو ویژگی است‬
.‫ رکورد را با تناوب روزانه ایجاد می کند‬1522 ‫ که‬،‫مربوطه‬

The influent flow dataset also contained two features, i.e., the value of the influent flow
(in m3 ) and the timestamp, with a total of 1535 records, again with a daily periodicity.
‫ یعنی مقدار جریان ورودی (بر حسب متر مکعب) و مهر‬،‫مجموعه داده جریان ورودی همچنین شامل دو ویژگی بود‬
.‫ دوباره با تناوب روزانه‬،‫ رکورد‬1535 ‫ با مجموع‬،‫زمانی‬
Finally, the climatological dataset had a total of 25 features, including the timestamp,
air temperature, and humidity, among others, with a total of 38,651 hourly timesteps.
‫ و‬،‫ دمای هوا‬،‫ از جمله مهر زمانی‬،‫ ویژگی بود‬25 ‫ مجموعه داده های اقلیم شناسی در مجموع دارای‬،‫در نهایت‬
.‫ گام زمانی ساعتی‬38651 ‫ و در مجموع‬،‫رطوبت‬

Table 1 presents the different features available in the three datasets, detailing its
characteristics and presenting the corresponding units of measure.
‫ ویژگی های آن را با جزئیات و واحدهای‬،‫ ویژگی های مختلف موجود در سه مجموعه داده را نشان می دهد‬1 ‫جدول‬
.‫اندازه گیری مربوطه را ارائه می دهد‬

None of the three datasets had missing values.


.‫هیچ یک از سه مجموعه داده دارای مقادیر گم نشده بودند‬

However, as in its genesis the problem identified in this study was based on a time
series problem, it was essential to pay attention to missing timesteps.
‫ توجه به‬،‫ از آنجایی که در پیدایش مشکل شناسایی شده در این مطالعه مبتنی بر یک مسئله سری زمانی بود‬،‫با این حال‬
.‫گام‌های زمانی از دست رفته ضروری بود‬

In the case of the climatological dataset, there were no missing timesteps.


.‫ هیچ مرحله زمانی گم نشده ای وجود نداشت‬،‫در مورد مجموعه داده اقلیمی‬

On the contrary, both the energy consumption and the influent inflow datasets
contained missing timesteps.
.‫ هر دو مجموعه داده مصرف انرژی و جریان ورودی دارای مراحل زمانی گمشده بودند‬،‫در مقابل‬

In the former, there were 88 missing timesteps, while in the latter 75 missing timesteps
were identified.
.‫ گام زمانی گم شده شناسایی شد‬75 ‫ گام زمانی مفقود وجود داشت در حالی که در دومی‬88 ‫در اولی‬

In a subsequent section, it is explained how to overcome the missing timesteps


problem.
.‫در بخش بعدی نحوه غلبه بر مشکل گام های از دست رفته توضیح داده شده است‬
As the main goal of this study was to forecast energy consumption, data exploration
emphasized the value_energy feature of the energy consumption dataset.
‫ اکتشاف داده بر ویژگی ارزش انرژی مجموعه داده‬،‫از آنجایی که هدف اصلی این مطالعه پیش‌بینی مصرف انرژی بود‬
.‫مصرف انرژی تأکید کرد‬

Firstly, it is worth mentioning that this feature presented an accumulated value. Hence,
it was necessary to subtract, from each observation, the value of the previous one, in
order to obtain its real value.
‫ مقدار‬،‫ الزم بود از هر مشاهده‬،‫ از این رو‬.‫ شایان ذکر است که این ویژگی یک مقدار انباشته ارائه می دهد‬،‫در ابتدا‬
.‫مشاهده قبلی کم شود تا مقدار واقعی آن به دست آید‬

Since the first observation had no previous one, it was removed.


.‫ حذف شد‬،‫از آنجایی که اولین مشاهده قبلی نداشت‬

A box plot analysis allowed us to identify the existence of some extreme outliers that
were derived from an incorrect insertion of values by the operators of the WWTP.
‫تجزیه و تحلیل نمودار جعبه به ما اجازه داد تا وجود برخی نقاط پرت شدید را که از درج نادرست مقادیر توسط‬
.‫ شناسایی کنیم‬،‫ مشتق شده بودند‬WWTP ‫اپراتورهای‬

A statistical analysis of the energy consumption values was performed, being


described in Table 2.
.‫ توضیح داده شده است‬2 ‫تجزیه و تحلیل آماری مقادیر مصرف انرژی انجام شد که در جدول‬

It was possible to verify that the mean energy consumption value in the dataset
presents a value of 8050.96 kWh, with a standard deviation of 3736.359 kWh. The
skewness was 3.172, representing an asymmetric distribution, i.e.,
‫ کیلووات ساعت را با انحراف استاندارد‬8050.96 ‫ مقدار‬،‫بررسی اینکه میانگین مقدار مصرف انرژی در مجموعه داده‬
‫ به‬،‫ بود که نشان دهنده یک توزیع نامتقارن است‬3.172 ‫ چولگی‬.‫ ممکن بود‬،‫ کیلووات ساعت ارائه می‌کند‬3736.359
،‫عنوان مثال‬
the positive value indicates a positive inclination in the distribution of the data, in which
the tail size of the right hand is larger than that of the left.
.‫مقدار مثبت نشان دهنده تمایل مثبت در توزیع داده ها است که در آن اندازه دم دست راست بزرگتر از دست چپ است‬

Regarding the kurtosis value, it was 28.101. A kurtosis value greater than 1 indicates
that the distribution of energy consumption has a very high peak (a leptokurtic
distribution).
‫ نشان می دهد که توزیع مصرف انرژی دارای پیک‬1 ‫ مقدار کشیدگی بزرگتر از‬.‫ بود‬28.101 ،‫با توجه به مقدار کشش‬
.)‫بسیار باالیی است (یک توزیع لپتوکورتیک‬

We then explored the energy consumption over the months of a year, during the 5
years present in the dataset.
.‫ سال موجود در مجموعه داده بررسی کردیم‬5 ‫ در طول‬،‫سپس مصرف انرژی را در طی ماه‌های یک سال‬

In Figure 2 it is possible to verify a pattern in all the explored years, with a constant
drop in energy consumption between July and August.
،‫ با کاهش مداوم مصرف انرژی بین جوالی و آگوست‬،‫ می توان یک الگو را در تمام سال های کاوش شده‬2 ‫در شکل‬
.‫تأیید کرد‬

Another analysis took into account the variation in energy consumption over the
different days of the week.
.‫تحلیل دیگری تغییر در مصرف انرژی در روزهای مختلف هفته را در نظر گرفت‬

This analysis was based on the mean value of the days of the week for each year.
.‫این تجزیه و تحلیل بر اساس مقدار میانگین روزهای هفته برای هر سال بود‬

As shown in Figure 3, it is possible to verify that Sunday and Monday were the days
when there was less energy consumption in the WWTP.
‫ می توان تأیید کرد که یکشنبه و دوشنبه روزهایی هستند که مصرف‬،‫ نشان داده شده است‬3 ‫همانطور که در شکل‬
.‫ وجود دارد‬WWTP ‫انرژی کمتری در‬

In conclusion, it appears that the traditional working days had a higher energy
consumption on average, while on weekends there was a decrease.
‫در نتیجه به نظر می رسد که روزهای کاری سنتی به طور میانگین مصرف انرژی باالتری داشته و در آخر هفته ها‬
.‫کاهش داشته است‬

To understand seasonality, we performed two different analyses on the energy


consumption data between 2016 and 2019:
‫ انجام‬2019 ‫ و‬2016 ‫ ما دو تجزیه و تحلیل مختلف را روی داده‌های مصرف انرژی بین سال‌های‬،‫برای درک فصلی‬
:‫دادیم‬

the first relative to the average consumption by season and the second related to the
energy consumption per trimester.
.‫اولی نسبت به میانگین مصرف فصلی و دومی مربوط به مصرف انرژی در هر سه ماهه است‬

Figure 4 depicts the first analysis, being possible to verify that, typically, more energy
was consumed during the autumn.
.‫ که می توان تأیید کرد که معموالً انرژی بیشتری در طول پاییز مصرف می شود‬،‫ اولین تحلیل را نشان می دهد‬4 ‫شکل‬

Interestingly, in 2019, autumn was the season with the lowest average energy
consumption value. In general, it was also possible to see that over the years, energy
consumption was rising in different seasons.
‫ به طور کلی همچنین‬.‫ پاییز فصلی بود که کمترین میانگین مصرف انرژی را داشت‬،2019 ‫جالب اینجاست که در سال‬
.‫ مصرف انرژی در فصول مختلف در حال افزایش است‬،‫می توان مشاهده کرد که در طول سال ها‬

Despite a higher number of average consumption values, it was not in the autumn that
the highest average peak was reached, but in the spring of 2019 with a value of
10,912 kWh. Regarding the lowest peak, it occurred in the winter of 2016, with a value
of 4398 kWh.
2019 ‫ بلکه در بهار سال‬،‫ باالترین پیک میانگین مصرف در پاییز نبود‬،‫علیرغم افزایش تعداد مقادیر میانگین مصرف‬
‫ کیلووات ساعت رخ‬4398 ‫ با مقدار‬1395 ‫ در زمستان‬،‫ از نظر کمترین پیک‬.‫ کیلووات ساعت بود‬10912 ‫با مقدار‬
.‫داد‬

Additionally, it was possible to verify that, in general, winter was the season with less
consumption of energy.
.‫ زمستان فصلی با مصرف کمتر انرژی است‬،‫ می توان تأیید کرد که به طور کلی‬،‫عالوه بر این‬
The trimesters analysis showed that the fourth trimester had the highest energy
consumption values over the first three years.
.‫تجزیه و تحلیل سه ماهه نشان داد که سه ماهه چهارم باالترین مقادیر مصرف انرژی را در سه سال اول دارد‬

Despite this, the highest value was verified in the second trimester of 2019, with
11,072 kWh.
.‫ کیلووات ساعت تأیید شد‬11072 ‫ با‬2019 ‫ باالترین مقدار در سه ماهه دوم سال‬،‫با وجود این‬

As demonstrated in the seasons’ analysis, in general, the average values increased


during the first three years.
.‫ مقادیر میانگین در طول سه سال اول افزایش یافت‬،‫ به طور کلی‬،‫همانطور که در تجزیه و تحلیل فصول نشان داده شد‬

In 2019, there was an increase in the first and second trimester and a decrease in the
third and fourth ones.
.‫ در سه ماهه اول و دوم افزایش و در سه ماهه سوم و چهارم کاهش داشته است‬2019 ‫در سال‬

Regarding the influent flow, an analysis was carried out considering the average for
each year, described in Table 3. As can be seen, 2019 was the year with the highest
volume of influent flow on the WWTP (1155.33 m3 ).
.‫ شرح داده شده است‬3 ‫ تحلیلی با در نظر گرفتن میانگین هر سال انجام شد که در جدول‬،‫با توجه به جریان ورودی‬
)‫ متر مکعب‬WWTP (1155.33 ‫ سال با بیشترین حجم جریان ورودی در‬2019 ‫ سال‬،‫همانطور که مشاهده می شود‬
.‫بود‬

Interestingly, checking the year of 2019 concerning the energy consumption (Figure 2),
we verified that this year also obtained, in general, the highest average of energy.
‫ تأیید کردیم که امسال نیز به طور کلی‬،)2 ‫ در مورد مصرف انرژی (شکل‬2019 ‫جالب اینجاست که با بررسی سال‬
.‫باالترین میانگین انرژی را به دست آوردیم‬

On the other hand, looking at 2016, excluding the incomplete year of 2020, this was
where the lowest average influent flow value occurred, this being, in general, the year
with the lowest energy consumption value.
‫از سوی دیگر‪ ،‬با نگاهی به سال ‪ ،2016‬بدون احتساب سال ناقص ‪ ،2020‬این جایی بود که کمترین مقدار متوسط‬
‫جریان ورودی رخ داد‪ ،‬به طور کلی‪ ،‬این سال با کمترین مقدار مصرف انرژی است‪.‬‬

‫‪2.1.2. Data Preparation‬‬


‫‪ .2.1.2‬آماده سازی داده ها‬

‫‪The first step to prepare the data were to carry out a feature engineering process in‬‬
‫‪the three datasets, thus creating three new features from the timestamps (i.e., year,‬‬
‫‪month, and day).‬‬
‫اولین گام برای آماده سازی داده ها‪ ،‬انجام یک فرآیند مهندسی ویژگی در سه مجموعه داده بود‪ ،‬بنابراین سه ویژگی جدید‬
‫از مهرهای زمانی (یعنی سال‪ ،‬ماه و روز) ایجاد کرد‪.‬‬

‫‪The dataset related to climatological data, as mentioned, had an hourly periodicity, so‬‬
‫‪to match the same periodicity as the other datasets, these were grouped by day,‬‬
‫‪month and year, aggregating the mean value per feature.‬‬
‫مجموعه داده‌های مربوط به داده‌های اقلیم‌شناسی‪ ،‬همانطور که ذکر شد‪ ،‬دارای تناوب ساعتی بودند‪ ،‬بنابراین برای‬
‫مطابقت با تناوب مشابه سایر مجموعه‌های داده‪ ،‬این داده‌ها بر اساس روز‪ ،‬ماه و سال گروه‌بندی شدند و میانگین مقدار‬
‫هر ویژگی را جمع‌آوری کردند‪.‬‬

‫‪As referred above, as both the energy consumption and influent flow datasets‬‬
‫‪presented accumulated values, a method was applied to obtain the value that would‬‬
‫‪correspond to each specific day.‬‬
‫همانطور که در باال ذکر شد‪ ،‬از آنجایی که مجموعه داده های مصرف انرژی و جریان ورودی مقادیر انباشته شده را‬
‫ارائه می دهند‪ ،‬روشی برای به دست آوردن مقداری که با هر روز خاص مطابقت دارد به کار گرفته شد‪.‬‬

‫‪The identified extreme outliers, which corresponded to miss insertions of values by the‬‬
‫‪operators of the WWTP (for example, extra digits), were also solved. The remainder of‬‬
‫‪the data treatment is specified in the following lines.‬‬
‫نقاط پرت شدید شناسایی شده‪ ،‬که مربوط به درج مقادیر از دست رفته توسط اپراتورهای ‪( WWTP‬به عنوان مثال‪،‬‬
‫ارقام اضافی)‪ ،‬نیز حل شد‪ .‬بقیه درمان داده ها در خطوط زیر مشخص شده است‪.‬‬
Handling Missing Timesteps
‫رسیدگی به گام های از دست رفته‬

To deal with the missing timesteps verified in the energy consumption and the influent
flow datasets, a dataset was created comprising all days (i.e., timesteps) that should
have been present in the dataset.
‫ مجموعه داده‌ای‬،‫برای مقابله با گام‌های از دست رفته تأیید شده در مصرف انرژی و مجموعه داده‌های جریان تأثیرگذار‬
.‫ مراحل زمانی) است که باید در مجموعه داده وجود داشته باشد‬،‫ایجاد شد که شامل تمام روزها (به عنوان مثال‬

In both cases, the start date was 2nd January 2016 and the end date 28 May 2020.
.‫ بود‬2020 ‫ مه‬28 ‫ و تاریخ پایان‬2016 ‫ ژانویه‬2 ‫ تاریخ شروع‬،‫در هر دو مورد‬

The datasets were joined, with missing timesteps being added and having its features
filled with the −99 value.
.‫ پر شدند‬99- ‫مجموعه داده‌ها با گام‌های زمانی مفقود اضافه شدند و ویژگی‌های آن با مقدار‬

Solving the missing timesteps problem created a new one, missing values, i.e.,
timesteps that were missing were now present but all their features had the −99 value.
‫ یعنی گام‌های زمانی که گم شده بودند اکنون‬،‫ مقادیر گمشده‬،‫ مسئله جدیدی ایجاد کرد‬،‫حل مسئله گام‌های زمانی گمشده‬
.‫ بودند‬99- ‫ اما همه ویژگی‌های آن‌ها دارای مقدار‬،‫وجود داشتند‬

Handling Missing Values


‫مدیریت ارزش های گمشده‬

To fill the missing values, a queue-based approach was followed.


.‫ یک رویکرد مبتنی بر صف دنبال شد‬،‫برای پر کردن مقادیر از دست رفته‬

Each record was read for each of the two datasets with missing values, saving its
value (energy consumption or influent flow) in the mentioned structure, with a
maximum size of eight values.
‫ با صرفه جویی در مقدار آن (مصرف انرژی یا جریان‬،‫هر رکورد برای هر یک از دو مجموعه داده با مقادیر گمشده‬
.‫ حداکثر با اندازه هشت مقدار خوانده شد‬،‫ورودی) در ساختار ذکر شده‬
Whenever reading a record, if the queue was full, a push operation would be
performed at the beginning of the queue.
.‫ در ابتدای صف عملیات فشار انجام می‌شد‬،‫ اگر صف پر بود‬،‫هر زمان که یک رکورد را می‌خوانید‬

When a timestep had a feature with the −99 value, its value would be computed based
on the average of the last eight records, i.e., the previous 8 days, present in the queue.
،‫ روز قبل‬8 ‫ یعنی‬،‫ مقدار آن بر اساس میانگین هشت رکورد آخر‬،‫ بود‬99- ‫وقتی یک گام زمانی دارای ویژگی با مقدار‬
.‫در صف محاسبه می‌شود‬

Once calculated, this value would then be pushed to the queue, eliminating the oldest
record. By the end of this process, no dataset had missing values neither missing
timesteps.
‫ هیچ‬،‫ در پایان این فرآیند‬.‫ این مقدار به صف کشیده می شود و قدیمی ترین رکورد حذف می شود‬،‫پس از محاسبه‬
.‫مجموعه داده ای دارای مقادیر از دست رفته و مراحل زمانی نبود‬

Joining Datasets

When reaching this point, each one of the three datasets was made of 1609
observations.
.‫ مشاهده ساخته شد‬1609 ‫ هر یک از سه مجموعه داده از‬،‫با رسیدن به این نقطه‬

However, we were required to join the three datasets into a single one. This was
performed using the features year, month, and day.
‫ این با استفاده از ویژگی های‬.‫ از ما خواسته شد که سه مجموعه داده را به یک مجموعه واحد ملحق کنیم‬،‫با این حال‬
.‫ ماه و روز انجام شد‬،‫سال‬

In the end, a single dataset was created, having 1609 observations with 30 features
each.
.‫ ویژگی ایجاد شد‬30 ‫ مشاهده با‬1609 ‫ یک مجموعه داده منفرد با‬،‫در پایان‬
Correlation Analysis
‫تجزیه و تحلیل همبستگی‬

To verify which features had a more significant correlation with the target feature
(value_energy), it was first necessary to check whether the data followed a normal
distribution.
‫ ابتدا الزم بود بررسی شود‬،‫برای بررسی اینکه کدام ویژگی با ویژگی هدف (ارزش_انرژی) همبستگی معنی‌داری دارند‬
.‫که آیا داده‌ها از توزیع نرمال پیروی می‌کنند یا خیر‬

Using a p < 0.05 and the Kolmogorov–Smirnov test, it was possible to verify that all
features assumed a non-Gaussian distribution.
.‫ می‌توان تأیید کرد که همه ویژگی‌ها توزیع غیر گاوسی دارند‬،‫اسمیرنوف‬-‫ و آزمون کولموگروف‬p <0.05 ‫با استفاده از‬

Hence, it was necessary to use the non-parametric Spearman’s rank correlation


coefficient, being possible to verify that the features that had a more significant
correlation with the target were the year, month, temperature, and flow_value. Since
the other features had a low correlation with the target, they were removed.
‫ الزم بود از ضریب همبستگی رتبه ناپارامتری اسپیرمن استفاده شود تا بتوان بررسی کرد که ویژگی هایی‬،‫از این رو‬
‫ از آنجایی که سایر ویژگی ها همبستگی‬.‫ دما و مقدار جریان هستند‬،‫ ماه‬،‫ سال‬،‫که همبستگی معنی داری با هدف داشتند‬
.‫ حذف شدند‬،‫کمی با هدف داشتند‬

After this treatment, the final dataset had 1609 observations with a shape (1609, 5).
Table 4 shows an example of a record in the final dataset.
‫ نمونه ای از یک‬4 ‫ جدول‬.)5 ،1609( ‫ مشاهده با یک شکل داشت‬1609 ‫ مجموعه داده نهایی‬،‫پس از این درمان‬
.‫رکورد در مجموعه داده نهایی را نشان می دهد‬

Handling Outliers
‫رسیدگی به موارد پرت‬

Extreme outliers were above 14,000 kWh. Only six observations were below 2000
kWh.
.‫ کیلووات ساعت بود‬2000 ‫ تنها شش مشاهده زیر‬.‫ کیلووات ساعت بود‬14000 ‫نقاط پرت شدید باالی‬
Since the range between the maximum and minimum values for the feature
value_energy was large, and considering the reduced amount of observations that
were causing it, two different methods were experimented to handle outliers.
‫ و با توجه به کاهش میزان‬،‫ زیاد بود‬value_energy ‫از آنجایی که محدوده بین حداکثر و حداقل مقادیر برای ویژگی‬
.‫ دو روش مختلف برای رسیدگی به موارد پرت آزمایش شدند‬،‫مشاهداتی که باعث آن می‌شدند‬

These two methods provided a comparative term for the different experiments, causing
slight modifications to the input data that were fed to the models.
‫این دو روش یک اصطالح مقایسه‌ای برای آزمایش‌های مختلف ارائه کردند که باعث تغییرات جزئی در داده‌های ورودی‬
.‫که به مدل‌ها داده می‌شدند‬
The two methods were as follows:
:‫دو روش به شرح زیر بود‬

• Method 1—to further reduce the amplitude of the target feature, the few timesteps
with value_energy greater than 10,000 kWh or lower than 2000 kWh had their value
updated, using the queue-based approach described above.
‫ کیلووات ساعت‬10000 ‫ چند گام زمانی با ارزش_انرژی بیشتر از‬،‫ برای کاهش بیشتر دامنه ویژگی هدف‬-1 ‫• روش‬
‫ ارزش خود را به‬،‫ کیلووات ساعت با استفاده از رویکرد مبتنی بر صف که در باال توضیح داده شد‬2000 ‫یا کمتر از‬
.‫روز کردند‬
The goal was to use interpolation to replace the outliers;
.‫هدف استفاده از درون یابی برای جایگزینی نقاط پرت بود‬

• Method 2—to further reduce the amplitude of the target feature, the few timesteps
with value_energy greater than 10,000 kWh or lower than 2000 kWh had their value
truncated.
‫ کیلووات ساعت‬10000 ‫ چند مرحله زمانی با ارزش انرژی بیشتر از‬،‫ برای کاهش بیشتر دامنه ویژگی هدف‬-2 ‫روش‬
.‫ کیلووات ساعت مقدار آنها کوتاه شد‬2000 ‫یا کمتر از‬
The goal was not to use interpolation to update the target value.
.‫هدف استفاده از درون یابی برای به روز رسانی مقدار هدف نبود‬

Normalisation
With the data prepared, the next step was to normalize them. Since LSTMs work
internally with the hyperbolic tangent, we decided that the applied normalization would
be in the range [−1, 1], according to the following equation:
‫عادی سازی‬
‫ها به صورت داخلی با مماس هذلولی ‪ LSTM‬با داده های آماده شده‪ ،‬گام بعدی عادی سازی آنها بود‪ .‬از آنجایی که‬
‫‪:‬کار می کنند‪ ،‬ما تصمیم گرفتیم که نرمال سازی اعمال شده مطابق با معادله زیر در محدوده [‪ ]1 ,1-‬باشد‬

‫‪Supervised Problem‬‬
‫مشکل نظارت شده‬

‫‪The final step was to go from an unsupervised problem to a supervised one, with the‬‬
‫‪respective inputs (X) and corresponding labels (y).‬‬
‫مرحله آخر این بود که از یک مشکل بدون نظارت به یک مشکل نظارت شده با ورودی های مربوطه (‪ )X‬و برچسب‬
‫های مربوطه (‪ )y‬برویم‪.‬‬

‫‪Thus, it was necessary to create sequences of data, which depend on the number of‬‬
‫‪timesteps used as input for the models.‬‬
‫بنابراین‪ ،‬الزم بود توالی‌هایی از داده‌ها ایجاد شوند که به تعداد گام‌های زمانی مورد استفاده به عنوان ورودی برای‬
‫مدل‌ها بستگی دارد‪.‬‬

‫‪A sliding window was used over the initial dataset to create the different sequences‬‬
‫‪and the respective labels, thus creating a set of sequences that can be fed to the‬‬
‫‪models.‬‬
‫یک پنجره کشویی روی مجموعه داده اولیه برای ایجاد توالی‌های مختلف و برچسب‌های مربوطه استفاده شد‪ ،‬بنابراین‬
‫مجموعه‌ای از توالی‌ها را ایجاد کرد که می‌توانند به مدل‌ها داده شوند‪.‬‬

‫‪As an example, if the shape of a model’s input was (1601, 7, 5), the first element set‬‬
‫‪the number of samples, the second the number of input timesteps, and the last the‬‬
‫‪number of features.‬‬
‫به عنوان مثال‪ ،‬اگر شکل ورودی یک مدل (‪ )5 ،7 ،1601‬بود‪ ،‬اولین عنصر تعداد نمونه ها‪ ،‬عنصر دوم تعداد مراحل‬
‫زمانی ورودی و آخرین عنصر تعداد ویژگی ها را تعیین می کند‪.‬‬

‫‪In this example, the labels would have the shape (1601, 1). A similar algorithm can be‬‬
‫‪seen in the work of Fernandes et al. [15].‬‬
‫در این مثال‪ ،‬برچسب ها دارای شکل (‪ )1 ،1601‬خواهند بود‪ .‬الگوریتم مشابهی را می توان در کار فرناندز و‬
‫همکاران مشاهده کرد‪.]15[ .‬‬

‫‪2.2. Model Conception‬‬


‫‪ .2.2‬مفهوم مدل‬
To achieve the objective of forecasting energy consumption in a WWTP, three different
DL models were conceived and evaluated, namely LSTMs, GRUs, and
uni-dimensional Convolutional Neural Networks (CNNs).
‫ و‬LSTMs، GRUs ‫ یعنی‬،‫ مختلف‬DL ‫ سه مدل‬،WWTP ‫برای دستیابی به هدف پیش‌بینی مصرف انرژی در یک‬
.‫) طراحی و ارزیابی شدند‬CNN( ‫شبکه‌های عصبی کانولوشنال تک بعدی‬

Regarding the choice of models, concerning the LSTM and GRU models, these were
selected since they belong to the set of Recurrent Neural Networks (RNNs), which has
shown an outstanding performance in time series problems.
‫ این مدل‌ها از آنجایی انتخاب شدند که به مجموعه‬،GRU ‫ و‬LSTM ‫ با توجه به مدل‌های‬،‫با توجه به انتخاب مدل‌ها‬
.‫ که عملکرد فوق‌العاده‌ای در مسائل سری زمانی نشان داده‌اند‬،‫) تعلق دارند‬RNNs( ‫شبکه‌های عصبی بازگشتی‬

While traditional ANNs cannot remember what they learned in previous iterations,
RNNs can learn from earlier timesteps [16–19]. Regarding the choice of CNNs as the
third model to be used, despite its greater use in image processing, it has shown
promising results in terms of time series problems when using uni-dimensional
convolutions [20–23].
‫ ها می‬RNN ،‫ های سنتی نمی توانند آنچه را که در تکرارهای قبلی آموخته اند به خاطر بیاورند‬ANN ‫در حالی که‬
،‫ ها به عنوان سومین مدل مورد استفاده‬CNN ‫ با توجه به انتخاب‬.]19-16[ ‫توانند از مراحل زمانی قبلی بیاموزند‬
‫ نتایج امیدوارکننده ای را از نظر مشکالت سری زمانی در هنگام‬،‫علیرغم استفاده بیشتر از آن در پردازش تصویر‬
.]23-20[ ‫استفاده از کانولوشن های تک بعدی نشان داده است‬

To find the best combination of hyperparameters, two error metrics were used. The
RMSE is an error measure, as it measures the difference between the values
predicted by the model (yˆ) and the true values observed (y).
‫ زیرا تفاوت‬،‫ یک اندازه گیری خطا است‬RMSE .‫ از دو معیار خطا استفاده شد‬،‫برای یافتن بهترین ترکیب ابرپارامترها‬
.‫) را اندازه می گیرد‬y( ‫ˆ) و مقادیر واقعی مشاهده شده‬y( ‫بین مقادیر پیش بینی شده توسط مدل‬
RMSE equation is as follows:
:‫ به صورت زیر است‬RMSE ‫معادله‬

The second metric, the MAE, is the mean of the differences between predicted and
observed values.
.‫ میانگین تفاوت بین مقادیر پیش بینی شده و مشاهده شده است‬،MAE ،‫معیار دوم‬
Its use is mainly to complement and strengthen the confidence on the obtained values.
Its equation is as follows:
:‫ معادله آن به صورت زیر است‬.‫کاربرد آن عمدتا ً برای تکمیل و تقویت اعتماد به مقادیر به دست آمده است‬

2.2.1. LSTMs p11

You might also like