Page 5 - Demo
P. 5


                                    Interface to Scilab%uf09f%uf09fRCPConsult2021-2025Page 5The assigned global vectors, global namesand 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 withtheScilabInterface the following well known example will be taken (User Manual: Stone example):The assigned global nameswill have the very same names as in the Stochastic Model: Load, Strength, Diameter, PAR1, PAR2and corresponding values. Eachglobal vectorwill have 5 elements with corresponding values as ordered above.6.Scilabscript fileThe script file containing a Functionwith a single input argument usually looks likefunctionresultScalar =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%u2019containing values from global vectorv_XP_can be accessed directly by an index, as is ordered in Stochastic Model of STRUREL.Alternatively, the assignedglobal namesmay be used also inside of functionfunctionresultScalar =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 vectorsis also applicablefunctionresultScalar =StrurelScilab(xp)// Uses only vector notation to access values of Variables and Parameters.// The sequence in globalvector 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 %u2013global vectors, global namesand arguments in the same function.Note:Function and argument (vector) names are arbitrary
                                
   1   2   3   4   5   6   7   8   9   10