0% found this document useful (0 votes)
65 views9 pages

Discrete Controller Synthesis Applied To Smart Greenhouse

This document summarizes a research paper that applies discrete controller synthesis techniques to develop an agricultural greenhouse controller. The controller is designed to control devices like irrigation systems to maintain optimal environmental conditions for crop growth. It uses formal methods and automata to model device behaviors and control rules. The controller is automatically synthesized from this model and validated through greenhouse simulations. Simulation results found the controller maintained thermal comfort for crops 87% of the time while improving energy efficiency over other approaches.

Uploaded by

flaviorochaavila
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views9 pages

Discrete Controller Synthesis Applied To Smart Greenhouse

This document summarizes a research paper that applies discrete controller synthesis techniques to develop an agricultural greenhouse controller. The controller is designed to control devices like irrigation systems to maintain optimal environmental conditions for crop growth. It uses formal methods and automata to model device behaviors and control rules. The controller is automatically synthesized from this model and validated through greenhouse simulations. Simulation results found the controller maintained thermal comfort for crops 87% of the time while improving energy efficiency over other approaches.

Uploaded by

flaviorochaavila
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Sustainable Computing: Informatics and Systems 35 (2022) 100679

Contents lists available at ScienceDirect

Sustainable Computing: Informatics and Systems


journal homepage: www.elsevier.com/locate/suscom

Discrete controller synthesis applied to smart greenhouse


Diego de Freitas Bezerra a, *, Victor Wanderley Costa de Medeiros b, Glauco Estácio Gonçalves c
a
Centro de Informática, Federal University of Pernambuco, Recife, Pernambuco, Brazil
b
Department of Statistics and Informatics, Federal Rural University of Pernambuco, Recife, Pernambuco, Brazil
c
Technology Institute, Federal University of Pará, Belém, Pará, Brazil

A R T I C L E I N F O A B S T R A C T

Keywords: The popularization of the Internet of Things allowed the emergence of different monitoring and control solutions
Internet of Things in different economic sectors. For example, in agriculture, this type of technology has supported the monitoring
Discrete controller synthesis of environmental variables essential in decision-making, defining when and how much water to use in a given
Smart environments
crop. Besides, it made it possible to control various devices to meet each crop type’s environmental requirements,
increasing productivity. In this sense, there is a need for increasingly improved control strategies to meet crop
requirements in real-time, ensuring sustainable production and reliable quality. This work presents Discrete
Event System techniques to develop an agricultural greenhouse controller considering self-configuring mecha­
nisms for adapting to dynamic environments and preventing conflicting rules from violating control objectives.
The controller was validated through a simulator based on temperature balance equations, allowing the envi­
ronment’s temperature control. We used accurate climate data from actual Brazilian meteorological stations to
evaluate different control scenarios in the year’s four seasons, checking the controller’s efficiency and the control
strategy adopted, guaranteeing the crop’s thermal comfort and minimizing water loss. Applying this control
technique, we achieved the crop’s thermal comfort under 87% of the time, influencing the absolute humidity and
evapotranspiration rates over 31 days. Besides, we were also able to reach 66% more energy efficiency than other
approaches.

1. Introduction presented in the literature to meet crop requirements in real-time,


ensuring sustainable production and reliable quality control [5]. Auto­
Internet of Things (IoT) has become more and more present in peo­ matic reconfiguration of the control system is a fundamental charac­
ple’s lives. Solutions capable of solving problems in the industry sector, teristic, which is reached by the development of self-configuring
homes, cities, agriculture, and health have brought new concepts of mechanisms for adapting to dynamic environments and preventing
products and services, improving various activities worldwide [1]. conflicting rules from violating control objectives or useless decisions
Through massive instrumentation of environments through sensors and [6].
actuators connected to the internet, IoT solutions allow monitoring and Many control techniques based on continuous-time dynamic systems
controlling the environment itself, playing an essential role in the and differential equations can be employed to develop a controller
infrastructure of these sectors and impacting the quality of services and capable of meeting reconfiguration and adaptability requirements [7].
resources wastage [2,3]. In agriculture, for example, monitoring the Other techniques can also be employed to meet these requirements. Li
environment provides farmers with essential information that directly et al. [5] and Revathi et al. [8] present a control system based on fuzzy
impacts the crop’s quality. Variables monitoring can be used to control logic. Although this approach allows the development of a controller
various devices – e.g., irrigation and microclimate systems, among capable of dynamically adapting to the environment, the authors pre­
others – to meet each crop type’s environmental requirements, sent no strategy to verify the control rules’ consistency.
increasing productivity and allowing farmers to meet off-season de­ Gatouillat et al. [9] and Sylla et al. [6] use formal methods to
mands [4]. describe the system’s behavior as a whole, defining control and adap­
Although many farmers still use conventional greenhouse control tation policies, obtaining a controller derived from these specifications.
(programmed time-based control), more precise control strategies are These systems are described through automaton formalism, describing

* Corresponding author.
E-mail address: [email protected] (D. de Freitas Bezerra).

https://doi.org/10.1016/j.suscom.2022.100679
Received 9 February 2021; Received in revised form 8 January 2022; Accepted 30 January 2022
Available online 3 February 2022
2210-5379/© 2022 Elsevier Inc. All rights reserved.
D. de Freitas Bezerra et al. Sustainable Computing: Informatics and Systems 35 (2022) 100679

their behavior through states that change according to specific events. blocks of equations or automatons with input and output events.
Based on Discrete Controller Synthesis [7], authors present the potential Equation, defined in a node, establishes the output value of the node.
of DCS to obtain a controller that does not present conflicts between the Automaton, also a statement defined in a node, describes formal finite
control rules [6]. Based on the same techniques we proposed in previous automaton using states, input, and output events [7]. The contract de­
work [10] a Control-as-a-Service architecture to dynamically process fines the rules which the controller must follow [11].
events in the context of the Internet of Things and smart environments. Fig. 1 presents the synthesis process of a controller from the discrete
We have presented scenarios in which this type of solution can be event system (DES) description. The model is constructed in a *.ept file
applied through case studies, such as Smart Farms, Smart Home, Intel­ written using the Heptagon/BZR language, which provides the DES
ligent Traffic Lights, and Smart Healthcare. control’s logical description. The Heptagon/BZR component is an
In this work, we propose to model and evaluate the performance of a interpreter that extracts the control objectives and the DES description,
controller generated through the DCS process in the control of actuators which are the input (*.z3z) of the Sigali tool.
in a smart greenhouse. Our approach modeled the devices’ behaviors Sigali applies the synthesis process and generates an intermediate
through automaton formalism and considered a set of control rules to controller, also represented as an automaton written in Heptagon/BZR
meet this scenario. This model was used to automatically synthesize the language. Finally, the controller automaton specifications and the
controller, supported by a programming language and synthesis tool. To original DES automata are composed to automatically generate C or
assess the self-adapting capacity of the resulting controller, we subjected Java code (according to a parameter passed to the Heptagon/BZR
it to a simulated scenario using a greenhouse simulator presented in this interpreter) that implements the system controller.
paper. Next, we provide a simple example of the usage of BZR/Heptagon
This work is organized as follows: Section 2 describes the DCS pro­ and Sigali. We propose a controller that coordinates two lamps. Fig. 2
cess; Section 3 present the related work; Section 4 describes the green­ illustrates the automaton named Lamp that represents the behavior of a
house simulator; Section 5 describes the controller model; Section 6 smart lamp. Each lamp has two possible states: ON or OFF with OFF
presents the results; and finally, Sections 7 and 8 presents a discussion, being the initial state. Each state is associated with an equation that
conclusions and future work. determines the output of the automaton at this state. In this case, the
output variable lamp_s represents if the modeled lamp is on or off. The c
2. Discrete controller synthesis variable can assume true or false values and indicate whether this device
can operate or not. Two input variables define transitions between
Discrete Controller Synthesis (DCS) is a formal method used to states. In this case, when c and push are true, the lamp state changes to
generate a controller from a set of rules (contract) defined by a model. ON. If c is false or the event push occurs, then it returns to OFF.
Based on Supervisory Control Theory, the method guarantees the In this model, c is a controllable event. It represents the controller
desired behavior partitioning the model input variables into controllable acting on the model in order to coordinate the transition between states,
and uncontrollable variables [11]. Thus, for a given set of rules, the DCS allowing it to change from OFF to ON or compelling it to do the reverse
algorithm calculates the constraint on controllable variables through the transition. The variable push is an uncontrollable event and represents
symbolic exploration of the overall state space, providing a controller an external action, like a push-button, which can be performed by any
that complies with the contract for any input values (for both types of human being or machine, for example.
variables) [12]. Listing 1 presents the definition of this lamp automaton using the
The synchronous language Heptagon/BZR compilation process in­
tegrates the DCS. Heptagon/BZR is a reactive language that allows the
generation of controller models based on finite-state automaton. The
language combines imperative and declarative programming para­
digms. The imperative paradigm, based on automaton, describes the
behavior of the system. The declarative paradigm defines the control
objectives specifications. It also integrates a contract mechanism that
allows using DCS through Sigali [11], a DCS tool. This process results in
an executable code (C or Java) of a controller capable of responding to
the contract defined in the modeling process.
There are four main elements for constructing the Heptagon/BZR
model: node, equation, automaton, and contract. The node defines Fig. 2. Lamp model.

Fig. 1. Overview of the discrete controller synthesis.

2
D. de Freitas Bezerra et al. Sustainable Computing: Informatics and Systems 35 (2022) 100679

Heptagon/BZR language. The first line declares the node (lamp), input control. They present model-defined rules for controlling lighting and
variables (push and c, of boolean type), and an output variable (lamp_s, users’ privacy and deploy the synthesized controller on a Raspberry Pi to
boolean also). Lines 2 and 11 delimit the node implementation, and control a lamp and shutter on a prototype.
automaton description is made between lines 3 and 10. The represen­ This approach has also proved successful in critical control scenarios.
tation of the diagram (states, equations on the states, and transitions) Aboubekr et al. [14] present the synthesis of a controller applied to a
into code is straightforward. robotic arm, proposing to apply DCS techniques to design discrete
control loops on top of continuous control tasks. The implementation of
Listing 1. Lamp model.
this solution integrates ORCCAD [15], a design environment for
node lamp(push, c: bool) returns (lamp_s:bool) real-time control executives, and the Heptagon/BZR language. A simu­
let lation was proposed to evaluate the robotic arm’s performance and
automaton
behavior controlled by the generated controller. Gatouillat et al. [9]
state OFF do
lamp_s = false; proposed a self-adaptation framework based on the discrete controller
unless push & c then ON synthesis to deal with dynamic changes in IoT environments considering
state ON do different quality of service metrics. As a case study, the authors simu­
lamp_s = true; lated its application in monitoring patients with a recurrent risk of
myocardial infarction.
unless push or not c then OFF
end
tel Note that the application of a DCS tool allows describing a controller
capable of meeting adaptability and reconfiguration requirements.
Given the dynamics of the environments presented in these works, we
can extend some characteristics to the greenhouse control context.
Listing 2. Lamp contract node description.
Although approaches based on Proportional Integral Derivative [16],
node twolamps(push1,push2: bool) returns (d1,d2: bool) Programmable Logic Controller [5], Fuzzy Logic [8], or Machine
contract Learning [17] allow the development of controllers capable of reconfi­
guring themselves to meet distinct environments requirements, to the
enforce not (d1 &d2)
with (c2, c1:bool)
let best of our knowledge, they do not have any synthesis engine that can
d1 = inlined lamp(push1,c1); check the control rules’ consistency and provides a correct and execut­
d2 = inlined lamp(push2,c2) able controller.
tel

4. Greenhouse simulator
Listing 1 describes only the behavior of each device. The node two­
lamps (cf. Listing 2) models the whole system, which two different lamps We implemented a simulator to analyze the behavior of climatic
and the rules to be guaranteed on the system are defined (contract variables while the controller coordinates the devices inside the green­
declaration). Lines 6 and 7 declare the two lamps as lamp automaton house. The simulation uses a mathematical model that describes the
instances. environmental conditions inside a greenhouse through first-order dif­
Such automata are, at first, independent, since each one has its own ferential equations presented by [18]. This model presents parameters
push and c events. However, the controller coordinates its execution as that represent the controllable devices, and their states can be redefined
the contract defined for this example prevents both processes from during the simulation, suitable for this work’s objectives.
remaining in the ON state simultaneously (line 3). To ensure that this The air temperature change rate inside the greenhouse depends on
rule is met, the controller acts blocking one or another automaton the heat produced by solar radiation, and the heat gain and loss ratios
through the variables c1 and c2. To synthesize a controller for this sce­ are directly influenced by the greenhouse structure, cover type, venti­
nario, both descriptions lamp and twolamps are written in an *.ept file, lation, cooling, heating, and plant evapotranspiration effects [18]. Based
and the process described at Fig. 1 is carried on. on these parameters, Eq. (1) presents the model for air temperature in­
side the greenhouse:
3. Related work
dTin 1
= ⋅QGRin + QHeater − L⋅E − (Tin − Tout ) × (qv ⋅Cp ⋅ρ + w⋅k) (1)
Several works have used the Heptagon/BZR and Sigali for the syn­ dt Cp ⋅ρ⋅H
thesis of controllers. Some of these works applied DCS to the context of
where Cp is the specific heat of air (J kg− 1 K− 1); H is the greenhouse
smart environments, such as smart houses or smart offices, modeling
height (m); Tin (◦ C) and Tout (◦ C) are the air temperature inside and
each device present in the environment, and establishing contracts to
outside of the greenhouse, respectively; QGRin (W m− 2) is the solar ra­
define the policies of operation on the environment [13,14,6,9]. How­
diation inside the greenhouse; k (J m− 2 ◦ C− 1 s− 1) is the heat trans­
ever, to the best of our knowledge, no work in literature uses the same
mission coefficient of glazing; E is the evapotranspiration rate inside the
approach in the Smart Farming context.
greenhouse; L (J kg− 1) is the latent heat of vaporization of water; qv is
Zhao et al. [13] explored Supervisory Control Theory techniques for
the ventilation rate (m3 m− 2 s− 1); QHeater (W m− 2) is the heat flux from
discrete event systems to develop a controller capable of controlling
the heating system; w is the ratio of glazing surface to floor surface; and ρ
different types of devices in the context of Smart Homes. The authors
(kg dry air m− 3) is the specific mass of air.
present each component’s modeling using automaton formalism and
The produced heat depends on the type of material that covers the
define a set of rules that meets three modes of operation: comfort,
greenhouse structure and external solar radiation, defining the values of
energy-saving, and minimal safety of residents. To validate its proposal,
transmittance (τc) and reflectance (ρg) on the floor surface [18]. Thus,
the authors present a case study in which a controller has been modeled
the solar radiation inside the greenhouse is estimated by
through Heptagon/BZR language, synthesized, and integrated with a
Smart Home simulator. QGRin = τc ⋅(1 − ρg )⋅QGRout , (2)
Sylla et al. [6] present a modular and hierarchical structure of con­
trol. This approach seeks to reduce the computational cost of synthe­ where QGRout (W m− 2) is the external solar radiation. Constants τc and ρg
sizing discrete controllers for multi-state systems. Using the are dimensionless.
Heptagon/BZR language for modeling and the ReaX tool for controller The presence of plants directly influences the evapotranspiration
synthesis, the authors propose a case study applied to a Smart Office variable that acts on the heat exchange coefficient. E is the combination

3
D. de Freitas Bezerra et al. Sustainable Computing: Informatics and Systems 35 (2022) 100679

of the processes of water loss by evaporation from the soil and transpi­ per hour [18]. Only natural ventilation occurs when the actuators are
ration from vegetation. Considering different crops type according to off, being qv = 0.014 for structures in the A-frame format. When pow­
size (small or large), Fitz-Rodriguez et al. [18] define the evapotrans­ ered on, each actuator can modify qv at a rate of 0.086. A heater (30,
piration (kg m− 2 h− 1) for small crops by Eq. (3): 000 W capacity) was included in the simulation. It influences the envi­
ronment based on the relationship between heater capacity, and the
E = 0.00006⋅τc ⋅QGRout + 0.0004. (3)
greenhouse area [18]. Thus, considering a single heater, the variable
Finally, note that QGRin and QHeater act by heating the greenhouse. On QHeater is given by:
the other hand, the variables L, E, and the difference between Tin and Tout
Hcap
work on heat reduction. Importantly, H, qv , Cp, ρ, w, QHeater, and k are QHeater = , (6)
Afl
defined based on the greenhouse settings, which will be presented in
Section 4.2. where Hcap is the heater’s capacity, and Afl is the greenhouse floor sur­
The absolute humidity model is based on the relationship between face area (m2), being Hcap = 30, 000 and Afl = 300. It defines the thermal
absolute humidity, and water vapor flow [18]. Thus, we consider effect when the heater is on. When it is off, we have QHeater = 0.
evapotranspiration as a source of water vapor gain and ventilation rate
as the sole cause of water vapor loss. Absolute air humidity is defined by 5. Controller modelling
Eq. (4):
dWin 1 We can define the controller model based on the simulator model to
= ⋅(E − (Win − Wout )⋅qv⋅ρ), (4) coordinate the heater and exhaust fan’s behavior. First, we define the
dt ρ⋅H
control rules based on the thermal requirements of small plants adapted
where Win and Wout are the absolute humidity of the air inside and to the hot climate. Cultures such as cantaloupe, cucumber, and squash
outside the greenhouse, respectively. Variables E, qv, and ρ act in the watermelon require temperature ranges between 27 to 38 ◦ C during the
same way as in Eq. (1). day and 24 to 27 ◦ C overnight [16]. From these intervals, Table 1 defines
the rules, which tin and srout are the air temperature inside the green­
house and solar radiation outside the greenhouse, respectively.
4.1. Data
When the internal temperature is below 24 ◦ C (Rule 1), we assume
the need to turn the heater on and to turn off the exhaust fan to maintain
The greenhouse settings were defined based on Brazil’s most com­
the temperature inside of the greenhouse between 24 ◦ C and 27 ◦ C. This
mon protected cultivation practices – i.e., the structure shape, cover
way, we can maintain the air temperature inside the greenhouse over­
material, and the actuators’ selection. We carried out two experiments
night, which is the period when the temperatures fall below 24 ◦ C in
using external environmental conditions data as input to the simulation,
Recife.
considering these regional settings. These experiments allow analyzing
Overnight (srout < 100), if the temperature exceeds 27 ◦ C then all
the generated controller’s efficiency according to climate variation.
actuators must be switched off (Rule 2), causing only natural ventilation
The first experiment uses hourly measurements of air temperature
to act. We consider that the first minutes of dawn and dusk (up to
(◦ C), absolute humidity of air (gwater kg1dry ), relative humidity of air (%),
100 Wm− 2 for radiation) can still be considered night. This rule con­
and solar radiation (W m− 2) for the days March/21/2019, June/22/ siders that this low level of solar radiation will cause the internal and
2019, September/24/2019, and December/23/2019 in the latitude external air temperature to be equal. During the day, when the tem­
− 8.059280 and longitude − 34.959239, Recife city, Pernambuco, in the perature exceeds 38 ◦ C (Rule 3), the controller turns on the exhaust fan
Northeastern Brazil. We obtained these data from the National Institute and turns off the heater in order to maintain the internal temperature
of Meteorology (Instituto Nacional de Meteorologia – INMET) [19] for between 27 ◦ C and 38 ◦ C.
one day (24 h) at each of the four seasons in the Southern Hemisphere, i. Since the simulator defines only two possible states for these devices
e., autumn, winter, spring, and summer, respectively. In the second (ON or OFF), this feature was reflected in the controller modeling pro­
experiment, we used data from the same service for one month between cess. However, it is possible to keep the climatic conditions inside the
March 1, 2019, and March 31, 2019. greenhouse favorable, directly influencing other variables, such as
Importantly, INMET weather data service does not provide absolute relative humidity and absolute humidity, through these devices’ coor­
humidity measurements. This way, we calculate it through Eq. (5) [20]: dination. For example, generating heat inside the greenhouse through
( )
the heater or reducing the heat exchange with the external environment
through the exhaust fan [8]. Fig. 3 (a) presents the model that represents
17.67×T
T+243.5
6.112 × e × RH × 2.1674
AH = , (5) the heater and exhaust fan.
273.15 + T
In this model, the controllable variable c (boolean) defines the
which is accurate within 0.1% in the temperature range from − 30 ◦ C to transitions between the states ON and OFF. The variable device_s, rep­
+35 ◦ C. This equation uses the relative humidity (RH) and air temper­ resents the current state of the device. This model in the BZR language is
ature (T). Finally, we interpolated these data using Lagrange’s poly­ identical to model presented in Listing 1 (Section 2).
nomial interpolation method [21] to obtain measurements per unit of From the rules presented in Table 1, we model a second automaton
second. (Fig. 3(b)) to represent an event analyzer that defines which rule is
associated with the occurrence of a given event. The Heptagon/BZR
language allows to declare an abstract data type using the type language
4.2. Greenhouse setup reserved word. In the first line, event is defined as a type. Three instances
of this type are presented: E1, E2, and E3, which represent each of the
We consider a greenhouse with A-frame structure and polyethylene
cover has its height, the ratio of glazing surface to the floor surface, the
Table 1
heat transmission coefficient of glazing, and transmittance defined as
Events designed for greenhouse controller.
H = 4, w = 2.2, k = 6.2, τc = 0.87, respectively [18]. In addition,
Event Action
ρg = 0.5 is presented as the light reflection capacity for polyethylene
toppings. Rule 1 tin < 24 heater & not fan
The ventilation settings are based on their ability to change the Rule 2 tin > 27 & srout < 100 not heater & not fan
Rule 3 tin > 38 not heater & fan
ventilation rate (qv ) of the greenhouse, representing the air exchanges

4
D. de Freitas Bezerra et al. Sustainable Computing: Informatics and Systems 35 (2022) 100679

(continued )
fan = inlined device(c_fan);
trigger = inlined event_checker(tin, srout);
tel

The contract is defined at the main node, represented by the node


smart_greenhouse (Listing 4). Note that this node has the same input as
the event_checker node, producing in response the actuators’ states and
which event was triggered (trigger). The heater, fan, and event_checker
automaton are instanced at lines 16, 17, and 18.
Although the same automaton represents the heater and the fan, they
are independent and have their controllable events. To ensure that the
rules are met, the controller acts on each automaton through the vari­
ables c_heater and c_fan. Whenever an event is triggered, it is checked
through the switch, defining what action should be taken by the
controller (lines 4 to 10).
We defined the controller model and submitted it to the automatic
synthesis process using Heptagon/BZR and Sigali. The syntax and con­
sistency of the model and rules were verified, generating a correct
controller. In the end, the controller can be deployed in IoT devices
(such as a Raspberry Pi) to act in the environment’s control.

6. Results
Fig. 3. Controller nodes model.
Using the SciPy library,1 we developed a Python-based simulator to
events presented by the rules (Table 1). solve the greenhouse model (Section 4). This simulator was deployed on
As input variables, the event_checker receives the air temperature a machine with an Intel Core i5 4200U Processor, 8 GB RAM, 120 GB
measured inside the greenhouse (tin) and the external solar radiation SSD, operating on the Linux OS (Debian 10). We deployed the controller
(srout). As output variable, it returns an instance of type event, that on a virtual machine running Linux OS (Ubuntu 16.04) with a 1.60 GHz
represents which event occurred according to the input variables. The single-core CPU and 1 GB RAM. We recorded the measurements of air
transitions between E1, E2 and E3 (lines 5, 9, and 13) are defined by temperature and absolute humidity for each second of simulation time.
events described at each rule (Table 1). After, we obtain a dynamic response for temperature and absolute
humidity conditions inside the greenhouse. As the simulation requests
Listing 3. Event checker node model. the controller (every minute), the controller returns the actuators’ status
type event = E1 | E2 | E3 according to the rules defined. The simulator sends the climate mea­
node event_checker(tin,srout:int) returns (event: event) surements and receives the states where the actuators must comply with
let the control rules. Fig. 4 represents the communication between the
automaton
simulator and the controller using a wireless 802.11 network.
state E1 do
event = Event1; Fig. 5 presents the results at 24-hour intervals in different seasons of
unless (tin > 27 &srout < 100) then E2 the year. The red lines represent the air temperature inside the green­
| (tin > 38) then E3 house, considering that the air changes are performed only by natural
state E2 do ventilation, without the devices acting. The green lines represent the air
temperature when the devices are acting according to the rules. Finally,
event = Event2;
unless (tin < 24) then E2
| (tin > 38) then E3 the blue lines represent the air temperature outside the greenhouse,
state E3 do obtained from INMET.
event = Event3; Note that at all seasons of the year, in the absence of control, for most
unless (tin < 24) then E1
of the daytime – between 8:00 and 17:00 – the air temperature inside the
| (tin > 27 &srout < 100) then E2
end greenhouse ranges from 40 ◦ C to 65 ◦ C, which is above the upper
tel threshold defined as ideal (38 ◦ C). However, in the controlled scenario,
the air temperature is within the ideal range, producing a much more
comfortable climate for the crop. Another interesting fact is that the
Listing 4. Contract node model. internal temperature tends to be equal to the external temperature
node smart_greenhouse(tin,srout: int) returns (heater,fan: bool; without radiation. However, the external temperature is not always
trigger: event) within the ideal thresholds. Note that in Fig. 5 (Spring), the outside air
contract temperature between 00:00 and 10:00 is less than ideal. The same can be
var rule: bool; observed in Summer (between 5:00 and 9:00) and Spring (between
22:00 and 00:00). In these cases, the heater’s activation allows the
let
switch trigger
| E1 do rule=heater &not fan; temperature at night to remain at the expected range.
| E2 do rule=not heater &not fan; Fig. 6 presents the absolute humidity measurements obtained in the
| E3 do rule=not heater &fan; simulation. As in the previous figure, the red, green, and blue lines
end
represent the absolute humidity inside the greenhouse with natural
tel
enforce rule
ventilation, with devices acting, and outside the greenhouse,
with (c_heater, c_fan: bool)
let
heater = inlined device(c_heater);
(continued on next column) 1
https://bit.ly/3bx3ovp.

5
D. de Freitas Bezerra et al. Sustainable Computing: Informatics and Systems 35 (2022) 100679

Fig. 4. Communication between the greenhouse simulator and the controller.

Fig. 5. Simulation results for air temperature.

respectively. simple control in which the farmer schedules the devices’ performance
The controller’s role in controlling the temperature also directly in­ according to the time of day. Thus, at 5:40 am, the ventilation system is
fluences the absolute humidity measurements. In the uncontrolled sce­ switched on and off at 5:55 pm. These intervals are defined based on
nario, we can see that the increase in water loss due to solar radiation incidence under one hundred watts per square meter.
evapotranspiration occurs at warmer times (between 8:00 and 17:00). Finally, we define the control strategy based on the control rules pre­
With the controller’s action (green lines), water loss is controlled, sented in Table 1 as a smart control.
peaking during the early morning hours in summer, autumn, and spring Fig. 8(a) and (b) present the results obtained in this experiment. For
due to solar radiation incidence after a long period without exposure to image legibility reasons, they present only 24 h of this experiment,
light – i.e., at night. comparing each strategy. Fig. 8(a) shows the temperature measured
From absolute humidity and temperature data obtained in the over that interval, and Fig. 8(b) shows the relative humidity
simulation, Fig. 7 presents the results for relative humidity. Observing measurements.
the behavior of relative humidity and absolute humidity variables inside Note that even when the temperature is within the thresholds
the greenhouse is essential because it is only possible to obtain the best accepted by the crop, the controller activates the heater based on a
plant growth within a specific humidity range. Very high relative hu­ simple control strategy, causing the temperature to be higher than ex­
midity favors fungal growth, causing disease in the crop, and a dry pected. On the other hand, a control strategy based on defined rules was
environment slows down plant growth. The most favorable relative more efficient, respecting such temperature ranges. The relative hu­
humidity depends on the cultivated plant species, with a typical range midity behavior, as expected, is strongly correlated to that of tempera­
ranging from 60% to 90% [22]. Crops such as cucumber and watermelon ture. For example, in a scenario where there is no control, the relative
require relative humidity intervals between 70% to 90%, and 65% to humidity reaches values below 20%, much lower than the ideal mea­
75%, respectively [22]. The controlled scenario kept this metric closer to sures for crops such as cucumber or watermelon.
the acceptable thresholds.
The second experiment analyses the temperature and relative hu­ 7. Discussion
midity inside the greenhouse over a month. For this analysis, we
consider three approaches. The first approach considered that no type of As the results present, the controller synthesized provides a
controller acts inside the greenhouse. The second approach considers a controller capable of meeting control rules defined in the modeling

6
D. de Freitas Bezerra et al. Sustainable Computing: Informatics and Systems 35 (2022) 100679

Fig. 6. Simulation results for absolute humidity.

Fig. 7. Simulation results for relative humidity.

process, ensuring that its synthesis is only possible when the model does considering intervals of 24 h. This approach allowed us to analyze the
not present conflicting rules. In other words, if a rule defines that the temperature, absolute humidity, and relative humidity on different days
device must be turned on, a second rule cannot turn off under the same of the seasons, according to Figs. 5, 6, and 7 . In the second experiment,
conditions. we analyze the synthesized controller efficiency. Here, we define effi­
In the first experiment, we prioritized crops’ thermal comfort ciency as the percentage of time that the temperature and relative hu­
adapted to the hot climate. The controller met the set of rules midity inside the greenhouse met each crop’s requirements. Fig. 9(a)

7
D. de Freitas Bezerra et al. Sustainable Computing: Informatics and Systems 35 (2022) 100679

Fig. 8. Temperature and relative humidity behavior based on each control strategy.

Fig. 9. Temperature and relative humidity behaviors, and energy consumption for each control strategy.

and (b) present these metrics over one month. more than absolute humidity. Another factor is the absence of a more
Note that when no device acts over a month (no control), the tem­ suitable device for generating specific humidity in the environment.
perature inside the greenhouse tends to be outside the thresholds, Although the synthesized controller has not shown significant gains
achieving only 41.88% efficiency (Fig. 9(a)). The simple control reached in relative humidity behavior, this can provide lower production costs
52.71%. However, the temperature increases at night due to the heater than simple control, directly impacting energy consumption. By
acting. Since this approach did not consider data analysis inside the continuously analyzing the greenhouse conditions to control the devices
greenhouse, it was inefficient almost half the time. The smart control and respecting the crop’s thermal comfort through the rules, it turns on
was the most efficient (86.81%). This last approach has the advantage of each actuator only when necessary, avoiding energy waste. A simple
constantly analyzing the greenhouse’s climatic conditions and acting control turns the heater on even when it is not needed during the night.
when necessary. Fig. 9(c) shows each device’s energy consumption for each control
Fig. 9(b) presents the same analysis to relative humidity behavior. strategy over one month.
The relative humidity efficiency of cucumber production reaches While the total energy consumption in the simple control was
65.27%, 62.97%, and 45.55% for smart, simple, and no control ap­ 10,965 kWh over one month, the smart control was about 66% more
proaches, respectively. The efficiency of the watermelon production was cost-effective (3,675 kWh). It is worth mentioning that while the un­
lower than the cucumber, 34.90%, 33.22%, and 15.02% for the same controlled approach does not consume energy, since there are no devices
control approaches. acting, the efficiency is about 50% lower than with the synthesized
The efficiency based on relative humidity does not present a signif­ controller.
icant difference between the control approaches. It can be justified In all cases, the synthesized controller proved to be efficient. Note
because the relative humidity intervals required by these crops are too that to meet other plants’ requirements, we can redefine the model’s
small. Although there is a correlation between relative and absolute rules and synthesize a new controller for this purpose. Besides, this
humidity, the temperature variation significantly affects this variation approach has shown significant gains in energy consumption, which can

8
D. de Freitas Bezerra et al. Sustainable Computing: Informatics and Systems 35 (2022) 100679

deliver greater productivity by ensuring thermal comfort and rational 8459, Springer Berlin Heidelberg, Berlin, Heidelberg, 2014, pp. 33–48, doi:
10.1007/978-3-662-43376-8_3.
energy use, avoiding waste.
[13] M. Zhao, G. Privat, E. Rutten, H. Alla, Discrete control for the Internet of Things
and smart environments, in: Presented as part of the 8th International Workshop
8. Conclusion on Feedback Computing, San Jose, CA, 2013.
[14] S. Aboubekr, G. Delaval, R. Pissard-Gibollet, E. Rutten, D. Simon, Automatic
generation of discrete handlers of real-time continuous control tasks, IFAC Proc.
In this paper, we present a control solution based on DCS to develop Vol. 44 (1) (2011) 786–793.
an agricultural greenhouse controller. In this context, the actuators were [15] S. Arias, F. Boudin, R. Pissard-Gibollet, D. Simon, Orccad robot controller model
modeled based on automaton formalism. A set of rules was defined and its support using eclipse modeling tools, in: 5th National Conference on
Control Architecture of Robots, Douai, France, 2010.
based on the thermal requirements of crop type, allowing the automatic [16] M.B. Fernandes, B.A. Costa, J.M. Lemos, Hydroponic greenhouse crop
generation of a controller to coordinate each actuator’s behavior. As a optimization, in: 2018 13th APCA International Conference on Control and Soft
validation, a greenhouse simulator was implemented to which the Computing (CONTROLO), IEEE, Ponta Delgada, 2018, pp. 270–275, doi:10.1109/
CONTROLO.2018.8514264.
controller was applied to control the greenhouse’s air temperature. This [17] P. Majumdar, S. Mitra, IoT and machine learning-based approaches for real time
approach made it possible to verify the controller’s efficiency environment parameters monitoring in agriculture: an empirical review,
throughout the four seasons and the adopted control strategy, guaran­ Agricultural Informatics: Automation Using the IoT and Machine Learning (2021)
89–115.
teeing the thermal comfort of the crop, minimizing water loss and en­ [18] E. Fitz-Rodríguez, C. Kubota, G.A. Giacomelli, M.E. Tignor, S.B. Wilson,
ergy consumption. M. McMahon, Dynamic modeling and simulation of greenhouse environments
As future work, we intend to enrich our models with more types of under several scenarios: a web-based application, Comput. Electron. Agric. 70 (1)
(2010) 105–116, https://doi.org/10.1016/j.compag.2009.09.010.
entities, incorporating a device model capable of acting in the genera­
[19] INMET, Rede de estações meteorológicas automáticas do inmet, Tech. rep.,
tion of specific humidity into the simulator. We believe that new control Instituto Nacional de Meteorologia, 2011. http://www.inmet.gov.br/.
rules based on relative humidity could increase the controller efficiency [20] H. Li, C.D. Rosebrock, N. Riefler, T. Wriedt, L. Mädler, Experimental investigations
significantly. on the effects of water vapor and oxygen concentrations in the ambience on the
burning constant, lifetime and residuals of single isolated xylene, isobutanol and
ethanol droplets, Exp. Therm. Fluid Sci. 109 (2019) 1–9, https://doi.org/10.1016/
Declaration of Competing Interest j.expthermflusci.2019.109920.
[21] P. Rules, Department of computer science and engineering the Chinese University
of Hong Kong Shatin, Hong Kong, Fut. Direct. Fuzzy Theory Syst. (1995) 129.
The authors report no declarations of interest. [22] P. Ponce, A. Molina, P. Cepeda, E. Lugo, B. MacCleery, Greenhouse Design and
Control, CRC Press, 2014.
Acknowledgements

The authors would like to thank Foundation for the Support of Sci­ Diego de Freitas Bezerra is B.Sc. in Computer Science and
received his M.Sc. degree in Applied Informatics from Federal
ence and Technology of the State of Pernambuco (FACEPE) (IBPG-0188- Rural University of Pernambuco. Currently, is a Ph.D. student
1.03/18) and National Council for Scientific and Technological Devel­ in Computer Science at Federal University of Pernambuco. His
opment (CNPq) (Process 424979/2016-0) for their financial support. research interests include: Self-Adaptive Systems; Machine
Learning; and Internet of Things.

References

[1] P. Asghari, A.M. Rahmani, H.H.S. Javadi, Internet of Things applications: a


systematic review, Comput. Netw. 148 (2019) 241–261, https://doi.org/10.1016/
j.comnet.2018.12.008.
[2] A. Souri, A. Hussien, M. Hoseyninezhad, M. Norouzi, A systematic review of IoT
communication strategies for an efficient smart environment, Trans. Emerg.
Telecommun. Technol. (2019).
[3] J.M. Talavera, L.E. Tobón, J.A. Gómez, M.A. Culman, J.M. Aranda, D.T. Parra, L.
A. Quiroz, A. Hoyos, L.E. Garreta, Review of IoT applications in agro-industrial and Victor Wanderley Costa de Medeiros is a professor at Federal
environmental fields, Comput. Electron. Agric. 142 (2017) 283–297, https://doi. University of Pernambuco since 2013. He received his Ph.D.
org/10.1016/j.compag.2017.09.015. degree in Computer Science from the Federal University of
[4] P. Schreinemachers, M.-h. Wu, M.N. Uddin, S. Ahmad, P. Hanson, Farmer training Pernambuco in 2013. His research interests include: Internet of
in off-season vegetables: effects on income and pesticide use in Bangladesh, Food Things; Distributed Systems; and High Performance
Policy 61 (2016) 132–140, https://doi.org/10.1016/j.foodpol.2016.03.002. Computing.
[5] L. Li, K. Cheng, J. Pan, Design and application of intelligent control system for
greenhouse environment, in: 2017 7th International Conference on Power
Electronics Systems and Applications-Smart Mobility, Power Transfer & Security
(PESA), IEEE, 2017, pp. 1–5.
[6] A.N. Sylla, M. Louvel, E. Rutten, G. Delaval, Modular and hierarchical discrete
control for applications and middleware deployment in IoT and smart buildings, in:
2018 IEEE Conference on Control Technology and Applications (CCTA), IEEE,
Copenhagen, 2018, pp. 1472–1479, doi:10.1109/CCTA.2018.8511406.
[7] C.G. Cassandras, S. Lafortune, Introduction to Discrete Event Systems, Springer
Science & Business Media, 2009.
Glauco Estácio Gonçalves is a professor at Federal University
[8] S. Revathi, T. Radhakrishnan, N. Sivakumaran, Climate control in greenhouse
of Pará since 2021. He received his Ph.D. degree in Computer
using intelligent control algorithms, 2017 American Control Conference (ACC),
Science from the Federal University of Pernambuco in 2012.
IEEE (2017) 887–892.
His research interests include: Resource Allocation; Cloud
[9] A. Gatouillat, Y. Badr, B. Massot, Smart and safe self-adaption of connected devices
Computing; and Smart Farming Applications.
based on discrete controllers, IET Softw. 13 (1) (2018) 49–59.
[10] D. de Freitas Bezerra, V.W.C. de Medeiros, G.E. Gonçalves, Towards a control-as-a-
service architecture for smart environments, Simul. Model. Pract. Theory 107
(2021) 102194, https://doi.org/10.1016/j.simpat.2020.102194. http://www.sci
encedirect.com/science/article/pii/S1569190X20301337.
[11] G. Delaval, E. Rutten, H. Marchand, Integrating discrete controller synthesis into a
reactive programming language compiler, Discrete Event Dyn. Syst. 23 (4) (2013)
385–418, doi:10.1007/s10626-013-0163-5.
[12] J. Cano, G. Delaval, E. Rutten, Coordination of ECA rules by verification and
control, in: E. Kühn, R. Pugliese (Eds.), Coordination Models and Languages, vol.

You might also like