echo Example 3:
* Example 3: a block diagram model of a system with 
* N processors, N memories and a switch.

format 8

bind
lamp 0.0000689
lamm 0.000224
lams 0.000202
end

block procs(N)
comp processor exp(lamp)
* req is the minimum number of procs needed for system to remain operational
kofn procs req,N, processor
end

block mems(N)
comp memory exp(lamm)
* req is the minimum number of mems needed for system to remain operational
kofn mems req, N , memory
end
 
block sys1(N)
comp switch exp(lams)
comp procs  cdf(procs;N)
comp mems   cdf(mems;N)
series TOP switch procs mems
end

loop N,8,24,8
loop i,4,N,4
  * vary the minimum number of processor-memory pairs required
  * for the system to function
  bind req i
  * first compute th mean time to system failure
  expr mean(sys1;N)

  loop t,100,1000,100
    * Now compute system failure prob at time t
    * Since keyword value requires symbolic computation of the CDF
    * and then numerical substitution, it can have numerical
    * instabilities. The keyword tvalue does a direct numerical
    * computation and hence is numerically more trustworthy.
    expr value (t;sys1;N), tvalue(t;sys1;N) 
  end
end
end

end