Download Learning Timed χ 1.0 - Manufacturing Networks Wiki
Transcript
48 Chapter 7. Timed Processes Process R waits for a start signal (start?). Note that the start signal is of the type void. This type can be used for channels only. When communication over a channel of the type void occurs, no actual data is sent or received, it functions like a synchronisation. After receiving the start signal, the process waits for tt time units. Then, the message ”Rocket arrived at t =” is printed to the screen, followed by the current time in the simulation. Time passing is represented by the delay statement, e.g. ∆3 represents a delay of 3 time units. In this specification 1 time unit corresponds to 1 minute. The simulated time in χ is represented by the pre-defined variable time . Below is the specification of the ignition process I and the model SR. In the model specification, the rockets and the ignition process become parallel. Note that in this case the rockets are ignited in order of increasing flight speed. Figure 7.2 shows a graphical representation of the model. proc I(chan s0!,s1!,s2!: void) = |[ s0!; delay 15.0 ; s1!; delay 15.0 ; s2!; delay 15.0 ]| model SR() = |[ chan s0,s1,s2: void :: I(s0,s1,s2) || R(s0,40.0) || R(s1,50.0) || R(s2,60.0) ]| I s0 R(40.0) s1 R(50.0) s2 R(60.0) Figure 7.2: model SR Compiling and simulating this specification yields the following output. [user@host chi]$ startmodel exmp71 Rocket arrived at t = 40.00000000000000000 Rocket arrived at t = 65.00000000000000000 Rocket arrived at t = 90.00000000000000000 [user@host chi]$_ We can now use simulation to investigate a different dispatching policy1 for the ignition process I, i.e. the order in which the rockets are to be ignited. Suppose we want to have all rockets to arrive at their destination in the shortest possible period of time. The suggestion is to ignite the slower rockets first. This can be attained, by changing the specification of 1 In this simple example, the problem could easily be solved by hand. However, it illustrates how simulation can aid in solving more complex problems.