Fundamentalni koncepti Simulacije
Fundamental Simulation Concepts
Slide 1 of 30
Sistem: sistem opsluge Dolazeći Utovareni kamioni
•
•
7
6
5
redovi (FIFO)
Uređaj za opslugu (Server) Odlazeći istovareni 4 kamioni Opsluživanje kamiona
Opšti cilj: (Pr)oceniti očekivanu produktivnost Vreme čekanja u redu,dužinu reda,proporciju vremena zauzetosti servera Vremenske jedinice
Mogu se koristiti različite jedinice na različitim mestima … neophodno definisanje Provera jedinice pri specifikovanju ulaza Definisati osnovne vremenske jedinice za interne proračune,outpute Umerenost pri interperetaciji ,zaokruživanju grešaka Fundamental Simulation Concepts
Slide 2 of 30
Specifičnosti Modela • • •
•
Inicijalno (vreme 0) prazan i neiskorišćen sistem Osnovne vremenska jedinica: minut Ulazni podaci broj vozila 1 2 3 4 5 6 7 8 9 10 11 . .
vreme dolaska vreme između dolazaka 0.00 1.73 1.73 1.35 3.08 0.71 3.79 0.62 4.41 14.28 18.69 0.70 19.39 15.52 34.91 3.15 38.06 1.76 39.82 1.00 40.82 . . . . .
vreme opsluge 2.90 1.76 3.39 4.52 4.46 4.36 2.07 3.36 2.37 5.38 . . .
Zaustaviti kada protekne 20 min (simuliranog) vremena Fundamental Simulation Concepts
Slide 3 of 30
Ciljevi : merenje performansi output-a • •
Ukupna opsluga kamiona preko linije (P) Prosečno vreme čekanja kamiona u redu: N
∑ WQi
i =1
N
•
N = broj kamiona koji završavaju čekanje u redu WQi = vreme čekanja u redu i-tog kamiona Potrebno je znati: WQ1 = 0 (zašto?) N > 1 (zašto?)
Maksimalno vreme čekanja kamiona u redu:
max WQi
i =1,...,N
Fundamental Simulation Concepts
Slide 4 of 30
Ciljevi studije: merenje performansi output-a •
Prosečan broj kamiona u redu u vremenu: 20 ∫0 Q(t ) dt
• •
Q(t) = broj kamiona u redu u trenutku t
20 Q (t ) max Maksimalni broj kamiona u redu: 0≤t ≤20 prosečno i maksimalno ukupno vreme kamiona u sistemu (vreme ciklusa): P
∑TSi
i =1
P
,
max TSi TSi = vreme u sistemu kamiona i
i =1,...,P
Fundamental Simulation Concepts
Slide 5 of 30
Ciljevi studije: merenje performansi output-a •
Iskorišćenje servera (proporcija zauzetosti u vremenu) 20
∫0
B( t ) dt 20
•
1 if the server is busy at time t , B( t ) = 0 if the server is idle at time t
veliki broj drugih mogućnosti (preopterećenost informacijama?)
Fundamental Simulation Concepts
Slide 6 of 30
Opcije analize •
procenjivanje
prosečno vreme između dolazaka= 4.08 minuta Prosečno vreme opsluge = 3.46 minuta Tako da se (prosečno) kamioni opslužuju brže nego što pristižu – –
Ukoliko bi vremena opsluge i vremena između dolazaka bila tačna tada nikada ne bismo imali red Ali podaci očigledno pokazuju varijabilnost, tako da može doći do formiranja reda
Traži se nešto između ova dva ekstrema
Fundamental Simulation Concepts
Slide 7 of 30
Opcije analize •
Teorija TMO
Zahteva dodatne pretpostavke o modelu – – – – –
vremena između dolazaka ~ eksponencijalna Vremena opsluge ~ eksponencijalna Mora biti ispunjeno E(usluge) < E(interarrival) Stabilno stanje (duži rok) Egzaktni analitički rezultati µ A = E(interarrival time) µS2 , µS = E(service time) µ A − µS
Problemi: validnost, vremenski okvir Često korisno kao prva aproksimacija
Fundamental Simulation Concepts
Slide 8 of 30
Dinamika simulacije: predviđanje (planiranje) događaja • •
Identifikovanje karakteristika događaja Odlučiti se za logiku svakog tipa događaja kako bi se
• • • •
Uticalo na promene stanja za svaku vrstu događaja Posmatrala statistika ažurirala vremena budućih događaja (ovog tipa,ostalih)
održavati simulacioni časovnik, budući kalendar (pregled) događaja ‚‚skakati” sa jednog događaja na drugi, procese, posmatrati statistiku, update-ovati kalendar događaja Mora se specifikovati odgovarajuće pravilo zaustavljanja(stopiranja) Obično se koristi programski jezik( general-purpose programming language) (C, FORTRAN, etc.) Fundamental Simulation Concepts
Slide 9 of 30
Događaji u sistemu •
Dolazak vozila u sistem
Ažurirati trajne vremenske statističke akumulatore (od poslednjeg događaja do sad) – – –
Označiti dolazeći deo trenutnim vremenom (koristićemo ga kasnije) Ako je server prazan: –
Početi pretovar (planirati dolazak), uposliti server,evidentirati vremena čekanja u redu (0)
u suprotnom (server je zauzet): –
Oblast ispod Q(t) Max Q(t) Oblast ispod B(t)
Staviti vozilo na kraj reda, povećati promenljivu dužine reda
Predvideti sledeći događaj dolaska Fundamental Simulation Concepts
Slide 10 of 30
Događaji u sistemu •
Odlazak(napuštanje) (kada je usluga završena)
Uvećanje broja opsluženih vozila
izračunati & evidentirati vreme u sistemu (sada- vreme dolaska)
Ažurirati vremensku statistiku (kao u slučaju dolaska) Ako red nije prazan:
–
Uzeti prvi kamion iz reda,izračunati i evidentirati vreme čekanja u redu,otpočeti opslugu (predvideti događaj odlaska)
u suprotnom (red je prazan): –
Server je neiskorišćen
Fundamental Simulation Concepts
Slide 11 of 30
Događaji u sistemu •
Kraj
•
Ažurirati vremensku statistiku Izračunati performanse output-a koristeći vrednosti statističkih akumulatora
Posle svakog događaja, podaci u kalendaru događaja koji se nalaze na vrhu se uklanjaju da bi se videlo koje je vreme, šta je potrebno raditi
Fundamental Simulation Concepts
Slide 12 of 30
“Ručna” simulacija • • • •
Manuelno praćenje promenjivih stanja,statističkih akumulatora Upotreba vremena između dolazaka, vremena opsluge Praćenje kalendara događaja “prebacivanje” sata sa jednog događaja na drugi
Fundamental Simulation Concepts
Slide 13 of 30
Ručna simulacija: System
Clock
B(t)
Q(t)
Number of completed waiting times in queue
Total of waiting times in queue
Arrival times of custs. in queue
Area under Q(t)
Event calendar
Area under B(t)
4
Q(t) graph
3 2 1 0
B(t) graph
0
5
10
15
20
0
5
10
15
20
2 1 0
Interarrival times
Time (Minutes) 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times
2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
Fundamental Simulation Concepts
Slide 14 of 30
Ručna simulacija : t = 0.00, početno System
Number of completed waiting times in queue 0
Clock
B(t)
Q(t)
0.00
0
0
Arrival times of Event calendar custs. in queue [1, 0.00, Arr] <empty> [–, 20.00, End]
Total of waiting times in queue
Area under Q(t)
Area under B(t)
0.00
0.00
0.00
4
Q(t) graph
3 2 1 0
B(t) graph
0
5
10
15
20
0
5
10
15
20
2 1 0
Interarrival times
Time (Minutes) 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times
2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
Fundamental Simulation Concepts
Slide 15 of 30
Ručna simulacija : t = 0.00, dolazak 1 kamiona System
1 Number of completed waiting times in queue 1
Clock
B(t)
Q(t)
Total of waiting times in queue
Arrival times of Event calendar custs. in queue [2, 1.73, Arr] <empty> [1, 2.90, Dep] [–, 20.00, End] Area under Area under Q(t) B(t)
0.00
1
0
0.00
0.00
0.00
4
Q(t) graph
3 2 1 0
B(t) graph
0
5
10
15
20
0
5
10
15
20
2 1 0
Interarrival times
Time (Minutes) 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times
2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
Fundamental Simulation Concepts
Slide 16 of 30
Ručna simulacija : t = 1.73, dolazak kamiona 2 System
2
1
Number of completed waiting times in queue 1
Clock
B(t)
Q(t)
Total of waiting times in queue
Arrival times of Event calendar custs. in queue [1, 2.90, Dep] (1.73) [3, 3.08, Arr] [–, 20.00, End] Area under Area under Q(t) B(t)
1.73
1
1
0.00
0.00
1.73
4
Q(t) graph
3 2 1 0
B(t) graph
0
5
10
15
20
0
5
10
15
20
2 1 0
Interarrival times
Time (Minutes) 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times
2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
Fundamental Simulation Concepts
Slide 17 of 30
Ručna simulacija : t = 2.90, odlazak kamiona 1 System
2 Number of completed waiting times in queue 2
Clock
B(t)
Q(t)
Total of waiting times in queue
Arrival times of Event calendar custs. in queue [3, 3.08, Arr] <empty> [2, 4.66, Dep] [–, 20.00, End] Area under Area under Q(t) B(t)
2.90
1
0
1.17
1.17
2.90
4
Q(t) graph
3 2 1 0
B(t) graph
0
5
10
15
20
0
5
10
15
20
2 1 0
Interarrival times
Time (Minutes) 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times
2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
Fundamental Simulation Concepts
Slide 18 of 30
Ručna simulacija : t = 3.08, dolazak kamiona 3 System
3
2
Number of completed waiting times in queue 2
Clock
B(t)
Q(t)
Total of waiting times in queue
Arrival times of Event calendar custs. in queue [4, 3.79, Arr] (3.08) [2, 4.66, Dep] [–, 20.00, End] Area under Area under Q(t) B(t)
3.08
1
1
1.17
1.17
3.08
4
Q(t) graph
3 2 1 0
B(t) graph
0
5
10
15
20
0
5
10
15
20
2 1 0
Interarrival times
Time (Minutes) 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times
2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
Fundamental Simulation Concepts
Slide 19 of 30
Ručna simulacija : t = 3.79, dolazak kamiona 4 System
4
3
2
Number of completed waiting times in queue 2
Clock
B(t)
Q(t)
Total of waiting times in queue
Arrival times of Event calendar custs. in queue [5, 4.41, Arr] (3.79, 3.08) [2, 4.66, Dep] [–, 20.00, End] Area under Area under Q(t) B(t)
3.79
1
2
1.17
1.88
3.79
4
Q(t) graph
3 2 1 0
B(t) graph
0
5
10
15
20
0
5
10
15
20
2 1 0
Interarrival times
Time (Minutes) 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times
2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
Fundamental Simulation Concepts
Slide 20 of 30
Ručna simulacija : t = 4.41, dolazak kamiona 5 System
5
4
3
2
Number of completed waiting times in queue 2
Clock
B(t)
Q(t)
Total of waiting times in queue
Arrival times of Event calendar custs. in queue [2, 4.66, Dep] (4.41, 3.79, 3.08) [6, 18.69, Arr] [–, 20.00, End] Area under Area under Q(t) B(t)
4.41
1
3
1.17
3.12
4.41
4
Q(t) graph
3 2 1 0
B(t) graph
0
5
10
15
20
0
5
10
15
20
2 1 0
Interarrival times
Time (Minutes) 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times
2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
Fundamental Simulation Concepts
Slide 21 of 30
Ručna simulacija : t = 4.66, odlazak kamiona 2 System
5
4
3
Number of completed waiting times in queue 3
Clock
B(t)
Q(t)
Total of waiting times in queue
Arrival times of Event calendar custs. in queue [3, 8.05, Dep] (4.41, 3.79) [6, 18.69, Arr] [–, 20.00, End] Area under Area under Q(t) B(t)
4.66
1
2
2.75
3.87
4.66
4
Q(t) graph
3 2 1 0
B(t) graph
0
5
10
15
20
0
5
10
15
20
2 1 0
Interarrival times
Time (Minutes) 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times
2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
Fundamental Simulation Concepts
Slide 22 of 30
Ručna simulacija : t = 8.05, odlazak kamiona 3 System
5
4
Number of completed waiting times in queue 4
Clock
B(t)
Q(t)
Total of waiting times in queue
Arrival times of Event calendar custs. in queue [4, 12.57, Dep] (4.41) [6, 18.69, Arr] [–, 20.00, End] Area under Area under Q(t) B(t)
8.05
1
1
7.01
10.65
8.05
4
Q(t) graph
3 2 1 0
B(t) graph
0
5
10
15
20
0
5
10
15
20
2 1 0
Interarrival times
Time (Minutes) 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times
2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
Fundamental Simulation Concepts
Slide 23 of 30
Ručna simulacija : t = 12.57, odlazak kamiona 4 System
5 Number of completed waiting times in queue 5
Clock
B(t)
Q(t)
12.57
1
0
Arrival times of custs. in queue
Total of waiting times in queue
Area under Q(t)
15.17
15.17
Event calendar [5, 17.03, Dep] () [6, 18.69, Arr] [–, 20.00, End] Area under B(t) 12.57
4
Q(t) graph
3 2 1 0
B(t) graph
0
5
10
15
20
0
5
10
15
20
2 1 0
Interarrival times
Time (Minutes) 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times
2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
Fundamental Simulation Concepts
Slide 24 of 30
Ručna simulacija : t = 17.03, odlazak kamiona 5 System
Number of completed waiting times in queue 5
Clock
B(t)
Q(t)
17.03
0
0
Arrival times of custs. in queue ()
Event calendar [6, 18.69, Arr] [–, 20.00, End]
Total of waiting times in queue
Area under Q(t)
Area under B(t)
15.17
15.17
17.03
4
Q(t) graph
3 2 1 0
B(t) graph
0
5
10
15
20
0
5
10
15
20
2 1 0
Interarrival times
Time (Minutes) 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times
2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
Fundamental Simulation Concepts
Slide 25 of 30
Ručna simulacija : t = 18.69, dolazak kamiona 6 System
6 Number of completed waiting times in queue 6
Clock
B(t)
Q(t)
18.69
1
0
Arrival times of custs. in queue ()
Total of waiting times in queue
Area under Q(t)
Event calendar [7, 19.39, Arr] [–, 20.00, End] [6, 23.05, Dep] Area under B(t)
15.17
15.17
17.03
4
Q(t) graph
3 2 1 0
B(t) graph
0
5
10
15
20
0
5
10
15
20
2 1 0
Interarrival times
Time (Minutes) 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times
2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
Fundamental Simulation Concepts
Slide 26 of 30
Ručna simulacija : t = 19.39, dolazak kamiona 7 System
7
6
Number of completed waiting times in queue 6
Clock
B(t)
Q(t)
Total of waiting times in queue
Arrival times of Event calendar custs. in queue [–, 20.00, End] (19.39) [6, 23.05, Dep] [8, 34.91, Arr] Area under Area under Q(t) B(t)
19.39
1
1
15.17
15.17
17.73
4
Q(t) graph
3 2 1 0
B(t) graph
0
5
10
15
20
0
5
10
15
20
2 1 0
Interarrival times
Time (Minutes) 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times
2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
Fundamental Simulation Concepts
Slide 27 of 30
Ručna simulacija : t = 20.00, kraj simulacije System
7
6
Number of completed waiting times in queue 6
Clock
B(t)
Q(t)
20.00
1
1
Arrival times of Event calendar custs. in queue [6, 23.05, Dep] (19.39) [8, 34.91, Arr]
Total of waiting times in queue
Area under Q(t)
Area under B(t)
15.17
15.78
18.34
4
Q(t) graph
3 2 1 0
B(t) graph
0
5
10
15
20
0
5
10
15
20
2 1 0
Interarrival times
Time (Minutes) 1.73, 1.35, 0.71, 0.62, 14.28, 0.70, 15.52, 3.15, 1.76, 1.00, ...
Service times
2.90, 1.76, 3.39, 4.52, 4.46, 4.36, 2.07, 3.36, 2.37, 5.38, ...
Fundamental Simulation Concepts
Slide 28 of 30
Ručna simulacija : proračun •
Prosečno vreme čekanja u redu: Total of times in queue 15.17 = = 2.53 minutes per truck No. of times in queue 6 • Prosečan broj kamiona u redu:
•
Area under Q( t ) curve 15.78 = = 0.79 truck Final clock value 20 Iskorišćenje servera: Area under B(t ) curve 18.34 = = 0.92 (dimension less) Final clock value 20 Fundamental Simulation Concepts
Slide 29 of 30
Simulaciona studija • • • • • • • • •
Razumeti sistem Imati jasne ciljeve Formulisati predstavljanje modela ‚‚Prevesti” ga u softver Verifikovati program Potvrditi model Projektovati eksperimente Izvršiti ih Analiza, dokumentovati rezultate Fundamental Simulation Concepts
Slide 30 of 30