Page 5 - Demo
P. 5


                                    Interface to Scilab%uf09f %uf09f RCP Consult 2021-2026 Page 5The assigned global vectors, global names and information variables can be explicitly used in any script or expression.For illustrated explanation how the Stochastic Model data of STRUREL must be used in communication with the Scilab Interface the following well known example will be taken (User Manual: Stone example):The assigned global names will have the very same names as in the Stochastic Model: Load, Strength, Diameter, PAR1, PAR2 and corresponding values. Each global vector will have 5 elements with corresponding values as ordered above.6. Scilab script fileThe script file containing a Function with a single input argument usually looks likefunction resultScalar = StrurelScilab (xp) // Uses only vector notation to access values of Variables and Parameters. // The sequence in input vector xp is predefined by Stochastic Model.  resultScalar = xp(4)*(%pi/4)*xp(2)*xp(3)^2 - xp(5)*xp(1);endfunctionHere elements of input vector %u2019xp%u2019 containing values from global vector v_XP_ can be accessed directly by an index, as is ordered in Stochastic Model of STRUREL.Alternatively, the assigned global names may be used also inside of functionfunction resultScalar = StrurelScilab (xp)// Uses global names of Variables and Parameters to access their values.// The sequence is arbitrary. Both STRUREL and Scilab are case sensitive. resultScalar = PAR1*(%pi/4)*Strength*(Diameter^2) - PAR2*Load;endfunctionDirect notation of both global vectors is also applicablefunction resultScalar = StrurelScilab (xp) // Uses only vector notation to access values of Variables and Parameters. // The sequence in global vector v_XP_ is predefined by Stochastic Model.  resultScalar = v_XP_(4)*(%pi/4)*v_XP_(2)*v_XP_(3)^2 - v_XP_(5)*v_XP_(1);endfunctionIt is permitted to use a mixed mode %u2013 global vectors, global names and arguments in the same function.Note: Function and argument (vector) names are arbitrary
                                
   1   2   3   4   5   6   7   8   9   10