• No results found

SYSTEM REALISATION 149 question is either modelled using a bounded Petri net, or a MICPTI

Reactive Processes

7.7. SYSTEM REALISATION 149 question is either modelled using a bounded Petri net, or a MICPTI

net. The role of those Petri net models is to capture the logic control of thesystem regardless of the environment, while the role ofreactive processesis to account for theenvironment and trigger actions on the system.

A reactive process proci is defined using four parameters: a triggering conditiontci, an exiting conditions eci, a priorityprioi and a goalgi such that:

− If the triggering condition tci is present, then proci tries to obtain gi.

− If the exiting condition eci is present, then proci does not need to obtain gi.

− Higher priority processes must run before lower priority ones.

Figure 7.10 illustrates the basic components, where triggering pro-cesses are handled by aProcess Monitor which in turn is responsible for invoking the process scheduler. Upon invocation the scheduler is requested to produce a set of running processes R, a set of waiting processes Q, and a path from the system current marking m to a target markingm(P ath(m, m)). The produced path is a sequence of commands that are executed by the Command Executor component.

The executed commands affect the system environment and reflect in sensory data. Finally, the processes involved use sensory data to determine whether they should notify the Process Monitor to exit or trigger.

7.7.1 Case: Garbage Transport System

Consider a wheeled container that has a carrying capacity of 50 kg.

It can fill or empty garbage at some rate. The container moves forward or backward on a horizontal axe of 30 meters by adjusting its forward and backward speeds. The set-up is equipped with weight, and position sensors (see Figure 7.11). We show how to make the garbage container repetitively move garbage from the right side to the discharging container using simple dedicatedreactive processes.

150 7 7. REACTIVE PROCESSES

Figure 7.10: Waiting processes are set in Q and running in R, while mis the system state. The scheduler generatesQ,R and also a path fromm to m.

Figure 7.11: Garbage Machine Schematic

7.7.2 Petri net model

We start by capturing the dynamic behaviour of the transport container (the system)regardless of its environment. Figure 7.12a shows an MICPTI net representing the garbage transport system.

The commands that can be sent to the controller are encoded in Petri net places. While Petri net transitions are used to change commands.

Moving the transport container forward is done by setting the variable F-SPEED, while moving backward is done using the variable

7.7. SYSTEM REALISATION 151 B-SPEED. It is not possible to set F-SPEED if B-SPEED is set and vis versa. Clearly, both speeds can not be set if the Brake is applied (BRAKE-ON, BRAKE-OFF). The filling and emptying rates, are controlled using the variables F-RATE and E-RATE respectively.

Before setting any of those two variables the brake has to be on.

Finally, it is not allowed to fill and empty at the same time. The commands and their units are summarised in Table 7.5. We also use four sensors, one for the position denoted pos and three others for weights denoted w1, w2 and w3.

As the model of Figure 7.12a shows no assumption is taken about the sensor data when representing thesystem. All what is considered are the commands that the system can take. A representation of the states is shown in the characteristic graph of Figure 7.13b. We assimilate the system to an infinite system by letting the speeds and the rates take any positive value.

Table 7.5: Garbage system commands and sensors definition Control variable Unit Comment

w1 kg Discharge container weight

w2 kg Transport container weight

w3 kg Remaining garbage weight

7.7.3 Processes and goals

After having defined the basic control of the transport container, we need do design a set of reactive processes. As mentioned earlier a reactive process has a goal, triggering and exiting conditions, and a

152 7 7. REACTIVE PROCESSES

(a)

(b)

Figure 7.12: MICPTI net of garbage system and its characteristic priority. In Table 7.6 nine processes are defined using three priority levels. The convention is that the higher the priority is, the more important is the process. The processes proc1 and proc3 are to be seen as anti collision processes. The process proc1 triggers when the position is almost 30 meters (maximum), and upon triggering

7.7. SYSTEM REALISATION 153 it aims at realising the goal g1, which sets the F-SPEED=0. The processproc3 is associated with theg3 and triggers when the position approaches 0 meters (the minimum). The processes proc2 and proc4

trigger to either move the transport container forward or backward.

Their associated goals g2 and g4 specify the required forward or backward speeds respectively. The process proc5 triggers when the job is done, upon triggering it applies the brake as specified by g5. The processes proc6 and proc9 trigger to either empty or fill the transport container, and are conditioned by the position of the transport container and its weight. Forproc9 the remaining weight is used as a condition to trigger filling. The emptying rate is specified by g6 which is set to 5 hg/s, while the filling rate is specified by g9

and is set to 4 hg/s. Finally,proc7 and proc8 trigger to interrupt the emptying and the filling operations respectively.

7.7.4 Simulation result

In this simulation we run the nine processes defined above concur-rently, and adopt a priority preemptive process scheduling strategy (see Algorithm 18). The initial parameters are the following:

− The initial positions is zero m (pos= 0)

− The discharge weight is zero kg w1 = 0

− The transport weight is zero kg w2 = 0

− The remaining weight is 120 kg w3 = 120 kg

Figure 7.13a shows three plots. The first one describes which and when a processes runs. The second shows position changes, and the third shows the weight changes. We can clearly see that the transport container moves between 0 and 30 m. Moving the container from 0 to 30 meters is justified by the triggering of proc2, while the backward movement is justified by the triggering of proc4. We can also see thatproc1triggers when the position is almost 30 m, and that proc3 triggers when the position is almost 0 m. As mentioned earlier these processes act as collision prevention. The weight change is also clearly correlated with the triggering ofproc9 for filling and proc6 for emptying the container.

These two processes are immediately followed byproc8 and proc7

to avoid that the container gets over filled, or emptied when its

154 7 7. REACTIVE PROCESSES Table 7.6: Garbage system process definitions and goals relations

Proc. Goal Trigger cond. Exit cond. Pri.

proc1 g1 tc1 =pos >29 ec1 6=tc1 2

is already empty. The process proc5 triggers at the end of the simulation when all the garbage has been transported and discharged.

Figure 7.13 shows the commands changes over time. The target commands are dotted curves marked with T in the legend, and the current commands are solid lines plots marked with C. The target commands are the result of the computed marking by the scheduling algorithm, and the current describes the actual commands that are