Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Mod&Sim5 DiagActividad&3Fases
Mod&Sim5 DiagActividad&3Fases
las 3 fases
Diagrama de Ciclo de actividades1
1. Tomado de:
Pidd, M. (2004). Computer simulation in management science (5th ed.): John Wiley & Sons, Inc.
New York, NY, USA.
2
Diagrama de ciclo de actividades
Estado
Estado activo muerto
(Actividades)
(Colas)
• Generalmente involucra • No involucra cooperación entre
cooperación entre entidades entidades
• La entidad está involucrada en • La entidad está generalmente
una actividad esperando por algo
• La duración se puede determinar • La duración NO se puede determinar
con anticipación: con anticipación: depende de la
• Determinística finalización del estado activo previo y
• Muestreo aleatorio el inicio del estado activo próximo
3
Ejemplo 1: taller de producción
Se puede determinar la
duración de la actividad Ausente
Cambio de Reinicio
piezas Máquina
5
Ciclo de actividades: Máquinas
Cambio de Reinicio
piezas Máquina
OK
desgastada
Utilizable
Parada Lista
Trabajando
6
Ciclo de actividades combinado
Ausente
Una máquina puede ser
Operarios reiniciada si:
• hay un operario esperando
Espera
&
Reinicio • (una máquina está en OK) o
Cambio de (una máquina está parada y
Máquina
piezas utilizable)
OK
8
Ejemplo 2: Venta de entradas a cine
ENTIDADES:
• Recepcionista: Atiende a dos tipos de clientes.
• Clientes que se presentan en persona:
• Llegan a la recepción, esperan, son atendidos y se van.
• Clientes que llaman por teléfono:
• Llaman por teléfono, esperan a que les contesten, conversan con el recepcionista y cuelgan.
9
Ciclo de actividades: cinema
Recepcionista
Afuera Otro
sitio
10
Ejemplo 3
• Los productos se reciben en camiones y se guardan en
inventario (los camiones llegan cargados). Los camiones
necesitan dos hombres para la descarga.
• Los productos son tomados del inventario y enviados a los
clientes en furgonetas (las furgonetas llegan vacías). Las
furgonetas necesitan 1 hombre para la carga
• 2 bahías de descarga para los camiones y 4 de carga para las
furgonetas
• La ruta de acceso es estrecha, solamente un camión se
puede mover en cualquier dirección. Hay espacio para dos
furgonetas (entra/sale)
• Prioridad a los camiones que salen, luego a los camiones
que entran. Las furgonetas tienen la menor prioridad.
• Se quiere saber cuantas bahías de carga son necesarias para
atender la demanda
11
Objetos
12
Ciclo de actividades: Camión
Entidades Furgonetas Número ilimitado, entran y salen
Camiones Número ilimitado, entran y salen
Recursos Bahías de descarga Dos disponibles
contables Bahías de carga Cuatro disponibles (variable decisión)
Personal 5 grupos disponibles ( 10 personas)
Ruta de entrada Una disponible
Bdescarga=1 Rentrada=1 Ruta de salida Una disponible
Rentrada=0 Rsalida=1
Rsalida=0
Vacío Fila
Bdescarga>0 &
Rentrada=1 &
Personal >1? Rsalida=1 ?
???
14
Tarea
15
Descripción del modelo JOE (Tomado del libro: Computer Simulation in Management Science by Mike Pidd, pag.136-137))
Joe’s parlour is open from 9.00am to 7.00pm and he and his fitters work throughout that period if there is work to be done. Motorists arrive at
random (your analysis shows that it follows an exponential distribution with a mean of 15 minutes) and wait for Joe to inspect their car’s exhaust
system. Joe feels that many motorists will go somewhere else when they see four cars are already waiting for inspection. Joe drives the car onto
any free hydraulic ramp for inspection. Your analysis shows that the inspection time follows a normal distribution with a mean of 5 minutes and a
standard deviation of 1.5 minutes. Joe then advises the customer on the necessary work and 70% customers elect to stay at Joe’s parlour to have
the work done. The other 30% go off elsewhere.
While waiting on the lounge, the customers can watch one of Joe’s fitters work on their car on the ramp. Your analysis shows that the fitting process
follows a lognormal distribution with mean of 40 minutes and a standard deviation of 10 minutes. When the fitter is finished, Joe inspects the work
and, if satisfactory, he prints out the bill for the driver, who then pays and leaves. If Joe decides that the work is not satisfactory (which seems to
happen to 10% of the jobs) then the fitter must rework the job – and this may take as long as the original work. Rework, too, is inspected in the same
way as the original work. Joe thinks| that he needs between 1 minute and 3 minutes to check his fitter’s work. Your analysis shows that the time that
Joe needs to complete the payment process follows an exponential distribution with a mean of 3 minutes.
Joe would like some advice from you. He needs to know how many fitters and ramps he should employ in the parlour (currently, three ramps and
two fitters). He is very secretive about his finances and will not give you this information, preferring to carry out a financial analysis himself after you
have advised him about fitters and ramps. Ideally, he would like to keep his customers waiting rather less than 10 minutes before he inspects their
vehicle after their arrival; he would also like to ensure that customers spend less than 60 minutes in total at the parlour. Currently, he has three
ramps and two fitters. 16
Diagramas de flujo de proceso
17
18
Simulación de las tres fases1
1. Tomado de:
Pidd, M. (2004). Computer simulation in management science (5th ed.): John Wiley & Sons, Inc. New York, NY, USA.
Robinson, S. (2004). Simulation: the practice of model development and use: Wiley.
19
Eventos en el método de las tres fases
20
Método de las tres fases: B’s y C’s
Estado Activo
21
Simulation tres fases: Bs & Cs
Ejemplo del estado activo “Servicio”
C: Comienza servicio
SI un recepcionista está desocupado y
Condiciones:
cliente está en la fila ENTONCES:
B: Termina servicio
Recepcionista se desocupa
Acciones: Persona sale del sistema
22
Inicio
Inicializar Simulación:
• Estado inicial
• Eventos iniciales
Excepción: Si el evento es una llegada –
Fase A
Avanza el reloj hasta el tiempo
(Proceso de remuestreo Bootstrap)- el
del próximo evento (t) comienzo de su estado (C) coincide con el fin
del mismo estado (B) de la entidad anterior.
Fase B En vez de usar C-B para representar las
Ejecutar todos los eventos B’s
que ocurren en t
llegadas, estas pueden ser representadas
simplemente con B. La llegada de un cliente
Fase C inmediatamente causa la llegada del próximo
Evaluar todas los C´s y ejecutar cliente .
todos los que estén activos
Si
Algún C’s?
No
No Fin de la
Simulación?
Si
Parar 23
Ejemplo: Cajero Electrónico
24
Tabla de números aleatorios
Col\Fila 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1 18 69 84 78 85 78 40 23 95 76 25 95 56 64 60 42 0 73 31 81
2 90 42 7 45 5 9 10 69 83 27 70 64 0 92 80 27 65 93 61 90
3 11 39 93 93 42 79 66 70 64 54 55 97 45 93 57 46 51 39 8 27
4 4 2 90 28 57 73 45 0 38 10 8 36 56 79 91 92 64 23 92 21
5 65 24 30 11 76 54 46 8 85 95 59 21 26 92 89 23 20 24 21 8
6 88 63 38 47 22 37 45 12 47 25 45 53 5 79 92 85 46 48 38 26
7 74 93 50 70 37 68 52 43 50 10 36 62 39 24 61 80 8 23 98 4
8 59 92 61 13 70 70 79 38 76 86 82 30 60 12 34 76 19 15 88 10
9 95 66 35 30 81 2 3 39 76 82 26 91 97 90 90 28 78 51 47 95
10 58 6 82 95 26 0 91 28 99 34 75 52 6 56 10 0 78 27 19 79
11 90 56 88 94 82 19 68 54 54 98 0 71 90 39 38 62 92 18 35 37
12 50 92 45 85 29 60 6 35 25 38 93 57 56 68 37 80 61 81 40 99
13 20 35 55 39 34 20 96 86 55 69 41 42 41 54 52 17 55 95 12 49
14 16 68 4 81 3 26 88 36 81 77 16 19 6 50 93 81 30 91 40 8
15 70 85 24 45 64 3 96 99 32 33 14 81 41 83 41 5 94 10 63 13
16 36 30 41 26 27 32 90 51 74 28 70 73 67 8 14 48 31 32 52 84
17 11 95 80 73 74 39 94 6 80 61 79 9 79 20 20 67 50 82 79 87
18 76 24 89 95 31 71 81 97 34 73 4 99 15 94 6 23 4 16 34 38
19 18 51 46 37 70 29 79 68 10 70 4 57 74 48 89 84 53 50 25 95
20 39 17 80 58 79 57 36 78 29 29 54 92 20 18 75 47 98 33 96 34
21 62 20 18 35 83 22 82 81 6 52 0 27 64 37 42 64 89 1 73 58
22 32 79 82 90 36 87 53 33 10 99 80 52 18 36 66 78 59 55 69 58
23 17 90 70 55 4 39 65 20 6 36 48 15 67 66 25 62 9 92 71 29
24 41 72 55 75 33 63 42 62 6 73 51 84 9 33 2 55 64 72 35 89
25 99 9 48 9 27 86 56 90 23 89 77 72 78 94 95 33 23 23 54 43
25
• Vamos a usar los datos desde la fila 21 para
representar los dígitos de los números aleatorios entre
0 y 1:
21 62 20 18 35 83 22 82 81 6 52 0 27 64 37 42 64 89 1 73 58
22 32 79 82 90 36 87 53 33 10 99 80 52 18 36 66 78 59 55 69 58
23 …
26
Variabilidad
27
Proceso de Simulación
[Tpll Cl1 = -4ln(1-0.6220) = 3.89] → Programar B1 y agregar a lista de eventos: Llegada de Cliente 1
28
Inicio
Inicializar Simulación:
• Estado inicial
• Eventos iniciales Para cada iteración:
Fase A 1. Encontrar el próximo evento de
Avanza el reloj hasta el tiempo la lista de eventos
del próximo evento (t) 2. Avance el reloj hasta el tiempo
del próximo evento
Fase B
Ejecutar todos los eventos B’s 3. Ejecutar todos los eventos B’s
que ocurren en t que ocurren en t
4. Actualizar la lista de eventos-
Fase C ejecutar las C´s (Si el evento es
Evaluar todas los C´s y ejecutar
todos los que estén activos
una llegada agregue la próxima
llegada, si el evento comienza
Si un proceso, entonces agregue
Algún C’s? el final del proceso)
No
No Fin de la Ir a Ejemplo
Simulación?
Si
Parar 30
Iteración 1
31
Iteración 2
33
Iteración 9
Estado Estadísticas Lista de eventos
Tiemp Cola Cajero T. espera N.A. Evento Tiempo Listo
o
0.00 0 Disponi 6220 B1: Lleg Cl1 3.89 ✓
ble
3.89 0 Cl1 (Cl1) 0.00 1835 B1: Lleg Cl2 4.70 ✓
4.70 Cl2 Cl1 8322 B2:Fin Serv. Cl1 8.39 ✓
8.39 0 Cl2 (Cl2) 3.69 8281 B1:Lleg Cl3 11.74 ✓
10.59 0 Disponi 0652 B2:Fin Serv. Cl2 10.59 ✓
ble
11.74 0 Cl3 (Cl3) 0.00 0027 B1:Lleg Cl4 11.75 ✓
11.75 Cl4 Cl3 6437 B2:Fin Serv. Cl3 15.67 ✓
13.97 Cl5, Cl3 4264 B1:Lleg Cl5 13.97 ✓
Cl4
15.67 Cl5 Cl4 (Cl4) 3.92 8901 B1:Lleg Cl6 22.80
19.88 0 Cl5 (Cl5) 5.91 7358 B2:Fin Serv. Cl4 19.88 ✓
3279 B2:Fin Serv. Cl5 22.86
35
Tarea
Customers arrive at random at Ruth's Bi-Lo self-service petrol station. During the busiest period
of the day (between 5 p.m. and 7 p.m.) customers arrive at an average rate of 20 per hour.
There is only a single pump to serve all customers, so that the system operates as a single
channel queue. The time required for customers to pull up, fill up with petrol, pay and leave is
a random variable that conforms approximately to the uniform distribution with a range from 1
minutes to 7 minutes. There is another garage nearby and so if the pump is in use and one car
is also waiting any potential customers will drive to the next garage. Ruth wishes to estimate:
• The mean waiting time of customers.
• The proportion of customers lost per hour.
Simulate by hand the period 5 p.m. to 5.30 p.m. and estimate the above quantities. Assume
that at 5 p.m. there is one car filling up with petrol and that this car will leave the garage at 1.1
minutes after 5. The next customer will arrive 2.0 minutes after 5. Work to two decimal places
of minutes. [Random numbers: Use row 2 for arrivals 90 42 etc. and row 6 for service times
88 63 etc.]
• What reservations would you have about these estimates and how would you overcome
them?
• How would you use the simulation to improve the operation of the business?
36
Tabla de números aleatorios
Col\Fila 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1 18 69 84 78 85 78 40 23 95 76 25 95 56 64 60 42 0 73 31 81
2 90 42 7 45 5 9 10 69 83 27 70 64 0 92 80 27 65 93 61 90
3 11 39 93 93 42 79 66 70 64 54 55 97 45 93 57 46 51 39 8 27
4 4 2 90 28 57 73 45 0 38 10 8 36 56 79 91 92 64 23 92 21
5 65 24 30 11 76 54 46 8 85 95 59 21 26 92 89 23 20 24 21 8
6 88 63 38 47 22 37 45 12 47 25 45 53 5 79 92 85 46 48 38 26
7 74 93 50 70 37 68 52 43 50 10 36 62 39 24 61 80 8 23 98 4
8 59 92 61 13 70 70 79 38 76 86 82 30 60 12 34 76 19 15 88 10
9 95 66 35 30 81 2 3 39 76 82 26 91 97 90 90 28 78 51 47 95
10 58 6 82 95 26 0 91 28 99 34 75 52 6 56 10 0 78 27 19 79
11 90 56 88 94 82 19 68 54 54 98 0 71 90 39 38 62 92 18 35 37
12 50 92 45 85 29 60 6 35 25 38 93 57 56 68 37 80 61 81 40 99
13 20 35 55 39 34 20 96 86 55 69 41 42 41 54 52 17 55 95 12 49
14 16 68 4 81 3 26 88 36 81 77 16 19 6 50 93 81 30 91 40 8
15 70 85 24 45 64 3 96 99 32 33 14 81 41 83 41 5 94 10 63 13
16 36 30 41 26 27 32 90 51 74 28 70 73 67 8 14 48 31 32 52 84
17 11 95 80 73 74 39 94 6 80 61 79 9 79 20 20 67 50 82 79 87
18 76 24 89 95 31 71 81 97 34 73 4 99 15 94 6 23 4 16 34 38
19 18 51 46 37 70 29 79 68 10 70 4 57 74 48 89 84 53 50 25 95
20 39 17 80 58 79 57 36 78 29 29 54 92 20 18 75 47 98 33 96 34
21 62 20 18 35 83 22 82 81 6 52 0 27 64 37 42 64 89 1 73 58
22 32 79 82 90 36 87 53 33 10 99 80 52 18 36 66 78 59 55 69 58
23 17 90 70 55 4 39 65 20 6 36 48 15 67 66 25 62 9 92 71 29
24 41 72 55 75 33 63 42 62 6 73 51 84 9 33 2 55 64 72 35 89
25 99 9 48 9 27 86 56 90 23 89 77 72 78 94 95 33 23 23 54 43
37
State Statistics Event list
Time Queue Pump Wait Lost R.N. Event Time Done
0.00 C1 End serve C1 1.10
1.10 - Arr C2 2.00
9042 Arr C3 9.04
38
Tarea
• Implementar ejemplo de
Joe en Simpy
• Desarrollar el ejercicio
E2.3 (pp35) de Robinson
e implementarlo en uno
de los siguientes lenguaje
de programación:
Python, Java, Matlab.
39