sampling_algorithm_structural_analysis

This function creates the samples and evaluates the limit state functions in structural reliability problems.

results_about_data, failure_prob_list, beta_list = sampling_algorithm_structural_analysis(setup)

Input variables

Name Description Type
setup Setup settings. Dictionary
number of samples Number of samples (key in setup dictionary) Integer
numerical model Numerical model settings (key in setup dictionary) Dictionary
variables settings Variables settings (key in setup dictionary) List
number of state limit functions or constraints Number of state limit functions or constraints Integer
none_variable None variable. User can use this variable in the objective function (key in setup dictionary) None, List, Float, Dictionary, String, or any
objective function Objective function. The PAREpy user defines this function (key in setup dictionary) Python function
name simulation Output filename (key in setup dictionary) String

Output variables

Name Description Type
results_about_data Results about reliability analysis DataFrame
failure_prob_list Failure probability list List
beta_list Beta list List

To use the sample algorithm, you must choose the algorithm and variable types and correctly fill in the 'numerical model' and 'variables settings' keys. See the following examples and sampling function.

Example Sintax
Crude Monte Carlo 'numerical model': {'model sampling': 'mcs'}
Stochastic - Crude Monte Carlo (five steps)
  • 'numerical model': {'model sampling': 'mcs-time', 'time steps': 5}
  • and 'none variable': {'time analysis': list(np.linspace(0, 50, num=5, endpoint=True))}¹

Table 1. 'numerical model' key - examples.

¹When applying a stochastic procedure, use a list in 'none variables' with the same length as 'time steps'. In this example, we use five time steps between 0 and 50 years. In this case, a user should import the Numpy library to use np. linspace. Another library can be used to create a list.

¹When applying a stochastic procedure, use the following code on top of the objective function:    

id_analysis = int(x[-1])
time_step = none_variable['time analysis']
t_i = time_step[id_analysis] 

More details in example 2.

Example 1

Consider the simply supported beam show in example 5.1 Nowak and Collins [1]. The beam is subjected to a concentrated live load \(p\) and a uniformly distributed dead load \(w\). Assume \(\boldsymbol{P}\) (concentrated live load), \(\boldsymbol{W}\) (uniformly distributed dead load) and the yield stress, \(\boldsymbol{F_y}\), are random quantities; the length \(l\) and the plastic setion modulus \(z\) are assumed to be precisely know (deterministic). The distribution parameters for \(\boldsymbol{P}, \boldsymbol{W}\) and \(\boldsymbol{F_y}\) are given bellow:

Variable Distribution Mean Coefficient of Variation (COV)
Yield stress \(\left(\boldsymbol{F_y}\right)\) Normal 40.3 0.115
Live load \(\left(\boldsymbol{P}\right)\) Gumbel max. 10.2 0.110
Dead load \(\left(\boldsymbol{W}\right)\) Log-normal 0.25 0.100

The limit state function for beam bending can be expressed as:

\[ \boldsymbol{R} = 80 \cdot \boldsymbol{F_y} \]

(1)

\[ \boldsymbol{S} = 54 \cdot \boldsymbol{P} + 5832 \cdot \boldsymbol{W} \]

(2)

\[ \boldsymbol{G} = \boldsymbol{R} - \boldsymbol{S} \begin{cases} \leq 0 & \text{failure}\\ > 0 & \text{safe} \end{cases} \]

(3)

of_file.py

def nowak_collins_example(x, none_variable):
    """Objective function for the Nowak example (tutorial).
    """

    # Random variables
    f_y = x[0]
    p_load = x[1]
    w_load = x[2]
    capacity = 80 * f_y
    demand = 54 * p_load + 5832 * w_load

    # State limit function
    constraint = capacity - demand

    return [capacity], [demand], [constraint]

your_problem.ipynb

# Libraries
import pandas as pd
pd.set_option('display.max_columns', None)

from parepy_toolbox import sampling_algorithm_structural_analysis
from obj_function import nowak_collins_example

# Dataset
f = {'type': 'normal', 
    'parameters': {'mean': 40.3, 'sigma': 4.64}, 
    'stochastic variable': False, 
    }

p = {'type': 'gumbel max',
    'parameters': {'mean': 10.2, 'sigma': 1.12}, 
    'stochastic variable': False, 
    }

w = {'type': 'lognormal',
    'parameters': {'mean': 0.25, 'sigma': 0.025}, 
    'stochastic variable': False, 
    }
var = [f, p, w]

# PAREpy setup
setup = {
             'number of samples': 70000, 
             'numerical model': {'model sampling': 'mcs'}, 
             'variables settings': var, 
             'number of state limit functions or constraints': 1, 
             'none variable': None,
             'objective function': nowak_collins_example,
             'name simulation': 'nowak_collins_example',
        }

# Call algorithm
results, pf, beta = sampling_algorithm_structural_analysis(setup)

Example 2

Consider the simply supported beam show in example 5.1 Nowak and Collins [1]. The beam is subjected to a concentrated live load \(p\) and a uniformly distributed dead load \(w\). Assume \(\boldsymbol{P}\) (concentrated live load), \(\boldsymbol{W}\) (uniformly distributed dead load) and the yield stress, \(\boldsymbol{F_y}\), are random quantities; the length \(l\) and the plastic setion modulus \(z\) are assumed to be precisely know (deterministic). The distribution parameters for \(\boldsymbol{P}, \boldsymbol{W}\) and \(\boldsymbol{F_y}\) are given bellow:

Variable Distribution Mean Coefficient of Variation (COV)
Yield stress \(\left(\boldsymbol{F_y}\right)\) Normal 40.3 0.115
Live load¹ \(\left(\boldsymbol{P}\right)\) Gumbel max. 10.2 0.110
Dead load \(\left(\boldsymbol{W}\right)\) Log-normal 0.25 0.100
¹Stochastic random variable

The limit state function for beam bending can be expressed as:

\[ \boldsymbol{R} = 80 \cdot \boldsymbol{F_y} \cdot D\]

(1)

\[ \boldsymbol{S} = 54 \cdot \boldsymbol{P} + 5832 \cdot \boldsymbol{W} \]

(2)

\[ \boldsymbol{G} = \boldsymbol{R} - \boldsymbol{S} \begin{cases} \leq 0 & \text{failure}\\ > 0 & \text{safe} \end{cases} \]

(3)

Consider equation (4) for resistance degradation \(\left(D\right)\) [2]. Use 50 years to stochastic analysis (five time steps).

\[ D(t_i) = 1 - \frac{0.2}{t_i} \cdot 0.01 \]

(4)

of_file.py

def nowak_collins_time_example(x, none_variable):
    """Objective function for the Nowak example (tutorial).
    """
    
    # User must copy and paste this code in time reliability objective function
    ###########################################
    id_analysis = int(x[-1])
    time_step = none_variable['time analysis']
    t_i = time_step[id_analysis] 
    # t_i is a time value from your list of times entered in the 'none variable' key.
    ###########################################

    # Random variables
    f_y = x[0]
    p_load = x[1]
    w_load = x[2]
    
    # Degradation criteria
    if t_i == 0:
        degrad = 1
    else:
        degrad = 1 - (0.2 / t_i) * 1E-2

    # Capacity and demand
    capacity = 80 * f_y * degrad
    demand = 54 * p_load + 5832 * w_load

    # State limit function
    constraint = capacity - demand

    return [capacity], [demand], [constraint]

your_problem.ipynb

# Libraries
import pandas as pd
pd.set_option('display.max_columns', None)
import numpy as np

from parepy_toolbox import sampling_algorithm_structural_analysis
from obj_function import nowak_collins_time_example

# Dataset
f = {'type': 'normal', 
    'parameters': {'mean': 40.3, 'sigma': 4.64}, 
    'stochastic variable': False, 
    }

p = {'type': 'gumbel max',
    'parameters': {'mean': 10.2, 'sigma': 1.12}, 
    'stochastic variable': False, 
    }

w = {'type': 'lognormal',
    'parameters': {'mean': 0.25, 'sigma': 0.025}, 
    'stochastic variable': False, 
    }
var = [f, p, w]

# PAREpy setup
setup = {
             'number of samples': 70000, 
             'numerical model': {'model sampling': 'mcs-time', 'time steps': 5}, 
             'variables settings': var, 
             'number of state limit functions or constraints': 1, 
             'none variable': {'time analysis': list(np.linspace(0, 50, num=5, endpoint=True))},
             'objective function': nowak_collins_time_example,
             'name simulation': 'nowak_collins_time_example',
        }

# Call algorithm
results, pf, beta = sampling_algorithm_structural_analysis(setup)

Reference list