360 likes | 428 Views
. Languages. Queueing. Simulators. Tool Development. Turing Machine. Event Graphs(Sigma). Power. Petri Nets. Usability. Complete Edge Definition. (i). t. A. B. ~. k. ( j ). After executing event A , a vector of expressions, k , is
E N D
. . Languages Queueing . Simulators Tool Development Turing Machine Event Graphs(Sigma) Power . Petri Nets Usability
Complete Edge Definition (i) t A B ~ k ( j ) After executing event A, a vector of expressions, k, is evaluated. If condition (i) is then true, event B will be scheduled to occur after a delay of t with variable vector, j, equal to those values of k.
Stop No Yes Figure 2.2: Main Event Scheduling Algorithm State Initialize Event List Advance Clock to Time of Next Event Change State Execute Event Cancel Events Schedule Events Remove Event From List Summary Statistics
The values of k become the attributes of scheduled events… PENDING EVENTS LIST(“Future” Events list is not necessarily in future) Time Event Priority Attributes 3.32 Breakdown 2 3,4,6 4.47 Finish 3 3,4,6 5.64 Arrival 4 7 Part number 7 5.64 Finish 3 2,5,1 Tool 3, worker 4, part 6 The “attributes” for the edge that scheduled the Breakdown event are expressions for the values for the “parameters”, (Tool,Worker,Part)
Q[C]==0&C>0) ~ CHKQs (C,A) C-1,A C,A C,A A A,A C,0 (S[A]<=0&A<N-1) ~ (Q[C]>0) ~ C,A+1 tc (S[A]>0) ts(C,A) RUN N,S[N]‘s ARRIVE ~ CHECK START LEAVE (C,A) (C,A) (A) {R=RND, C=(R>.4)+(R>.8), Q[C]=Q[C]+1} {S[A]=S[A]-1, Q[C]=Q[C]-1} {S[A]=S[A]+1} Simulated Call Center (3 classes of caller and agent skill levels) Policy: Highest priority calls answered first with the lowest skilled agents that can handle the call. Exercise: Find the error… ( should be ) C,C C,0
Customers In Service 6 Customers Waiting In Line 16 15 14 13 12 11 10 ID=15 NEXT=11 8 Pending Events List Time Type Parameters 3.243 Leave 8 4.210 Enter 5.593 Leave 6 6.478 Leave 10 State for BANK2.MOD
I+1 , 0 ( I 7 & J < I ) ~ ~ ( I < 7 & J = = I ) I , J+1 ( I 7 & J I ) EVENT (I,J) ~ 2 , 0 Do EVENT FOR I = 2 to 7 and J = 0 to I
(Q>0) NEXT ~ ta ts (S>0) ~ RUN ENTER START LEAVE IN ID (S) (IN) (IN) {ID=ID+1, Q=Q+1, W[ID]=CLK} {Q=Q-1, S=S-1, NEXT=NEXT+1} {S=S+1, W[IN]=CLK-W[IN]} BANK2.MOD
(Q>0) NEXT ~ ta ts (S>0) ~ RUN ENTER START LEAVE IN ID (S) (IN) (IN) {ID=ID+1, Q=Q+1, W[ID]=CLK} {Q=Q-1, S=S-1, NEXT=NEXT+1} {S=S+1, W[IN]=CLK-W[IN]} BANK2.MOD – can you simplfy? (IN not used in START)
(Q>0) ~ ta ts (S>0) ~ RUN ENTER START LEAVE NEXT (S) (IN) {ID=ID+1, Q=Q+1, W[ID]=CLK} {Q=Q-1, S=S-1, NEXT=NEXT+1} {S=S+1, W[IN]=CLK-W[IN]} BANK2.MOD (modified What about collecting wait in line only?)
(Q>0) ~ NEXT ta ts (S>0) START (IN) ~ RUN ENTER LEAVE ID (S) {Q=Q-1, S=S-1, W[IN]=CLK-W[IN], NEXT=NEXT+1} {ID=ID+1, Q=Q+1, W[ID]=CLK} {S=S+1} BANK2.MOD (modified – wait in queue only)
(Q>0) ~ ta ts (S>0) ~ RUN ENTER START LEAVE Q+1 (S) (IN) (IN) {S=S+1, W[IN]=CLK-W[IN]} {Q=Q+1, W[ID]=CLK} {Q=Q-1, S=S-1} BANK2.MOD – LIFO? Error – why?
DISK Function • Reads input from files during a run. • DISK{F;R} reads record R from file F. • Record can be: • Numerical Data......or • EXPRESSIONS(e.g. Q+5*BET{.5;.3}) • Program can change itself during execution.
DISK Function Examples: 1. The file QUE.DAT is: 11 12 13 14 15 Q=DISK{QUE.DAT;4} = 14 Q=DISK{QUE.DAT;9} = 14(wraps around at EOF) Q=DISK{QUE.DAT;0} (reads file in sequence, wrap at EOF) Q=DISK{QUE.DAT;1+5*RND}= Uniform{11,12,...15}
3. Tabled Data in TOOL.DAT //JID IST BIN MTTF MTTR 1 3.5 4 14.4 15.2 2 3.7 3 10.0 18.7 3 2.5 2 15.4 16.6 4 0.5 5 8.4 12.4 ~ (I<3) I+1 Read (I) (I==3) ~ 0 0 ... is Read by... { JID[I]=DISK{TOOL.DAT;1+5*I}, IST[I]=DISK{TOOL.DAT;2+5*I}, BIN[I]=DISK{TOOL.DAT;3+5*I}, MTTF[I]=DISK{TOOL.DAT;4+5*I}, MTTR[I]=DISK{TOOL.DAT;5+5*I}} Think of I as the “row” in the data table (starting with 0)!
From Jesus Jimenez report on John Fowler’s SRC Project at Arizona State Execution time in seconds of the JDS and RDS at different traffic intensities for “minifab lite”.
Run (R,M) Enter (Q) ~ ta (S) ts ~ Leave Start {Q=Q-1, S=S-1} {S=R} {Q=Q+1)} {S=S+1} Can get average Q from this model – say, want Average W? (use Little’s Law).
NEXT Run (R,M) Enter Could use MOD function to recycle elements of The W[ ] array. (Assume that Max Q << M-R) (Q) ~ ta (S) ts Leave (IN) ~ Start {Q=Q+(Q<(M-R)), ID=MOD{ID+1;M}, W[ID]=CLK} {Q=Q-1, S=S-1, NEXT=MOD{NEXT+1;M}} {NEXT=0, S=R} {S=S+1, W[IN]=CLK-W[IN]}
NEXT Run (R,M) Enter Or...Can use (Much Faster and Easier) Resident Entity Model to get Average Delay(Eliminate W[.]!) (Q) ~ ta (S) ts Leave (IN) ~ Start {Q=Q+(Q<(M-R)), ID=MOD{ID+1;M}, W[ID]=CLK} {Q=Q-1, S=S-1, NEXT=MOD{NEXT+1;M}} {NEXT=1, S=R} {S=S+1, W[IN]=CLK-W[IN]}
Run (R,x) Delay Enter Start Delay.mod ~ (Q) ta (R) ts ~ Leave X {Q=Q+1} {R=R+1} {Q=Q-1, R=R-1, S=S+1} {D=D+1, W=W+(S>=D), PROB = W/D } Estimates PROB = Prob{Wait<X} as average number of Delays (D) after Starts (S) Homework: Check Priorities between Delay and Start? Is it O.K. for R>1 resources? Why NOT?
Records of Transient Entity Attributes The Array, ENT[0], ... ,ENT[N], Acts as a Temporary Buffer for Transferring Data Between the Model and Ranked Lists (Queues). Queue M will be Ranked by Attribute ENT[ RNK [M] ].
Priority Queues • PUT{C;L} will add ENT[ ] to list L according to ranking criterion C. • Returns a value of 1 • e.g. Q = Q + 1 • GET{C;L} will move a record from list L into ENT[ ] according to criterion C • e.g. Q = Q - 1
Queue Ranking Options • PUT{Option;List} • 1 or FIF: First is First • 2 or LIF: Last is First • 3 or INC: Increasing values of a rank attribute • 4 or DEC: Decreasing values of rank attribute • 5 or EVN: Breaking Ties between rank • Get{Option;List} • 1 or FST: First in line • 2 or LST: Last in line • 3 or Key: Specific entity
The ENT[ ] Array SIGMA Memory File ENT [ ] ENT [ ] PUT GET LIST LIST Transient Entity Attributes using the ENT[ ] Array
1 1 I+1 I+1 SORTING N Random Numbers RUN SORT (I<N&PUT{DEC;LINE}) (GET{FST;LINE}) ~ ~ (I==N) SHOW ~ SORT SHOW RUN (I) (I) { LINE=4, RNK[LINE]=6 } { X=RND, ENT[6]=X } { X=ENT[6] }
LEAVE RUN START ENTER A Priority Queue State Changes {R=1, {R=R+1} RNK[5]=3} {ID=ID+1, {Q=Q-GET{FST;5}, ENT[1]=ID, W[ENT[1]]=CLK-ENT[2], ENT[2]=CLK, R=R-1} ENT[3]=1+(RND>.5), Q=Q+PUT{INC;5}}
Time Constrained Process Sequence Example: stamping mill in heavy mfg. Maximum Cooling Time = tc tp th ta Heat Press QF = queue for furnaces QP = queue for presses F = number idle furnaces P = number idle presses
Straight-Forward Approach to TBS ta Redo Run (tc,F,P) Enter Heat (F>0) (F>0) ~ ~ {QP=QP-1, QF=QF+1} {F=F-1, QF=QF-1} {QF=QF+1} th ~ (QF>0) Ready tc Cold (ENT[0]) {F=F+1, QP=QP+1} ~ (P>0) (QP>0) ~ Done Press tp {P=P-1, QP=QP-1} {P=P+1} Problems: non-FIFO or Random tc
ta Redo Run (tc) Enter Heat (F>0) (F>0) ~ ~ {QP=QP-1, QF=QF+1} {F=F-1, QF=QF-1} {QF=QF+1} {F=1,P=1} th ~ (QF>0) ~ (GET{KEY;1}) Ready Cold (ENT[0]) tc ID {F=F+1,ID=ID+1, ENT[0]=ID, QP=QP+PUT{FIF;1}} ~ (P>0) (QP>0) ~ Done Press tp {P=P-1, QP=QP-GET{FST;1}} {P=P+1}
Conditional Get • CGET{Condition;List} • Example: Want to start the first job line 8, if any, with ENT[3]=2 or ENT[4]>.5, if the Buffer B is not full, and a Worker of skill W is Idle. CGET{(ENT[3]==2 ENT[4]>.5) & B & W ; 8} Check Start ~ Will Develop a conceptual job shop with 2 Events
Start with Single Resource Queue (Q1) ~ ta ts FINISH ENTER (Q= =1) ts ~ {Q = Q-1} {Q = Q+1} Q = total number of jobs in the system ta = time between job arrivals ts = processing times
M Resource Queue (QM) ~ ta ts FINISH ENTER (QM) ts ~ {Q = Q-1} {Q = Q+1}
N Step Process (QiMi) (i= =1) ~ ~ i 1 ta ts(i) (QiMi) FINISH (i) ENTER (i) ts(i) i ~ {Qi = Qi-1} {Qi = Qi+1} i+1 ~ (i<N) Mi = number of resources for ith step Qi = total number of jobs in the ith step ta = time between job arrivals ts(i) = processing times at ith step
General “Job Shop” 1. K processing resources 2. J job types, each with a different routing Subscript “everything” with the ith step for the jthjob using the kth resource. Mk= number of resources of type k Qk = total number of jobs in queue k, rank increasing priority (RNK[k]=2) . Dj,k = priority for job type j at resource k ta(j) = time between type j job arrivals ts(i,j) = processing times at ith step of job j Ri,j = The resource type needed by the jth job type at the ith step of Nj steps.
(CGET{Q[K] M[K];K}) (I= =1) ~ ~ 1,J,R[1;J] ENT[0], ENT[1], K ta(j) ts(i,j) FINISH (I,J,K) ENTER (I,J,K) (CGET{Q[K]M[K];K}) ts(i,j) ENT[0], ENT[1], K ~ {ENT[0]=I, ENT[1]=J, ENT[2]=D[J;K], Q[K]=Q[K]+PUT{INC;K}} {Q[K]=Q[K]-1} ~ (I<N[J]) I+1,J,R[I+1;J] Note: RNK[K] = 2 for all queues