Reset: a = a + nc(t
E
–t)
Reset: t = t
E
.
Generate J:
J = 1: reset n = n + 1.
J = 2: reset n = n - 1.
J = 3: Generate Y. If Y > a, set I = 0 and end this run; otherwise reset a = a –Y.
Generate X: reset t
E
= t + X.
7. A system needs n working machines to be operational. To guard against machine
breakdown, additional machines are kept available as spares. Whenever a machine breaks
down it is immediately replaced by a spare and is itself sent to the repair facility, which
consists of a single repair person who repair failed machines one at a time. Once a failed
machine has been repaired it becomes available as a spare to be used when the need
arises. All repair times are independent random variables having the common distribution
function G. Each time a machine is put into use the amount of time it functions before
breaking down is a random variable, independent of the past, having distribution function
f. The system is said to “Crash” when a machine fails and no spares are available. Define
variables and events to analyze this system and write a model in simulating to estimate
the time at which the system crashes.
(20 marks)
solution
(A Repair Problem)
Time variables
t
System State Variables r
i
1
= the number of machine that are down at time t.
Event List: t
1
≤
t
2
≤
t
3
≤
……
≤
t
n
, t*
t
1,
t
2
, t
3
,…t
n
=
time (in order) at which the n machines presently in use will fail.
t* =
time at which the machines presently in repair will become operational.
Initialize
Set t = r = 0, t* =
∞
.
Generate X
1
,……,X
n
, independent random variables each having distribution F.
order these values and let t
i
be the i
th
smallest one, i = 1,..,n.
Set Event List: t
1
,…, t
n
, t*.
Case 2: t
1
< t*
Reset: t = t
1
.
Reset: r = r + 1.
If r = s + 1, stop this run and collect the data T = t.
If r < s + 1, generate random variable X having distribution F. Order the value t
2
, t
3,
t
n
, t + X and let t
i
be the i
th
smallest one, i = 1,..,n.
If r = 1, generate random variable Y having distribution G and reset t* = t = Y.
Case 2: t*
≤
t
1
Reset: t = t*.
Reset: r = r - 1.
If r > 0, generate random variable Y having distribution G and reset t* = t = Y.
If r < s + 1, generate random variable X having distribution F. Order the value t
2
, t
3,,
t
n
, t + X and let t
i
be the i
th
smallest one, i = 1,..,n.
If r = 0, set t* =
∞
.