Mathematical Problems in Engineering

Volume 2013 (2013), Article ID 639306, 9 pages

http://dx.doi.org/10.1155/2013/639306

## Greenhouse Modeling Using Continuous Timed Petri Nets

^{1}ITESM Campus Guadalajara, Avenida General Ramón Corona 2514, Colonia Nuevo México, 45201 Zapopan, JAL, Mexico^{2}CINVESTAV-IPN, Unidad Guadalajara, Avenida del Bosque 1145, 45019 Zapopan, JAL, Mexico

Received 5 April 2013; Revised 21 June 2013; Accepted 21 June 2013

Academic Editor: Hamid Reza Karimi

Copyright © 2013 José Luis Tovany et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

This paper presents a continuous timed Petri nets (ContPNs) based greenhouse modeling methodology. The presented methodology is based on the definition of elementary ContPN modules which are designed to capture the components of a general energy and mass balance differential equation, like parts that are reducing or increasing variables, such as heat, CO_{2} concentration, and humidity. The semantics of ContPN is also extended in order to deal with variables depending on external greenhouse variables, such as solar radiation. Each external variable is represented by a place whose marking depends on an *a priori* known function, for instance, the solar radiation function of the greenhouse site, which can be obtained statistically. The modeling methodology is illustrated with a greenhouse modeling example.

#### 1. Introduction

Greenhouses allow increasing the quantity and improve the quality of the crops produced inside them. The automation of greenhouses has been one of the main topics regarding greenhouse functioning and production, since using control loops, tuned as the agronomist and biologist researchers propose, improves the use of water, energy, and fertilizers. Simultaneously, the volume and quality of crops are increased.

One of the main problems in controlling greenhouses is obtaining a fine mathematical greenhouse model capturing the actual greenhouse behavior since the models are represented by nonlinear differential equations including disturbances where the parameters are time variant. The derived models lead to very complex differential equations and they are hard to obtain.

In order to obtain a greenhouse model, researchers use many approaches; most of them are based on heat and mass balance equations. In [1], a greenhouse model, including natural ventilation and evaporative cooling, is presented. The authors use heat and mass balance equations to derive the model. Since that approach includes a linearization stage, the model is valid only around the operating point. Another approach deals with linear and nonlinear identification of the greenhouse behavior using neural networks [2]. This method uses, however, a large amount of data samples due to their large number of degrees of freedom, and it also requires a large computation time for training the neuronal network. In [3] a robust method for nonlinear identification of a climate system using evolutionary algorithms was proposed. Although the model is validated, the convergence of the algorithm could be too long. In [4] a fuzzy model of a greenhouse by taking heat and water measurements is proposed. However, the number of fuzzy rules needed to compute an actual greenhouse model is too large and it is not clear how to find out the rules.

The approach herein presented uses continuous timed Petri nets [5, 6] to capture the greenhouse dynamics. We propose a bottom-up modeling methodology: first, elementary modules (balance, generation, consumption, and fluid balance) are defined to represent the basic components of an energy and mass balance equation such as storage, source, loss, generation, and consumption of mass or energy. A balance module representing any energy or mass balance equation is obtained by merging these elementary modules. Then, a model is constructed for each greenhouse state variable, adding as many elementary modules as components exist in the energy and mass balance equation. Afterwards the model parameters are identified and represented by the parameters, such as marking and transition firing rates.

The greenhouse modeling methodology presented in this paper provides a pictorial representation of variables which allows easy understanding of the interaction between places (variables). Also, the model allows having a modular model where elements can be added or removed as necessary. The lack of negative values in Petri nets does not affect the system modeling because the greenhouse climate (temperature, water vapor concentration, and CO_{2} concentration) is a positive system.

This work is organized as follows. In Section 2, some concepts about Petri nets are presented and the extended semantics is proposed. In Section 3, a Petri net modeling procedure for greenhouses is proposed. Section 4 presents an example of a greenhouse modeled with . Finally, in Section 5 some conclusions are given.

#### 2. Preliminaries

##### 2.1. Petri Nets Concepts

This subsection introduces basic concepts on continuous timed Petri nets. In order to have more detailed information, an interested reader may also consult [7–10].

*Definition 1. *A continuous Petri net is a pair , where is a Petri net structure and is the initial marking, and and are finite sets of elements named places and transitions, respectively. are the pre- and postincidence matrices, where represents the weight of the arc going from to (from to ).

The incidence matrix denoted by is defined by . Right and left annullers of are called - and -*flows*, respectively.

Each place has a marking denoted by . Let ; then the set , is the preset (postset) of .

A transition is enabled at marking if and only if, , . Its enabling degree is given by

The enabling degree determines the maximum amount of that can be fired at marking leading to a new marking; thus where .

If is reachable from by firing the finite sequence of enabled transitions, then is named the state equation, where is the firing count vector; that is, is the cumulative amount of firing of in the sequence .

The set of all reachable markings from is called the reachability set and it is denoted by . In the case of a system, is a convex set [11].

A is bounded when every place is bounded; that is, for all, s.t. at every reachable marking , and it is live when every transition is live (it can ultimately be fired from every reachable marking) [8].

*Definition 2. *A continuous timed Petri net is a 3-tuple , where is a and is a function associating a firing rate with each transition.

The state equation of a is
where is the time variable, .

*Definition 3. *A is called infinite server semantic if the flow of a transition is
where is the flow of transition and the th entry of the vector .

Notice that under infinite server semantics can actually be considered as a piecewise linear system (a class of hybrid systems) due to the operator that appears in the enabling function in the flow definition. Equation (2) can be expressed as a piecewise linear system given by

The firing rate matrix is denoted by . A configuration of a at is a set of arcs describing the effective flow of all transitions:

*Definition 4. *A is called *product server semantic * if the flow of a transition is

In order to apply a control action in (2), a subtracting term , such that , is added to every transition to indicate that its flow can be reduced. This control action is adequate because it captures the real behavior that the maximum machine throughput can only be reduced. Thus, the controlled flow of transition becomes . Then, introducing and in (2) the forced state equation is

In order to obtain a simplified version of the state equation, the input vector is rewritten as , where and . Then the matrix is constructed and the state equation can be rewritten as
Notice that . A transition is called noncontrollable when its flow cannot be reduced. Every non-controllable transition has associated a constant input control .

##### 2.2. with Extended Semantics

Regular models do not include disturbances and nonlinearities; therefore it is required to add semantics that allow us to incorporate them.

*Definition 5. *A place is called a *function place* if its marking at time is determined by the actual marking of other places or external disturbances. Thus, the marking of a *function place * is described by
where is the marking of place at time , is a known function, and is a measurable disturbance.

Notice that the marking of *function places* is not determined directly by the differential equations. Also, since *function places* are mainly seen as disturbances, their markings do not represent controllable variables.

*Definition 6. *A that includes function places is called a with extended semantics.

From now on, all in this paper are considered with extended semantics.

##### 2.3. Mass and Energy Balance Equations

From experience, it is well known that matter and energy may change their form, but they cannot be created or destroyed. This notion is expressed in the general mass and energy balance equation: where is the accumulated quantity (final amount of quantity minus initial amount of quantity) inside the system boundary during the time interval , is the amount of quantity entering the system through the system boundary, is the amount of quantity leaving the system through the system boundary, is the amount of quantity generated (i.e., formed) inside the system boundary, is the amount of quantity consumed (i.e., converted to another form) inside the system boundary, and a quantity may be in any mass or heat unit.

#### 3. Modeling Methodology

##### 3.1. Greenhouse System

A greenhouse is a building which isolates the crop from the outside environment, preventing it from hazards such as extreme climate changes and plagues. Also, it improves the crop production by means of the greenhouse climate manipulation, provided through some components that can be added: temperature can be manipulated by means of ventilation, heating systems, and water sprinklers; water concentration can be manipulated by means of humidifiers, water sprinklers, ventilation, and fans; luminosity can be manipulated by means of shaded mesh and light bulbs; carbon dioxide concentration can be manipulated by means of CO_{2} injectors. Notice that some components affect more than one climate variable. The selection of components varies depending on the geographical area and economical factors.

Nevertheless, all environmental influences over a greenhouse, manipulated or not, fulfill the energy and mass balance equation (10). For example, a simple heat balance equation is depicted in Figure 1, where the heat source, for instance, solar radiation, is the heat entering into a greenhouse system; the heat storage, the greenhouse itself, is the heat absorbed by the greenhouse system; and the heat to surroundings, for instance by ventilation, is the heat loss outside the greenhouse system.

For the generated and consumed flows, some examples are as follows: the energy gained from condensation is part of the generated heat ; the energy consumed by evaporative cooling is part of the heat consumed .

Therefore, we propose a modeling approach based on the construction of modules that represent each component of the balance equation.

##### 3.2. Elementary Modules

Some modules are defined in order to represent the flows in the balance equation. A first approach to a balance module is obtained from Figure 2.

The of Figure 2 has the following matrices:

Thus, the marking equations are given by

The balance of the marking is given when the steady state markings of and are equal. So, the equilibrium points of the previous equations must be . Thus, the required relationships are

Replacing the latter relationships, the equations of the marking are

For example, given a temperature in and a different temperature in , the difference between and is given by the heat capacity of each system.

In order to prove that the equilibrium points are stable, the Lyapunov function is used, where the derivative of is given by which is negative for any , so the equilibrium points are stable.

The number of tokens in the steady state depends on the initial values and . The marking at the equilibrium point can be separated in three cases: , , and .

If , gains (or losses) tokens faster than losses (or gains) them, so the steady state marking value is closer to. If , gains (or losses) tokens faster thanlosses (or gains) them, so the steady state marking value is closer to. In case , the steady state marking is given by .

The balance module as presented in Figure 2 with restrictions (13) can be represented as the of Figure 3 when one of the variables is measured ( is a *function place*) and its dynamics are not modeled. In order to represent a balance, the transitions and have the same firing rate . Thus, the equation of the of Figure 3 is

For generation and consumption flows, the of Figures 4 and 5 are used, respectively.

The heat and mass balance can be carried out by a fluid that affects proportionally the transfer between variables. In that case, a as in Figure 6 is used. This is defined with product semantics in order to represent the product of the fluid with the variables and .

There are modules dependent on a device, but the device dynamics is considered to be faster than the greenhouse dynamics, so the dynamics of the devices are not modeled. The only difference is that transitions related to devices are controllable; that is, the transitions of a device module have the form as stated in Section 2.

##### 3.3. Greenhouse Model

Since every greenhouse physical variable fulfills the energy and mass balance equation, we propose a modeling approach based on the construction of modules as described in the following.

###### 3.3.1. Modeling Procedure

(1) Create places for variables and *function places* for disturbances. Variable places capture the greenhouse variables (such as soil temperature, air temeprature, and CO_{2} concentration) and *function places* capture external variables (such as solar radiation and external temperature) (2) Construct a module for each variable of interest in the greenhouse.(2a) A balance module is associated with each physical exchange (heat or mass) affecting the corresponding variable (e.g., ventilation, conduction). (2b) A generator module is associated to each physical transformation inside the greenhouse which increases the corresponding variable (e.g., evapotranspiration). (2c) A consumption module is associated with each physical transformation inside the greenhouse which decreases the corresponding variable (e.g., condensation, evapotranspiration).(2d) A fluid balance module is associated with each physical exchange (heat or mass) affecting the corresponding variable with the proportional effect of a fluid (e.g., natural ventilation). (3) Merge all constructed balance modules. (4) Identify the model parameters.

Following the previous procedure we obtain the *greenhouse ** model*. For a practical illustration, we show in the next section the greenhouse modeling of two climate variables: temperature and water vapor concentration.

#### 4. Greenhouse Modeling Example

Consider the greenhouse climate system of Figure 7. We want to obtain the greenhouse temperature and water vapor concentration model. According to step 1 of the modeling procedure, we have to associate places for the involved variables: greenhouse temperature , soil temperature , and one for the vapor concentration as shown in Table 1.

The *function places* associated with the other variables are to solar radiation , to outside temperature , to subsoil temperature , to outside water vapor concentration , for wind speed , to humidifier maximum water flow , and to water condensation .

Following step 2, for the greenhouse temperature we construct generation module for solar radiation and condensation ; consumption module for the humidifier ; balance module for soil temperature , leaks nondependent on wind and conduction through cover ; and fluid balance module for leaks dependent on wind and controlled natural ventilation .

For the greenhouse humidity we construct: generation module for humidifier ; consumption module for condensation ; balance module for outside humidity leaks nondependent on wind ; and fluid balance module for leaks dependent on wind and controlled natural ventilation .

Since soil temperature is also modeled, we construct balance module for greenhouse temperature and subsoil temperature . Then, modules for each variable are constructed as shown in Table 2.

Then, we merge all constructed modules. Thus, we obtain the depicted in Figure 8, with state equations:

Solar radiation , soil temperature , outside temperature , water vapor condensation , humidifier , and outside humidity concentration are considered as random, albeit measurable. This is because, along the day, these environmental variables are changing; nevertheless, we can add sensors in order to measure them.

It has to be noted that the energy balance between and is related by and, since a balance module is used, , so the balance can be referred to as which is an energy exchange.

A similar procedure can be done for the remaining terms of , , and are related by a balance module, and by two-fluid balance module (one is controllable, but the other is not); it gains energy from ; it also gains and loses water because of and , respectively. It has to be noted that, for a greenhouse temperature above 273°K, the tokens in will be higher than the tokens in and .

In the case of , the relations are only balance modules between and or . For , there is a balance module between and ; and are related by two-fluid balance module (one is controllable, but the other is not); it gains and loses water because of and , respectively.

The identification of the model parameters can be carried out according to the preferred method. In this example, the least square method is used. The model proposed in [12] is taken as the real system and the model depicted in Figure 8 will be the identified model. In order to simplify the method, the identification is carried out in two steps. In the first one the firing of controllable transitions is avoided (i.e., the parameters associated with noncontrollable transitions are computed). These parameters are fed to the second identification step. In this step the parameters associated with controllable transitions are derived and the whole model is obtained.

We are using the parameters values presented in [12, Chapter 7, pp. 135–150] without any crop inside the greenhouse and heating pipes are not considered. Besides, we add humidifier dynamics and external weather variables are considered as a sine function at different frequencies and amplitudes. The identification was carried out using the least squares method. The simulation time for the original model is 8 hours, so the functions used to approximate the external variables are positive during the simulation time. The following external variables were considered for the identification:

The percentage of use of the actuators is presented as follows:

The initial conditions are

In order to validate the proposed modeling methodology, we now present a comparison between our model and the one proposed by [12]. All the simulations and identification were carried out in MATLAB and Simulink.

In Figure 9, a comparison between the greenhouse temperature model and the one used by [12] is presented. In Figure 10, a comparison between the greenhouse humidity model and the one used by [12] is presented. From these figures, it can be seen that the proposed modeling methodology shows a good agreement with the original system, capturing in an accurate way the dynamic behavior of the greenhouses variables. The error ( and ) between the original system and the identified system is less than .

In order to demonstrate the accuracy of the proposed modeling methodology under a real and severe scenario, another identification is carried out using real data for , , , and (see Figure 11), in the winter of 2012, from a greenhouse prototype located in Jalisco, Mexico. The other external disturbances , , and are taken as in (18) and (19). The initial conditions are the same as in (20). It can be seen in Figures 12 and 13 that the identified model has a small error in comparison to the original model which is still less than .

#### 5. Conclusions

The greenhouse modeling methodology presented in this paper provides a pictorial representation of variables which allows easy understanding of the interaction between them. The bounds in actuators are represented naturally by the marking of a place as in the case of the humidifier. In the case of the humidifier, although the tokens flow from its place can be reduced with the control, the representing place is a source place because the tokens are constant and they represent the maximum capacity of water flow.

The most important point is that it allows having a modular model. Thus, elements can be added or removed as necessary. Also, the lack of negative values in do not affect the system modeling because the greenhouse climate (temperature, water vapor concentration, and CO_{2} concentration) is a positive system.

The simulation contains fixed parameters for the original system, but a greenhouse parameter may change according to certain variables which will provide bigger variations in the model and the need to identify constantly in order to change the model parameters that represent better the greenhouse. Future work will include the identification of a real greenhouse prototype and its control design.

#### Acknowledgments

This work was supported by project no. 107195, CONACyT, Mexico. J. L. Tovany and R. Ross-León were supported by CONACyT, Grants nos. 300891 and 13527, respectively.

#### References

- T. Boulard and A. Baille, “A simple greenhouse climate control model incorporating effects of ventilation and evaporative cooling,”
*Agricultural and Forest Meteorology*, vol. 65, no. 3-4, pp. 145–157, 1993. View at Google Scholar · View at Scopus - J. B. Cunha, “Greenhouse climate models: an overview,” in
*Proceedings of the 4th European Federation for Information Technologies in Agriculture, Food and the Environment Conference (EFITA '03)*, Debrecen, Hungary, 2003. - J. M. Herrero, X. Blasco, M. Martínez, C. Ramos, and J. Sanchis, “Robust identification of non-linear greenhouse model using evolutionary algorithms,”
*Control Engineering Practice*, vol. 16, no. 5, pp. 515–530, 2008. View at Publisher · View at Google Scholar · View at Scopus - P. Salgado and J. B. Cunha, “Greenhouse climate hierarchical fuzzy modelling,”
*Control Engineering Practice*, vol. 13, no. 5, pp. 613–628, 2005. View at Publisher · View at Google Scholar · View at Scopus - M. Kloetzer, C. Mahulea, C. Belta, and M. Silva, “An automated framework for formal verification of timed continuous petri nets,”
*IEEE Transactions on Industrial Informatics*, vol. 6, no. 3, pp. 460–471, 2010. View at Publisher · View at Google Scholar · View at Scopus - C. R. Vazquez and M. Silva, “Timing-dependent boundedness and liveness in continuous petri nets,” in
*Proceedings of the 10th International Workshop on Discrete Event Systems (WODES '10)*, pp. 10–17, 2010. - R. David and H. Alla,
*Discrete, Continuous, and Hybrid Petri Nets*, Springer, Berlin, Germany, 2005. View at Zentralblatt MATH · View at MathSciNet - J. Desel and J. Esparza,
*Free Choice Petri Nets*, vol. 40 of*Cambridge Tracts in Theoretical Computer Science*, Cambridge University Press, Cambridge, UK, 1995. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - C. Mahulea, A. Ramírez-Treviño, L. Recalde, and M. Silva, “Steady-state control reference and token conservation laws in continuous petri net systems,”
*IEEE Transactions on Automation Science and Engineering*, vol. 5, no. 2, pp. 307–320, 2008. View at Publisher · View at Google Scholar · View at Scopus - M. Silva and L. Recalde, “Petri nets and integrality relaxations: a view of continuous petri net models,”
*IEEE Transactions on Systems, Man and Cybernetics C*, vol. 32, no. 4, pp. 314–327, 2002. View at Publisher · View at Google Scholar · View at Scopus - M. Silva and L. Recalde, “On fluidification of Petri Nets: from discrete to hybrid and continuous models,”
*Annual Reviews in Control*, vol. 28, no. 2, pp. 253–266, 2004. View at Publisher · View at Google Scholar · View at Scopus - G. van Straten, G. van Willigenburg, E. van Henten, and R. van Ooteghem,
*Optimal Control of Greenhouse Cultivation*, CRC Press, New York, NY, USA, 2010.