Thermosys 4.3
Total Page:16
File Type:pdf, Size:1020Kb
THERMOSYS 4.3 Getting Started Guide ____________________________________________________________ April 2015 _______________________________________________________________ THERMOSYS 4.3 Getting Started Guide V. 1 140508 Table of Contents 1 Installation and File Organization.................................................................................... 3 2 THERMOSYS by Example................................................................................................. 4 2.1 THERMOSYS Component Descriptions.........................................................................................5 2.1.1 Compressor...........................................................................................................................6 2.1.2 Condenser .............................................................................................................................7 2.1.3 Thermostatic Expansion Valve..............................................................................................8 2.1.4 Evaporator.............................................................................................................................9 2.1.5 Box Model ...........................................................................................................................10 2.2 Simulink ® Blocks: On-Off Controller and Simulation Settings.....................................................11 2.3 Additional THERMOSYS Models Not Applied in this Example....................................................12 3 Running Simulations .......................................................................................................13 4 Future Updates and Advanced Use ................................................................................14 2 _______________________________________________________________ THERMOSYS 4.3 Getting Started Guide V. 1 140508 Overview: THERMOSYS is a toolbox designed for the Simulink ® environment within MATLAB ® that models and simulates vapor compression systems. Component models including a compressor, evaporator, condenser, multipurpose tank, valves, and more allow the simulation of these systems. Coupled with the power of the existing Simulink ® library, control schemes can be applied in order to aid the design and effective control of thermal systems. NOTE: This Getting Started Guide is for versions of MATLAB ® prior to 2012b. A second guide for Matlab 2012b and newer will be issued soon with updated screenshots for the new User Interface. 1 Installation and File Organization THERMOSYS includes separate instructions for installation and licensing which should be followed before using the program. Before each use of THERMOSYS, ensure that the entire “install” folder and its subfolders are part of the MATLAB ® path. The Simulink ® Library Browser will display the THERMOSYS toolbox if this is done properly. The toolbox should display a “Components” and a “Fluid Properties” icon. The “Components” section is where the user can drag blocks into Simulink ® models. With this in mind, we can close Simulink ® and take a moment to browse through the THERMOSYS install directory. Within the “install” folder, several other subfolders and files are available and discussed below: • “Component S-Functions” – This contains the code that each Simulink block calls. These are compiled code and are unavailable for viewing or editing. • “Fluid Tables” – This directory contains fluid property tables for the different refrigerants and gases used within THERMOSYS. THERMOSYS 4.1.1 includes properties for Air, Ammonia, CO 2, Glycol(75%)/Water(25%), R21, R134a, R245fa, R404a, R407c, R410a, R507a, and Water. In a pending update, software will be provided that allows for the generation of these tables for additional refrigerants using the NIST software “REFPROP.” • “Heat Transfer Coefficients” – This contains heat transfer coefficients necessary for the models. These are compiled code and are unavailable for viewing or editing. • “HelpFiles” – This contains the various help files about the various components which will be accessible in the MATLAB ® Simulink ® help browser. • “Icons” – This directory contains the images used in each of the THERMOSYS blocks. It is not recommended that these be altered. • “Licensing” – This directory contains initialization and validation files for the THERMOSYS licensure system. The ‘thermosys.license.dat’ file you will receive after sending in your license request should be placed in this folder . • “Sample Systems” – This directory contains sample refrigeration systems. These are useful for reference and show many different block connections. They also demonstrate how other Simulink ® blocks can be used to implement control on the systems. 3 _______________________________________________________________ THERMOSYS 4.3 Getting Started Guide V. 1 140508 • “Single Component Models” – This directory contains simple examples with individual components for a basic understanding of their inputs and outputs. • “Support Functions” – Some of these functions are called within the various component models, while others are user-oriented utilities. Within this folder, “Fluid Table Generation” has compiled code which generates fluid property tables from REFPROP. However, the MATLAB ® interface provided with the purchase of REFPROP is only compatible with MATLAB ® versions prior to 2007. For this reason, a separate package for fluid property tables is in development that is compatible with current versions. With the current release, these functions are not packaged for standalone use, and are only called by the THERMOSYS blocks when needed. • “slblocks.m” – This file automatically adds the THERMOSYS toolbox to the Simulink ® Library Browser. It must be part of the MATLAB ® path before opening Simulink ®, but no other user interactions are needed. • “thermosys.mdl” – This file contains the actual THERMOSYS blocks. Within this file, the masks (which contain the user interface and default parameters) can be viewed and edited. Editing the block masks is not recommended. The user may simulate their own system by dragging and dropping blocks from this file or the Library Browser into a new Simulink ® model, as shown in Section 2 of this guide. 2 THERMOSYS by Example The following is a demonstration example using Sample System #3 to get users started with THERMOSYS. Open “Sample_3_TXV_Box_On_Off_Cycling.mdl” in the “Sample Systems”. This can be accomplished by either double clicking the file within your file browser (which should then open MATLAB ® and the sample), or by opening the file within MATLAB ® or Simulink ®. Sample 3 is used for this demonstration as it includes a wide variety of components along with a user- created control system (using non-THERMOSYS Simulink ® blocks). These include a refrigeration loop consisting of a compressor, condenser, expansion valve, and evaporator. This loop (in conjunction with a simple On-Off controller) regulates the temperature within a Box Model (essentially a room affected by its environment). This example, as provided, regulates the temperature of the box to a value between 19 and 20 degrees C. With the sample open, run the model by clicking the “play” button shown at the left below in Figure 1. One can then double-click the eyeglasses-shaped icon within the model as indicated in the right of the figure below to open a scope view of the box temperature changing in time. Figure 1. Running and Viewing Sample 3. 4 _______________________________________________________________ THERMOSYS 4.3 Getting Started Guide V. 1 140508 After running the simulation for a few seconds, it is advised to click the “Autoscale” button within the scope view or to select “Autoscale” from the right-click drop-down menu. NOTE: repeatedly autoscaling the embedded scopes in the examples can crash the simulation. This is not the case for the discrete scope blocks like. If the simulation crashes when autoscaling the scope accept the error message and restart the simulation. When run successfully, the scope should display a drop in temperature to 19 degrees, and at this point the refrigeration system shuts down, allowing the environment to heat the box. With more simulation time, the refrigeration system enables again when the temperature has risen to 20 degrees. A sample of system pressures and box temperature output with the TXV cycling on and off is shown below in Figure 2. Figure 2. Sample 3 Successful Code Output (3000 sec.). 2.1 THERMOSYS Component Descriptions All components applied in Sample 3, their connections, and their initial conditions are now described in detail. Special considerations for the components will also be mentioned. Following the THERMOSYS components used in Sample 3, the remaining Simulink ® components will be overviewed in the Section 2.3. In this example, all inputs and outputs to most blocks are linked to Simulink ® standard “goto” and “from” tags for neatness. Figure 3 shows the full simulation model. 5 _______________________________________________________________ THERMOSYS 4.3 Getting Started Guide V. 1 140508 Figure 3. Full Simulation Loop for Sample 3 (block displays in Text mode). 2.1.1 Compressor Figure 4. Compressor Block. The Compressor Block shown in Figure 4 has four inputs and two outputs. The [rpm] “from” tag feeds into the compressor’s input. The evaporator exit pressure [Pe_out] is fed into the compressor’s input pressure ( ) and the desired compressor output pressure [Pc_out] is assigned to the compressor block’s output pressure