English Français

Documentation / Manuel utilisateur en Python : PDF version

XIV.14. Macros Reliability

XIV.14. Macros Reliability

XIV.14.1. Macro "reliabilityFormSorm.py"

XIV.14.1.1. Objective

The objective of the macro is to perform a FORM SORM study.

This example comes from De Victor's thesis. The problem has three input variables x, fe and M. Each variable follows a normal distribution with the following mean and standard error: x is N(40, 5), fe is N(50, 2.5) and M is N(1000,200). The safety threshold is calculated with M-x*fe and should be positive for a safe solution.

XIV.14.1.2. Macro Uranie

The Script follows the following steps:

  • a macro section to choose the optimisation solver;

  • a namespace section;

  • the definition of the safety function;

  • the study procedure.

"""
Example of reliability form / sorm usage
"""
import numpy as np
from rootlogon import DataServer, Reliability, Relauncher, Reoptimizer


def fselect(x_var, fe_var, m_var):
    """Compute the criterion."""
    # critere
    return [m_var-x_var*fe_var]


# inputs
x = DataServer.TNormalDistribution("x", 40, 5)
fe = DataServer.TNormalDistribution("x2", 50, 2.5)
M = DataServer.TNormalDistribution("M", 1000, 200)

# outputs
cont = DataServer.TAttribute("seuil")
# starting point
start = np.array([-1., -1., 1.], dtype=np.float64)

# code
fobj = Reliability.TSimpleTransform()
fobj.addParameter(x)
fobj.addParameter(fe)
fobj.addParameter(M)

fcont = Relauncher.TPythonEval(fselect)
fcont.addInput(x)
fcont.addInput(fe)
fcont.addInput(M)
fcont.addOutput(cont)

code = Reliability.TFormEval(fobj, fcont)
it = Reoptimizer.TGreaterFit(0.0)
code.addConstraint(cont, it)

# runner
run = Relauncher.TSequentialRun(code)
run.startSlave()
if run.onMaster():
    # tds
    tds = DataServer.TDataServer("toto", "tds for vizir test")
    code.addAllInputs(tds)

    # FORM
    # optimizer
    solv = Reoptimizer.TNloptCobyla()
    nlo = Reoptimizer.TNlopt(tds, run, solv)
    code.addObjective(nlo)

    # resolution
    nlo.setStartingPoint(len(start), start)
    nlo.solverLoop()
    # results
    # tds.getTuple().Scan("*")

    # SORM
    sorm = Reliability.TSorm(tds, run)
    sorm.solverLoop()

    # results
    tds.getTuple().Scan("*")

    # cleanup
    run.stopSlave()

The study procedure requests the definition of:

  • variables: input variables with their statistical laws and the output variable;

  • the starting point for the design point optimisation. Take care that it is defined in the normal space (not in the physical space);

  • evaluation functions; the transformation function, the safety function, and the composition of both of them;

  • a standard sequential TRun;

  • the TDataServer with its inputs declaration;

  • the FORM optimisation sequence;

  • the SORM estimation sequence;

  • back-up and finalisation.

XIV.14.1.3. Console

Processing reliabilityFormSorm.py...
|....:....|....:....|....:....|....:....|....:....0050
|....:....|....
:************************************************************************************************************************************************************
*    Row   * toto__n__ *   u_x.u_x * u_x2.u_x2 *   u_M.u_M * betaHL.be * form.form *       x.x *     x2.x2 *       M.M * seuil.seu * factor.fa * sorm.sorm *
************************************************************************************************************************************************************
*        0 *         0 * -2.289658 * -0.677000 * 1.8963080 * 3.0490734 * 0.0011477 * 28.551708 * 48.307498 * 1379.2616 * -1.67e-05 * 1.0203699 * 0.0011711 *
************************************************************************************************************************************************************

There are two lines used to show the optimisation progress (evaluation numbers), and then the resulting TDataServer is shown. Columns start with two indexes, the three normal variables, the Hasofer-Lind indicator, the FORM estimation, the three physical variables, the FORM correction, and the SORM estimation.

/language/en