Page 3 - Demo
P. 3
Interface to Python%uf09f%uf09fRCPConsult2017-2025Page 33.RegisterPythonspecific dynamic library python???.dllin STRURELenvironmentFor final binding of STRURELand Pythonyou have toregisterpython???.dllin each STRURELmodule (e.g. Comrel).Press key F2inthe STRURELmodule to open the PreferencesDialog Box. Go to position Standard Add-onsand check whether this dll is registered. Here we show it for Python3.11 with python311.dll. If Pythoninstallation,system runtime environment and binding to STRURELare ready you can start to use the PythonInterface.4.Interaction between STRURELand PythonThe major kind of communication with thePythonInterface is by usingscript fileswith extension %u2019.py%u2019. Two types of scripts are implemented.The first typeof script describes a real functionwith a single argument as a vector containing thevalues of all stochastic variables and fixed values of all deterministic parameters, as ordered in the Stochastic Model of STRUREL. If the functionis run from the GUI for testing and debugging the stochastic variables are set to the mean values. The return value of this functionis a partialor complete evaluation of theState Function in Symbolic Expression of STRURELjob.The second type of script may contain any set of commands in Pythonlanguage. Such a script must have a statement defining variable %u2019res%u2019 as a final return value. Usually, this statement is the last one. We recommend using thefirst type of script, because a description of functionwill be loaded and parsed bytheengineonce. Then, on runtime, it will be just evaluated numerically. The second kind of script requires loading and parsing of its content by the engine runtime for each call of evaluation. This slows down computation.