6. Reliability Simulation
Simulating P(event) = 0.8, using pseudo-random r: 0.0 <= r <= 1.0
if( r <= 0.8) ... i.e. with reliability 0.8, if component worksor:
if( r >= 0.2) ...series vs. parallel
--> c1 -> c2 -> c3 --> if( c1 && c2 && c3) ... ok |-> c1 ->| | | -->|-> c2 ->|--> if( c1 || c2 || c3) ... ok | | |-> c3 ->|General Monte-Carlo simulation framework:
double p; int success = 0, i, trials = 100000; for( i = 0; i < trials; ++i) { ... simulate one trial, if ok then ++success; ... } p = success; p /= trials; /* estimate of probability of success */chapter4_7.c - reliability simulation