2.08k likes | 2.13k Views
MSC.Software Corporation. 2 MacArthur Place Santa Ana, CA 92707, USA Tel: (714) 540-8900 Fax: (714) 784-4056 Web: http://www.mscsoftware.com. Tokyo, Japan Tel: 81-3-6911-1200 Fax: 81-3-6911-1201. United States Tel: 1-800-732-7284 Fax: (714) 979-2990 . Munich, Germany
E N D
MSC.Software Corporation 2 MacArthur Place Santa Ana, CA 92707, USA Tel: (714) 540-8900 Fax: (714) 784-4056 Web: http://www.mscsoftware.com Tokyo, Japan Tel: 81-3-6911-1200 Fax: 81-3-6911-1201 United States Tel: 1-800-732-7284 Fax: (714) 979-2990 Munich, Germany Tel: (+49)-89-43 19 87 0 Fax: (+49)-89-43 61 716 Dynamic System Modeling, Simulation, and Analysis Using MSC.EASY5 Advanced Class EAS102 Course Notes December 2005 Part Number: E5*V2005*Z*Z*Z*SM-EAS102-NT1
Goals Appreciate MSC.EASY5 as a set of tools to solve engineering problems Use all of MSC.EASY5’s capabilities – not just the familiar ones Look for an MSC.EASY5 tool or feature to help with an unusual problem Work with MSC.EASY5, not around it • What class is not about: MSC.EASY5 mechanics, but some is inevitable Control analysis/design, but some is inevitable Tutorial on Thermal-Hydraulic, Gas Dynamics, PowertrainLibrary, etc. • It does contain: Review of some fundamentals that are sometimes not well understood Concepts and use of some advanced features – cannot be encyclopedic Topics selected to fit class needs Advanced Class Introduction Goals and Content Chart 2
Overview of MSC.EASY5 • Review of Some Fundamentals • Model Building Process • Specifying Analysis Data • Finding an Initial Operating Point - Steady State Analysis • Running a Transient Response - Numerical Integration • Using the Linear Model Analysis - Eigenvalues and Eigenvectors • Review of Fortran Components • Building Library Components • Modeling Digital Controllers - Delay and Sample states • Modeling Discontinuities with Switch States • Miscellaneous Advanced Topics Advanced Class Introduction Outline of Course Content Chart 3
Overview What is MSC.EASY5? • MSC.EASY5 is an engineering tool for analyzing complex systems Can be Electrical, Pneumatic, Hydraulic, Mechanical,... Used for “intermediate” level of detail modeling and analysis More detailed than discrete event or steady state tools Less detailed than finite element tools Models use nonlinear, discontinuous algebraic, differential, and difference equations • Model can be built in different ways Use MSC.EASY5 general purpose blocks (integrators, saturation, sums,...) Use MSC.EASY5 libraries for specific application areas • Hydraulics • Gas dynamics & pneumatics • Electric drive • Multiphase fluid • Powertrain Write your own equations in Fortran or C User Code components Build your own application libraries Chart 4
PI Controller Position Command First Order Lag (for actuator control) 50 command 1 S2 GB KP=10 KI=.025 .01s+1 -50 S2 LA Servo Valve (w pressure state) Two Chamber Actuator Spring Force SPRFORC Actuator_pos Upstream Boundary Global Fluid Conditions (P, T) Fixed orifice Properties Hydraulic P = 100 Fluid P=1.105 T = 50 4 Constant pressure source Overview Block Diagram Model Representation • Each box represents the behavior of a system elements • Blocks from MSC.EASY5 GP library – generic integrators, summing junctions, etc.. • Components from application libraries – pipes, pumps, motors, etc. • Connection arrows between blocks represent interactions between system element Interaction (information flow) may be single- or bi-directional Chart 5
Overview Analysis Options • Types of Analysis: Steady State • Find the values the plant would settle out to after an initial transient Simulation – time response • How does the plant respond to a command or a disturbance Model Linearization • Determine the stability of the system • For control system design • Also for understanding system Frequency response between any two points in model - Root locus, Stability margins, Eigenvalue Sensitivity, Power Spectral Density Matrix Algebra Tool • Controls Design • Data Analysis before or after other analyses • Use MSC.EASY5 Plotter of Visualize results Chart 6
Overview MSC.EASY5 is Several Programs • Programs you interact with • MSC.EASY5x main window • Where you construct your model schematic • Also used for data entry and controlling analyses • Plotter • Visualize the results of the analyses • Icon Editor • Create custom graphic representations for your components • Create component on-line documentation • Matrix Algebra Tool (MAT) • Programs that run in the “background” • Model generator • Translates your schematic diagram into a Fortran subroutine of model equations called EQMO • Analysis/Simulation program • Where the actual computation occur • Custom built for each model • Library Maintenance and Model Documentation programs Chart 7
Overview Levels of Dynamic System Simulation Fidelity • Physical systems can be simulated at many levels of complexity. The “correct” level depends on the purpose of the simulation. • 1. Atomic level – uses quantum mechanical partial differential equations (PDE’s) • Purpose: molecular level effects • Applications: nuclear physics 2.Continuum (or distributed parameter) - uses field equations (PDE’s) • Purpose: study quantities that vary significantly over the points in a geometric object • Applications: detailed aerodynamics, impact analysis, component (e.g. valve) analysis 3. Macroscopic (or lumped parameter) - uses ordinary differential equations • Purpose: study quantities that vary in time but can be averaged over spatial components • Applications: Flight controls, hydraulic system analysis, electric power system control 4. Systems analysis - uses algebraic equations with time delays • Purpose: study quantities that effectively change value instantaneously at discrete instances of time • Applications: Scheduling, communications • Each level requires orders of magnitude more effort than the next highest but provides more accurate results. • MSC.EASY5 is usually used to model dynamic systems at Level 3, but occasionally it is used for Level 2. Chart 8
Advanced Modeling and Simulation With MSC.EASY5 Model Building and Simulation Review Chart 9
Building Models • Start MSC.EASY5 • Enter name of model • Open the Add Component panel • Press Add button in the Editing toolbar • Alternatively: Select “Add” from the EASY5x Edit Menu • To add a component to your model • Select the library in the top frame of the Add panel • Select the group from the middle frame of the Add panel • Select the component from the third frame • Point at the spot on the schematic window where you want the component and click the left mouse button • To add a connection between two component • Click on the “From” component to select it • Click on the “To” component to get default connection • Hold-R (right click and hold) on the “To” component to force a non-default connection Chart 10
Building Models Exercise A: A Simple Model • Build a model called ExerciseA containing three components from the GP (General Purpose) Library - placed as shown below: • SJ - Summing Junction - from Sum/Multiple/Divide Group • IN - Integrator - from Integrators Group • GN - Gain - from Sum/Multiply/Divide Group (To change to feedback icon, Hold-R on icon, select Flip) • Select “Create Executable” from the MSC.EASY5 Build menu. • When message “Executable has been Created” appears on the message line, select “Display Executable Source file” from the Build menu. • Scroll the source window down until you see “Model Equations” Chart 11
Building Models Exercise A (contin.): Model Source Code You should see the following code: C ---> Model Equations C Component SJ S_Out_SJ = C1_SJ*S_In1_SJ + C2_SJ*S_In2_SJ 9001 Continue C Component IN CALL EZGPIN(S_Out_IN,XDOT(1),INX(1),S_In_IN,GKI_IN,1,'IN') 9002 Continue C Component GN s_out_GN = K_GN* s_in_GN + bia_GN 9003 Continue Components appear in the order they were added to model (in this case) SJ & GN appear as blocks of actual code IN appears as a subroutine call (this is called a “standard” component) All these components can be “vectorized” setting channels (N) > 1 in the CDT Chart 12
Building Models Library and Component Names • Library Names • 2 alphabetic characters, GP = general purpose, HC = Advanced Hydraulics, etc. • Component Names in Libraries • 2 alphanumeric characters • May have name collisions in different libraries • GP/LL – Lead-Lag • HC/LL – Laminar Leakage • Add panel uses library name to qualify component name • Component Qualifier • 1 or 2 alphanumeric characters • Used to distinguish between instances of like-named component in model • Two integrators in model: IN2 and IN3 • Lead-lag LL23 and Laminar Leakage LL06 • Full model component name • Two character component name plus two character qualifier • Full component name is part of all source code variable names Chart 13
Building Models Input-Output Names for Components • Default MSC.EASY5 Naming Convention • Characters left of the (first) underscore identify variable • First character must be alphabetic • Characters right of the (second) underscore are component name • Names automatically unique • Characters between underscores (if there are two underscores) • identify the port • More on ports later • User-Supplied Names • Can have up to 26 alphanumeric characters (1st must be alphabetic) • Use for variables appearing in plots (others a waste of effort) • Meaningfulness is your responsibility • They replace default names everywhere (menu, code, results) • Created by writing over default name in Component Data Table • You can return to MSC.EASY5 names by selecting user-defined name and pressing the delete key followed by the return key Chart 14
Building Models Exercise A Continued: Connections • Make the following default connections in your model: • From SJ to IN • From IN to GN • From GN to SJ • Examine one of the connections (point at connection and click center mouse Button). Notice that only the “S” variables have been connected (S = signal) • Create an executable and look at the Executable source file Chart 15
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 The source code for this model should look like: 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 • Connections are made by substituting the name of the output of the from component in for the name of Chart 16
Building Models Creating the Executable • 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 Chart 17
Building Models Mathematical Form of the model • 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 Chart 18
Building Models Exercise A Continued: A Simple Transient • 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 Chart 19
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 equations specify how physical quantifies changenot how 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. Chart 20
Model Building Complex Connections • Connections between the GP components are usually the connection of a single output of the “from” component to a single input of the “to” component. • A strength of MSC.EASY5 ported connections is the ability to use a single graphical • connection line to represent a physical association between two components of a • physical system. Examples: Hydraulic fluid flowing from a valve into a heat exchanger Electric power flowing from a transmission line to a transformer Mechanical power flowing from a drive shaft to a differential • Modeling these associations requires multi-variable, bi-directional information passing between the componentmodels. Example (Hydraulic connection - simplified): Chart 21
Building Models Port Connections • A component port is a collection of variables (both inputs and outputs) grouped to represent a physical connection • A port connection between a port on one component to a port on a second component consists of: A connection of each output variable of either port to the input of the other port with the same variable identifier (ignoring the port name) • Each port has a unique alpha-numeric name Port name is the portion of variable name between the two underscores Example: S_In_IN is the inlet signal for the GP/IN integrator component Component name Port name Input name Each port also has a number that is used internally by MSC.EASY5 • Connection scheme Conventional names (W for flow rate, etc.) and ports make automatic connection possible Also can check for complete connection – i.e. won’t misconnect W = flow rate to W = shaft speed because rest of port names don’t match Chart 22
Physical Example: MSC.EASY5 model: VA PI PU Port Connections (in a single operation) connect in both directions all the data required to define connection - typically flow rate and temperature in forward direction, pressure in reverse direction. Port Connections Example Port Connection Chart 23
Building Models Making your Model More Meaningful • Use User-defined Names • Component Appearance • Selections in Component Data Table Options menu to: • Change component name or qualifier • Invoke the Icon Editor to change the icon of only that instance of the component • Connection Labeling and Appearance • “View” menu for port labels • “Edit” menu for data name labels • “Attributes” in connection data table for color, style , label position & orientation • Hold-R with mouse pointed at connection to access pop-up menu to edit • attributes, etc. Chart 24
Advanced Modeling and Simulation With MSC.EASY5 Class Project: Cabin Air Control System Chart 25
Strategies for Model Building (or don’t try this at home) • In a training course we: • Cook up problems that are somewhat idealized • Build fairly large models all at once • Provide detailed instructions, parameter values and I.C.s • This optimizes chances for success, efficiently uses class time • This may not work for you outside of a classroom setting • Start small (1-4 components). Get that working first. • Build incrementally: add 1-4 components at a time. • At each step, carefully consider parameter values and I.C.s, obtain a valid operating point. • Crawl • Walk • Run Chart 26
Project 1 Build the Schematic for an Air Flow System • Model Objective: Model a system which takes air from two sources, mixes them together to supply a specified flow of air at a specified temperature Desired Temperature = 190 oF , desired Flowrate = 30 lb/min = 0.5 lb/sec • Component usage (schematic on next page): Hot air supply: GD/VIH – Boundary conditions for hot air supply • GP/AFP produces pressure disturbance • SJHA will be used later to add the pressure disturbance to baseline pressure of 50 psia • Valve in VIH regulates flow of hot air • GP/IHHV + GP/SJHV model valve dynamics • Connect S_Out_SJHA to P1_VIH (Boundary pressure). • Connect S_Out_IHHV to OPE_VIH • Initialize both OPS_VIH and S_Out_IHHV Cold air supply: GD/IOC – Boundary conditions for cold air supply • GP/AFT produces temperature disturbance • SJCA will be used later to add the temperature disturbance to baseline cold temperature • Connect S_Out_SJCA to TF1_IOC (Boundary temperature). Flow adder GD/NO combines the flows Combined air flow: GD/VDP + GD/PC • Valve in VDP allows regulation of total air flow • GP/IHOV + GP/SJOV model valve dynamics • Connect S_Out_IHOV to OPE_VDP • Initialize both OPS_VDP and S_Out_IHOV • Downstream pressure B.C: PP_Exit_PC Sensor dynamics: GD/WS and GD/TS measure flow rate and temperature Chart 27
Project 1 Schematic For Air Flow System vary input boundary conditions lag with limited output outlet boundary condition: constant P set table in IOC component to a size=6 Chart 28
Set the table size as noted Open the IOC Component Data Table - center click on icon Open the table size adjuster - Select “Table of 1 var” Move slider until “6” appears or type “6” into field Select OK Project 1 Notes on Building the Air Flow Model • Add your own qualifiers and edit the component titles so the • schematic will agree with the handout You can control the qualifier used from the add menu • Tomove or edit connection labels, Hold-R on connection line, then select • Properties or Line Attributes from pop-up menu • Remember: no data yet • Generate the executable • Question: Why are we using the IH and SJ combination instead of just a lagcomponent to represent valve actuators? Chart 29
Numericaldata is not part of compiled model • Change values without rebuilding model • Many analysis options change parameter values during an analysis • Vector/matrix and table sizes are part of topology, contents are not • Any input may be data (user supplied value) or it may be ‘connected’ • (computed elsewhere in your model) Specifying Model Data Chart 30
Baseline data for model • Parameters Default parameter values • Libraries use defaults when there is a sensible default • Generic default value is 0.99999 (recognizable, not zero, close to one) • Tables 1 and 2 independent variable tables built in to many library components Blocks from GP library: • FU, FV, FW for 1, 2, 3 independent variable tables • TA and TB for 2 or 4 functions of TIME Fixed-grid option available to speed lookup Specifying table size • Center click on “Table of x Var” in CDT entry • Use spinbar ( ) or manually type table sizes 3 through 9 independent variable tables available • See user’s manual for formats Specifying Model Data Data in Component Data Tables Chart 31
Information needed for each state: • Initial conditions • GP library default value of zero - often not a realistic value • Library defaults may (depending on the units choice) be more realistic • Error control • Error tolerance for variable step integration • Perturbation size for linearization • GP library default of 0.001 • Application libraries (HC, VC, GD, etc.) usually use tighter (smaller) defaults • Freeze Control • “no” – state behaves normally • “yes” – state holds initial condition (behaves like a constant input parameter) • use to • ignore some physical effect • isolate part of the model for debugging • allow state to be used as root locus parameter Specifying Model Data State Information in Component Data Table Chart 32
Project 2 Data For Air Flow Model (Page 1 of 19) Enter the following data into the component data tables of the AirFlow model: Chart 33
Project 2 Data For Air Flow Model (Page 2 of 19) Chart 34
Project 2 Data For Air Flow Model (Page 3 of 19) Chart 35
Project 2 Data For Air Flow Model (Page 4 of 19) Chart 36
Project 2 Data For Air Flow Model (Page 5 of 19) Chart 37
Project 2 Data For Air Flow Model (Page 6 of 19) Chart 38
Project 2 Data For Air Flow Model (Page 7 of 19) Chart 39
Project 2 Data For Air Flow Model (Page 8 of 19) (continued) Chart 40
Project 2 Data For Air Flow Model (Page 9 of 19) Chart 41
Project 2 Data For Air Flow Model (Page 10 of 19) Chart 42
Project 2 Data For Air Flow Model (Page 11 of 19) Chart 43
Project 2 Data For Air Flow Model (Page 12 of 19) Chart 44
Project 2 Data For Air Flow Model (Page 13 of 19) Chart 45
Project 2 Data For Air Flow Model (Page 14 of 19) Chart 46
Project 2 Data For Air Flow Model (Page 15 of 19) Chart 47
Percent Open Project 2 Data For Air Flow Model (Page 16 of 19) (continued) , Orifice Area Dynamics = External Chart 48
Project 2 Data For Air Flow Model (Page 17 of 19) (continued) Chart 49
Project 2 Data For Air Flow Model (Page 18 of 19) Chart 50