Places and transitions for each submodel of Figure 3 .
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.
- discrete event systems
- supervisory control systems
- petri nets
- embedded systems
- industrial processes
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 . 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 . 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 .
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 . 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) . 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 , 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 .
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 . 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.
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 . The developed supervisory control scheme can be employed to control the processes that have controllable and uncontrollable transitions . 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.
for all reachable marking . Thus is constant for all reachable states if 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 . The plant state is represented by an marking vector of non-negative integers, where each vector component is equal to the marking of the corresponding place in the Petri net model of the plant. The supervisory control goal is to restrict the reachable marking vectors of a plant as:
where L is a integer matrix (), and B is a integer vector (), and is the number of constraints. After adding the slack variables, constraint define in Eq. (3) becomes:
The matrix contains the arcs that connect the controller places to the transitions of the process net. So, given the Petri net model of the process and the constraints, the Petri net controller is constructed see .
where is the initial plant marking vector of non-negative integers. The supervisor is a Petri net with incidence matrix made up of the process net’s transitions and a separate set of places. With the addition of supervisor places the overall system is given by.
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 .
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  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 .
|Pm2||Open the inlet valve of the mixing tank|
|Pm3||Open the valve of supply tank|
|Pm4||Stir the content of mixing tank|
|Pm5||Discharge the mixing tank (open the outlet valve)|
|Tm1||Start a new batch|
|Tm2||Mixing tank is filled|
|Tm3||Duration of mixing operation is vanished|
|Tm4||Empty the mixing tank|
In this sample, the places Pm3 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 Tma1 and Tmb1 are fired, the place Pm3 contains two tokens and therefore the Petri net model is not safe. The safeness of the place Pm3 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 is the marking vector component that corresponds to place Pm3. The requirement can be easily transformed to the form Eq. (6) with the plant marking vector being:
, and .
Given the incident matrix of the PN model shown in Figure 3 ; :
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: i.e. . On the other hand, the simulation of the supervised system indicates that the supervised plant has 15 reachable states. In this case, the supervisor eliminates the marking which is forbidden state, and all the reachable states satisfy the safety condition. This procedure can be generalized for more complex batch processes such as coordination, deadlock avoidance, and resource allocation discussed in .
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 .
The mathematical differential equations of the heat system of the reactor is detailed in . In this case, the temperature of the reaction for each reactor is controlled using fuzzy neural systems-based local controllers  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 . 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 . To show the firing of the continuous activity resided in the embedded model, consider the initial marking vector, defined below.
Starting from this initial marking vector, the simulation of a part of the embedded PN-based model shown in Figure 6 , can be carried out. When the transition Trb3 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 . 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 T5. The problem arises at the beginning of opening the gate that has unknown time units “[0, ]”. This is due to the reason that no expectation for beginning the departure phase of the train; its departure depends on the passenger riding. The analysis should be performed to get the exact period time unit required to activate the transition T5 every departure phase. This means that this transition is continuously evaluated. The system comprises two tasks, train task and gate task. In our work , 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 (P2, P4). This means that the train in the R-Y zone and the gate still opened.
In this simulation, there are 11 reachable states starting from the initial marking vector to the final vector . The firing sequence shows that the marking vector, is a forbidden state. It is clear that the marking vector includes the forbidden state (P2, P4). Based on P-invariant, a supervisory control scheme for the KRC system is synthesized in Section 2.2. The constraints vector is , the controller incidence matrix is , the initial marking of the controller is , and . The developed supervised time Petri net of the KRC system is depicted in Figure 10 . There are 10 reachable states starting from the initial marking vector to the final vector and the supervisor eliminates the forbidden state vector .
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 .
Quiz 2: With the help of our work in , 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 , can you overcome the communication problems through the embedded PN model of Quiz 2?
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 . 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.