Monte Carlo Simulation experimental and theoretical view
Introduction
Buffon
Gosset (Student)
Fermi, von Neumann, Ulam
Neutron transport
System Transport (RAMS)
Uncertainty and Sensitivity Analysis
Kelvin
The History of Monte Carlo Simulation
1707-
88
1908
1824-
1907
1950s
1930-
40s
1990s
44RAMS: evaluating the probability of system failure
xdxqxIFxPFP F )()()()(
: vector of the uncertain system parameters
: multidimensional probability density function (PDF) of
: failure region (in this case, F = {Y(x) > Y})
: indicator function -
nj xxxxx ...,,...,,, 21
n
j
jj xqxq1
)()( xnF
1,0:)( nF xI
Fx
FxxIF
if,0
if,1)(
(Y(x) Y)
(Y(x) > Y)
Y
Y
S
5Passive decay heat removal system of a
Gas-cooled Fast Reactor (GFR)
Nine uncertain parameters, x (Gaussian):
Power
Pressure
Cooler wall temperature
Nusselt numbers (forced, mixed, free)
Friction factors (forced, mixed, free)
SYSTEM FUNCTIONAL FAILURE
Tout,core CxTx hotcoreout 1200: ,
CxTx avgcoreout 850: ,
F
=
The Isolation Condenser (IC) system is designed to remove excess sensible and core
decay heat from the Simplified Boiling Water Reactor (SBWR) by natural circulation,
when the normal heat removal system is unavailable
Isolation Condenser in SBWR
11 design and critical parameters 40 sub-critical parameters to be investigated
The Passive Residual Heat Removal (RHR) System of the HTR-PM
RHR System in HTR-PM
Legend:
1.Reactor
2.Vessel
3.Water cooling wall
4.Hot water header
5.Cold water header
6.Shade
7.Hot leg
8.Cold leg
9.Water tank
10.Air cooler
11.Air cooling tower
12.Inlet shutter
13.Outlet shutter
14.Inlet net
15.Outlet net
16.Wind shield
The Simulation Code Models
37 Inputs
Residual Heat in
Reactor Core Water-Cooled Wall
Air-Cooler in the
Tower
Atmosphere
radiation
Natural circulation
natural convection
RHR System in HTR-PM
Problem statement
Description of phenomena Adoption of mathematical models(which are for example turned into
operative computer codes for simulations)
Models Deterministic or Stochastic
In practice the system under analysis can not be characterized exactly
and the knowledge of the undergoing phenomena is incomplete
Uncertainty on both the values of the model parameters and
on the hypothesis underlying the model structure
Uncertainty propagates within the model and causes uncertainty
of the model outputs
How uncertainty propagates
y = m(x)
y = m(x)
x = vector of n uncertain input
parameters
m(x) = model structure
Deterministic Stochastic
y = output vector correspondent
to x and m(x)
(e.g., advection-dispersion equation, Newton law)
(e.g., Poisson model, exponential model)
m(x)
11Reliability assessment failure probability evaluation by Monte Carlo (MC)
Monte Carlo (MC)
sampling of uncertain parameters
(probability distributions)x = {x1, x2, , xj, , xn}
System model code
(e.g. RELAP)
System
performance indicator, Y(x)
NT independent runs
Sample estimate of the failure probability P(F), YT
number Y xP F
N
Fuel
cla
ddin
g
Tem
per
ature
, Y
(x)
Time
F
Failure threshold, Y
S
12The Monte Carlo (MC)-based approach for failure probability
evaluation: drawbacks
T
Y
N
xYnumberFP
SMALL NUMBER FOR
HIGHLY RELIABLE SYSTEMS!
LONG CALCULATIONS!
S
+
UNCERTAINTY/CONFIDENCE
13The Monte Carlo (MC)-based approach for failure probability
evaluation: technical developments
1. Subset Simulation (SS)
2. Line Sampling (LS)
ESTIMATION OF THE RELIABILITY OF T-H SYSTEMS
Long calculations
Rare failure events
-Failure Domain
(FD) Identification
- Confidence on the
Safety Margin
estimation
Advanced MC Simulation
methods
Meta-models (e.g. Artificial Neural Networks)
1. Identification of important directions for pointing towards the failure region FD
2. Pre-selection of failure transients
Order statistics
TRANSIENTS
GENERATION
Issues: Solutions:
The experimental view
Simulation of system transport
Simulation for reliability/availability analysis of a component
Examples
Contents
Sampling Random Numbers
SAMPLING RANDOM
NUMBERS
Example: Exponential Distribution
Probability density function:
Expected value and variance:
00
0)(
t
tetf tT
2
1][
1][
TVar
TE
t
fT(t)
( ) tTf t e
Sampling Random Numbers from FX(x)
xX exF1
Sample R from UR(r) and find X:
RFX X1
xX exFR 1
RRFX X 1ln
11
Example: Exponential distribution
sample an
Graphically:
0 1, ,..., ,...kx x x
0
k
k k i
i
F P X x P X x
~ [0,1)R U
Sampling from discrete distributions
1- Calculate the analytic solution for the failure probability of the network,
i.e., the probability of no connection between nodes S and T
2- Repeat the calculation with Monte Carlo simulation
Arc number i Failure
probability Pi
1 0.050
2 0.025
3 0.050
4 0.020
5 0.075
Failure probability estimation: example
Analytic solution
21
43
1
[ 1] [ ] 3.07 10T jj
P X P M
3
1 1 4
3
2 2 5
4
3 1 3 5
5
4 2 3 4
[ ] 0.05 0.02 1 10
[ ] 0.025 0.075 1.875 10
[ ] 0.05 0.05 0.075 1.875 10
[ ] 0.025 0.05 0.02 7.5 10
P M p p
P M p p
P M p p p
P M p p p
1) Minimal cut sets
M2={2,5}
M3={1,3,5}
M4={2,3,4}
2) Network failure probability (rare event approximation):
The arrival state of arc i after it has undergone a transition can be
sampled by applying the inverse transform method to the set of discrete
probabilities of the mutually exclusive andexhaustive arrival
states
We calculate the arrival state for all the arcs of the newtork
As a result of these transitions, if the system falls in any configuration
corresponding to a minimal cut set, we add 1 to Nf
The trial simulation then proceeds until we collect N trials. We obtain
the estimation of the failure probability dividing Nf by N
0 1
R
S
B
B
1
31
B
B
1
21
S
,1i ip p
ip 1 ip
Monte Carlo simulation
N number of trials
NF number of trials corresponding to realization of a minimal cut set
The failure probability is equal to NF / N
clear all;
%arc failure probabilities
p=[0.05,0.025,0.05,0.02,0.075]; nf=0;
n=1e6; %number of MC simulations
for i=1:n
%sampling of arcs fault events
r=rand(1,5); s=zeros(1,5); rpm=r-p;
for j=1:5
if (rpm(1,j)= 1
nf=nf+1;
end
end
pf=nf/n; %system failure probability
For n=106, we obtain3[ 1] 3.04 10TP X
Monte Carlo simulation
SIMULATION OF SYSTEM
TRANSPORT
Monte Carlo simulation for system reliability
PLANT = system of Nc suitably connected components.
COMPONENT = a subsystem of the plant (pump, valve,...) which may stayin different exclusive (multi)states (nominal, failed, stand-by,... ). Stochastic
transitions from state-to-state occur at stochastic times.
STATE of the PLANT at t = the set of the states in which the Nccomponents stay at t. The states of the plant are labeled by a scalar which
enumerates all the possible combinations of all the component states.
PLANT TRANSITION = when any one of the plant components performs astate transition we say that the plant has performed a transition. The time at
which the plant performs the n-th transition is called tn and the plant state
thereby entered is called kn.
PLANT LIFE = stochastic process.
Random walk = realization of the system life generated by the underlying
state-transition stochastic process.
Plant life: random walk
Phase Space
( ) ( ) 0,R R MC t C t t T
( ) ( ) 1 ,R R MC t C t t T
( ) ( ) 1 ,R R MC t C t t T
( ) ( ) 0,R R MC t C t t T
( ) ( )R
T
C tF t
M
Example: System Reliability Estimation
Events at components
level, which do not entail
system failure
T(tt; k)dt = conditional probability of a transition at tdt, given that thepreceding transition occurred at t and that the state thereby entered wask.
C(k k; t) = conditional probability that the plant enters state k, given thata transition occurred at time t when the system was in state k. Both theseprobabilities form the trasport kernel:
K(t; k t; k)dt = T(t t; k)dt C(k k; t)
(t; k) = ingoing transition density or probability density function (pdf) of asystem transition at t, resulting in the entrance in state k
Stochastic Transitions: Governing
Probabilities
SIMULATION FOR COMPONENT
AVAILABILITY / RELIABILITY
ESTIMATION
1 2
m
State 2
State 1
State X=1 ONState X=2 OFF
One component with exponential
distribution of the failure time
1 2
m
State 2
State 1
State X=1 ONState X=2 OFF
One component with exponential
distribution of the failure time
1 2
m
State 2
State 1
State X=1 ONState X=2 OFF
One component with exponential
distribution of the failure time
1 2
m
State X=1 ONState X=2 OFF
One component with exponential
distribution of the failure time
values
3 10-3 h-1
m 25 10-3 h-1
Limit unavailability:
1/0.1071
1/ 1/U
m
m
Monte carlo simulation for estimating the
system availability at time t
- Nt time intervals t
- If the component fails in t+t, the counter increases cA(tj) =cA(tj) +1; otherwise, c
A(tj) = cA(tj)
Trial 1
Monte carlo simulation for estimating the
system availability at time t
- another trial
Trial 1
Trial i-th
Monte carlo simulation for estimating the
system availability at time t
- another trial
Trial 1
Trial i-th
Trial M-th
Monte carlo simulation for estimating the
system availability at time t
Trial 1
Trial i-th
Trial M-th
= unavailability at time tj
= mean value of cA(tj) at time tj
( ) { ( ) 1}A j
G t P X t
( )( )
A
j
A j
c tG t
M
The counter cA(tj) adds 1 until M trials have been sampled
Pseudo Code
%Initialize parameters
Tm=mission time; Nt=number of trials; Dt=bin length;
Time_axis=0:Dt:Tm;
FOR i=1:Nt
%parameter initialization for each trial
t=0; failure_time=0; repair_time=0; state=1;
while t=failure_time));
counter(i,lower_b)=1;
Else
t=t+exprnd(1/mu); state=1; repair_time=t;
upper_b=find(time_axis
SIMULATION FOR SYSTEM
AVAILABILITY / RELIABILITY
ESTIMATION
Phase Space
Arrival
Init
ial
1 2 3
1 -
2 -
3 -
)( 21BA
)(
31BA
( )2 1A B
)(
32BA
)( 13BA
)(
23BA
A
B
C
Components times of transition between states are exponentially distributed
( = rate of transition of component i going from its state ji to the state mi)i
mji 1
Indirect Monte Carlo: Example (1)
The components are initially (t=0) in their nominal states (1,1,1)One minimal cut set of order 1 (C in state 4:(*,*,4)) and one minimalcut set of order 2 (A and B in 3: (3,3,*)).
Arrival
1 2 3 4
Init
ial
1 -
2 -
3 -
4 -
C 21 C
31 C
41
C 12 C
32 C
42
C 13 C
23 C
43
C 14 C
24 C
34
Indirect Monte Carlo: Example (2)
SAMPLING THE TIME OF TRANSITION
The rate of transition of component A(B) out of its nominal state 1 is:
The rate of transition of component C out of its nominal state 1 is:
The rate of transition of the system out of its current configuration (1,1, 1) is:
We are now in the position of sampling the first system transition timet1, by applying the inverse transform method:
where Rt ~ U[0,1)
)(
31)(
21)(
1BABABA
CCCC
4131211
CBA111
1,1,1
)1ln(1
1,1,101 Rtt t
Analog Monte Carlo Trial
Assuming that t1 < TM (otherwise we would proceed to the successive trial), we now need to determine which transition has occurred, i.e. which
component has undergone the transition and to which arrival state.
The probabilities of components A, B, C undergoing a transition out of their initial nominal states 1, given that a transition occurs at time t1, are:
Thus, we can apply the inverse transform method to the discrete distribution
1,1,11
1,1,1
1
1,1,1
1 , ,
CBA
0
R
C 1,1,11
A
1,1,11
B
1,1,11
C
C
10
Sampling the kind of Transition (1)
Given that at t1 component B undergoes a transition, its arrival state can be sampled by applying the inverse transform method to the set of
discrete probabilities
of the mutually exclusive and exhaustive arrival states
B
B
B
B
1
31
1
21 ,
0 1
R
S
B
B
1
31
B
B
1
21
S
As a result of this first transition, at t1 the system is operating in configuration (1,3,1).
The simulation now proceeds to sampling the next transition time t2 with the updated transition rate
CBA131
1,3,1
Sampling the Kind of Transition (2)
RSU[0,1)
The next transition, then, occurs at
where Rt ~ U[0,1).
Assuming again that t2 < TM, the component undergoing the transition and its final state are sampled as before by application of the inverse trasform
method to the appropriate discrete probabilities.
The trial simulation then proceeds through the various transitions from one system configuration to another up to the mission time TM.
)1ln(1
1,3,112 Rtt t
Sampling the Next Transition
When the system enters a failed configuration (*,*,4) or(3,3,*), where the * denotes any state of the component,
tallies are appropriately collected for the unreliability and
instantaneous unavailability estimates (at discrete times tj [0, TM]);
After performing a large number of trials M, we canobtain estimates of the system unreliability and
instantaneous unavailability by simply dividing by M, the
accumulated contents of CR(tj) and CA(tj), tj[0,TM]
Unreliability and Unavailability Estimation
For any arbitrary trial, starting at t=0 with the system in nominal
configuration (1,1,1) we would sample all the transition times:
where
)1ln(1
1,
1
01 Rtti
mtim
im i
i
i
Cm
BAim
CBAi
i
i
ifor 4,3,2
,for 3,2
,,
)1,0[~1, URi
mt i
A
B
C
Direct Monte Carlo: Example (1)
These transition times would then be ordered in ascending order from
tmin to tmaxTM .
Let us assume that tmin corresponds to the transition of component A
to state 3 of failure. The current time is moved to t1= tmin in
correspondence of which the system configuration changes, due to
the occurring transition, to (3,1,1) still operational.
A
B
C
Direct Monte Carlo: Example (2)
The new transition times of component A are then sampled
and placed at the proper position in the timeline of the succession of
occurring transitions
The simulation then proceeds to the successive times in the list, incorrespondence of which a system transition occurs.
After each transition, the timeline is updated with the times of thetransitions that the component which has undergone the last transition
can do from its new state.
During the trial, each time the system enters a failed configuration, tallies are collected and in the end, after M trials, the unreliability and
unavailability estimates are computed.
)1ln(1
3,
3
13 RttA
mtAm
Am A
A
A
)1,0[~
2,1
3, UR
k
Amt A
Example (2)
The theoretical view
Contents
Sampling
Evaluation of definite integrals
Simulation of system transport
Simulation for reliability/availability analysis
Contents
Sampling
Evaluation of definite integrals
Simulation of system transport
Simulation for reliability/availability analysis
Buffons needle
Buffon considered a set of parallel straight lines a distance D apart onto a plane and computed the probability P that a needle of length L < D randomly
positioned on the plane would intersect one of these lines.
sinP P Y L
1( ) [0, ]
1( ) [0, ]
/
/ 2
Y
A
f y y DD
f
dy d L DP
D
rrRPrUR :cdf
1 :pdf dr
rdUru RR
0
Sampling (pseudo) Random Numbers
Uniform Distribution
~ [0,1)R U
1 mod i ix ax c m
, [0, 1]
1
a c m
m
0 0
1 1
15 15
16
22
16
11(5 2 1) mod 16 11
16
...
1313
16
2
x r
x r
x r
x
ii
xr
m
Sampling (pseudo) Random Numbers
Uniform Distribution
Example: a = 5, c = 1, m = 16
Where
Sample R from UR(r) and find X:
RFX X1
Question: which distribution does X obey?
Application of the operator Fx to the argument of P above yields
Summary: From an R UR(r) we obtain an X FX(x)
xRFPxXP X 1
xFxFRPxXP XX
1
1 r 0
rUrR RPr xFX
R X x
Sampling (pseudo) Random Numbers
Generic Distribution
Markovian system with two states (good, failed) hazard rate, = constant
cdf
Sampling a failure time T
tT etTPtF 1
dtedttTtPdttf tT
tTR etFrFR 1
RRFT T 1ln
11
Example: Exponential Distribution
hazard rate not constant
CDF
Sampling a failure time T
1 tTf t dt P t T t dt t e dt
1 tR TR F r F t e
1
1 1 ln 1TT F R R
Example: Weibull Distribution
1 tTF t P T t e
sample an
Graphically:
0 1, ,..., ,...kx x x
0
k
k k i
i
F P X x P X x
~ [0,1)R U
1 1
1 1
( ) ( )
~ [0,1) and ( )
k k R k R k
R
k k k k k k
P F R F F F F F
R U F r r
P F R F F F f P X x
Sampling by the Inverse Transform Method:
Discrete Distributions
Contents
Sampling
Evaluation of definite integrals
Simulation of system transport
Simulation for reliability/availability analysis
MC analog dart game: sample x from f(x)
the probability that a shot hits x dx is f(x)dx the award is g(x)
Consider N trials with result {x1, x2, ,xn}: the average award is
N
i
iN xgN
G1
1
1 ; 0 pdf
dxxfxfxf
dxxfxgGb
a
MC Evaluation of Definite Integrals (1D)
Analog Case
1
0
1
2 2
0
22
2
2cos 0.6366198
2
By setting: 1, g cos2
( )
1 ( ) cos
2 2
1 1 ( ) ( )
1 1 2 1 9
2
N
N
G x dx
f x x x
G E g x
E g x x dx
Var G Var g x E g x E g xN N
Var GN N
2
4
2 6
.47 10
for 10 histories, ~ [0,1) cos2
0.6342, 9.6 10N
i i i
N G
N x U g x x
G s
MC Evaluation of Definite Integrals (1D)
Example
MC biased dart game: sample x from f1(x)
the probability that a shot hits x dx is f1(x)dx the award is
N
i
iN xgN
Gxgxf
xfxg
1
11
1
1
1
The expression for G may be written
DDdxxfxgdxxfxg
xf
xfG 111
1
MC Evaluation of Definite Integrals (1D)
Biased Case
The pdf f1*(x) is:
From the normalization condition:
For the minimum value
* 2
1 ( )f x a bx
1 1
* 2
1
0 0
* 2
1
( ) 1 1 3( 1)3
( ) 3( 1)
bf x dx a bx dx a b a
f x a a x
31.5
2a
1
1
1 1
2
2
0 0 ( )( )
cos 12cos (1.5 1.5 )
2 1.5 1.5f x
g x
x
G xdx x dxx
1
0
2cos 0.6366198
2G x dx
MC Evaluation of Definite Integrals (1D)
Biased Case: Example
2
4
1 1
1 2 10.406275 9.9026 10NVar G
N N
Finally we obtain:
1
4 *
1 1 2
2 8
1
cos2
for 10 histories, ~1.5 1.5
0.6366, 9.95 10N
i
i i
i
N G
x
N x f g xx
G s
MC Evaluation of Definite Integrals (1D)
Biased Case: Example
Contents
Sampling
Evaluation of definite integrals
Simulation of system transport
Simulation for reliability/availability analysis
Monte Carlo simulation for system reliability
PLANT = system of Nc suitably connected components.
COMPONENT = a subsystem of the plant (pump, valve,...) which may stay in different exclusive (multi)states (nominal, failed, stand-by,... ).
Stochastic transitions from state-to-state occur at stochastic times.
STATE of the PLANT at t = the set of the states in which the Nccomponents stay at t. The states of the plant are labeled by a scalar
which enumerates all the possible combinations of all the component
states.
PLANT TRANSITION = when any one of the plant components performs a state transition we say that the plant has performed a
transition. The time at which the plant performs the n-th transition is
called tn and the plant state thereby entered is called kn.
PLANT LIFE = stochastic process.
Random walk = realization of the system life generated by the underlying
state-transition stochastic process.
Plant life: random walk
T(tt; k)dt = conditional probability of a transition at t dt, given that the preceding transition occurred at t and that the state thereby entered was k.C(k k; t) = conditional probability that the plant enters state k, given that a transition occurred at time t when the system was in state k.Both these probabilities form the trasport kernel:
K(t; k t; k)dt = T(t t; k)dt C(k k; t)
(t; k) = ingoing transition density or probability density function (pdf) of a system transition at t, resulting in the entrance in state k
Stochastic Transitions: Governing
Probabilities
The von Neumanns Approach and the Transport Equation
74
The transition density (t; k) is expanded in series of the
partial transition densities:
n(t; k) = pdf that the system performs the nth transition at t,
entering the state k.
Then,
Transport equation for the plant states
'
0
0
0
)','|,()','('),(
),(),(
k
t
t
n
n
ktktKktdtkt
ktkt
)**,,(),,(),(),( 110011000
*011
1
0
1
ktktKktktKktdtktk
t
t
),,()**,,(
),,(),(),(
112211*
1
112211
1
*122
2
1
2
1
2
ktktKktktKdt
ktktKktdtkt
k
t
t
k
t
t
),,(),,(*)*,,(...
...),(
11112211*
1
*2
,...,,*
1
2
1
121
nn
t
t
t
tn
kkk
t
tn
n
ktktKktktKktktKdt
dtdtktn
n
n
Initial Conditions: (t*, k*)
Formally rewrite the partial transition densities:
Monte Carlo Solution to the Transport
Equation (1)
MC analog dart game: sample x = (t1, k1; t2, k2; ...) from f(x)=
the probability that a shot hits x dx is f(x)dx the award is g(x)=1
Consider N trials with result {x1, x2, ,xn}: the average award is
N
i
iN xgN
G1
1
1 ; 0 pdf
dxxfxfxf
dxxfxgGb
a
),,(),,(*)*,,( 11112211 nn ktktKktktKktktK
MC Evaluation of Definite Integrals
Contents
Sampling
Evaluation of definite integrals
Simulation of system transport
Simulation for reliability/availability analysis
Monte Carlo Simulation in RAMS
k
t
k dtRktG0
),(),()(
= subset of all system failure states Rk(,t) = 1 G(t) = unreliability Rk(,t) = prob. system not exiting before t from the state k
entered at
References