Places and transitions for each submodel of Figure 3 .

## Abstract

Hybrid control system is an exciting field of research where it contains two distinct types of systems: one with continuous dynamics continuous variable dynamic system and the other with discrete dynamics discrete event dynamic system, that interact with each other. The research in the area of hybrid control can be categorized into two areas: one deals with the conventional control systems, and the other deals with the decision making systems. The former addresses the control functions at the low level (field level). The latter addresses the modeling, analysis, and design at the higher level found in the supervision, coordination and management levels. The study of hybrid systems is central in designing intelligent hybrid control systems with high degree of autonomy and it is essential in designing discrete event supervisory controllers for continuous systems.

### Keywords

- discrete event systems
- supervisory control systems
- petri nets
- embedded systems
- industrial processes

## 1. Introduction

In general automation systems’ structure can be categorized into six levels: Sensor/Actuator Level, Machine/Controller Level, Process Automation Level, Operation Unit Level, Plant Level. Trends are making this structure possible and desirable to create streamlined three-level automation systems or even to collapse it [1]. This is due the trend to create embedded control systems, cyber physical systems, networking, and discrete hybrid control systems. The trend to reduce machine size and cost while increasing productivity using nanotechnology, requires new approaches to control systems [2]. Thanks to the increased reliability of industrial PC technology, traditional rack-based PLCs can be replaced with more powerful PC-based control systems. While Industrial PC’s provide the highest performance and control capacity, new generations of PC technology based on open embedded operating systems, combine the functions of a PLC and an operator panel in one unit which is applicable to smaller scale applications.

The development of complex man-made systems that perform complicated and interacted tasks, has been accompanied by an ever increasing demand for even more sophisticated modeling and control schemes. The need for a systematic and mathematical approach to analysis, design, and control of complex large scale systems is highly demanded. In fact, In operations research, for example, researchers have been interested for a long time in systematic methods to deal with large-scale systems [3, 4, 5, 6]. However, control engineers have taken up this challenge in recent years to develop intelligent models for hybrid dynamical systems [7].

The study of hybrid systems is central in designing intelligent hybrid control systems with high degree of autonomy. Such systems include discrete and continuous activities [8]. The field of discrete vent systems (DES) is relatively a new research area that combines different formalisms, methodologies and tools from Supervisory control theory, artificial intelligence (AI) and operations research (OR) [9]. The domains of DES are: manufacturing automation, communication protocols, robotics, process control, nuclear reactors, space exploration systems, aircraft control systems, fault diagnosis, and refinery systems [5, 10, 11]. Historically, DES were introduced in the early 1980s, in the field of chemical engineering. They quickly gained popularity in modeling and supervision of hybrid systems [12, 13].

The design of supervisory controllers for discrete event systems has received considerable attention in research centers [14, 15, 16]. There are methods for designing supervisors based on automata models [17], however, they need exhaustive search over the system states that makes them impractical for systems with large number of states, as the number of states increases the state space explosion problem arises [18, 19]. One way of dealing with these problems is to model discrete event systems with Petri Nets (PNs). In this way the state explosion problem can be avoided. Some recent contributions on the Petri net based supervisory control can be found in [20, 21]. PN models are normally more compact compared with automata-based models and are better suited for the representation of discrete event systems due to its mathematical manipulation and graphical representation [22, 23, 24]. Timed Petri nets are common used for industrial control systems [14].

The main objective of this chapter is to explore and step by step construct a supervisory control scheme in the field of DES modeling and control. It also shows how the continuous activities; temperature control, pressure control, etc. are represented by few places resided in the embedded PN models. These objectives can be achieved as follows.

### 1.1. Investigation of DES modeling and supervision

Types of events that may occur in discrete event systems are controllable, and uncontrollable events (sensors). The latter arises a severe problem when the plant works under control. It cannot be inhibited from firing by the supervisor. Embedded supervisors should be developed to deal with such problems.

### 1.2. Selection of the best modeling formalism

There are many tools to develop DES models e.g. finite state automata, and Petri nets. The latter has a good descriptive power compared with the former. Petri nets models are more compact than automata-based models for representing DES.

### 1.3. Developing supervisory control scheme

There are two types of supervisors, one is mapping supervisors, and the other is compiled supervisors. The latter has two notable features, its computational demand is small, and its structure can be reconfigured online. The developed supervisors should perform resource allocation, coordination, and deadlock avoidance tasks at the higher level of complex hybrid industrial systems. Ordinary and timed Petri nets are employed in this chapter to structure embedded supervisory control models for industrial processes.

### 1.4. Testing the proposed scheme

Chemical batch processes and kernel railroad crossing system were employed for testing the proposed control scheme; they have resources scarce, forbidden states, and deadlock problems. This chapter structures embedded supervisory control scheme that deals with the continuous activities at the lower level, as well as the discrete ones at the higher level in efficient manner. The continuous activities can be modeled and supervised using intelligent control schemes.

## 2. Supervisory control systems

This section gives an introduction to the hybrid nature of complex systems as well as their hierarchical structure. It also includes a brief overview of relative work in the area of DES supervision using finite state automata and Petri nets. A comparison between Petri nets and finite state automata as modeling formalisms for the purpose of supervisor synthesis is given in this section.

### 2.1. Investigation of DES modeling and supervision

Discrete event systems are useful when dealing with dynamic systems that are not fully modeled by classical models, such as differential or difference equations. It is noted that while differential and difference equation models evolve with time, a discrete event system evolves with the occurrence of events. An comprehensive literature on discrete event systems has appeared in the last 30 years, and their study continues to be an area of ongoing research. DED combines different formalisms, methodologies and tools from control theory (CT), artificial intelligence (AI), and operations research (OR) as shown in Figure 1 [9]. These methods facilitate the modeling of continuous and discrete activities as a unified approach.

System modeling is an important phase in the supervisory system synthesis procedure. There is a set of methods for designing supervisors based on automata system models [16, 17]. The disadvantage of these methods is that they need a huge search over the system states as mentioned in Section 1. One way of dealing with these problems is to model discrete event systems with Petri nets (PNs). Petri net-based solutions have several advantages over finite state automata. These advantages recommends the Petri nets to be used in this chapter. They are listed as follows.

The states of a Petri net are represented by the possible markings and not by the places. Thus Petri nets give a more compact description.

The plant and the specifications can be represented graphically in an easily understood format using Petri nets instead of using textual descriptions or mathematical notations, which are difficult to understand.

Petri net models can be used for the analysis of their properties, performance evaluation and the systematic construction of discrete event supervisors [20, 22].

The Petri net model allows for the simultaneous occurrence of multiple events.

### 2.2. Structuring a supervisory control scheme

This subsection shows the use of Petri nets to design a supervisor, including its synthesis techniques, methods of handling uncontrollable and unobservable transitions within the plant structure. The supervision based on place invariants method is employed in this chapter to build an embedded supervisory control systems. In this method, the control objective is to force the process to obey linear constraints in the form of linear inequalities. The ideas of developing such supervisors were borrowed from [21]. The developed supervisory control scheme can be employed to control the processes that have controllable and uncontrollable transitions [25]. Using an embedded Petri net structure, the developed scheme is easy to implement and its computational demand is relatively small. The design method has numerical properties that make it particularly appealing for large scale systems. Mathematically, the developed scheme can be detailed as follows.

A place invariant is an integer vector *x* that satisfies [21, 25]:

for all reachable marking *x* is a place invariant. Place invariants can be computed by finding solutions to Eq. (2).

Based on the method of place invariants, it is possible to enforce a set of constraints on the plant state

where *L* is a

Each place invariant defined in Eq. (6) must satisfy Eq. (2) such that:

The matrix

If the initial marking defined in Eq. (7) does not violate the given set of constraints, these constraints can be enforced by a supervisor with the incidence matrix

where

This method admits the structure of the process net as well as a set of specifications. This is because the constraints on these transitions is a subset of the specifications. Supervisors are used to insure that the behavior of the plant does not violate a set of constraints defined in Eq. (3) under a variety of operating conditions. Every single constraint is transformed to a marking invariant that corresponds to a place invariant of the supervised system. The regulatory actions of the supervisor are based on observations of the plant state, resulting in feedback control. More details about the P-invariant-based supervisory control schemes can be found in [17, 21, 25].

### 2.3. Step by step developing P-invariant-based supervisory control scheme

The most common examples of hybrid systems are batch processes which are characterized by combination of discrete and continuous dynamics [17, 26]. Batch processes are currently used in the chemical and food process industries. A comprehensive model of batch systems has to include discrete event aspects as well as continuous ones. As a consequence, their automation and optimization pose difficult issues mainly because it is necessary to operate concurrently with continuous and discrete models.

Batch plants consist of many transport resources (*transporters*) like valves and pipes, and processing resources (*processors*) like mixing tanks, batch reactor vessels, and other container like units [27, 28, 29]. Transporters and processors are involved in transforming a batch from raw materials to final products.

The main problems inherent to the modeling and supervision of batch processes are:

*The hybrid nature of the process.*State variables like the tank level or the pump speed are continuous, others like the on-off valves, are discrete-state components. Moreover, the whole process behaves as a cycle of discrete events.*The variety of knowledge.*Some elements of the process can be described by physical equations, e.g. the tank level, and others by experimental models, e.g. the behavior of the pump described by a transfer function.

The event driven part of a batch plant is modeled using Petri nets. The most appropriate method in batch plants modeling is the Petri net Bottom-up synthesis method [30, 31], where plants in process industries generally exhibit less flexible structure than manufacturing processes and the individual process units are well defined and standardized [29].

This section uses the bottom-up approach to Petri net modeling of the chemical batch processes. It also employs the P-invariant supervisory control scheme described in Section 2.2 to structure an embedded PN-supervisory control model of the batch process.

#### 2.3.1. Example 1: a simple batch plant

This process used to illustrate the idea of supervisor design for the purpose of resource allocation for two process lines chemical process shown in Figure 2 .

In this figure, two mixing tanks shared the same supply tank and only one tank can be filled at a time. Based on the receipt given in Table 1 , using Petri net tool ver. 2.1 [33] the PN model of the two individual process lines shown in Figure 2 is constructed as depicted in Figure 3 . This model is structured using the bottom-up synthesis method [31].

Place | Associated action |
---|---|

P_{m1} | Process ready |

P_{m2} | Open the inlet valve of the mixing tank |

P_{m3} | Open the valve of supply tank |

P_{m4} | Stir the content of mixing tank |

P_{m5} | Discharge the mixing tank (open the outlet valve) |

Transition | Associated event |

T_{m1} | Start a new batch |

T_{m2} | Mixing tank is filled |

T_{m3} | Duration of mixing operation is vanished |

T_{m4} | Empty the mixing tank |

In this sample, the places P_{m3} are corresponding to the outlet valve of the supply tank. The invariant-based supervision discussed in Section 2.2 is employed for the purpose of supervisor synthesis. This is particularly interesting, because the resulting supervisory mechanism is computed efficiently. All transitions are assumed to be controllable.

It is clear that, if transitions T_{ma1} and T_{mb1} are fired, the place P_{m3} contains two tokens and therefore the Petri net model is not safe. The safeness of the place P_{m3} is required, because it represents the operation of opening and closing the outlet valve of the supply tank. The double-booking problem should be avoided in this case, otherwise, the situation is considered as a malfunction. To overcome this problem, the supervisor has to be designed to co-ordinate the two mixers in such a way that only one will be filled at a time. This requirement is written as:

where _{m3}. The requirement can be easily transformed to the form Eq. (6) with the plant marking vector being:

Given the incident matrix of the PN model shown in Figure 3 ;

The supervisor can be computed by Eqs. (6) and (7) as follows:

The supervisor consists of a single place that is connected to the plant Petri net as shown in Figure 4 . The marking invariant that is enforced by the supervisor is:

The simulation of the unsupervised system via Reachability graph analysis method of PN indicates that the unsupervised plant has 16 reachable states, one of them indicates the absence of safety condition, this marking vector is:

**Quiz 1:** With the help of our work in [14], can you model the chemical batch process shown in Figure 2 using timed Petri nets?

#### 2.3.2. Control of continuous activities as a part of hybrid systems

The main objective of this subsection is to control the continuous part of a complex batch process shown in Figure 5 . This process comprises six input buffers, two mixing tanks and two reactor vessels. In this case, heating and cooling are continuous variables of this batch process. The preparation of the input substances takes place in two mixing tanks to which the raw materials are supplied from three supply tanks (buffers). The substance is composed from one of the two basic components (component ‘a’ or component ‘b’) that is diluted to the required concentration by component ‘c’. The filling of the mixing tank is controlled by the on/off valve Vma in combination by one of the supply tank valves Vsa, Vsb, or Vsc. The discharging of the mixer is controlled by the on/off valve Vmb. The level in the mixing tank is measured by the level sensor; L. The required quantities of each input depend on the recipe detailed in [17].

The mathematical differential equations of the heat system of the reactor is detailed in [22]. In this case, the temperature of the reaction for each reactor is controlled using fuzzy neural systems-based local controllers [32] that are designed for each of heating and cooling phases in each process line. It is controlled by feeding hot or cold glycol through the reactor jacket, which surrounds the reactor vessel.

Using the P-invariant supervisory control method discussed in Section 2.2, the embedded PN-based supervisory control model is structured using Petri net tool ver. 2.1 [33]. A part of this embedded model is shown in Figure 6 . The main objective of this subsection is to show how can activate the continuous activities resided inside the embedded model of the process. It also shows the control result of heating phase as a set of continuous places resided in the embedded model using fuzzy neural controller. The full simulation results can be found in our work [17]. To show the firing of the continuous activity resided in the embedded model, consider the initial marking vector,

Starting from this initial marking vector, the simulation of a part of the embedded PN-based model shown in Figure 6 [17], can be carried out. When the transition T_{rb3} is fired, the fuzzy neural controller resided in place 8; Prb8, is activated as shown in Figure 6 and the marking vector becomes,

The response of the reaction at the desired set point 50°C is depicted in Figure 7 .

#### 2.3.3. Example 3: KRC modeling and supervision using timed PNs

The kernel railroad crossing (KRC) shown in Figure 8 is a standard benchmark in real time systems [14]. When a train is sensed to approach the crossing, a signal is sent to the supervisor that sends a command to the specified gate that is closed to prevent cars crossing that survives ourselves. Having more than one track and more than one train may enter crossing zone, leads to a complicated situation that is out of our paper scope. For simplicity let us merge the two depicted zones as one zone (region). The Petri net of the system is depicted in Figure 9 . The train needs one time unit (t.u.) to enter the R-Y zoon and five (t.u.) to leave it for departure phase. The gate needs no time to start closing and requires two (t.u.) to be completely closed. It needs extra two (t.u.) to be completely opened after firing the transition T_{5}. The problem arises at the beginning of opening the gate that has unknown time units “[0, _{5} every departure phase. This means that this transition is continuously evaluated. The system comprises two tasks, train task and gate task. In our work [14], consider that the controllable events are the beginning of each task. However, the accomplishing of the tasks is uncontrollable. Therefore, our goal was to control the beginning of the tasks in order to obtain safe arrival and departure of the train. Also, the synthesized control scheme should avoid the forbidden state (P_{2}, P_{4}). This means that the train in the R-Y zone and the gate still opened.

Using Petri net tool software ver. 2.1 [33], the system incidence matrix is of the PN model shown in Figure 9 is:

In this simulation, there are 11 reachable states starting from the initial marking vector _{2}, P_{4}). Based on P-invariant, a supervisory control scheme for the KRC system is synthesized in Section 2.2. The constraints vector is

Another issue, in distributed hybrid systems, each process line is controlled by its own logic controller and supervisory part resides in another level. The interaction among different modules is performed through synchronized transitions. In practical implementation, it is difficult to achieve such synchronization among the logic controllers of the embedded systems. Because of the communication delays, it cannot be guaranteed that transitions in different controllers fire simultaneously. One way for dealing with this problem is to define the firing order of the transitions. In the cases when the two logic controllers share the same resource and the supervisor performs the resource allocation such as indicated in Figure 4 , the transition that reserve the resource must be fired in the supervisor first and then in the local controller. In the opposite case the communication delay would allow double booking problem of the shared resource by the two controllers or even deadlock. Due to the pages limitation, more details about this implementation problem the readers can be directed to read our work detailed in [34].

**Quiz 2:** With the help of our work in [17], can the reader complete the missing part of the supervised embedded PN model depicted in Figure 6 using P-invariant supervisory control discussed in Section 2.2?

**Quiz 3:** With the help of our work in [34], can you overcome the communication problems through the embedded PN model of Quiz 2?

## 3. Conclusions

Hybrid systems modeling and supervision have been used extensively in automation, robotics, and manufacturing applications. Different frameworks for dynamic supervisory controllers are used in flexible manufacturing systems and automated batch processes. The high-level system changes in hybrid systems are modeled as discrete event dynamic systems, while the low-level systems changes are modeled as continuous variable dynamic systems. The major issue in studying hybrid systems is the consistency between continuous and discrete models evolution. Petri nets possess many assets as models for DES. They provide more compact representation for larger reachable state spaces, and increase the behavioral complexity compared with automata-based models. Batch plants are common examples of hybrid systems. In this chapter Petri net embedded models were developed by abstracting the behavior of hybrid systems. As a final conclusion, the work in this chapter allows the readers to design and analysis their own supervisory control schemes using Petri net tools ver. 2.1 or higher [33]. Although the developed schemes are tested using batch chemical processes, they are promising to control complex industrial automated processes. This chapter opens several research directions to be considered and investigated. It may extend this work to optimization of supervisory control schemes, modeling and supervision of hybrid industrial systems using timed Petri nets, and implementing the proposed schemes for large scale systems.