Use a Python script as limit-state function

In one of the previous posts, we showed you how to work with in-line Python functions directly in STRUREL. Did you know? You can also use a Python script as limit-state function in STRUREL.

Again, we use the example limit-state function RS that we already used in the past: Our stochastic model consists of the two random variables R and S, where R represents the resistance of a system of interest and S is the system load. The symbolic expression for the corresponding limit-state function in the native syntax of STRUREL would be:

FLIM(1) = R-S

However, if you have Python installed on your system and if the Python interface of STRUREL is configured correctly, you could also use the following expression:

FLIM(1) = pythons("my_model")

where my_model.py is a Pyhton script file located in the same directory as the iti-file of STRUREL.

For the example at hand, the Python script file should look as follows:

res = R - S

where the variable names R and S must match the names of the random variables of the stochastic model of STRUREL. The variable res must contain the value of the limit-state function, where the value of res is later retrieved by STRUREL.

By means of the STRUREL command pythons, you can integrate any limit-state function written in Python directly in your reliability analysis performed with STRUREL.

Sponsored Post Learn from the experts: Create a successful blog with our brand new courseThe WordPress.com Blog

WordPress.com is excited to announce our newest offering: a course just for beginning bloggers where you’ll learn everything you need to know about blogging from the most trusted experts in the industry. We have helped millions of blogs get up and running, we know what works, and we want you to to know everything we know. This course provides all the fundamental skills and inspiration you need to get your blog started, an interactive community forum, and content updated annually.

Use a Matlab script as limit-state function

In one of the previous posts, we showed you how to work with in-line Matlab functions directly in STRUREL. Did you know? You can also use a Matlab script as limit-state function in STRUREL.

Again, we use the example limit-state function RS that we already used in the past: Our stochastic model consists of the two random variables R and S, where R represents the resistance of a system of interest and S is the system load. The symbolic expression for the corresponding limit-state function in the native syntax of STRUREL would be:

FLIM(1) = R-S

However, if you have Matlab installed on your system and if the Matlab interface of STRUREL is configured correctly, you could also use the following expression:

FLIM(1) = matlabs("my_model")

where my_model.m is a Matlab script file located in the same directory as the iti-file of STRUREL.

For the example at hand, the Matlab script file should look as follows:

function [lsfval] = my_model(INPUT)

R = INPUT(1);
S = INPUT(2);

lsfval = R - S

end

The ordering of the random variables in the vector INPUT corresponds to the order in which they appear in the stochastic model of STRUREL.

Alternatively, the Matlab script file could look as follows:

function [lsfval] = my_model(INPUT)

global R;
global S;

lsfval = R - S

end

where the variable names R and S must match the names of the random variables of the stochastic model of STRUREL.

By means of the STRUREL command matlabs, you can integrate any limit-state function written in Matlab-Syntax directly in your reliability analysis performed with STRUREL.

How to use in-line Matlab in Strurel

In the last post, we showed you how to work with in-line Python functions directly in STRUREL. Did you know? You can also use in-line Matlab functions directly in a symbolic expression in STRUREL.

For example, assume a problem for which you have the two random variables R and S in your stochastic model, where R represents the resistance of a system of interest and S is the system load. The symbolic expression for the corresponding limit-state function in the native syntax of STRUREL would be:

FLIM(1) = R-S

However, if you have Matlab installed on your system and if the Matlab interface of STRUREL is configured correctly, you could also use the following expression:

FLIM(1) = matlabf("R-S")

Sure, calling the Matlab interpreter for this simple demonstration example is like taking a sledgehammer to crack a nut. However, the interface-function matlabf is a tool that gives you access to the full power of Matlab directly in the symbolic expression of STRUREL.

How to use in-line Python in Strurel

Did you know? You can use in-line Python functions directly in a symbolic expression in STRUREL.

For example, assume a problem for which you have the two random variables R and S in your stochastic model, where R represents the resistance of a system of interest and S is the system load. The symbolic expression for the corresponding limit-state function in the native syntax of STRUREL would be:

FLIM(1) = R-S

However, if you have Python installed on your system and if the Python interface of Strurel is configured correctly, you could also use the following expression:

FLIM(1) = pythonf("R-S")

Sure, calling the Python interpreter for this simple demonstration example is like taking a sledgehammer to crack a nut. However, the interface-function pythonf is a tool that gives you access to the full power of Python directly in the symbolic expression of Strurel.

STRUREL 2020 is available

The new release of STRUREL is available. We have added many helpful features to our software packages COMREL, SYSREL and COSTREL. Most notably, we extended the external interface of STRUREL: All our packages can now be coupled to C/C++, FORTRAN, Maplesoft Maple, Wolfram Mathematica, MathWorks Matlab, Python and Ruby. It is now straight-forward to use an external interface of STRUREL in your analysis. We also pushed our Add-On Feature to a new level, so that you can work with complex and challenging limit-state functions and share your projects with others.

COMREL 10 released

We released the latest version of Comrel: COMREL 10.

Major improvements include:(i) Limit-state functions entered in Comrel are automatically expressed in mathematical notation. (ii) The help system has been revised. (iii) The symbolic expression editor supports undo/redo.

Please note: Since Comrel 9.5 users can directly load limit-state functions written in C/C++, FORTRAN and Matlab into Comrel. Furthermore, data, documentation material and other information can be incorporated into the associated user-made libraries.

You can download the demo version of COMREL 10 from http://strurel.de/demoversion.html

Version 9.5 of COMREL is available!

The new release of COMREL comes with numerous improvements. The most notable new features are: (i) Limit-state functions coded in Python can now directly be analyzed. (ii) You can now easily develop your own interfaces to external programs by employing the new Sturel Add-On (SAO) feature. (iii) The COMREL manual is now directly integrated into the graphical user interface.