Page 6 - Demo
P. 6


                                    Interface to Ruby%uf09f %uf09f RCP Consult 2020-2026 Page 6# Uses global names of Variables and Parameters to access their values.# The sequence is arbitrary. Both STRUREL and Ruby are case sensitive.$PAR1*Math::PI/4*$Strength*$Diameter**2-$PAR2*$LoadendDirect notation of both global vectors is also applicabledef StrurelRuby(xp)# Uses only vector notation to access values of Variables and Parameters.# The sequence in input vector xp is predefined by Stochastic Model.$v_XP_[3]*Math::PI/4*$v_XP_[1]*$v_XP_[2]**2-$v_XP_[4]*$v_XP_[0]endIt is permitted to use a mixed mode %u2013 global vectors, global names and arguments in the same function.%uf046 The Ruby has a special notation for global names, see - global variables in Ruby.Note: Method and argument (vector) names are arbitrary.The other kind of script file may contain any set of commands in notation of Ruby language but must have a statement defining variable %u2019$res%u2019 as a final return value.$res=$PAR1*Math::PI/4*$Strength*$Diameter**2-$PAR2*$Loador$res=$v_XP_[3]*Math::PI/4*$v_XP_[1]*$v_XP_[2]**2-$v_XP_[4]*$v_XP_[0]The creation of an interface script in correct notation is not trivial. To make it easier a template with some helpful data can be generated for a new script referenced in the simplified form of an interface function. After definition of required Symbolic Expressions and parsing a name of script will be shown in Reliability Job tree. Blue color means that this script file is not yet saved. Otherwise the colour of script name is red. For this state you can use right mouse click to activate a popup menu and select a script file of interest as shown below. The Script Editor will be activated with a corresponding template content. Then you can modify text of script as you like. Use the Evaluation button in Script Editor toolbar to control syntax and numeric of your script.
                                
   1   2   3   4   5   6   7   8   9   10