Toolbox For The Modeling And Analysis Of Thermodynamic .

Transcription

NASA/TM—2014-216638Toolbox for the Modeling and Analysisof Thermodynamic Systems (T-MATS)User’s GuideJeffryes W. ChapmanVantage Partners, LLC, Cleveland, OhioThomas M. LavelleGlenn Research Center, Cleveland, OhioRyan D. MayVantage Partners, LLC, Cleveland, OhioJonathan S. Litt and Ten-Huei GuoGlenn Research Center, Cleveland, OhioJanuary 2014

NASA STI Program . . . in ProfileSince its founding, NASA has been dedicated to theadvancement of aeronautics and space science. TheNASA Scientific and Technical Information (STI)program plays a key part in helping NASA maintainthis important role.The NASA STI Program operates under the auspicesof the Agency Chief Information Officer. It collects,organizes, provides for archiving, and disseminatesNASA’s STI. The NASA STI program provides accessto the NASA Aeronautics and Space Database andits public interface, the NASA Technical ReportsServer, thus providing one of the largest collectionsof aeronautical and space science STI in the world.Results are published in both non-NASA channelsand by NASA in the NASA STI Report Series, whichincludes the following report types: TECHNICAL PUBLICATION. Reports ofcompleted research or a major significant phaseof research that present the results of NASAprograms and include extensive data or theoreticalanalysis. Includes compilations of significantscientific and technical data and informationdeemed to be of continuing reference value.NASA counterpart of peer-reviewed formalprofessional papers but has less stringentlimitations on manuscript length and extent ofgraphic presentations.TECHNICAL MEMORANDUM. Scientificand technical findings that are preliminary orof specialized interest, e.g., quick releasereports, working papers, and bibliographies thatcontain minimal annotation. Does not containextensive analysis.CONTRACTOR REPORT. Scientific andtechnical findings by NASA-sponsoredcontractors and grantees. CONFERENCE PUBLICATION. Collectedpapers from scientific and technicalconferences, symposia, seminars, or othermeetings sponsored or cosponsored by NASA. SPECIAL PUBLICATION. Scientific,technical, or historical information fromNASA programs, projects, and missions, oftenconcerned with subjects having substantialpublic interest. TECHNICAL TRANSLATION. Englishlanguage translations of foreign scientific andtechnical material pertinent to NASA’s mission.Specialized services also include creating customthesauri, building customized databases, organizingand publishing research results.For more information about the NASA STIprogram, see the following: Access the NASA STI program home page athttp://www.sti.nasa.gov E-mail your question to help@sti.nasa.gov Fax your question to the NASA STIInformation Desk at 443–757–5803 Phone the NASA STI Information Desk at443–757–5802 Write to:STI Information DeskNASA Center for AeroSpace Information7115 Standard DriveHanover, MD 21076–1320

NASA/TM—2014-216638Toolbox for the Modeling and Analysisof Thermodynamic Systems (T-MATS)User’s GuideJeffryes W. ChapmanVantage Partners, LLC, Cleveland, OhioThomas M. LavelleGlenn Research Center, Cleveland, OhioRyan D. MayVantage Partners, LLC, Cleveland, OhioJonathan S. Litt and Ten-Huei GuoGlenn Research Center, Cleveland, OhioNational Aeronautics andSpace AdministrationGlenn Research CenterCleveland, Ohio 44135January 2014

AcknowledgmentsThe authors would like to thank Alicia Zinnecker and Yuan Liu of N & R Engineering, and Jeffrey Csank of NASA Glenn ResearchCenter for their work on T MATS testing and for general technical advice. We would also like to thank Sanjay Garg at NASAGlenn Research Center for his support in the development of T MATS, and the NASA Aviation Safety Program’s Vehicle SystemsSafety Technologies (VSST) project for funding this work.Trade names and trademarks are used in this report for identificationonly. Their usage does not constitute an official endorsement,either expressed or implied, by the National Aeronautics andSpace Administration.Level of Review: This material has been technically reviewed by technical management.Available fromNASA Center for Aerospace Information7115 Standard DriveHanover, MD 21076–1320National Technical Information Service5301 Shawnee RoadAlexandria, VA 22312Available electronically at http://www.sti.nasa.gov

last modified: November 15, 2013Table of Contents1.0 Introduction . 11.1 Identification . 11.2 Notation . 21.3 System Overview . 21.4 T-MATS Quick Start Guide . 21.4.1 Installing T-MATS . 21.4.2 Un-installing T-MATS . 31.4.3 T-MATS examples . 41.4.4 Block help . 42.0 T-MATS Library Structure. 53.0 T-MATS Tools . 63.1 GF Convert . 63.2 iDesign On . 63.3 iDesign Off . 63.4 Block Link Setup. 64.0 T-MATS Simulation Creation . 74.1 Simulation Setup . 74.2 T-MATS Formatting . 94.2.1 Color coding . 94.2.2 Simulink wiring . 94.2.3 Mask format. 104.2.4 S-functions . 124.3 Solver Setup . 124.4 Turbomachinery Plant Setup . 124.4.1 Independent and dependent variables . 134.4.2 Maps . 134.4.3 Compressor variable geometries (IGVs and VSVs) . 174.4.4 Bleeds and air bypass . 174.4.5 Turbofan modeling options . 184.4.6 iDesign . 195.0 Customization. 205.1 Library Blocks . 205.1.1 Creating new Simulink Library Browser folders. 205.2 S-functions . 215.3 Tool Creation . 216.0 Troubleshooting T-MATS . 226.1 Convergence “Errors” . 226.2 Crashing . 237.0 T-MATS Tutorials . 247.1 T-MATS Example 1: Newton-Raphson Equation Solver . 247.2 T-MATS Example 2: Example GasTurbine SS . 277.2.1 Creating the gas turbine plant . 277.2.2 Plant solver integration and plant inputs . 307.3 T-MATS Example 3: Example GasTurbine Dyn . 327.3.1 General architecture. 327.3.2 Adding control to the simulation . 367.3.3 Plant interface with outer loop systems . 387.3.4 Advanced simulation structure and formatting. 38Appendix A . 40NASA/TM—2014-216638iii

last modified: November 15, 2013Figure IndexFigure 1.—Sample simulation architecture for a dynamic system. . 8Figure 2.—Sample T-MATS function block parameters mask. . 10Figure 3.—Sample T-MATS function block parameters mask with vectored inputs and checkboxes. . 11Figure 4.—Sample turbojet block diagram. . 13Figure 5.—Sample compressor map (pressure ratio vs. corrected flow). . 14Figure 6.—Sample compressor map (efficiency vs. corrected flow). 15Figure 7.—Sample turbine map (corrected flow vs. pressure ratio). . 16Figure 8.—Sample turbine map (efficiency vs. pressure ratio). . 16Figure 9.—Sample fan model creation schemes for a gas turbine with bypass. . 19Figure 10.—Sample MATLAB internal problem message. . 23Figure 11.—Model configuration parameters setup. . 25Figure 12.—Run equation solver. . 26Figure 13.—Gas turbine plant. 29Figure 14.—Steady-state solver setup. . 31Figure 15.—Iterative NR Solver w JacobianCalc wiring. . 33Figure 16.—Dynamic gas turbine simple “outer” loop. . 35Figure 17.—Dynamic gas turbine with controller. . 37Table IndexTable 1.—T-MATS user’s manual notation . 2Table 2.—T-MATS color coding. 9Table 3.—Dynamic turbofan model independent and dependent variables . 13Table 4.—Compressor map equations . 15Table 5.—Compressor map equations . 17Table 6.—T-MATS library file structure . 20Table 7.—Steady-state turbofan engine example, unused outputs . 27Table 8.—Example 2 convergence outputs . 30NASA/TM—2014-216638iv

last modified: November 15, 20131.0IntroductionThe Toolbox for the Modeling and Analysis of Thermodynamic Systems (T-MATS) is a Simulinktoolbox intended for use in the modeling and simulation of thermodynamic systems and their controls.The package contains generic thermodynamic and controls components that may be combined with avariable input iterative solver and optimization algorithm to create complex systems to meet the needs ofa developer.The goal of the T-MATS software is to provide a toolbox for the development of thermodynamic systemmodels, which contains a simulation framework, multi-loop solver techniques, and modularthermodynamic simulation blocks. While much of the capability in T-MATS is in transientthermodynamic simulation, the developer’s main interests are in aero-thermal applications; as such, onehighlight of the T-MATS software package is the turbomachinery block set. This set of Simulink blocksgives a developer the tools required to create virtually any steady-state or dynamic turbomachinerysimulation, e.g., a gas turbine simulation. In systems where the control or other related systems aremodeled in MATLAB/Simulink, the T-MATS developer has the ability to create the complete system in asingle tool.T-MATS turbomachinery blocks were created using a philosophy that combines the understandability andlogic of physics-based models with the accuracy and tunability of empirically-developed models. Thisuser’s guide is written with the assumption that the user is familiar with modeling thermodynamicsystems, and a user is encouraged to see the referenced documentation 1,2 for a review of generalthermodynamic and modeling principles before building a simulation.T-MATS is written in MATLAB/Simulink v2012b (The Mathworks, Inc.), is open source, and is intendedfor use by industry, government, and academia. All T-MATS equations were developed from publicsources and all default maps and constants provided in the T-MATS software package are nonproprietaryand available to the public. 3 The software is released under the Apache V2.0 license agreement. Licenseterms and conditions can be found at tificationThe T-MATS user’s guide applies to version 1.0 of the T-MATS software package, as developed byNASA Glenn Research Center. The package consists of a T-MATS Simulink library containing thefollowing sub-libraries: Effectors and Controls, Numerical Methods, Solver, and Turbomachinery. Inaddition, the T-MATS package contains development tools, “T-MATS tools,” as well as examples todemonstrate how systems may be created using the Simulink libraries.1http://www2.chem.umd.edu/thermobook/: Referenced as of 9/2013Jones, S.M., “Steady-State Modeling of Gas Turbine Engines using the Numerical Propulsion System SimulationCode,” GT2010–22350, ASME Turbo Expo, Glasgow, UK, June 14–18, 2010.3Jones, S.M., “An Introduction to Thermodynamic Performance Analysis of Aircraft Gas Turbine Engine CyclesUsing the Numerical Propulsion System Simulation,” NASA/TM—2007-214690, March 2007.2NASA/TM—2014-2166381

last modified: November 15, 20131.2NotationThe notation summarized in Table 1 will be used throughout the T-MATS User’s Guide.TABLE 1.—T-MATS USER’S MANUAL NOTATIONTypeDefinitionCourier FontMATLAB function, Simulink blocks, or code (i.e.,Simulink: From block)Times New Roman Font ItalicsVariables (i.e., f(x)) or file names, block input/outputFile Paths (i.e., TMATS Library\MEX)Arial FontSignify what library a block is taken from (i.e.,Platform: Name blockSimulink: From block)1.3System OverviewThe Toolbox for the Modeling and Analysis of Thermodynamic Systems (T-MATS) is a genericthermodynamic simulation system built in MATLAB/Simulink. Developed to use graphical-basedsimulation techniques to meet the requirements of industry professionals as well as academics, T-MATScombines generic thermodynamic and controls modeling capability with a numerical iterative solver tocreate a framework for the creation of complex thermodynamic system simulations. Numerical methodsutilized by T-MATS include Newton-Raphson iterative solving techniques and Jacobian calculationtechniques.1.4T-MATS Quick Start Guide1.4.1Installing T-MATSTo install T-MATS execute the following steps:1. Download T-MATS from the GIT server https://github.com/nasa/T-MATS, click the “DownloadZIP” button, and extract the files to a folder that can be accessed by MATLAB, ensuring there areno spaces in the path name. Note that T-MATS was developed in the Microsoft Windows 7operating system using MATLAB v2012b and Microsoft Software Development Kit (SDK) 7.1;it is not guaranteed to work on other operating systems, with other MATLAB versions, or withother compilers.2. Navigate to the directory of the desired released version of T-MATS in the downloaded zip file,TMATS vXX, in MATLAB.3. Run Install TMATS.m; this will set up the paths for T-MATS as well as create the mex files.If the user does not have elevated privileges, paths may not have been saved properly. If the pathshave not been saved, new paths must manually be added to the pathdef.m file. Open the “SetPath” window by clicking on the “Set Path” button in the MATLAB toolbar on the HOME taband add the paths (\TMATS Library, \TMATS Library\MEX,\TMATS Library\TMATS Support, and \TMATS Tools) to the list. Click “Save” to save thepath definitions; a message will pop up warning that administrator privileges are required andproviding the option to instead save the paths to a new pathdef.m file. Save this file to a locationon the MATLAB path. Note: this process will save the current path list; before saving, it shouldbe verified that no unintended paths are on the list.NASA/TM—2014-2166382

last modified: November 15, 20134. To add the T-MATS tools to the Simulink toolbar, create the MATLAB file, startup.m, with thefollowing lines of code:load simulinkMenu customization TMATSThe startup.m file may be saved anywhere on the MATLAB path, and these lines function to loadT-MATS editing tools to the Simulink window each time MATLAB is opened. If a startup.m filealready exists, just add the above lines of code.If, during MATLAB startup, a warning is displayed notifying the user thatMenu customization TMATS.m cannot be found, it is probable that the T-MATS paths have notbeen added properly in MATLAB. The most common reasons for missing path definitions arethat either the T-MATS paths were not loaded into the pathdef file (see step 3 to solve this issue)or the modified startup.m file is being used by a version of MATLAB that T-MATS was notinstalled on. The warning messages can be removed by either installing T-MATS on the otherversion or by placing the startup.m file in a path used only by the desired MATLAB version. Itshould be noted that, while these warnings may be annoying, they will have no effect on theperformance or functionality of MATLAB if T-MATS is not used.At this point the T-MATS library installation is complete. T-MATS modules may be found in theSimulink Library Browser under the heading “TMATS.” T-MATS tools may be found under “Diagram”in the Simulink model window menu bar.1.4.2Un-installing T-MATSTo remove T-MATS, execute the following steps:1. Execute Uninstall TMATS.m from the same location that Install TMATS was run. (By default,these files are both located in the TMATS folder).a. If paths were added manually to the pathdef.m file during installation, they must beremoved manually by re-saving the pathdef.m file after the Uninstall TMATS.m file hasbeen run.2. Remove the following lines from the startup.m file:load simulinkMenu customization TMATSNASA/TM—2014-2166383

last modified: November 15, 20131.4.3T-MATS examplesT-MATS includes a number of sample systems set up to help a user gain insight into how to use theT-MATS library to simulate thermodynamic systems. To gain access to these examples, navigate to theExamples folder under TMATS Examples and run TMATS Run Example.m. A selection of differentexamples will be listed in the MATLAB window (as shown below); the user can then indicate the numbercorresponding to the example to open. An alternate way to open an example is to navigate directly to thefolder containing the example and run the * setup everything.m file (or by opening the *.slx file, in caseswhere a setup file does not exist). run (‘C:\Builds\TMATS C\TMATS Examples\TMATS Run Example.m’)Select the enumeration of the T-MATS Example to be set up:1) NewtonRaphson Equation Solver2) Steady State GasTurbine3) Dynamic GasTurbine4) Cancel SetupThe * setup everything.m script will execute every command necessary to set up that particular example,which may include any of the following: loading variables to the workspace, creating paths, loadingbusses, and opening the Simulink model. The paths can be removed by running the corresponding* Example cleanup.m file.1.4.4Block helpEach T-MATS module contains a help file that explains the particulars of how to set up that block,therefore the low level functionality of each block will not be discussed in this document.NASA/TM—2014-2166384

last modified: November 15, 20132.0T-MATS Library StructureThe T-MATS Library, as displayed in the Simulink Library Browser, contains four sub-libraries:Effectors and Controls, Numerical Methods, Solver, and Turbomachinery.1. Effectors and Controls: This sub-library contains the building blocks of the outermost loop of asimulation. The library blocks are simple representations of effector and control systemcomponents. Depending on the fidelity requirements of the simulation, it may be necessary todevelop more complex models.2. Numerical Methods: This sub-library contains the most basic building blocks of the numericalsolvers required to simulate a T-MATS system. These blocks are very generic and can be used tocreate iterative solvers for a wide range of systems, even outside of T-MATS.3. Solver: This sub-library contains blocks that simplify simulation creation, including hybridblocks, comprised of blocks from the “Numerical Methods” sub-library, and blocks that areuseful for general simulation development.4. Turbomachinery: This sub-library contains the building blocks necessary to create a gas turbinemodel for simulation. The blocks are based on basic thermodynamic equations and principles,and use a series of maps that define the characteristics of the system being modeled. The defaultmaps and constants in T-MATS are intended only for demonstration.T-MATS is intended to be an environment for building thermodynamic simulations in Simulink with thegoal of dynamic analysis and controls design. The sub-libraries discussed above provide the basicbuilding block of a simulation, however a user may be required to create new blocks, and/or tweakexisting blocks, to meet his/her specific needs.NASA/TM—2014-2166385

last modified: November 15, 20133.0T-MATS ToolsT-MATS comes with a set of tools designed to make model creation easier and faster. These tools arelocated on the Simulink menu bar under Diagram - T-MATS Tools. Each tool will be described in thefollowing sections.3.1GF ConvertThe GF Convert tool changes the selected Simulink: GoTo block into a Simulink: From block, or viceversa. It will also convert a Simulink: Outport into a Simulink: Inport and vice versa.3.2iDesign OnThe iDesign On tool will check all iDesign checkboxes located in T-MATS blocks within the model. TheiDesign mode is described in Section 4.4.6.3.3iDesign OffThe iDesign Off tool will un-check all iDesign checkboxes located in T-MATS blocks within the model.The iDesign mode is described in Section 4.4.6.3.4Block Link SetupBlock Link Setup will create Simulink: GoTo blocks and/or Simulink: From blocks that correspond to aparticular subsystem’s inputs and outputs, and then connect them with wires. T-MATS blocks will bedealt with on a case-by-case basis, with blocks and connections created as appropriate for that particularblock. In many cases, additional Simulink: GoTo or Simulink: From blocks will be created that areintended to be used in other parts of the simulation. The Block Link Setup tool may also be used to createa Simulink: Inport or Simulink: Output block for a selected Simulink: GoTo or Simulink: Fromblock, or vice versa.NASA/TM—2014-2166386

last modified: November 15, 20134.0T-MATS Simulation Creation4.1Simulation SetupIn many thermodynamic systems, the inputs to each component alone are not enough to determine howthe system will respond. For example, the mass flow rate and pressure ratio across a compressor are notunique for a given shaft speed. In order to resolve this, a compressor map is used to solve for incomingflow to the compressor block. This calculated compressor flow and the actual incoming flow are thencompared to calculate a flow error. During simulation, the flow error is driven to zero by adjusting theR-line value to change the position on the map at which the compressor is operating (see Section 4.4 formore details).The T-MATS software package contains blocks that allow for easy creation of a thermodynamic modelthat requires “outer loop” iteration (over time) and “inner loop” iteration. The iterative solver blocks inthe “Solver” sub-library apply a Newton-Raphson method to iteratively solve for plant independentvariables by monitoring plant dependent variables. For the example in the previous paragraph, thedependent variable is flow error and the independent variable is R-line. As with all Newton-Raphsontechniques, a Jacobian for the plant is calculated by the solver; this Jacobian is essentially a linear mapfrom the plant independent variables to the dependent variables, which may change based on the systemoperating point and the degree of system nonlinearity. In cases where the Newton-Raphson solver fails toconverge in a timely manner due to a non-linearity, the T-MATS solver blocks will add robustness byrecalculating the Jacobian matrix.An easy way to learn how to use the T-MATS “Solver” sub-library is to look at the examples. There arethree examples included in the T-MATS software package that demonstrate progressively morecomplicated solver implementations; for more information on the examples and setup, see the tutorial(Section 7.0). In the first and simplest example, NewtonRaphson Equation Solver, the TMATS: SS NRSolver w JacobianCalc block is used to solve a system of three equations for three unknowns. Itshould be noted that the independent variables (x) and the dependent variables (f(x)) are both expressed inthe form of a 3x1 vector. The input to the iterative solver block can be of any length, as long as the inputs,outputs, and appropriate mask input variables are all the same length.The second example (GasTurbine SS Template) sets up a gas turbine with a steady-state solver using theT-MATS block set. In this example, the TMATS: SS NR Solver w JacobianCalc block is usedas the system solver. The four inputs, or dependent variables (on the right hand side of the solver block),are the normalized flow errors from the nozzle, turbine, and compressor, as well as shaft acceleration. Theindependent variables are flow into the engine, R-line (compressor), PR-map (turbine), and mechanicalshaft speed. Components in the “Turbomachinery” sub-library have been color-coded for convenience(more details on the color scheme are in Section 4.2.1).The third example (GasTurbine Dyn Template) simulates a dynamic gas turbine system. This systemrequires setting up a hierarchy with the TMATS: Iterative NR Solver w JacobianCa

Nov 15, 2013 · The Toolbox for the Modeling and Analysis of Thermodynamic Systems (T-MATS) is a generic thermodynamic simulation system built in MATLAB/Simulink. Developed to use graphical-based simulation techniques to meet the requiremen