animación de un sistema de puertas (código en glider)
DESCRIPTION
Animación de un Sistema de Puertas (código en GLIDER). NETWORK L (I)::IT:=1; Tipo:=((NUMBER-1) mod 4) + 1; SENDTO(P[Tipo]); P (G) [1..4]::STATE BEGIN IT:=5; ABIERTA:=NOT ABIERTA END; IF ABIERTA THEN SENDTO(S) ELSE STOPSCAN; - PowerPoint PPT PresentationTRANSCRIPT
Animación de un Sistema de Puertas(código en GLIDER)
NETWORK
L (I):: IT:=1; Tipo:=((NUMBER-1) mod 4) + 1; SENDTO(P[Tipo]);
P (G) [1..4]:: STATE BEGIN IT:=5; ABIERTA:=NOT ABIERTA END; IF ABIERTA THEN SENDTO(S) ELSE STOPSCAN;
S (E):: WRITELN(NUMBER:2,' ',Tipo:1,' ',' ',GT:2:0,' ',TIME:2:0);
INIT ACT(L,0); TSIM:=21; ABIERTA:=FALSE; FOR I:=1 TO 4 DO ACT(P[I],5);
DECL VAR ABIERTA:BOOLEAN; I: INTEGER; MESSAGES L(Tipo:INTEGER);END.
Tiempo: 0
L 0
Lista de Eventos Pendientes
Simulación lista para arrancar
L
P1
S
P4
P3
P2
P1 5 P2 5 P3 5 P4 5Abierta: False
ABIERTA:=FALSE;
ACT(L,0);
FOR I:=1 TO 4 DO ACT(P[I],5);
Tiempo: 0
L 0
Lista de Eventos Pendientes
Se procesa el primer evento y se activa L
L
P1
S
P4
P3
P2
P1 5 P2 5 P3 5 P4 5Abierta: False
Tiempo: 0Lista de Eventos Pendientes
Se genera la próxima llegada y el cliente [1]
L
P1
S
P4
P3
P2
P1 5 P2 5 P3 5 P4 5Abierta: False
L 1
1
Tiempo: 1Lista de Eventos Pendientes
Se procesa el segundo evento y se activa L
L
P1
S
P4
P3
P2
P1 5 P2 5 P3 5 P4 5Abierta: False
1
L 1
Tiempo: 1Lista de Eventos Pendientes
Se genera la próxima llegada y el cliente [2]
L
P1
S
P4
P3
P2
P1 5 P2 5 P3 5 P4 5
1
Abierta: FalseL 2
2
Tiempo: 2Lista de Eventos Pendientes
Se procesa el próximo evento y se activa L
L
P1
S
P4
P3
P2
P1 5 P2 5 P3 5 P4 5Abierta: False
1
2
L 2
Tiempo: 2Lista de Eventos Pendientes
Se genera la próxima llegada y el cliente [3]
L
P1
S
P4
P3
P2
P1 5 P2 5 P3 5 P4 5
1
Abierta: FalseL 3
2
3
Tiempo: 3Lista de Eventos Pendientes
Se procesa el próximo evento y se activa L
L
P1
S
P4
P3
P2
P1 5 P2 5 P3 5 P4 5Abierta: False
1
2
3
L 3
Tiempo: 3Lista de Eventos Pendientes
Se genera la próxima llegada y el cliente [4]
L
P1
S
P4
P3
P2
P1 5 P2 5 P3 5 P4 5
1
Abierta: FalseL 4
2
3
4
Tiempo: 4Lista de Eventos Pendientes
Se procesa el próximo evento y se activa L
L
P1
S
P4
P3
P2
P1 5 P2 5 P3 5 P4 5Abierta: False
1
2
3
4
L 4
Tiempo: 4Lista de Eventos Pendientes
Se genera la próxima llegada y el cliente [5]
L
P1
S
P4
P3
P2
P1 5 P2 5 P3 5 P4 5
1
Abierta: FalseL 5
2
3
4
5
Tiempo: 4Lista de Eventos Pendientes
Se procesa el próximo evento (P1)
L
P1
S
P4
P3
P2
Abierta: False
1
2
3
4
P1 5 P2 5 P3 5 P4 5 L 5
5
Tiempo: 5Lista de Eventos Pendientes
Se activa P1 (por evento), se genera próximo evento y se cambia el valor de Abierta
L
P1
S
P4
P3
P2
Abierta: False
1
2
3
4
P2 5 P3 5 P4 5 L 5
5
P1 10Abierta: True
ABIERTA:=NOT ABIERTAEND;
STATE BEGIN IT:=5;
Tiempo: 5Lista de Eventos Pendientes
P1 deja pasar los clientes
L
P1
S
P4
P3
P2
Abierta: False
1
2
3
4
P2 5 P3 5 P4 5 L 5
5
P1 10Abierta: True
Tiempo: 5Lista de Eventos Pendientes
P1 deja pasar los clientes
L
P1
S
P4
P3
P2
Abierta: False
12
3
4
P2 5 P3 5 P4 5 L 5
5
P1 10Abierta: True
Tiempo: 5Lista de Eventos Pendientes
P1 deja pasar los clientes
L
P1
S
P4
P3
P2
Abierta: False
12
3
4
P2 5 P3 5 P4 5 L 5
5
P1 10Abierta: True
Tiempo: 5Lista de Eventos Pendientes
P1 deja pasar los clientes
L
P1
S
P4
P3
P2
Abierta: False
12
3
4
P2 5 P3 5 P4 5 L 5
5
P1 10Abierta: True
Tiempo: 5Lista de Eventos Pendientes
Se activa P2 (por revisión)
L
P1
S
P4
P3
P2
Abierta: False
12
3
4
P2 5 P3 5 P4 5 L 5
5
P1 10Abierta: True
Tiempo: 5Lista de Eventos Pendientes
P2 deja pasar los clientes
L
P1
S
P4
P3
P2
Abierta: False
12
3
4
P2 5 P3 5 P4 5 L 5
5
P1 10Abierta: True
Tiempo: 5Lista de Eventos Pendientes
P2 deja pasar los clientes
L
P1
S
P4
P3
P2
Abierta: False
12
3
4
P2 5 P3 5 P4 5 L 5
5
P1 10Abierta: True
Tiempo: 5Lista de Eventos Pendientes
Se activa P3 (por revisión)
L
P1
S
P4
P3
P2
Abierta: False
12
3
4
P2 5 P3 5 P4 5 L 5
5
P1 10Abierta: True
Tiempo: 5Lista de Eventos Pendientes
P3 deja pasar los clientes
L
P1
S
P4
P3
P2
Abierta: False
12
3
4
P2 5 P3 5 P4 5 L 5
5
P1 10Abierta: True
Tiempo: 5Lista de Eventos Pendientes
P3 deja pasar los clientes
L
P1
S
P4
P3
P2
Abierta: False
123
4
P2 5 P3 5 P4 5 L 5
5
P1 10Abierta: True
Tiempo: 5Lista de Eventos Pendientes
Se activa P4 (por revisión)
L
P1
S
P4
P3
P2
Abierta: False
123
4
P2 5 P3 5 P4 5 L 5
5
P1 10Abierta: True
Tiempo: 5Lista de Eventos Pendientes
P4 deja pasar los clientes
L
P1
S
P4
P3
P2
Abierta: False
123
4
P2 5 P3 5 P4 5 L 5
5
P1 10Abierta: True
Tiempo: 5Lista de Eventos Pendientes
P4 deja pasar los clientes
L
P1
S
P4
P3
P2
Abierta: False
1234
P2 5 P3 5 P4 5 L 5
5
P1 10Abierta: True
Tiempo: 5Lista de Eventos Pendientes
Se activa S (por revisión)
L
P1
S
P4
P3
P2
Abierta: False
1234
P2 5 P3 5 P4 5 L 5
5
P1 10Abierta: True
Tiempo: 5Lista de Eventos Pendientes
S elimina los clientes
L
P1
S
P4
P3
P2
Abierta: False
1234
P2 5 P3 5 P4 5 L 5
5
P1 10Abierta: True
1 1 0 5
N T G T
5 1 4 5
2 2 1 5
3 3 2 5
4 4 3 5
Abierta: True
Tiempo: 5Lista de Eventos Pendientes
Se procesa el próximo evento. Se activa P2 por evento.
L
P1
S
P4
P3
P2
Abierta: FalseP2 5 P3 5 P4 5 L 5 P1 10
Tiempo: 5Lista de Eventos Pendientes
Abierta cambio y se genera el próximo evento
L
P1
S
P4
P3
P2
Abierta: FalseP2 10P3 5 P4 5 L 5 P1 10
Abierta: False
Abierta: FalseAbierta: True
Tiempo: 5Lista de Eventos Pendientes
Se procesa el próximo evento. Se activa P3 por evento.
L
P1
S
P4
P3
P2
P2 10P3 5 P4 5 L 5 P1 10
Tiempo: 5Lista de Eventos Pendientes
Abierta cambio y se genera el próximo evento
L
P1
S
P4
P3
P2
Abierta: FalseP2 10 P3 10P4 5 L 5 P1 10
Abierta: True
Tiempo: 5Lista de Eventos Pendientes
Se procesa el próximo evento. Se activa P4 por evento.
L
P1
S
P4
P3
P2
Abierta: TrueP2 10 P3 10P4 5 L 5 P1 10
Abierta: False
Tiempo: 5Lista de Eventos Pendientes
Abierta cambio y se genera el próximo evento
L
P1
S
P4
P3
P2
Abierta: FalseP2 10 P3 10 P4 10L 5 P1 10
Abierta: False
Tiempo: 5
L 5
Lista de Eventos Pendientes
Se procesa el próximo evento
L
P1
S
P4
P3
P2
P1 10 P2 10 P3 10 P4 10Abierta: False
Tiempo: 5Lista de Eventos Pendientes
Se activa L
L
P1
S
P4
P3
P2
P1 10 P2 10 P3 10 P4 10Abierta: False
Tiempo: 5Lista de Eventos Pendientes
Se genera la próxima llegada y el cliente [6]
L
P1
S
P4
P3
P2
P1 10 P2 10 P3 10 P4 10
6
Abierta: FalseL 6
Tiempo: 5
L 6
Lista de Eventos Pendientes
Se procesa el próximo evento y se activa L
L
P1
S
P4
P3
P2
P1 10 P2 10 P3 10 P4 10Abierta: False
6
Tiempo: 6Lista de Eventos Pendientes
Se genera la próxima llegada y el cliente [7]
L
P1
S
P4
P3
P2
P1 10 P2 10 P3 10 P4 10
6
Abierta: FalseL 7
7
Observaciones
• La 4 puertas están controladas por la misma variable ABIERTA.
• Al activarse por evento P1 en el tiempo 5, ABIERTA toma el valor TRUE y se dejan pasar todos los clientes retenidos en P1.
• Luego por revisión, pasan también los retenidos en P2, P3 y P4.
Observaciones
• Las activaciones por evento posteriores de P2, P3 y P4 no causan movimientos de mensajes (no quedaron clientes) y lo único que hacen es alternar el valor de ABIERTA a FALSE, TRUE y finalmente FALSE.
• El efecto es que se abrieron las puertas, se dejaron pasar los clientes y se cerraron (se abrieron y cerraron instantáneamente)