# Tutorial 1b – Limit-state function formulated directly in Fesslix

In this tutorial we formulate the limit-state function of the problem introduced in Tutorial 1 directly in Fesslix. Subset Simulation is employed to estimate the probability of failure.

## 1   Step by Step Instruction ### 1.1   Constants As in Tutorial 1a, we start by defining scalar variables.

Fesslix parameter file
const N = 100;     # number of random variables used in the problem
const la = 1;      # parameter of the exponential distribution
const Nsmp = 1e3;  # number of samples used per level in Subset Simulation
const pthr = 10%;  # probability of the intermediate Subset levels

### 1.2   Random variables Before we can actually define the random variables, we have to create a set that can hold an arbitrary number of random variables. We assign the name RVS to this set:

Fesslix parameter file
rbrv_set_new RVS;

Next, we define the 100 exponentially distributed random variables.

Fesslix parameter file
sfor (i;N) {              # this is a loop that runs from 1 to N.
rbrv_set_addRV RVS +=   # add a random variable to the set RVS
exponential(           # the type of the random variable is 'exponential'
rv_ & {i},            # the name of the random variable is, e.g., rv_1, rv_2, ...
lambda = la           # we assign the value of 'la' to the parameter lambda.
);
};

Finally, we need to finalize the set with the command rbrv_set_create:

Fesslix parameter file
rbrv_set_create RVS;

After the above command is executed, no more random variables can be added to the set.

### 1.3   Limit-state function In this tutorial, we define the limit-state function directly within Fesslix.

In the following we use the keyword var to define a scalar function that does not take any explicit parameters. The difference to a variable defined with the const-keyword is: var stores a function and evaluates the function anew each time the variable is needed.

Fesslix parameter file
var lsf = mtxsum(
tmpx!{
rbrv_vec_get x: tmpx = "RVS";
}
) - 60;

In the code above, the command rbrv_vec_get retrievs a vector containing the realizations of all random variables in the set RVS and assigns it to vector tmpx. The function mtxsum returns the sum of all coefficients of vector tmpx.

### 1.4   Subset Simulation We tackle the reliability problem with Subset Simulation. Subset Simulation is contained in the module RND which needs to be loaded explicitly:

Fesslix parameter file
loadlib "RND";       # Subset Simulation is contained in the module 'RND'.

Finally, we can start Subset Simulation:

Fesslix parameter file
sus (
Nsmp*pthr;         # The number of chains used at each level in Subset Simulation.
1/pthr;            # The length of each chain.
lsf                # The limit-state function.
) {
rbrvsets = "RVS";  # The set of random variables to use.
};

## 2   The complete parameter file fesslix.org – Home  |  Contact  |  Impressum  |  © 2015-2017 Wolfgang Betz