An Intelligent Weather Station

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

Article

An Intelligent Weather Station


Gonçalo Mestre 1,† , Antonio Ruano 2,3, *,† , Helder Duarte 2,† , Sergio Silva 1,† ,
Hamid Khosravani 2 , Shabnam Pesteh 2 , Pedro M. Ferreira 4,† and Ricardo Horta 5
Received: 20 October 2015; Accepted: 25 November 2015; Published: 10 December 2015
Academic Editor: Leonhard M. Reindl
1 EasySensing—Intelligent Systems, Centro Empresarial de Gambelas, Pav A5, Campus de Gambelas,
University of Algarve, 8005-139 Faro, Portugal; [email protected] (G.M.);
[email protected] (S.S.)
2 Faculty of Science and Technology, Campus de Gambelas, University of Algarve, 8005-139 Faro, Portugal;
[email protected] (H.D.); [email protected] (H.K.); [email protected] (S.P.)
3 Centre for Intelligent Systems, IDMEC, Instituto Superior Técnico, 1049-001 Lisboa, Portugal
4 LaSIGE, Faculdade de Ciências, Universidade de Lisboa, Portugal; [email protected]
5 Rolear SA, 8001-906 Faro, Portugal; [email protected]
* Correspondence: [email protected]; Tel.: +351-289-800-999; Fax: +351-289-800-066
† These authors contributed equally to this work.

Abstract: Accurate measurements of global solar radiation, atmospheric temperature and relative
humidity, as well as the availability of the predictions of their evolution over time, are important
for different areas of applications, such as agriculture, renewable energy and energy management,
or thermal comfort in buildings. For this reason, an intelligent, light-weight, self-powered and
portable sensor was developed, using a nearest-neighbors (NEN) algorithm and artificial neural
network (ANN) models as the time-series predictor mechanisms. The hardware and software design
of the implemented prototype are described, as well as the forecasting performance related to the
three atmospheric variables, using both approaches, over a prediction horizon of 48-steps-ahead.

Keywords: weather station; self-powered device; neural networks; prediction; wireless


communications; MOGA design

1. Introduction
There are a number of different weather stations available in the market. They provide
measurements of atmospheric parameters such as solar radiation, air temperature and relative
humidity, wind velocity and direction, atmospheric pressure and rainfall, the first three variables being
the most common.
The atmospheric variables are measured by sensors that usually are connected to a data logger.
These are powered by an external power supply, internal or external depending on the data logger.
To avoid blackouts, some weather stations include a small size battery. One important point is that
the conventional data loggers have a very limited storage size, and, in the case of a power shortage,
they can lose some of their data. A conventional data logger is a passive device, meaning that they do
not allow the addition of external routines and/or the reprogramming of the devices, with the objective
of including control actions and prediction. Same data loggers are incorporated with programming
options to change the acquisition parameters and the data availability.
With the evolution of technology, a few weather stations have a wireless interface integrated
or offer it as an optional part. This wireless part typically uses the IEEE 802.11 or the IEEE 802.15.4
standards for communication. The ones that originally do not have the option to perform wireless data
communication can be attached to a device that converts the data logger communication interface into

Sensors 2015, 15, 31005–31022; doi:10.3390/s151229841 www.mdpi.com/journal/sensors


Sensors 2015, 15, page–page
Sensors 2015, 15, 31005–31022
interface into a wireless communication, with the use of devices such as the NPort Z3150 (Moxa, Brea,
USA) [1] or the Waspmote (Libelium, Zaragoza, Spain) [2] that can be programmed to reach that goal.
a wireless communication, with the use of devices such as the NPort Z3150 (Moxa, Brea, CA, USA) [1]
A major field of current research consists in developing intelligent systems capable of
or the Waspmote (Libelium, Zaragoza, Spain) [2] that can be programmed to reach that goal.
integrating environmental data, to improve efficiency in the use of resources and to enable
A major field of current research consists in developing intelligent systems capable of integrating
sustainable functioning of man-made utilities. This can be achieved by making an intelligent use of
environmental data, to improve efficiency in the use of resources and to enable sustainable functioning
environmental variables forecasts [3], for applications such as photovoltaic plants and
of man-made utilities. This can be achieved by making an intelligent use of environmental variables
micro-grids [4–6], where global radiation and air temperature forecasts play an important role, in
forecasts [3], for applications such as photovoltaic plants and micro-grids [4–6], where global radiation
agricultural applications [7,8] for greenhouse environmental control and irrigation management, in
and air temperature forecasts play an important role, in agricultural applications [7,8] for greenhouse
energy management in buildings [9,10], where predictions of solar radiation, air temperature and
environmental control and irrigation management, in energy management in buildings [9,10], where
relative humidity offer the possibility of important energy savings, as well as in sensor networks,
predictions of solar radiation, air temperature and relative humidity offer the possibility of important
with nodes powered by miniature solar harvesters, where forecasts of solar radiation reduces the risk
energy savings, as well as in sensor networks, with nodes powered by miniature solar harvesters, where
of temporary depletion and increases their utility [11]. These selected works, which are a small subset
forecasts of solar radiation reduces the risk of temporary depletion and increases their utility [11].
of a much larger body of research, undoubtedly illustrate the need of a weather station that, besides
These selected works, which are a small subset of a much larger body of research, undoubtedly
measurement of atmospheric variables, provides their forecasts autonomously, and makes them
illustrate the need of a weather station that, besides measurement of atmospheric variables, provides
available wirelessly to the application at hand.
their forecasts autonomously, and makes them available wirelessly to the application at hand.
The intelligent weather station described in this paper is a follow-up of the work described
The intelligent weather station described in this paper is a follow-up of the work described in [12].
in [12]. It measures three atmospheric variables: Global solar radiation, air temperature and relative
It measures three atmospheric variables: Global solar radiation, air temperature and relative humidity.
humidity. These measurements are carried at a user-specified time interval. In addition, it predicts
These measurements are carried at a user-specified time interval. In addition, it predicts the evolution
the evolution of each variable in a prediction horizon up to 48 steps-ahead. The prediction step can
of each variable in a prediction horizon up to 48 steps-ahead. The prediction step can coincide with
coincide with the measurement sampling time, or it can be a multiple of it. In the latter case, the
the measurement sampling time, or it can be a multiple of it. In the latter case, the average value of
average value of each variable is computed, over the prediction step. In the case presented here, the
each variable is computed, over the prediction step. In the case presented here, the sampling time
sampling time is 1 min and the prediction step is 5 min, which means that the maximum prediction
is 1 min and the prediction step is 5 min, which means that the maximum prediction horizon is 4
horizon is 4 h. The system was built with the objective of being self-sufficient, regarding electrical
h. The system was built with the objective of being self-sufficient, regarding electrical energy. In
energy. In addition, to facilitate its deployment, it incorporates wireless communication based on the
addition, to facilitate its deployment, it incorporates wireless communication based on the wireless
wireless IEEE 802.15.4 [13] standard. The weather station functional and signal flow diagram is
IEEE 802.15.4 [13] standard. The weather station functional and signal flow diagram is presented in
presented in Figure 1.
Figure 1.

Figure 1. Simplified weather station signal-flow diagram.


Figure 1. Simplified weather station signal-flow diagram.
This article is organized as follows. The hardware and software implementation are presented
This article is organized as follows. The hardware and software implementation are presented
in Sections 2 and 3 respectively. In Section 4, the working prototype is described and in Section 5 the
in Sections 2 and 3, respectively. In Section 4, the working prototype is described and in Section 5 the
prediction functionality is discussed. Results are shown in Section 6. Finally, conclusions are drawn in
prediction functionality is discussed. Results are shown in Section 6. Finally, conclusions are drawn
Section 7.
in Section 7.
2. Hardware
2. Hardware
The weather station development began with the search and selection of the hardware.
The weather
As explained station itdevelopment
previously, began
was necessary that with the
a unit search
that couldand selection
execute threeofpredictive
the hardware. As
models
explained
in previously,
a multi-step fashion,itstore
was the
necessary that a the
data, enable unitimplementation
that could execute three predictive
of wireless models and
communication in a
multi-step fashion, store the data, enable the implementation of wireless communication
that provided an interface to connect other hardware, such as sensors. Besides the computational and that

2
31006
Sensors 2015, 15, 31005–31022

requirements, it was also necessary to take into account the device power consumption since the
unit must be self-powered. In order to fulfill all requirements, the Raspberry PI B+ [14] was selected.
It is a mini-computer created by the Raspberry foundation, which will be denoted in the sequel as RPI.
To work with an RPI, an Operating System (OS) is compulsory. The operating system must be installed
on a Secure Digital (SD), which must be permanently inserted on the RPI. There is a wide variety of
OSs available for the RPI, most of them Linux based. The main differences between operating systems
are their base distribution and goal; some are developed to fulfill specific purposes as a media center
or a web server, where others are multi-purpose. From the available options, the Raspbian OS [15], an
OS based on the Debian GNU/Linux Distribution [16], compiled and optimized for RPI, was selected.
This Linux distribution was chosen due to its stability, support and the fact that it is multi-purpose.
With the weather station core selected, the development was shifted to the sensors employed to
measure the atmospheric variables considered. The chosen sensors were the SHT75 [17] from Sensirion,
to measure air temperature and relative humidity, and the SP-110 [18] from Apogee Instruments, to
measure global solar radiation.
The SHT75 sensor is a 4 pin digital output sensor that uses a unique capacitive sensor to measure
relative humidity and a band-gap sensor to measure air temperature. It was chosen mainly for its
resolution, 0.05% for relative humidity and 0.01 ˝ C for temperature. Another important factor was its
stability over different atmospheric conditions. To obtain the most reliable data and to avoid problems
with atmospheric conditions such as direct sun light exposure and rain, a solar radiation shield from
Davis Instruments [19] was considered.
For the global solar radiation measurements, the SP-110 pyranometer was employed. The SP-110
is a self-powered sensor with a sensitivity of 0.20 mV per W/m2 and a resolution of 5 W/m2 . The sensor
has an analog output with a range from 0 mV to 250 mV. Since the RPI does not have analog ports, it
was necessary to incorporate an analog to digital converter (ADC) to use this sensor. The chosen ADC
uses an I2C interface and it has 12 bits of resolution [20].
Besides the sensors, a push button and a toggle button were also incorporated in the weather
station design. The need for these buttons is due to the fact that the RPI does not have a power or
reset button. Therefore a push button was added to work like a reset button: it makes changes to some
configurations present in the RPI and restarts the device. The toggle button was added to provide
power saving and debug modes on the weather station.
Once the main hardware was selected, a power consumption study was performed on the unit.
During the study, it was found that, during normal use, it would consume around 300 mA without
any devices attached to it. After disabling some unnecessary software services, mostly related to
the Ethernet, USB and HDMI interfaces, the consumption dropped to around 150 mA. Based on
that, it was decided to have two types of modes: A power saving mode, where those services were
turned off, saving power but disabling debugging; and a debug mode, where all the services were
on and debugging was possible. The programming related to these buttons will be discussed in the
Software section.
As pointed out earlier, an important functionality of the device is its ability to communicate
wirelessly using an IEEE 802.15.4 standard interface. To incorporate this feature, Xbeer RF
Modules [21] with antennas were selected from Digi International. There are two types of these
modules that can operate in Europe, each using a different frequency: 868 MHz [22] and 2.4 GHz [23].
The weather station was developed to allow the operation of both types, being only necessary to
change the configuration. Since the RPI does not have a socket to accommodate the Xbee, a printed
circuit board (PCB) was designed for that purpose. Besides the socket, the PCB includes the ADC and
connections to plug the power, sensors and buttons. The developed board not only provides a place
holder for the Xbee and enables the communication, but it is also ready to control its sleep state. This is
particularly useful since this is a self-powered device and awaken 2.4 GHz or 868 MHz Xbee modules
have a power consumption of about 37 and 60 mA, respectively. These values drop to around 0.05

31007
Sensors 2015, 15, 31005–31022

mA in sleep mode, justifying the use of sleep control. This board acts as a bridge between the external
instrumentation and the RPI. It connects to the RPI via a ribbon cable.
Besides the power saving options adopted, and to accomplish the self-powering goal, a solar
panel and a battery were incorporated. To determine their energy capacity, it was assumed that the
battery should be able to power the full system for at least 24 h, without any recharge, and the solar
panel should be able to charge during the day the energy consumed overnight. From data collected
through experiences and by considering safety margins, the requirements for the battery and the solar
panel were determined as 10 Ah [24] and 12 V, 1.2 A [25], respectively.
To increase the device sustainability and versatility, a charger prioritizing circuit was included.
The objective of this implementation is to allow the user to connect the unit to the power grid, as backup.
The prioritizing circuit is a micro-controller that is able to select between three power sources according
to a priority list. The circuit has three inputs named V1, V2 and V3, being V1 the one with highest
priority and V3 the one having least priority. At each instant, the selected power source is the one
with highest priority that is valid according to its voltage. Valid voltages are configured during circuit
development by recurring to the adjustment of voltage dividers. In the weather station circuit, the
battery is connected to V1, meaning that only when the battery voltage drops below its cutoff voltage,
V2 will be activated. When V2, the power grid, is activated, it will power the unit until the battery
charge goes over a prescribed threshold, making V1 to return to its valid state. The third power input,
V3, is not being used. The circuit selected to implement this behavior was the LTC4417 from Linear
Technology [26].

3. Software
In the previous section, all core and peripheral hardware components selected for the development
of the weather station were enumerated and described. To bring them all together and to create a
weather station the software are key parts.
As mentioned, a toggle button is used to select the mode of operation and a push button to restart
the RPI. Associated with the toggle button there is a service that executes when the RPI is initiated.
The service checks the state of the button and performs its actions accordingly. If the device is in
debug mode no services are disabled and a web service is started. On the other hand if the device
is in power saving mode the web server is not initiated and services related to the Ethernet, HDMI
and USB bus are disabled. The state of this button is only verified when the device is initiated. The
reset button is checked at every second by a service developed for that purpose. If the button is
pressed between 10 and 15 s, the RPI restarts; if it is pressed longer, besides restarting it also resets the
network configurations and the administrator password that gives access to the web page. A graphical
overview of these services is shown in Figure 2.
The web page is accessible by Ethernet when the RPI is running on Debug mode and, therefore,
initializes the web server. The web page’s purpose is to allow changes in configurations, definitions and
data visualization (measurements and predictions). Regarding the configuration section, it is possible
to change the sampling interval, the prediction interval and some Xbee definitions. The sampling
interval can be set from a minimum of 30 s to a maximum of 5 min. The prediction interval must be
defined as a multiple of the sampling interval. It can only be set during the initial configuration of the
weather station. The webpage also enables the user to change configurations in the Xbee module, such
as destination addresses, sleep modes, encryption options, antenna type and additional configurations.
Although the mentioned services are important for the unit to accomplish its objectives, the most
important part of the weather station software is the data acquisition part. When the station is turned
on, a service is initialized that reads the sensor values at the user-defined rate and transmits the data
through the 802.15.4 wireless interface. The values are stored in the RPI using a Sqlite database and
marked as sent if the destination device receives the values. Otherwise, if they are not received, they
are marked as not sent and scheduled for retransmission later. Sqlite was chosen due to its simplicity
and low processing requirements, as it does not possess a database engine and is simply based on

31008
Sensors 2015, 15, 31005–31022

Sensors 2015, 15, page–page

files and an interface library. The database is composed of three tables: Config, measurement and
predicted values. The config table stores configuration parameters, the measurement table stores the
predicted values. The config table stores configuration parameters, the measurement table stores the
data acquired from the sensors and the predicted table stores the predictions.
data acquired from the sensors and the predicted table stores the predictions.

Figure 2. Signal flow diagram of the reset and the power saving buttons monitor services.
Figure 2. Signal flow diagram of the reset and the power saving buttons monitor services.
The predictions are computed by a program that is executed at every prediction interval. The
The predictions are computed by a program that is executed at every prediction interval. The
program is initiated by the cron service, a task scheduling service that exists in most Linux distributions.
program is initiated by the cron service, a task scheduling service that exists in most Linux
The predictions are computed by one of two algorithms: A Nearest Neighbors (NEN) algorithm or an
distributions. The predictions are computed by one of two algorithms: A Nearest Neighbors (NEN)
Artificial Neural Networks (ANN) based algorithm.
algorithm or an Artificial Neural Networks (ANN) based algorithm.
During
During thethe
first day
first dayofofdeployment,
deployment, the the weather stationdoes
weather station doesnot
notprovide
provideanyany predictions
predictions as itas
it does not have the necessary historical data. After acquiring a full day of data,
does not have the necessary historical data. After acquiring a full day of data, it starts using the NEN it starts using the
NEN algorithm to calculate the predictions of the relative air humidity, air temperature
algorithm to calculate the predictions of the relative air humidity, air temperature and global solar and global
solar radiation.
radiation. It It keeps
keeps using
using this
this methodology
methodology until
until it it receives
receives ananANNANNparameters
parametersfile filethrough
throughthe
the
802.15.4 module. The parameters file is sent to the weather station by the receiver
802.15.4 module. The parameters file is sent to the weather station by the receiver device, when device, when enough
dataenough
has been dataacquired
has been toacquired
enable a to successful
enable a design of the
successful threeofANNs.
design When
the three ANNs.the When
program the detects
programthe
existence
detectsofthe
a parameters
existence of file, it starts using
a parameters file, itthe ANNs
starts usingapproach
the ANNstoapproach
make thetopredictions. The values
make the predictions.
The values
acquired acquired are
are maintained maintained
in the RPI for the in the RPI for
number the number
of days requiredoftodays required
compute to compute the
the predictions. This
predictions. This number, which is configurable through the webpage,
number, which is configurable through the webpage, depends on the maximum delay that is used at depends on the maximum
the delay
inputsthat is used
of the at the inputs
forecasting of the forecasting algorithms.
algorithms.

4. Prototype
4. Prototype
To complete
To complete thethe unit,
unit, it was
it was necessarytotosearch
necessary searchand
andselect
select aa few
few more
more components
componentstotoallow
allowitsits
outdoor
outdoor deployment.To
deployment. Tohold
holdand
and protect
protect most
mostofofthe electronic
the electronic components,
components, an IP
an65IPcompliant box
65 compliant
was used. According to the International Protection Rating, an IP 65 [27] box
box was used. According to the International Protection Rating, an IP 65 [27] box provides enough provides enough
protection
protection forfor
an an outdoor
outdoor environment,since
environment, sinceititoffers
offers aa full
full protection
protection against
againstdust
dustandandwater
waterjets.
jets.
The box encloses all the electronic devices, except the sensors that must be located outsidethe
The box encloses all the electronic devices, except the sensors that must be located outside thebox.
box.
The radiation sensor does not require any special protection since it was developed to be directly
The radiation sensor does not require any special protection since it was developed to be directly
exposed to the environment. On the contrary, the temperature and humidity sensor is protected by a
exposed to the environment. On the contrary, the temperature and humidity sensor is protected by a
solar radiation shield, which protects the sensor while maintaining the relevant characteristics of the
solar radiation shield, which protects the sensor while maintaining the relevant characteristics of the
atmosphere. The prototype also has a mounting point to allow attaching it to a 2 m mast.
atmosphere. The prototype also has a mounting point to allow attaching it to a 2 m mast.
In Figure 3, it is possible to see the prototype of the meteorological station fully built and
In Figure 3, it is possible to see the prototype of the meteorological station fully built and deployed.
deployed. The station was deployed on the terrace of one of the University buildings, close to an
The station was deployed on the terrace of one of the University buildings, close to an already working
5
31009
Sensors 2015, 15, 31005–31022
Sensors 2015, 15, page–page

data-logger based weather


already working station.
data-logger The
based site ofstation.
weather deployment was
The site chosen to allow
of deployment comparison
was chosen of the
to allow
acquired data from both stations.
comparison of the acquired data from both stations.

Figure 3. Two sides of the weather station prototype.


Figure 3. Two sides of the weather station prototype.
5. Predictive Models
5. Predictive Models
Two predictive models are used to generate forecasts of the three measured atmospheric
Two predictive
variables: A NEN models are used
algorithm to generate
and forecastsapproach.
an ANN-based of the threeBothmeasured
compute atmospheric variables:
one-step-ahead
A NEN algorithm and an ANN-based approach. Both compute one-step-ahead
predictions, and are iterated in a multi-step fashion to generate longer forecasts up to a given predictions, and are
prediction
iterated horizon. These
in a multi-step techniques
fashion are briefly
to generate described
longer forecastsin this Section;
up to a given further details can
prediction be found
horizon. These
in the references
techniques are briefly provided.
described in this Section; further details can be found in the references provided.
TheThe NENNEN (fordetails,
(for details, please
please seesee[28])
[28])uses pattern
uses patternmatching to compute
matching the predictions.
to compute Two
the predictions.
Two parameters, d and n, are necessary: d corresponds to the number of full days used to search the
parameters, d and n, are necessary: d corresponds to the number of full days used to search for for the
best best matching patterns (neighbors); and n is the number of closest (in the Euclidean sense) neighbors
matching patterns (neighbors); and n is the number of closest (in the Euclidean sense) neighbors
that will be averaged to compute the one-step-ahead prediction.
that will be averaged to compute the one-step-ahead prediction.
Using two months of existing data (from 1 July 2014, until 31 August 2014), a number of
Using two months of existing data (from 1 July 2014, until 31 August 2014), a number of
experiments were executed in order to determine the best (n, d) pair for each measured variable. For
experiments
that, d andwere
n wereexecuted
varied, in andorder to determine
for each combination thethebest
Root(n, d) pair
Mean for Error
Square each (RMSE)
measured overvariable.
the
For that, d and n were varied, and was
for each combination thespace
Rootconsisted
Mean Square of d Error
instants of the prediction horizon computed. The search 7,14,(RMSE)
21, 28,35over
the instants of the prediction horizon was computed. The search space consisted of d = {7, 14, 21, 28, 35}
and n  1, 2, ,8,9 . From the experiments, it was concluded that for air relative humidity the pair
and n = {1, 2, . . . , 8, 9}. From the experiments, it was concluded that for air relative humidity the pair
(21, 4) should be used, (35, 4) for air temperature, and (14, 3) for global solar radiation. An illustration
(21, 4) should be used, (35, 4) for air temperature, and (14, 3) for global solar radiation. An illustration
for the air temperature model, using 35 days of data and all values of n, is presented in Figure 4. As
for the air temperature model, using 35 days of data and all values of n, is presented in Figure 4. As it
it can be seen, at the end of the prediction horizon the difference between n = 3 and n = 9 is
can be seen, at the end of the prediction horizon the difference between n = 3 and n = 9 is about 0.1 ˝ C.
about 0.1 °C. Although the pair (35, 4) is not the one that produces the lowest RMSE, it achieves good
Although the pairon(35,
performance the4)first
is not the one
steps, that produces
an acceptable the lowest
performance at RMSE,
the final it achieves
steps, and good performance
allows fewer
on the first steps, an acceptable performance at the final steps, and
computations to generate the prediction, therefore also contributing to save some energy.allows fewer computations to
generateThe the prediction,
ANN-basedthereforeapproachalso contributing
uses, for modeltodesign,
save some an energy.
existing Multi-Objective Genetic
The ANN-based
Algorithm (MOGA) approach
framework. uses, forapproach
This model design,
can bean existinginMulti-Objective
included a large set of designGenetic Algorithm
algorithms
that combine
(MOGA) framework.different
Thisevolutionary
approach can algorithms within
be included derivative-based ones, which
a large set of design can bethat
algorithms seen, for
combine
instance,
different in [29–31]. Details
evolutionary on thewith
algorithms use ofderivative-based
the MOGA for model ones,design
which cancanbe sought,
be seen, forfor
instance,
instance,
in [32], Details
in [29–31]. thereforeon it will
the beusebriefly
of thedescribed
MOGAhere. for model design can be sought, for instance, in [32],
therefore it will be briefly described here.
The MOGA is used to design Radial Basis Function (RBF) Neural Network (NN) models,
by selecting combinations of input variables (and 6 their lags), as well as the number of neurons,
that optimize pre-specified model performance criteria.

31010
Sensors 2015, 15, page–page

The MOGA is used to design Radial Basis Function (RBF) Neural Network (NN) models, by
selecting combinations
Sensors 2015, 15, 31005–31022 of input variables (and their lags), as well as the number of neurons, that
optimize pre-specified model performance criteria.

Figure
Figure 4. 4. Evolutionofofthe
Evolution theRMSE
RMSEofofthe
theair
airtemperature
temperatureover
overthe
theprediction
predictionhorizon
horizonusing
using dd == 35
35 for
for all
all n values.
n values.

The output of a RBF model is given by:


The output of a RBF model is given by:
i k  C ( j )
2

l  2

o  k   wl 1l  ´w|j|irks
2 2j 2
e ´ Cpjq||2 (1)
ÿ j 2σj2
o rks “ wl `1 ` w j e (1)
In Equation (1), o  k  j at instant k, i  k  is the jth input at that instant,
denotes the output, j

w In
represents
Equationthe
(1),vector of the the
o[k] denotes linear weights,
output, C  j k, represents
at instant theinput
i j [k] is the jth vector (extracted
at that instant,from the C
w represents
thematrix)
vectorof
ofthe
thecenters associatedC(j)
linear weights, with the hidden
represents theneuron  j is its spread,
vectorj,(extracted from theand represents
C matrix)
2
the
of the centers
associated
Euclideanwith the hidden neuron j, σ j is its spread, and || ||2 represents the Euclidean distance.
distance.
AsAsdynamic
dynamicmodels
modelsare areconsidered,
considered, the RBFs are
the RBFs are usedusedas asNonlinear
NonlinearAuto-Regressive
Auto-Regressive (NAR)
(NAR)
models.
models. Denotingasasy ythe
Denoting themodelled
modelledvariable, estimation((ŷŷ),), at
variable, the estimation instant k, can
at instant can be
be given
givenas:as:


k “ ff yy kk´ddoo1 ,, . . .,,yyrkk ´ddoons
ŷyˆrks 
` “ ‰ ˘
 1   n  (2) (2)

InInEquation
Equation(2),(2), ff represents
representsthe theRBF
RBF model
model Equation
Equation (1), (1),
which which
means means that
that its its argument
argument (the
delays
(the delays of of
y) y)
represent
represent thethenetwork
network input, i k 
input, ,
i[k], being
being dd 
oi oi 0
ą . As
0. Asthe objective
the objectiveis to
is determine
to determinethethe
evolution
evolution of of
thethe
variables
variables over over a prediction
a predictionhorizon,
horizon,Equation
Equation (2)(2)
is iterated over
is iterated thatthat
over horizon. For k
horizon.
+1,For
wekshall have:
+1, we shall have: ` “ ‰ ˘
ŷ rk ` 1s “ f y k ` 1 ´ do1 , . . . , y rk ` 1 ´ don s (3)

yˆ  k  1  f y k  1  do1  , , y k  1  don 
Depending on the indices of the delays, for the steps within the prediction horizon, we may not
 (3)

have measured
Depending values
on theforindices
one orofmore terms in
the delays, forthetheargument
steps within of Equation (3). These
the prediction must
horizon, webe obtained
may not
using previous predictions. This way, the computation of the forecast over
have measured values for one or more terms in the argument of Equation (3). These must be obtained a given prediction horizon
is an iterative
using previousprocess.
predictions. This way, the computation of the forecast over a given prediction horizon
is an
The iterative
designprocess.
of models by the MOGA framework involves the determination of:

‚ 7 number of delays to use, and their values;


The inputs: In this case, this is translated in the
‚ The number of hidden neurons (l in Equation (1));
‚ The model parameters: C, w and σ.

31011
The design of models by the MOGA framework involves the determination of:
 The inputs: In this case, this is translated in the number of delays to use, and their values;
 The number of hidden neurons (l in Equation (1));
Sensors 2015, 15, 31005–31022
 The model parameters: C, w and σ .
Before being evaluated in MOGA, each model has its parameters determined by a
Before being evaluated
Levenberg-Marquardt in MOGA,
algorithm [33,34] each model an
minimizing has error
its parameters determined
criterion that exploits bythea
Levenberg-Marquardt algorithm [33,34] minimizing an error criterion that exploits the
linear-nonlinear relationship of the RBF NN model parameters [35,36]. The initial values of the linear-nonlinear
relationship of the RBF(C
nonlinear parameters NN and σ ) are
model parameters [35,36]. The
chosen randomly, initial
or with thevalues
use ofof the nonlinear
a clustering parameters
algorithm, w is
(Cdetermined
and σ) are chosen randomly, or with the use of a clustering algorithm, w
as a linear least-squares solution, and the procedure is terminated usingis determined as a linear
the
least-squares solution,
early-stopping and[37]
approach the procedure is terminated
within a maximum numberusing
of the early-stopping
iterations. approach
The workflow [37] within
of MOGA can
a be
maximum number
seen in Figure 5. of iterations. The workflow of MOGA can be seen in Figure 5.

Figure5.5. MOGA
Figure MOGA Worflow
Worflow (reprinted
(reprinted from
from [32]).
[32]).

MOGA requires that the data used to develop the models is divided into three data sets: a
MOGA requires that the data used to develop the models is divided into three data sets: a training
training set to estimate the model parameters, a testing set for terminating the training, and a
set to estimate the model parameters, a testing set for terminating the training, and a validation set to
validation set to compare the performance of the models obtained by the MOGA (as the MOGA uses
compare the performance
a multi-objective of the models
formulation, obtained
its results by athesingle
are not MOGA (as the MOGA
solution, but a set uses
of anon-dominated
multi-objective
formulation, its results are not a single solution, but a set of non-dominated
solutions). This data division is automatically executed by an algorithm, AppoxHull, which solutions). This also
data
division
ensuresisthat
automatically
the vertices executed
in the approximate convex AppoxHull,
by an algorithm, whichdata
hull of the whole alsoare
ensures thatin
included the
thevertices
trainingin
the approximate convex hull of the whole
set. For more details on ApproxHull, please see [38]. data are included in the training set. For more details on
ApproxHull, pleaseofsee
The design NNs [38].
by a MOGA is a time-consuming process. For this reason, it is executed in a
cluster of processors. It is aalso
The design of NNs by MOGA is a time-consuming
an iterative process, which process.
meansFor thatthis
thereason,
resultsitobtained
is executed in a
in one
cluster of processors. It is also an iterative process, which means that
design experiment enable the user to fine tune the parameters of a next experiment.the results obtained in one design
experiment enable the
As described user the
before, to fine
firsttune the parameters
predictions of a next
are obtained experiment.
using the NEN algorithm, after storing
one day of data, i.e.,  n, d   1,1 . These values will be increased every
As described before, the first predictions are obtained using the NENday,algorithm,
until theafter storing
desired one
values
day of data, i.e., (n, d) = (1, 1). These values will be increased every day, until the desired values for
for each model can be achieved. This way, all the processing is done at the weather station.
each model can be achieved. This way, all the processing is done at the weather station.
The usage of the ANN models requires their design, which is done externally. The process of
The usage of the ANN models requires their design, which is done externally. The process of
model design starts when one of two conditions is met: after a fresh start, when enough data is
model design starts when one of two conditions is met: after a fresh start, when enough data is
collected; or when a degradation of the forecasts is identified. The process is implemented by an
collected; or when a degradation of the forecasts is identified. The process is implemented by an
Hyper-Text Transfer Protocol (HTTP) based Web Service 8 (WS) using a basic web server authentication.
It accepts a POST of data that is triggered by the Weather Station Receptor (WSR) device or by the
weather station, when the conditions mentioned above are detected. After the POST of data, a simple
protocol ensures that the weather station will receive the expected ANNs parameters.

31012
Sensors 2015, 15, page–page

Hyper-Text Transfer Protocol (HTTP) based Web Service (WS) using a basic web server
Sensors 2015, 15, 31005–31022
authentication. It accepts a POST of data that is triggered by the Weather Station Receptor (WSR)
device or by the weather station, when the conditions mentioned above are detected. After the POST
of data, a simple protocol ensures that the weather station will receive the expected ANNs parameters.
WhenWhen the WS thereceives
WS receivesa POST
a POSTof of
data,
data,it itmanages
managesthe the authorization,
authorization, the theANN
ANN design
design tasks,
tasks, and and
offloads
offloads the ANN design work to another system. Additionally, an email notification of this event is is
the ANN design work to another system. Additionally, an email notification of this event
sent tosent
thetotechnical team.
the technical ForFor
team. each weather
each weather station,
station,only
only one
one design taskisispossible
design task possible at at
anyanytime.time.
WhenWhen a newatask
newistask
created in the in
is created WS,theit WS,
spawns two MOGA
it spawns two MOGAdesigndesign
experiments
experimentsfor each variable.
for each
variable.
The first Theparameters
uses the first uses thedetailed
parameters detailed
above, above,
while while
in the in the second,
second, some MOGA some MOGA parameters
parameters are fine
are fine tuned, depending on the results of the first execution. In this case, the
tuned, depending on the results of the first execution. In this case, the RMSEs for the training and RMSEs for the training
testingand testing error are set as restrictions, as well as the model complexity. The number of neurons, the
error are set as restrictions, as well as the model complexity. The number of neurons, the
number of inputs and the set of lags considered are also decreased, therefore reducing the search
number of inputs and the set of lags considered are also decreased, therefore reducing the search space
space of MOGA. When the second design is finished, the model parameters are sent back to the WS
of MOGA. When the second design is finished, the model parameters are sent back to the WS that
that notifies the technical team of the design conclusion. If the new ANN parameters are considered
notifies
good, technical
the the processteam of the design
is validated and theconclusion.
WS will send If them
the new ANN
to the parameters
weather are
station. If theconsidered
validation is good,
the process
faulty,isthe
validated
technicaland the
team WS analyze
must will send
thethem
problem,to the weatheralternative
formulate station. IfMOGA
the validation
experiments is faulty,
and the
technical team must
afterwards analyze
submit the parameters
validated problem, formulate
to the WSR. alternative MOGA
A signal flow experiments
diagram of the WS and afterwards
is presented
submitinvalidated
Figure 6. parameters to the WSR. A signal flow diagram of the WS is presented in Figure 6.

Figure 6. WS signal flow diagram.


Figure 6. WS signal flow diagram.

6. Results
6. Results
The intelligent
The intelligent weather
weather station
station was deployed
was deployed in theinterrace
the terrace
of oneofofone
the of the buildings
buildings of the
of the Gambelas
campus of the University of Algarve, Faro, Portugal, between 22 February 2015, 03:00:00 + 00:00+ and
Gambelas campus of the University of Algarve, Faro, Portugal, between 22 February 2015, 03:00:00
7 April00:00 and
2015, 7 April +
14:35:00 2015, 14:35:00
01:00. + 01:00.
During this During
period,this period,
12,800 12,800 of
samples samples of the
the three three atmospheric
atmospheric variables
variables were collected. During the first 35 days, the forecasts within a prediction horizon of 48 steps
were collected. During the first 35 days, the forecasts within a prediction horizon of 48 steps ahead
ahead (4 h, as the prediction interval considered was 5 min), were obtained by the NEN algorithm.
(4 h, as the prediction interval considered was 5 min), were obtained by the NEN algorithm. After
After that, and with 10,000 values acquired for each variable, the neural network models were
that, and with 10,000
designed values acquired
and transmitted for each
to the weather variable,
station by thethe
WS.neural network
The results models
of the were
forecasts fordesigned
the three and
transmitted to the weather station by the WS. The results of the forecasts for the three variables
variables obtained by the RBF models, for the last 1350 samples (approximately the last five days) obtained
by the RBF models, for the last 1350 samples (approximately the last five days) were compared with the
9
results obtained by the NEN, with the parameterizations already mentioned, as well as (n, d) = (2, 2)
and (7, 4).
The RBF models were designed with two iterations of MOGA. In the MOGA experiments executed
for this work, the parameters employed in the first iteration were: number of neurons in the hidden
layer limited between two and 30; number of input terms for each neuron between one and 15; number
of RBF NN training trials 10; maximum number of training iterations 50; population size 100. The

31013
Sensors 2015, 15, page–page

were compared with the results obtained by the NEN, with the parameterizations already mentioned,
Sensorsas2015,
well15,
as31005–31022
(n, d) = (2, 2) and (7, 4).
The RBF models were designed with two iterations of MOGA. In the MOGA experiments
executed for this work, the parameters employed in the first iteration were: number of neurons in the
selected
hiddenmodel
layerdesign
limitedobjectives
between twoare:and
the 30;
RMSE obtained
number in the
of input training
terms and
for each test data
neuron sets,one
between and the
modelandcomplexity.
15; number In the second
of RBF iteration,
NN training themaximum
trials 10; MOGA parameters have been
number of training restricted
iterations based on the
50; population
size
results 100. Theon
obtained selected model design objectives
the non-dominated are: the RMSE
set. The previous obtained
objectives in the
were set training and testwith
as restrictions, data goals
sets, and the model complexity. In the second iteration, the MOGA parameters have
determined as the average of the previous results in the non-dominated set, and a further objective,been restricted
based over
the RMSE on thetheresults obtained
prediction on the
horizon, wasnon-dominated
incorporated.set. The previous objectives were set as
restrictions, with goals determined as the average of the previous results in the non-dominated set,
and a furtherTemperature
6.1. Atmospheric objective, the RMSE over the prediction horizon, was incorporated.

ApproxHull
6.1. found
Atmospheric 696 vertices in the data convex hull. The number of samples for the training,
Temperature
testing and validation
ApproxHull founddata sets were
696 vertices 2888,
in the data 962 andhull.
convex 964,Therespectively. The for
number of samples MOGA yielded 83
the training,
non-dominated solutions. From these, a six-input model Equation (4) was selected:
testing and validation data sets were 2888, 962 and 964, respectively. The MOGA yielded 83
non-dominated solutions. From these, a six-input model Equation (4) was selected:
y rks “ f py rk ´ 1s , y rk ´ 2s , y rk ´ 6s , y rk ´ 11s , y rk ´ 277s , y rk ´ 299sq (4)
y  k   f  y  k  1 , y k  2 , y k  6 , y k  11 , y k  277 , y k  299 (4)
Figure 7 shows the measured values (in black) and the values estimated by the model (in red),
Figure 7 shows the measured values (in black) and the values estimated by the model (in red),
for the first 100 samples of the training, testing and validation sets, respectively. The RMSE values
for the first 100 samples of the training, testing and validation sets, respectively. The RMSE values
obtained withwith
obtained these data
these sets
data were
sets were0.36,
0.36,0.31
0.31 and 0.32,respectively.
and 0.32, respectively. It may
It may be observed
be observed that that an almost
an almost
exactexact
fitting has been achieved in all data sets, which is an excellent sign about the generalization
fitting has been achieved in all data sets, which is an excellent sign about the generalization
capability of the
capability model.
of the model.

Figure 7. Measured (black) and estimated (red) values of Temperature, for the first 100 samples of the
Figure 7. Measured (black) and estimated (red) values of Temperature, for the first 100 samples of the
training (Top); testing (Middle); and validation (Bottom) data sets.
training (Top); testing (Middle); and validation (Bottom) data sets.

10
Figure 8 shows the air temperature one-step-ahead predictions obtained by the NEN algorithm
and the RBF ANN for the last 1350 samples, as well as the evolution of the RMSE along the prediction
horizon. By comparing the top and middle plots, it is clear that the best performance is obtained
by the RBF ANN model. Regarding the prediction error over the instants of the prediction horizon,
the bottom plot shows that the RBF ANN, as expected, achieves also the best results. It may also be
concluded that the NEN method performance is positively influenced by parameterizations that use

31014
Figure 8 shows the air temperature one-step-ahead predictions obtained by the NEN algorithm
and the RBF ANN for the last 1350 samples, as well as the evolution of the RMSE along the prediction
horizon. By comparing the top and middle plots, it is clear that the best performance is obtained by
the RBF ANN model. Regarding the prediction error over the instants of the prediction horizon, the
Sensors
bottom 2015, 15, shows
plot 31005–31022
that the RBF ANN, as expected, achieves also the best results. It may also be
concluded that the NEN method performance is positively influenced by parameterizations that use
more data. The NEN(35, 4) is comparable to the RBF in the end part of the horizon, but much worse
more data. The NEN (35, 4) is comparable to the RBF in the end part of the horizon, but much worse
over the first half.
over the first half.
Table 1 summarizes the one-step-ahead RMSE and presents the sum of the RMSE over the
Table 1 summarizes the one-step-ahead RMSE and presents the sum of the RMSE over the
prediction horizon instants, for the four models. It is evident, among the NEN parameterizations,
prediction horizon instants, for the four models. It is evident, among the NEN parameterizations,
that the best results are obtained by the selected one, (35, 4), and that the best performance overall is
that the best results are obtained by the selected one, (35, 4), and that the best performance overall is
achieved by the ANN model.
achieved by the ANN model.

Figure 8.
Figure 8. One-step-ahead error for
One-step-ahead error for the
the NEN
NEN algorithm
algorithm (Top)
(Top) and
and the
the RBF
RBF ANN
ANN (Middle);
(Middle); considering
considering
the last
the last1350
1350data
datapoints.
points.Evolution
Evolutionofofthe
theRMSE
RMSE (Bottom),
(Bottom), along
along thethe prediction
prediction horizon
horizon instants,
instants, for
for air
temperature forecasts obtained by the RBF model (black), and the NEN algorithm: Red (2, 2), blue (7,2),
air temperature forecasts obtained by the RBF model (black), and the NEN algorithm: Red (2, 4)
bluegreen
and (7, 4) (35,
and 4).
green (35, 4).

Table 1. Root mean square


Table 1. square errors
errors (RMSEs)
(RMSEs) of
of Temperature.
Temperature.
48
Model
Model
RMSE1
RMSE1
48
ř RMSE
RMSE
i
i 1
i

i“1
NEN (2, 2) 2.17 111.06
NEN (2, 2) 2.17 111.06
NEN (7,4)4)
NEN (7, 1.93
1.93 101.52
101.52
NEN (35,4)4)
NEN (35, 1.39
1.39 84.79
84.79
RBF
RBF 0.30
0.30 65.46
65.46

6.2. Atmospheric Relative Humidity


AppoxHull found 1169 vertices in the data convex hull. The number of samples for the training,
11
testing and validation was 2888, 962 and 964, respectively. The MOGA yielded 83 non-dominated
solutions. From these, a six-input model Equation (5) was selected:

y rks “ f py rk ´ 1s , y rk ´ 2s , y rk ´ 7s , y rk ´ 8s , y rk ´ 12s , y rk ´ 17sq (5)

31015
6.2. Atmospheric Relative Humidity
AppoxHull found 1169 vertices in the data convex hull. The number of samples for the training,
testing and validation was 2888, 962 and 964, respectively. The MOGA yielded 83 non-dominated
solutions. From these, a six-input model Equation (5) was selected:
Sensors 2015, 15, 31005–31022
y  k   f  y  k  1 , y k  2 , y k  7 , y k  8 , y k  12 , y k  17 (5)

Figure
Figure 9 depicts
depicts the measured
measured values
values (in
(in black)
black)and
andthe
thevalues
valuespredicted
predictedby bythethemodel,
model,for
forthe
the
first
first 100
100 samples
samples of the training, testing
testing and
and validation
validationsets,
sets,respectively.
respectively.The
Thecorresponding
correspondingRMSE RMSE
values
values obtained withwiththese
thesedata
datasets
setswere
were1.46,
1.46, 1.03
1.03 and
and 1.07,
1.07, respectively.
respectively. As air
As for fortemperature,
air temperature,
an
an almost
almost perfect
perfect fitting
fitting waswas obtained
obtained in cases.
in all all cases.
Figure 10
Figure 10illustrates
illustratesthe
theone-step-ahead
one-step-aheadpredictions
predictions obtained
obtained byby
thethe
NENNEN algorithm
algorithm withwith the
the three
three parameterizations
parameterizations and theand theANN,
RBF RBF ANN,
for thefor the1350
last lastsamples,
1350 samples, asas
as well well
theasevolution
the evolution
of theofRMSE
the
RMSEthe
along along the prediction
prediction horizonhorizon
for the for the
four four models.
models. PleasePlease
notice notice that,
that, for for relative
relative humidity,
humidity, the
the chosen
chosen NEN parameterization
NEN parameterization was (21, 4). was (21, 4).

Figure 9.
Figure 9. Measured
Measured (black)
(black) and
and estimated
estimated (red)
(red) values
values of
of relative
relative humidity,
humidity,for
forthe
thefirst
first100
100samples
samplesof
of the training (Top); testing (Middle); and validation (Bottom) data
the training (Top); testing (Middle); and validation (Bottom) data sets. sets.

It may be seen that the NEN performance suffers, because relative humidity day-to-day patterns
exhibit a stronger variability than air temperature. Figure 10 shows the corresponding result obtained
by executing the RBF model (in red). The conclusions that were drawn for air temperature apply also to
relative humidity: The best performance was obtained by the RBF NN model, and the parameterization
(21, 4) achieved the best NEN results, which are better than those obtained by the RBF at the last few
instants of the prediction horizon.
Table 2 presents the summary of results for the relative humidity, considering the four models. As
found for the Temperature, among the NEN parameterizations, the best results are obtained by the
selected one, and the best performance overall is12 obtained by the ANN model.

31016
Sensors 2015, 15, 31005–31022
Sensors 2015, 15, page–page

Figure 10. One-step-ahead error for the NEN algorithm (Top) and the RBF ANN (Middle),
Figure 10. One-step-ahead error for the NEN algorithm (Top) and the RBF ANN (Middle), considering
considering the last 1350 data points. Evolution of the RMSE (Bottom), along the prediction horizon
the last 1350 data points. Evolution of the RMSE (Bottom), along the prediction horizon instants, for
instants, for air relative humidity forecasts obtained by the RBF model (black), and the NEN
air relative humidity forecasts obtained by the RBF model (black), and the NEN algorithm: Red (2, 2),
algorithm: Red (2, 2), blue (7, 4) and green (21, 4).
blue (7, 4) and green (21, 4).
It may be seen that the NEN performance suffers, because relative humidity day-to-day patterns
Table
exhibit a stronger variability than 2. RMSEs of Relative
air temperature. Figure 10Humidity.
shows the corresponding result obtained
by executing the RBF model (in red). The conclusions that were drawn for air temperature apply also
to relative humidity: The best performance was obtained 48
ř by the RBF NN model, and the
Model RMSE1 RMSEi
parameterization (21, 4) achieved the best NEN results, which i“1 are better than those obtained by the
RBF at the last few instants of NEN
the prediction
(2, 2) horizon.
14.34 742.17
Table 2 presents the summary of
NEN (7, 4)results for the relative humidity,
11.32 632.72 considering the four models.
As found for the Temperature, NENamong the NEN8.52
(21, 4) parameterizations,
497.36 the best results are obtained by
the selected one, and the best performance
RBF overall
0.99is obtained409.43
by the ANN model.

Table 2. RMSEs of Relative Humidity.


6.3. Solar Radiation
48

The numberRMSE
ApproxHull found 659 vertices.Model 1 
of samples
i 1
RMSE
for the
i training, testing and validation
was 2895, 965 and 966, respectively.NEN
The(2,
MOGA
2) yielded
14.34 168 non-dominated
742.17 solutions. From these, an
11-input model Equation (6) was selected:
NEN (7, 4) 11.32 632.72
˜ NEN (21, 4) 8.52 497.36 ¸
y rk ´ 1s , y RBF
rk ´ 2s , y rk ´ 3s , y rk ´ 409.43
0.99 5s , y rk ´ 8s , y rk ´ 34s ,
y rks “ f (6)
y rk ´ 35s , y rk ´ 37s , y rk ´ 281s , y rk ´ 289s , y rk ´ 290s
6.3. Solar Radiation
Figure 11 showsfound
ApproxHull the measured values
659 vertices. (in black)
The number and thefor
of samples values estimated
the training, by the
testing and model, for the
validation
first 100
was 2895, 965 and 966, respectively. The MOGA yielded 168 non-dominated solutions. From these,with
samples of the training, testing and validation sets, respectively. The RMSEs obtained
these an
data sets were
11-input model71.35, 31.2(6)and
Equation was38.18, respectively. Although the fittings are excellent, as for
selected:
the other variables, regarding solar radiation the error in the training set is, in comparison, higher.
13
This was a consequence of an increase of cloudiness during those days, which resulted in increased
uncertainty and consequent degradation of predictive performance. Please note that the RMSE in

31017
Figure 11 shows the measured values (in black) and the values estimated by the model, for the
first 100 samples of the training, testing and validation sets, respectively. The RMSEs obtained with
these data sets were 71.35, 31.2 and 38.18, respectively. Although the fittings are excellent, as for the
other variables, regarding solar radiation the error in the training set is, in comparison, higher. This
Sensors
was a2015, 15, 31005–31022
consequence of an increase of cloudiness during those days, which resulted in increased
uncertainty and consequent degradation of predictive performance. Please note that the RMSE in the
training set set
the training is expected
is expectedto be higher
to be higher than in in
than the other
the othersets,
sets,asasthe
thetraining
trainingset
setincludes
includes thethe convex
convex
hull samples.
hull samples.
Figure
Figure 1212 shows
showsthe theone-step-ahead
one-step-ahead predictions
predictions obtained
obtained by the
by NEN algorithm
the NEN with the
algorithm withthree
the
parameterizations, and by the RBF ANN model, for the last 1350 samples,
three parameterizations, and by the RBF ANN model, for the last 1350 samples, as well as the as well as the evolution of
the RMSE over the prediction horizon instants for all the models. Please notice
evolution of the RMSE over the prediction horizon instants for all the models. Please notice that,that, for this variable,
the chosen
for this parameterization
variable, was (14, 4). By comparing
the chosen parameterization was (14, the topcomparing
4). By and middlethe plots
topitand
maymiddle
be concluded
plots it
that the RBF ANN achieves the best results. This may be confirmed
may be concluded that the RBF ANN achieves the best results. This may be confirmed by by looking at the bottom
lookingplot,
at
which illustrates the evolution of the RMSE, along the prediction horizon instants,
the bottom plot, which illustrates the evolution of the RMSE, along the prediction horizon instants, obtained by the
four models
obtained considered.
by the four modelsContrary to the previous
considered. Contrarytwo weather
to the variables,
previous for solarvariables,
two weather radiationfor none of
solar
the NEN models achieves a comparable performance with the RBF ANN
radiation none of the NEN models achieves a comparable performance with the RBF ANN in any part in any part of the
prediction horizon.
of the prediction horizon.
Table
Table 33 shows
shows the the one-step-ahead
one-step-ahead RMSE RMSE as as well
well as the sum
as the sum of of the
the RMSE
RMSE over
over thethe prediction
prediction
horizon
horizon instants, for all the models. As found for the two other variables, among the
instants, for all the models. As found for the two other variables, among NEN
the NEN
parameterizations, the
parameterizations, the best
best results
results are
are obtained
obtained byby the
the selected
selected one,
one, and
and the
the best
best performance
performance overall
overall
is achieved by the ANN
is achieved by the ANN model. model.

Figure 11. Measured (black) and estimated (red) values of solar radiation, for the first 100 samples of
the training (Top);
(Top); testing
testing (Middle);
(Middle); and
and validation
validation (Bottom)
(Bottom) data
data sets.
sets.

14

31018
Sensors 2015, 15, 31005–31022
Sensors 2015, 15, page–page

Figure 12. One-step-ahead error for the NEN algorithm (Top) and the RBF ANN (Middle),
Figure 12. One-step-ahead error for the NEN algorithm (Top) and the RBF ANN (Middle), considering
considering the last 1350 data points. Evolution of the RMSE (Bottom), along the prediction horizon
the last 1350 data points. Evolution of the RMSE (Bottom), along the prediction horizon instants,
instants, for solar radiation forecasts obtained by the RBF model (black), and the NEN algorithm:
for solar radiation forecasts obtained by the RBF model (black), and the NEN algorithm: Red (2, 2),
Red (2, 2), blue (7, 4) and green (14, 4).
blue (7, 4) and green (14, 4).
Table 3. RMSEs of Solar Radiation.
Table 3. RMSEs of Solar Radiation.
48
Model RMSE1
48
ř
 RMSE
i 1
i

Model RMSE1 RMSEi


NEN (2, 2) 132.22 i“1 12,109
NEN (7, 2)
NEN (2, 4) 122.26
132.22 12,173
12,109
NEN
NEN (7, 4)4)
(14, 154.67
122.26 11,951
12,173
NEN (14, 4)
RBF 154.67
29.49 11,951
7850
RBF 29.49 7850
7. Conclusions
7. Conclusions
In this paper, we have shown the hardware and software design of an intelligent weather station
which, besides
In this paper,offering wireless
we have communication
shown the hardwareand energy autonomy,design
and software providesof not
an only measurements
intelligent weather
of atmospheric variables, but also their forecasts, over a prediction horizon.
station which, besides offering wireless communication and energy autonomy, provides not only
Two types
measurements of forecasting
of atmospheric methodsbut
variables, arealso
available in the weather
their forecasts, over a station: a Nearest
prediction horizon.Neighbor
algorithm,
Two types of forecasting methods are available in the weather station: a NearestNetwork
which is completely local to the station, and another based on Artificial Neural Neighbor
models, which, for their design, requires an auxiliary computer system to perform optimized model
algorithm, which is completely local to the station, and another based on Artificial Neural Network
design. It was shown that the forecasts obtained by the ANN models are substantially better than the
models, which, for their design, requires an auxiliary computer system to perform optimized model
ones given by the NEN algorithm.
design. It was shown that the forecasts obtained by the ANN models are substantially better than the
An accurate comparison of the prediction results with other approaches is difficult because the
ones given by the NEN algorithm.
data, as well as the prediction interval, are not the same and, typically, a prediction horizon of just
An accurate comparison of the prediction results with other approaches is difficult because the
one step is considered in these approaches. In order to have a general idea of the quality of the RBF
data, as wellofas
forecasts thethe prediction
intelligent interval,
weather are not
station, the same
compared and,
with typically,
other a prediction
solutions, it must firsthorizon of just
be assumed
onethat
step is considered in these approaches. In order to have a general idea of the quality
similar predictions will occur when the prediction interval is changed. Assuming this, it can be of the RBF
forecasts of the intelligent weather station, compared with other solutions, it must first be assumed that
15

31019
Sensors 2015, 15, 31005–31022

similar predictions will occur when the prediction interval is changed. Assuming this, it can be pointed
out that, in [5], different 1-step forecasting methods of solar radiation were compared, considering
a prediction interval of 1 h. Their RMSEs lied between a range of [48.8 59.5] W/m2 . In our case, the
RMSE is 29.5 W/m2 for a prediction interval of 5 min. In [4], considering also a prediction interval of
1 h, the mean absolute percentage error (MAPE) obtained for the solar radiation of one cloudy day
is 9.65%, while this index, computed for the RBF results using the data used in Section 6.3, is 7.78%.
In [3], one-step-ahead forecasts of air temperature and relative humidity are presented. Their RMSEs
lie in the range of [1.58 1.63] ˝ C and [4.25 4.47]%, while in the ANN approach presented in this paper
these values are 0.3 ˝ C and 0.99%.
If any of the approaches referenced above would be applied for a specific site, a weather station
would have to be installed in that location, models would have to be designed externally, using data
that should be transmitted in real-time from that weather station, and one-step-ahead predictions
would have to be computed, in real-time, externally. The intelligent weather station proposed in this
work is a complete and autonomous solution to this problem, besides enabling to have excellent quality
predictions over a user-defined prediction horizon, and not for a single step. As such, we anticipate
that a commercial version of such a device will have a large range of practical applications, examples
being in PV plants, energy building management systems as well as in agricultural applications.

Acknowledgments: The authors would like to acknowledge the support of QREN SIDT 38798 and University of
Algarve grant No. 032/2015.
Author Contributions: All the authors belonged to the research team of QREN SIDT 38798, with the exception of
Hamid Khosravani, who developed ApproxHull used in this work, and Shabnam Pesteh, who contributed to this
work in her Master Thesis.
Conflicts of Interest: The authors declare no conflict of interest.

References
1. Moxa Inc. Nport z3150 Series User’s Manual. Available online: http://www.moxa.com/doc/man/
NPort_Z3150_Series_Users_Manual_v2.pdf (accessed on 6 December 2015).
2. Libelium. Waspmote Overview. Available online: http://www.libelium.com/products/waspmote/overview/
(accessed on 6 December 2015).
3. Das, M.; Ghosh, S.K. A probabilistic approach for weather forecast using spatio-temporal inter-relationships
among climate variables. In Proceedings of the 2014 9th International Conference on Industrial and
Information Systems (ICIIS), Gwalior, India, 15–17 December 2014; pp. 1–6.
4. Chen, S.X.; Gooi, H.B.; Wang, M.Q. Solar radiation forecast based on fuzzy logic and neural networks. Renew.
Energy 2013, 60, 195–201. [CrossRef]
5. Inman, R.H.; Pedro, H.T.C.; Coimbra, C.F.M. Solar forecasting methods for renewable energy integration.
Prog. Energy Combust. Sci. 2013, 39, 535–576. [CrossRef]
6. Sharma, N.; Sharma, P.; Irwin, D.; Shenoy, P. Predicting solar generation from weather forecasts using
machine learning. In Proceedings of the 2011 IEEE International Conference on Smart Grid Communications
(SmartGridComm), Brussels, Belgium, 17–20 October 2011; pp. 528–533.
7. Ferreira, P.M.; Ruano, A.E. Discrete model based greenhouse environmental control using the branch &
bound algorithm. In Proceedings of the 17th IFAC World Congress, Seoul, Korea, 6–11 July 2008.
8. Luo, Y.; Chang, X.; Peng, S.; Khan, S.; Wang, W.; Zheng, Q.; Cai, X. Short-term forecasting of daily reference
evapotranspiration using the hargreaves-samani model and temperature forecasts. Agric. Water Manag. 2014,
136, 42–51. [CrossRef]
9. Ferreira, P.M.; Ruano, A.E.; Silva, S.; Conceicao, E.Z.E. Neural networks based predictive control for thermal
comfort and energy savings in public buildings. Energy Build. 2012, 55, 238–251. [CrossRef]
10. Collotta, M.; Messineo, A.; Nicolosi, G.; Pau, G. A dynamic fuzzy controller to meet thermal comfort by
using neural network forecasted parameters as the input. Energies 2014, 7, 4727–4756. [CrossRef]
11. Renner, C.; Nguyen, P.A.T. A system for efficient dissemination of weather forecasts for sustainable
solar-powered sensors. In Proceedings of the Sustainable Internet and ICT for Sustainability (SustainIT),
Madrid, Spain, 14–15 April 2015; pp. 1–8.

31020
Sensors 2015, 15, 31005–31022

12. Ferreira, P.M.; Gomes, J.M.; Martins, I.A.C.; Ruano, A.E. A neural network based intelligent predictive sensor
for cloudiness, solar radiation, and air temperature. Sensors 2012, 12, 15750–15777. [CrossRef] [PubMed]
13. IEEE. IEEE Standard for Local and Metropolitan Area Networks. Available online:
http://standards.ieee.org/getieee802/download/802.15.4k-2013.pdf (accessed on 6 December 2015).
14. Foundation, R.P. Raspberry Pi—Model B. Available online: http://www.raspberrypi.org/products/model-b/
(accessed on 6 December 2015).
15. Raspbian. Raspbian OS. Available online: http://www.raspbian.org/RaspbianDocumentation (accessed on
6 December 2015).
16. Debian. Debian OS. Available online: www.debian.org (accessed on 6 December 2015).
17. AG, S. Sht7x Datasheet. Available online: http://www.sensirion.com/fileadmin/user_upload/
customers/sensirion/Dokumente/Humidity/Sensirion_Humidity_SHT7x_Datasheet_V5.pdf (accessed on
6 December 2015).
18. Apogee Instruments, Inc. Owner’s Manual—Pyranometer Model sp-110 and sp-230. Available online:
https://www.apogeeinstruments.co.uk/content/SP-110manual.pdf (accessed on 6 December 2015).
19. Davisnet. Radiation Shiled User´s Guide. Available online: http://www.davisnet.com/product_documents/
weather/manuals/07395-093_IM_07714.pdf (accessed on 6 December 2015).
20. Tecnology, L. Ltc2309 Datasheet. Available online: http://cds.linear.com/docs/en/datasheet/2309fd.pdf
(accessed on 6 December 2015).
21. Inc, D.I. Xbee RF Modules. Available online: http://www.digi.com/products/wireless-wired-embedded-
solutions/zigbee-rf-modules/zigbee-mesh-module/ (accessed on 6 December 2015).
22. Digi International Inc. Xbeer /Xbee-pror 868 RF Modules. Available online: http://ftp1.digi.com/
support/documentation/90001020_E.pdf (accessed on 6 November 2015).
23. Digi International Inc. Xbeer /Xbee-pror RF Modules. Available online: http://ftp1.digi.com/support/
documentation/90000982_R.pdf (accessed on 6 November 2015).
24. Yuasa. Np 10-6 Data Sheet. Available online: http://www.yuasabatteries.com/pdfs/NP_10_6_DataSheet.pdf
(accessed on 6 December 2015).
25. SunStore. 12v 20w Monocrystalline Solar Panel. Available online: http://www.sunstore.co.uk/12v-20w-
Monocrystalline-Solar-Panel.html (accessed on 6 December 2015).
26. Tecnologies, L. Ltc4417 Datasheet. Available online: http://cds.linear.com/docs/en/datasheet/4417f.pdf
(accessed on 6 December 2015).
27. DSM & T. Ip Rating. Available online: http://www.dsmt.com/pdf/resources/iprating.pdf (accessed on
6 December 2015).
28. Ferreira, P.M.; Pestana, R.; Ruano, A.E. Improving the identification of rbf predictive models to forecast the
portuguese electricity consumption. In Proceedings of the IFAC Conference on Control Methodologies and
Technology for Energy Efficiency (CMTEE 2010), Vilamoura, Portugal, 29–31 March 2010.
29. Garro, B.A.; Sossa, H.; Vásquez, R. Back-propagation vs. particle swarm optimization algorithm: Which
algorithm is better to adjust the synaptic weights of a feed-forward ann? Int. J. Artif. Intell. 2011, 7, 208–212.
30. Nawi, N.; khan, A.; Rehman, M.Z.; Aziz, M.; Herawan, T.; Abawajy, J. An accelerated particle swarm
optimization based levenberg marquardt back propagation algorithm. In Neural Information Processing;
Loo, C., Yap, K., Wong, K., Teoh, A., Huang, K., Eds.; Springer International Publishing: Berlin, Germany,
2014; Volume 8835, pp. 245–253.
31. Zhang, W.; Niu, P.; Li, G.; Li, P. Forecasting of turbine heat rate with online least squares support vector
machine based on gravitational search algorithm. Knowl. Based Syst. 2013, 39, 34–44. [CrossRef]
32. Ferreira, P.; Ruano, A. Evolutionary multiobjective neural network models identification: Evolving
task-optimised models. In New Advances in Intelligent Signal Processing; Ruano, A., Várkonyi-Kóczy, A., Eds.;
Springer: Berlin/Heidelberg, Germany, 2011; Volume 372, pp. 21–53.
33. Levenberg, K. A method for the solution of certain problems in least squares. Q. Appl. Math. 1944, 2, 164–168.
34. Marquardt, D. An algorithm for least-squares estimation of nonlinear parameters. SIAM J. Appl. Math. 1963,
11, 431–441. [CrossRef]
35. Ruano, A.E.B.; Jones, D.I.; Fleming, P.J. A new formulation of the learning problem for a neural
network controller. In Proceedings of the 30th IEEE Conference on Decision and Control, Brighton, UK,
11–13 December 1991; pp. 865–866.

31021
Sensors 2015, 15, 31005–31022

36. Ferreira, P.M.; Faria, E.A.; Ruano, A.E. Neural network models in greenhouse air temperature prediction.
Neurocomputing 2002, 43, 51–75. [CrossRef]
37. Haykin, S. Neural Networks: A Comprehensive Foundation, 2nd ed.; Prentice Hall: Upper Saddle River, NJ,
USA, 1999.
38. Ruano, A.; Khosravani, H.R.; Ferreira, P.M. A randomized approximation convex hull algorithm for high
dimensions. In Proceedings of the 2nd IFAC Conference on Embedded Systems, Computational Intelligence
and Telematics Control (CESCIT), Maribor, Slovenia, 22–24 June 2015.

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

31022

You might also like