You are on page 1of 10

The real time modeling of water resources systems using Petri-nets

Jiri Zezulak
Dept. of water resources, Forestry Faculty, Czech Agricultural University, Prague, CR
Jakub Krejci
AquaLogic Consulting, Prague, CR

ABSTRACT: In non-stationary topological coding of individual units of water resources system, Petri-net
algorithm offers a powerful tool for decomposition of a system and for subsequent user-independent
numerical simulation. The case system, consisting of several reservoir control-units and having hydrologic
processes related, could be represented by a bipartite graph. Non-stationary graph coding results from gaps in
real-time data and from time-dependent operation of the scheme. When integrating hydrological and
hydraulic processes into a single-entity distributed system, computation control mechanism should take into
account the changes in the data structures in time. The paper reviews principles of the ordinary Petri-net
techniques and shows its potential in real-time reservoir control.

1 INTRODUCTION While electronic regulators react instantly, the time


factor and related transportation delay become
Man-controlled hydrological system usually consists important in hydrological systems (this is why we
of several mathematically incompatible processes. usually speak in dimension of quasi-real time rather
Integration of its sub-systems, where it has been than of the real-time systems).
practiced at all, has generally been based on various
concepts of topological decomposition. It becomes
apparent that lack of available tools necessary for
such schematizing depreciates model applicability.
The Petri-nets (the PN's hereafter) invented by
Petri in his 'Kommunikation mit Automaten' of
1962, have opened a new generation of instruments
by inventing an immediate causative relation of
event-firing-up condition. Since that, PN's have been
recognized as powerful formal discrete engines for
description of distributed asynchronous processes,
deterministic and stochastic. Originated from
autonomous independently operating finite
automata, their application dominates in parallel
architecture of computer systems like networking, Figure 1. Definition sketch of the reservoir and adjacent
databases, compilers (e.g. semantics of SmallTalk) hydrological sub systems
and elsewhere in telecommunications, machinery
and economy. The purpose of the paper is to address problems of
An analogy between the electronic, technologic an event driven computation-control over parallel
and economic control at one side and water processes in hydrologic and hydraulic modeling. It
resources control at the other is obvious. It is an aims at development of an algorithmic tool for
important detail about the PN's used in man- modeling of concurrent, semi-distributed and
controlled water resources systems worth to deterministic processes under conditions of
mention: the role of time and hence incompatibility uncertainty.
in information fluxes through various subsystems.
Construction of a multi-unit, multipurpose topological representation of the construction. The
reservoir model, that covers contributing graph is a first approximation to the PN portrait of
hydrological systems in addition, is a typical case in the four above subsystems, completed by a 'dummy',
semi-distributed water resources systems analysis, or more precisely, 'no-action' procedure BB-DMY
see Figure 1. that solely provides an interface with the
downstream located systems. Each arc of the graph
symbolizes a single deterministic process possible to
2 COUPLING OF PROJECT ELEMENTS be numerically evaluated. The nodes represent mass
and energy compatibility conditions. The full black
Solution of semi-distributed system will always raise arrows provide the time dependent information on
a question of decomposition, simplification, and selected state variables. They appear either as the
schematizing. outputs of monitoring system (the observed
quantities) or as regulator-demanded output
(objective function of the reservoir control). For
2.1An undivided system
example the reservoir pool level, inflow, outflow,
The sketch in Figure 1 displays chunks of the gate positioning, turbine through flow, head, power
problem as recognized by utilities of the AquaLog production fall in both data categories. In the PN it is
modeling system: the reservoir, two oblong-shaped possible to activate directly an arc-wise calculations
river reaches and five 'opened envelopes' of for various mathematical alternatives. This is
catchment inflows. Seventeen hydrological stations organized by mapping of the arcs (we will replace
(full black arrows) operate to monitor boundary them by PN Transitions later on) into four or more
conditions of hydrologic systems: precipitation, user-invisible computational points. In such an
temperature, and hydrometric data. As the real-time approach, an explicit specification of trends in an
monitoring systems frequently fail in data transfer objective function is possible and the long-term
from observation sites, flexibility in response to strategy can be investigated in parallel with the real-
immediate changes in configuration of the model time control. With such dual-support philosophy, the
boundary conditions becomes an essential feature of model opens an extensive field of applications and it
the modeling tools. eliminates much of programming.

2.2System decomposition, CASE A


3 HYDRAULIC FORMULATION
While leaving out (not necessarily) domain of
hydrological processes, we limit our concern to the In the modeling system AquaLog, the most
topology of the reservoir. As shown in the upper part important thing about communication between the
of Figure 2 the reservoir model consists of four basic hydraulic and hydrological processes is that each of
subsystems, of the water balance equation, the AA- them is analyzed using common program
RES associated with two flow-control units (CC- environment, disregarding internal computational
MB3 and DD-MB3, the spillway and water release structures. Anything specific at stage of
control) and with the power house unit, EE-ELN. decomposition in the Figure 2 does apply to all
remaining processes. Uncertainties in data
accessibility to individual subsystems, as result of
malfunctioning of data collection and transmission
systems, culminate into shortcomings in
mathematical formulation. Process-determination
under- and over-determination becomes an important
issue. In an algorithmic sense, the two latter ends up
in abnormal program status, and the two-way dialog
mode takes over. We will now briefly review two
typical modeling techniques of the AquaLog-MAN,
the RES and the MS3.

3.1 RES, the reservoir water balance


Figure 2. Three-unit reservoir. Definition sketch. The 1D reservoir continuity condition is separated
from hydraulic definition of its flow-control
Simplified depiction of the problem in the top of structures. This is what makes integration of its arcs
the Figure 2 becomes more peculiar once the outputs (the PN Transitions) with the other techniques easy.
of the data collection system come into The RES technique may be written in common no-
consideration. The lower part of the Figure 2 shows wedge-storage differential form, involving four state
variables: the pool level H1 reservoir inflow I, alternative computational structures of the RES
outflow O and flooded area S, see the Table 1 for modeling technique.
Table 1. Truth table and computational alternatives of RES modeling technique
State variables Formal computational schemes Iters
alt. H1N+1 H4N+1 IN+1 ON+1 Phase 1 Phase 2
1 1 1 0 0 ON+1=F1(H1N+1, H4 N+1) IN+1=FI(H1N+1, ON+1) 0
2 0 1 1 0 ON+1=F1(H1N, H4 N+1) H1N+1=FII(H1N+1, ON+1) 1
3 0 0 1 1 H1N+1=FII(H1N+1, ON+1) H4 N+1=F3(H1N+1, ON+1) 1
4 1 0 0 1 H4 N+1=F3(H1N+1, ON+1) IN+1=FI(H1N+1, ON+1) 0
5 1 0 1 0 ON+1=FIII(H1N+1, PN+1) H4N+1=F3(H1N+1, ON+1) 0
6 0 1 0 1 H1N+1=F2(H4N+1, ON+1) IN+1=FI(H1N+1, ON+1) 0
7 0 U 1 1 H1N+1=FII(H1N+1, ON+1) n.a. 1
8 1 U 0 1 IN+1=FI( H1N+1, ON+1) n.a. 0
9 1 U 1 0 ON+1=FIII(H1N+1, PN+1) n.a. 0

Figure 3. Kinematic reservoir state variables. Definition sketch of RES

Table 2. Truth table and computational alternatives of MS3 modeling technique


State variables Type of the spillway
alt. H1 H4 H3 Q Sharp crested Broad crested
1 1 1 0 0 H1-H4+k1=(Q/M1)2/3 H1+k1=H2+k2+hz2=H3+k3+hz2+hz3; M2=2 .2gB2
M1 = f (z,m,H1,H4,H3) H1=H2+Q2/(M2(H-H4);
for H3H5H=H3;
for H3H5H=H2Hs
2 1 0 1 0 H1-H4+k1=(Q/M1)2/3 H1+k1=H2+Q2/(M2(H2-H4)2)
M1=f(z,m,H1,H4,H3) H42(H1-H2)+H4(2H22-2H1.H2)+H1.H22-H23-Q2 /M=0
3 1 1 0 1 n.a. for H3H2H1+k1=H2+Q2/(M2(H2-H4)2 )
H23+H22(-H1-2H4)+H2(2H1H4+H42 )-H1H42-Q2/M2=0
3/2
4 1 1 1 0 Q=M1(H1-H4+k1) H1+k1=H2+Q2/(M2(H2-H4)2)
M1=f(z,m,H1,H4,H3) Q=(M2)(H2-H4)(H1-H2+k1)

H1 Q
H4

H 3
H2

HB1 H B2

The technique is a simple difference scheme of the


Figure 4. Sharp-crested weir state variables. 1st order ordinary differential equation. The
Definition sketch of the MS3 superscripts N and N+1 indicate the current and the
unknown time-levels respectively. The values of the
last column indicate the use of an iterative
algorithm, if necessary. Scenarios 1 through 6
(where the crest of a single-unit spillway H4
appears) are only complementary, used in case of
single purpose single-unit reservoir. So, for the PN
model solely the alternatives 7, 8 and 9 apply.

3.2MS3, the spillway modeling technique


The second example shows computation
alternatives of controlled spillway. State variables of
the MS3 technique (Tab. 2) are: the U/S water level
H1 (pool), current crest position H4, D/S water level
H3 and overflow Q, all in Figure 4. The spillway
gate simulator MS3 calculates four alternatives of
the sharp/broad crested weir formulas. Switching in
truth table options can easily be automated.
In theory, the downstream level H3 of the 3rd
alternative can be related to remaining variables H1,
H4 and Q by means of the coefficients z and m.
Such an assumption is weak indeed as it uses the
D/S rating curve as substitute. As a result of the
inflow velocity head, all remaining alternatives are
virtually iterative.

3.3Remaining modeling techniques


Once topological coding of the case is finished, the
master program browses in the list of modeling Before the action
techniques in AquaLog-MAN system library. Four
additional techniques endorse the above mentioned
ones:
MB3 Bottom outlet simulator
ELN Power house unit After the action
DMY Water transfer unit
Q_H Rating curve

Distributed into 4 computational points, they work


similarly to the MS3 technique.

4 MODEL DESIGN PROPERTIES

In the first stage of model design, the hydraulic


formulation is certainly straightforward. Generic
hindrance of feedback within the looped systems in
Figure 2 is, in the real-time 'world', augmented by
additional factors:
 an access to hydraulic state variables, depends
on model design and on functioning of the data-
collection system,
 time dependent changes of hydraulic regime of
reservoir control units are both possible and
likely to appear,
 demand for an immediate reaction of the real-
time flow control (objective function) to the
results of the program of the long-term strategy.
Solution of such situations by traditional
programming would be very intricate, even for
systems of simple structure like that of Figure 2.

4.1Briefly towards the Petri-net philosophy


Principles of the PN technology are originated
from theory of bipartite graphs. The nodes of the
graphs consist of a finite set of Places and of finite
set of Transitions. Finite set of arcs interconnects the
Places with Transitions and vice versa. A set of
Tokens is placed inside Places, thus defining Initial Table 3 Scenarios of the spillway equations
Marking. The set of arcs works as input/output MS3 H1 H2 Q
Hpool Hcrest
generator. It arranges for flow of Tokens from Places
to Transitions and from Transitions to Places. T1 ms31 0 1 1
Formulation of such asynchronous processes is T2 ms32 1 0 1
given by a definition T3 ms33 1 1 0

PN = < P, T, F, B, M0 > They represent Transitions T1 through T3 shown


where in the Figure 6 (three upper oblongs). Similarly, the
P Set of Places reservoir balance procedures are listed in the Table 4
T Set of Transitions (see the alternatives 7, 8, and 9) and represented by
F Forward incidence matrix Transitions res1, res2 and res3 of Figure 6. From the
B Backward incidence matrix truth Tables 3 and 4, it is possible to analyze all the
M0 Initial Marking
Table 4 Scenarios of the reservoir equations
RES Hpool I Q
Petri's idea was both simple and ingenious, see the
PN elementary operation shown in Figure 5. It does T4 res1 0 1 1
not need any further explanation. T5 res2 1 0 1
Figure 5. An elementary action in the PN: T6 res3 1 1 0

An overlap of TP vanishes, Transitions and computation alternatives.


Places do not have any common elements. In In both cases, solely the determined solutions are
ordinary PN's, both categories of the nodes are considered. Under-determined cases (a single unity
simply connected. No multiple arcs appear. This is in a line of a truth table) and overdetermined cases
also the case here discussed. (three unities in a line) are considered as an
abnormal and, for a moment, left out of
consideration. Separation of an 'algorithmic' case
4.2Interconnection of RES and MS3 techniques from 'non-algorithmic', make them, in effect,
We will now couple the two listed 'easy' different procedures with possibly different fields of
techniques, the reservoir RES with the spillway MS3, application.
into a single-unit reservoir model, Figure 6. The (hydraulically) 'well defined' class of the
Figure 6. The PN of interconnected processes, problems can be detected by the reachebility tree of
the MS3 and the RES the PN analysis, its most significant preference.
Once the tree has been developed, essential
The two modeling procedures, residing in the properties, such as conservativeness, liveness,
system library, are triggers that fire up computation safeness, and boundedness of the net can be
of the PN Transitions. The MS3 applies for the first clarified. Using the reachebility tree, one can review
group of processes, the RES for the second. On behavior and features of the project. As seen from
contrast to the Table 2, the effect of the D/S water the Figure 6, we have formulated the only one of the
level is disregarded. The general solution falls into JJA alternative solutions. To what extent JJA could
three scenarios as shown in the truth Table 3, the go, can be computed from
ms31, ms32 and ms33.
JJA=2JJJJ(JJ-1)=2332=36 In this case the PN is bounded, safe and
conservative.
where JJ=3 is a number of state variables in a truth
table (the number of program scenarios). Out of the
5.2 Some PN definitions
36, only 24 are realistic, as no arc emanates from the
Place H2 towards the Place I, variables are Reachebility tree: represents all of the obtainable
independent. In traditional programming, 24 Markings for a PN. It begins with the Initial
procedures would be used to solve this simple Marking, with a line from the Initial Marking to a
problem. new marking for each enabled Transition. The
process is repeated for each new Marking that is
neither a terminal node nor a duplicate node until all
5 PETRI-NET TOOLS possible markings are found, e.g. Brink (1996).
Safe: If a place is safe, then the number of Tokens
The number of alternatives JJA would increase in that Place is guaranteed to be either 0 or 1. The
drastically if just few more units were added to the PN is declared safe if all of the Places in the net are
system of Figure 6. Some of the PN features, safe. In the CASE B, as an example, this provides a
accessible by means of the PN processors including
graphical editors, will be shown as an option.

5.1A second problem, CASE B


We refer to a sketch similar to that of Figure 2,
now enhanced by more flow-control units: by three
independently operating segment weirs MS3, two
Johnson type outlets MB3 and by a powerhouse
ELN. The Table 5 accounts for the following
components of MAN model:

Table 5 List of Orlik reservoir components


MAN Transition U/S Place D/S Place
DMY T1 P1 P2
RES T2 P2 P3
ELN T3 P3 P4
DMY T4 P4 P5
MS3 T5 P6 P7
MS3 T6 P6 P7
MS3 T7 P6 P7
MB3 T8 P8 P9
MB3 T9 P8 P9
DMY T10 P3 P8
DMY T11 P4 P9
DMY T12 P3 P6
DMY T13 P4 P7

The Ceska (1994) graphical PN editor PeSim was


used to construct the PN shown in Figure 7. The
graph consists of a set of 9 Places, labeled P1
through P9 and of 13 Transitions labeled T1 through
T13. The Initial Marking of the net depends on data
structure produced by the data-collection system.
Generally, the net is non-stationary as the Marking
changes with the flux of data.
The Marking is kept zero in all Places until all the
techniques become determined. Afterwards it is set
by unity. As stated, an analysis is based on properties
of the PN reachebility tree. An example of its
portion, both in numerical form and in graphics
shows the Figure 7.
The window 'Net properties' proofs applicability
of the method for the CASE B, the Orlik reservoir.
res eln dmy

P2 T2 P3 T3 P4
dmy dmy
dmy mb3 T4
T10 T11
T1
T8
P8 P9
dmy dmy P5
P1 T9
T12 T13

T5

P6 P7
T6
ms3

T7

Figure 7. The PeSim generated PN, including a part of


reachebility tree, please refer to the Table 5

Figure 8. AquaLog Builder interactive facility:


the model of the PN in Figure 7 under construction

a necessary but not sufficient condition for solution constant. This is an important property for nets that
to be either undetermined or determined at a current model resources. In particular case of Figure 7,
time level. No further investigations of over- computation status of flow control structures falls
determination conditions are therefore necessary. into determined solution.
Bounded: a PN is called j-bounded if all places in Live: A PN is live when no terminal nodes in the
the net are bounded and j represents the maximum reachebility tree exist. For each Marking in the tree,
bound value of all Places. This is a more general at least one Transition is enabled.
property than the safeness. Practically it means that In our case, the live net applies to standard, 'well
the formulation might become over-determined at defined' mode of calculation. No computation
certain time-levels. deadlocks appear, and thus no need for the dialog
Conservative: A PN is said to be strictly control. The live nets are typical for projects where
conservative if, for all possible Markings, the total historical data are being used, e.g. in simulation
number of Tokens in the PN always remains analysis.
In such a manner, operator's scrabble could continue
Figure 9. The user-machine dialog of AquaLog MAN until his satisfaction'.

5.3A third problem, CASE C


6 THE ALGORITHM
To show the other, less 'enjoyable' aspect of the PN
features, let analyze topology of the bypass AquaLog MAN associates three distinct program
reservoir, see Figure 10. Here, the use of the two- environments: the standard computational status, the
way dialogue option became as necessary option. uncertainty conditions and the conflicting situations.
The PN analysis of the CASE C failed in The two latter are recognized as abnormal:
construction of the reachebility tree, abnormalities in standard computation: this is a simplest option;
the net development appeared and, in turn, the all Transitions are well defined, the PN is safe
program has been abnormally terminated. Standard and strictly conservative
computation mode halted and dialog window has uncertainty: some of the Transitions have no data
been opened (in the Figure 9 the window is (e.g. more than 1 zero in a line of truth Table 3
captioned as 'MAN dialog control'). The ListBox in or 4 and hence undetermined solution in the
the upper Panel 1 'Select yet incomplete object and Transition). The PN is safe but no more
press button 1' reviews all the subsystems (their conservative.
serial number, the ID, description, technique used in conflict: the mass balance is not preserved in
and computation status) and it offers a list of not yet some Place (e.g. in case of over-determined
computed objects. After any tolerated choice has solution where three unities appear in a line of
been made, the ListBox of Panel 2 has displayed truth Table 3 or 4). The PN is no more live, it
data of the selected object (e.g. the flow control is in deadlock
unit), both in the old- and in the new time levels. The last two situations require the two-way dialog
The undefined control data were notified as UN- while the first does not. Obviously, one has often to
DEF and prompted for completion (the TextBox of make a compromise in several respects:
the Panel 3). The buttons CONFIRM, CONTINUE, all Transitions were computed to required extent
DISPLAY and RETRY are controls of the dialogue. of time domain,
(1996) thirty-four PN tools were located. An
examination of these tools was performed and data
collected in four major areas: Operating
Environment, Graphical Editor, Simulation, and
Analysis…' (unquote).
Hydraulic engineers confront problems of on-line
digital control of flow regulators, where the PN's
would perfectly suit this purpose. Moreover, they
may bridge still existing gap between the real-time
reservoir control and the long term water resources
strategy, simply by replacing the 'observed' boundary
value by the 'demanded' value of the objective
function generated by external software.
Secondly, what are the cons? Hydroinformatics'
conditio sine qua non clearly states that the
algorithm should be proven and robust before it goes
into the hands of, possibly inexperienced, engineer.
P11
The situation in use of PN's in this field is far from
P1
being so. It is rather in stage of an 'academic
T14
T1
P2
exercise'. As we have shown, the PN's in water
T2
P3
T15
P12
resources may become unsafe and prone to
T10 T11
deadlocks. Consequently, they require delicate
P6 T3 handling, what depreciates an implementation value.
Integration of the PN technology with hydraulics
P4
T12
P9
culminates in intricate programming, complex and
T13 costly.
T9 T4 T5 T6 T16 The use of PN's as a tool of Hydroinformatics
remains a challenge to professional programmers,
P5
P10
hydraulic engineers and hydrologists.
T7

P7
T8
P8 REFERENCES
Figure 10. Definition sketch of the reservoir Vihorlat and its
PN (note the T13/T14 as 'hydrological' contribution of direct Abel, Dirk 1990. Petri-Netze für Ingenieure. Modellbildung
rain/evaporation to the pool) und Analyse Diskret Gesteuerter Systeme. Berlin:
Springer-Verlag
values of boundary conditions came either from Babovic, V. 1991. Applied Hydroinformatics. A Control and
data collection system or as user entries, Advisory System for Real-Time Operations. Reports
the mass and energy balance in all Places series 26 Delft: IHE Delft
satisfies predetermined criteria. Baldassari, P. 1997. Einführung in high-level Petri-Netze.
It is worth to underline again, that computation Vienna: TU
Brink, R.S. 1996. A Petri-net Design, Simulation, and
sequence of individual modeling techniques in a Verification Tool. New York: Dept. of Computer
project depends on immediate access to the data, Engineering, College of Engineering Rochester Institute
The algorithm generally varies with the time. The of Technology, Rochester
model uses nested iterative procedures for Ceska, M. 1994. Petriho site. Akademicke nakladatelstvi
computation of individual flow-control units. The CERM: Brno (in Czech)
PN algorithm supervises the higher iteration level; Zezulak, J. 1985. Modeling of Complex River Systems in
the accelerated Newton-Raphson procedure is used Service of Operational Hydrology. DrSci dissertation.
for the lower. Prague: Technical University (in Czech)
Zezulak, J. & Straka, V. 1987. Real-time Control of
Irrigation Schemes. Rabat: XIII th Congress of ICID
Zezulak, J. 1992. Information System for Automated Data
7 CONCLUSIONS AND CRITIQUES Collection and Processing for Energy Power
Development on River Drin. Geneva: WMO/UNDP
Firstly, what are the pros of using the PN technique Project ALB/86/003
in water resources modeling? Browsing through Zezulak, J. & Krejci, J. & Smolik, M. 1991. AquaLog, the
libraries and Internet proved no reference of using Decision Support System in Field of Water Management,
Water Pollution and Hydrology. Como, Italy: Proceedings
the PN's in Hydroinformatics. At the same time,
of 3rd Intl. Software Exhibition for Environmental
Brink claims that '…at the time of this document, Sciences and Engineering.

You might also like