Building Models Exercise A (contin Connection Model Source File The source code for this model should look like: Model Equations Component GI K GN* S Out in bia gn 9001 Continue Component Su s Out s cl SJ*s out gn C2 SJ*s In2 SJ 9002 Continue CALL EZGPIN(S Out IN, XDOT(1),INX (l),s Out Su, GKI IN, 1,'IN') 9003 Continue Notice the formula for s out snowuses s out GN instead ofs in SJ Connections are made by substituting the name of the output of the from component in for the name of the input in the code of the to component Notice that the components have been reordered Modelat this stage has no values for parameter, initial conditions, tables EAS102. December 2005 pyright@ 2005 MSC Software Corporation Chart 16
EAS102, December 2005 Copyright© 2005 MSC.Software Corporation Chart 16 The source code for this model should look like: – Connections are made by substituting the name of the output of the from component in for the name of • Notice the formula for S_Out_SJ now uses S_Out_GN instead of S_In_SJ the input in the code of the “to” component • Notice that the components have been reordered • Model at this stage has no values for parameter, initial conditions, tables,... Building Models Exercise A (contin.): Connection Model Source File C ---> Model Equations C Component GN s_out_GN = K_GN* S_Out_IN + bia_GN 9001 Continue C Component SJ S_Out_SJ = C1_SJ*S_Out_GN + C2_SJ*S_In2_SJ 9002 Continue C Component IN CALL EZGPIN(S_Out_IN,XDOT(1),INX(1),S_Out_SJ,GKI_IN,1,'IN') 9003 Continue
Building models Creating the Executable ·EAsY5X Saves latest version of your model, model name. ver. emf if model has changed Translates topology- boxes, connections, size of tables- into model generation statements in MSC. EASY5's language in file "mode/_ name".ezmod Model file contains no data Model file is host-independent- can be processed on any EASY5 platform Places file in your working directory Invokes the MSC EAsy5 Mode/ Generator MSCEASY5 Model Generator Sorts computations in the model into explicit order- every quantity calculated before it is used elsewhere Discussion later on what happens if it cannot do so and what to do about it Generates model description file, "model name".ezmg/ Generates FORTRAN code representing your model, "model name.f Compiles same and links it with the EASY5 Analysis Program, "model_name".exe EAS102. December 2005 pyright@ 2005 MSC Software Corporation Chart 1
EAS102, December 2005 Copyright© 2005 MSC.Software Corporation Chart 17 • EASY5x • Saves latest version of your model, model_name.ver.ezmf if model has changed • Translates topology – boxes, connections, size of tables – into model generation statements in MSC.EASY5’s language in file “model_name”.ezmod • Model file contains no data • Model file is host-independent – can be processed on any EASY5 platform • Places file in your working directory • Invokes the MSC.EASY5 Model Generator • MSC.EASY5 Model Generator • Sorts computations in the model into explicit order – every quantity calculated before it is used elsewhere • Discussion later on what happens if it cannot do so and what to do about it • Generates model description file, “model_name”.ezmgl • Generates FORTRAN code representing your model, “model_name”.f • Compiles same and links it with the EASY5 Analysis Program, “model_name”.exe Creating the Executable Building Models
Building Models Mathematical Form of the model MSC EASY5 model of your system Set of explicit, ordinary differential equations in State Space Form dot =f(, u, time)-derivatives of state variables y=g(, u, time)-formulas for algebraic variables Implies that calling model with given x, t will result in given xdot No matter how many times you call No"memory hidden in model X=X+1 for instance We'll expand definition later to include other than continuous dynamics State variables are those defined by ordinary differential equations Does not change instantaneously States contain all the information needed to stop a simulation and restart it later Numerical integration advances time and recomputes X Well expand the definition later to include other than continuous dynamics Algebraic variables are just called variables in MSC EASY5 Determined instantaneously by the states · Don't need to be saved EAS102. December 2005 pyright@ 2005 MSC Software Corporation Chart 18
EAS102, December 2005 Copyright© 2005 MSC.Software Corporation Chart 18 • MSC.EASY5 model of your system •Set of explicit, ordinary differential equations in State Space Form • xdot = f(x,u,time) - derivatives of state variables • y = g(x,u,time) - formulas for algebraic variables • Implies that calling model with given x, t will result in given xdot • No matter how many times you call • No “memory” hidden in model x = x+1 for instance • We’ll expand definition later to include other than continuous dynamics • State variables are those defined by ordinary differential equations • Does not change instantaneously • States contain all the information needed to stop a simulation and restart it later • Numerical integration advances time and recomputes x • We’ll expand the definition later to include other than continuous dynamics • Algebraic variables are just called variables in MSC.EASY5 • Determined instantaneously by the states • Don’t need to be saved Mathematical Form of the model Building Models
Building Models Exercise A Continued: A Simple Transient Set the following parameters in your model: GKI_In =1,sIn1_SJ=0,KGN=10 · Set the initial condition:s。utlN=1.0 Select Simulation from the Analysis menu press the button labeled"Show/Edit Plot Variables and Plot Results yes and In the simulation data form set Time Increment = 01 In the Plot specification Form: press the show Name List button, then click all in the List Popup that appears, and then press done Press the"Execute and close Button". You should quickly see four plots, one of which should look like 80 This is generally described as a"decaying exponentialcurve EAS102. December 2005 pyright@ 2005 MSC Software Corporation Chart 19
EAS102, December 2005 Copyright© 2005 MSC.Software Corporation Chart 19 • Set the following parameters in your model: GKI_IN = 1, S_In1_SJ = 0, K _GN =10 • Set the initial condition: S_Out_IN = 1.0 • Select Simulation from the Analysis menu • In the Simulation data form: set Time Increment = .01 and Plot Results = yes and press the button labeled “Show/Edit Plot Variables” • In the Plot Specification Form: press the Show Name List button, then click all in the List Popup that appears, and then press Done • Press the “Execute and Close Button”. You should quickly see four plots, one of which should look like” • This is generally described as a “decaying exponential” curve Exercise A Continued: A Simple Transient Building Models
Review of Fundamental Concepts Initial Conditions Algebraic equations determine the current value of a physical quantity from the current values of other physical quantities Example: ohms law: v= ir If I know the resistance and the current now, I can determine the voltage now. Differential equations specify how physical quantifies change not how they are Example: Capacitor: dvldt= ic To determine the current value of v I need to need to know at some earlier time to and the value of i at all values of time between to and now. this is easier to see from the integralform of the equation vow C i(o)dt Important note: To determine now, I don' t really need to know i at tnow-it's good enoughto knowi for t up to tow. i When you push down on accelerator, your car's velocity doesn't change instantly. J The value v is called an initia condition EAS102. December 2005 pyright@ 2005 MSC Software Corporation Chart 20
EAS102, December 2005 Copyright© 2005 MSC.Software Corporation Chart 20 Review of Fundamental Concepts Initial Conditions Algebraic equations determine the current value of a physical quantity from the current values of other physical quantities. Example: Ohm’s Law: v = ir If I know the resistance and the current now, I can determine the voltage now. Differential equationsspecify how physical quantifies changenothow they are. Example: Capacitor: dv/dt = i/C To determine the current value of v I need to need to know v at some earlier time t0 and the value of i at all values of time between t0 and now. This is easier to see from the integral form of the equation Important note: To determine vnow, I don’t really need to know i at tnow - it’s good enough to know i for t up to tnow. { When you push down on accelerator, your car’s velocity doesn’t change instantly.} The value v0 is called an initial condition