Anda di halaman 1dari 12

Hgskolan Dalarna Solar Energy Research Center SERC School of Industrial Leadership 781 88 Borlnge Tel: 023 - 77 87 07,

Fax: 023-77 87 01 Chris Bales

SolNET PhD Course Dynamic Simulation and Cultural Context of Energy Systems 6ECTS


Version: 2007-01-07

Getting Started

There are many examples in the TRNSYS 16 directory that you can play with. It is always best to make a copy first so that you have an original to go back to later. The examples are mentioned briefly in the getting started manual. In this document there are few other tips for you to use to get practice in different aspects. 1.1 Course Website

The course website is found via the university course portal, where you have to logon with the username and password you have been given. If you do not have it yet, then you can login as guest. Here you will then have to choose the course in the box at the top (showing gstrum) - MD019 (VT07, 25%, Dag, Normal, Borlnge). Here you will find the materials for the course (course materials sections) and the site where you should upload the reports for the course (hand-in area) (links on left hand side of starting window). 1.2 Location of working directory and backups

Each student will have his own user space on the universities main server. It is possible to run TRNSYS using a working directory in this user space (H:), but this generally creates problems as the data files (weather) and so on are on the hard disk of the computer. It is suggested that you create a folder where you have all of your work files, with several different sub-folders, one for each of your projects. The examples that are not in the Studio manuals will be given to you by the teacher. This applies to example 3, example 8 and example 10. 1.3 Manuals

There are electronic manuals on the computer and can be accessed online from the TRNSYS studio.


Exercises with example begin

Go through the first example in the Getting started manual (section 1.4.1) before going on to the exercises given in this document. Before starting, though, copy the folder begin from the TRNSYS16 examples folder to your work folder.
Instructions for TRNSYS 16 Exercises

Chris Bales, 2007-01-05

Following this you can try some of the following exercises. Outputs to printer Import the output files into Excel and display them there. Note that you have to have the decimal separator (see in the windows control panel: regional options / number) set to decimal point and not comma for Excel to be able to read the output files. Note also that you have to either save the data in excel with another name or shut the output file in Excel before you simulate again. Excel locks files that it opens. The simulation will crash. Try it to see what error message you get. Look at the connections to the printer and then to those to the integrator to find out what the information being printed is. Follow the connections until they come from the component that originally produced them, in this case the collector and the auxiliary heater. Read more about the output by opening the component (doubleclick) and then clicking on the more button for the relevant output in the output tab window. Go through the manual and the Studio drawings to understand what the components (types) are that are used in this example. Look especially at the controller (type 2). Using Constants and equations as variables that can be used in several components Change the printing interval for the printer to be the same as that for the integrator. o In Control cards, in the box simulation cards, enter the text: CONSTANTS 1 PRINTSTEP = 12 This defines a constant that can be used in any component proforma. It is useful when the same value is used in several places or to collect all variables that are to be changed so that they are in the same place. The variable name can be any length but only the first 8 are counted. Thus Temperat and Temperature are treated the same. o In the proformas (parameters) for the integrator and the upper printer, change respectively the integration time and print interval to PRINTSTEP. To do this you need to click on the box for units (next to the value) to change it to string (otherwise it will not accept letters, only numbers). o Run the simulation again and compare results. The printer now gives results every 12 hours and the integrator integrates over only 12 hours and then resets instead of integrating over the whole simulation period. Do the same thing, but now using an equation component: o Insert a new equation component via the assembly menu, insert new equation, and change its label to variables by double clicking on the label. o Open the proforma and create a new equation name by clicking on the new icon (top right by intermediates & outputs) and typing in PRINTINT. o Make the value 6 in the right hand box as shown. o Change the variable name in the integrator and printer to PRINTINT and simulate

Instructions for TRNSYS 16 Exercises

Chris Bales, 2007-01-05

again. See that the output is different again. Change other parameter values to see what happens have a play !!

Using online plots Add an extra online output component to begin. Look in the online help in Studio for more information about how to add the online and how to connect inputs to it from other components. o Go to the Direct Access Toolbar on the right hand side of the screen, where there is a list of components. Choose output / online / type65 and drag it into the project. o Rename it Overview o Open the proforma and set the number of variables (inputs) on the left and right to 6 and 3 respectively (first two parameters). o Choose the link icon (left hand icons, between the key and the A). Then click first on the tank and then on the type65 component to create the link. This is now a link, but contains no information flow. o Make links between the collector, data reader and auxiliary heater to the online component. Note that they are blue before any connections are made inside the link. o Open the link between the data reader and the online component and connect ambient temperature to left axis variable. This is done by first clicking on the output and then on the input. o Now change the label for this variable by opening the online component and changing the input quantity for the first variable to Tamb as shown. o Now open the link to see that the label is now Tamb for the first variable. o Make the labels for the other 5 left hand variables to: RH, Vw, Tcout, Tcin and Tauxout for the relative humidity, wind speed, collector outlet and inlet temperatures and finally outlet temperature from the auxiliary heater. Make the labels for the 3 right hand variables to: Pcoll, Paux, Ihor for the powers for the collector, the auxiliary and the horizontal radiation. Making the labels first helps in the connecting process later. Connect the relevant outputs from the weather reader to RH, Vw and Ihor; collector to Tcout and Pcoll; auxiliary heater to Tauxout and Paux; and pump to Tcin. Note that the text in the connection box turns from blue to black when the connection is made. Note also that the label for the variables changes to the name of the output. This is often annoying and you will normally want to rename them to something that makes more sense to you. Simulate the system. You will see that the scale is not correct for either the temperatures or the powers. Open the online component and change the scales for left and right axes (parameters 3-6). Change also the labels for the tab at the bottom of the online plot and the axis using the tab window special cards. Simulate again and this time say NO after the simulation has finished. Here you can play with the online picture. Look at the plot and try and understand how the system works, together with the description at the start of section 2.2. You can also:

Instructions for TRNSYS 16 Exercises

Chris Bales, 2007-01-05

o Turn on/off curves by clicking on the relevant label. o Show the instantaneous values by holding the shift key down. o Change the scales for the y-axes by clicking on them. o Check also the plot options menu and what you can do there. o Make a zoom window by dragging the cursor over the area to be zoomed. In this you can change the scale for both the x and y-axes, and look closer at the results. Add an equation component and another online component (one that prints data out to a file, in this case call it just online.plt) and check where the information is displayed and what is printed. The equations job here should be to change the units from the TRNSYS units for power of kJ/hr to kW (dividing by a factor of 3600), see right. Insert 3 inputs and 3 outputs as shown first, before connecting to other components. Change the length and time step of the simulation in the control cards.


Exercises: Example 3

Copy the whole folder for this example to your work folder. Read the excerpt from the TRNSYS manual at the back of this document to see how the system is made up and how it works. Open the Studio project. Why does it not work? o Look at the results file for the error. (Icon at bottom on left). Click on the line with the error label and it expands to give details. This is a very common error when transferring models from one computer to another or moving it to different parts of the computer. You have to look in all the components that read or write files to find the error and correct it. Add two online components to check that it does work as it should do. Change parameter values to explore what happens.

2.3 2.3.1

More Advanced Examples Model: Example 8

Do the same as for the other examples try and understand how it is put together and how it works. Note especially the use of the flow diverter and T-piece to simulate a mixing valve. To aid the understanding of the system you should work with layers and also work with positioning the connections, both of which allow you to make the drawing easier to understand. Use the example SDHW in the TRNSYS 16 examples area as an idea for you. Open the Studio project. Why does it not work? o Look at the results file for the error. (Icon at bottom on left). Click on the line with the error label and it expands to give details. This is a very common error when transferring models from one computer to another or moving it to

Instructions for TRNSYS 16 Exercises

Chris Bales, 2007-01-05

different parts of the computer. You have to look in all the components that read or write files to find the error and correct it. Making the drawing easier to understand This drawing was made in an older version of Studio (IIisbat), where there were limited features for making drawings easy to understand. Here are some hints. You can move the position of the connections in a user-defined or default positions (always 90 angles). To switch between these modes you click on the connection and turn user-defined path on and off. You can move the path by first marking the connection and then dragging one of the markers at the corners. You can send components to different layers by clicking the component with the right mouse button and choosing send to layer. You can change which views are shown using the menu choice view / show layers. Play with this to see how it works. It is good to have all the outputs on one layer, controllers on another and so on. Change the appearance of the line by clicking it with the right mouse button and choosing properties. You can connect to a component at one of 8 different positions just drag the connection point to one of the other possible ones that will be shown while you drag. It is good to have a given style for different kinds of information. This makes it easier to follow see example sdhw. This style is best to define when you start using TRNSYS and then follow it all the time. o Calculation data between active components (eg temperature, flow between collector and tank) o control signals o between sensor and controller o connections to outputs (printers, online etc.) Note the use of the macro facility for the pump loads. Read the manual for Studio (online) to find out how macros work, and have a play with them. Add an extra online to check more how it works. Check also the use of equation definitions for pipe diameter and length as well as other parameters.

Input Data

Exercise to study the performance of a single component.


Exercise: Create your own model to study input components

In this exercise you will create a system model with only a data reader, a time dependent forcing function and an online component. Create a data file for one day with two columns: time (whole hours) and some profile you choose and place it in your work folder. You can do this either by typing straight into a text file or by creating it in excel and then saving it as a text file.

Instructions for TRNSYS 16 Exercises

Chris Bales, 2007-01-05

Create a new project in Studio and save it in the work folder with a suitable name. The name of the deck is in the control cards. The default is ***.dck and this will then create a deck file with the same name as the Studio project. Add a data reader (free format, generic) and an online component to your project. Edit the data reader so that it can read the data file (check using the edit button in the external files window). Connect the data reader to the online component to check that it does what you think it should do. What happens at the start of the simulation? Note that the online component draws a line between two values and that this can be misleading sometimes when the changes are really a step function. Look at the actual values for the variables and time by holding the shift key down when you move the cursor. Add a forcing function (draw off) and create the same profile in the forcing function. Connect it to the online component for both the average and instantaneous values. Compare the outputs from the two components. See what happens when you change the time step to less than one hour. How does the interpolation in the data reader function, and what is the difference between the average and instantaneous values for the forcing function.


Exercises: SDHW example

As for all others, check the manual and the Studio drawing to understand how the system works. Make a copy of the original before working on this. Datafile instead of Forcing Function Make a plot of the load defined in the forcing function. Create a datafile with 24 values in it, one on each row, with the same values as for each hour given in the forcing function. Create a data reader to read this file (unformatted reading with only 1 output) and replace the forcing function with this. Do you get the same results? What happens when you use a time step less than one hour and choose interpolation of the input data? (Connect an online to the data reader to see this).

Non-Standard Components

Choose a non-standard component from the TESS library and find out how it works. To start with read the documentation available and what it has for parameters, inputs and outputs. Then make a new project with it and connect to it a number of forcing functions so that you can test it under different input conditions to find out how it works in practice. You will need to connect online component and/or printers for this. See cooling tower project as an example.


Fault Finding
Exercise: Energy Balance in example 3 Copy example three to your work area and open the Studio project. Why does it not work?

Instructions for TRNSYS 16 Exercises

Chris Bales, 2007-01-05

o Look at the results file for the error. (Icon at bottom on left). Click on the line with the error label and it expands to give details. This is a very common error when transferring models from one computer to another or moving it to different parts of the computer. You have to look in all the components that read or write files to find the error and correct it. Check out where the inputs to the summary printer come from ie, what outputs from what components. Note that the change in internal energy for the tank comes directly and not via the integrator. Why? Run the simulation. Open the file from the summary printer. Can you make an energy balance for the tank and for the house? Look at the description of the outputs and the description of the model in the Studio proforma. Look also in the mathematical description of the TRNSYS components of Type 4 and Type 12. Add extra columns in the printer and in the integrator and connect them to the relevant outputs from the tank and house model in order to able to make an energy balance. Resimulate and make an energy balance. Change the tolerances for the convergence and re-simulate. Make a plot of the percentage energy balance error (calculated as a percentage of the energy input to the component) against the convergence tolerance. Why is this error larger than the convergence tolerance? Use the range 0.0001 to 0.01 for the tolerance. Simulation time as function of convergence tolerance for simple system


Copy the SDHW example from the TRNSYS 16 examples area to your work area. Check what is connected to the Totals printer and how the data are calculated. Add extra outputs to this printer so that you can do an energy balance for the storage tank. Change the tolerances for the convergence and re-simulate. Make a plot of the percentage energy balance error (calculated as a percentage of the energy input to the component) against the convergence tolerance. Make a plot of the simulation time against the tolerance as well. Use the range 0.0001 to 0.01 for the tolerance. If you do anything on the computer during the simulation, this may affect the simulation time. If you shut off the online plotters, then you will speed up the simulation time.

Instructions for TRNSYS 16 Exercises

Chris Bales, 2007-01-05


Multizone Building Model & Prebid

Exercises: Sunspace example

First copy the whole folder from the TRNSYS 16 folder (examples) to your work folder. Follow the instructions in the getting started manual (section 1.4.2). 6.2 Exercise: Create new building project with wizard

Follow the instructions in the getting started manual (section 1.6). See also instructions in the Studio manual they are similar. Try all the features available in the wizard in turn and find out how they work (ie make several different projects, each with a separate feature available in the wizard). Connect up online components to check how the simulation performs so that you understand the results. Check also in the Studio version what components have been used in order to make this possible.

Instructions for TRNSYS 16 Exercises

Chris Bales, 2007-01-05


Solar Radiation


le ct or

Storage Tank

Figure EX3.1: A Solar House Heating System This system examines the performance of a solar house-heating system in Boulder, CO for a week in January. The system consists of a flat plate solar collector, storage tank and the heat load. The load is met by two separate systems, solar and auxiliary, and is modeled in the energy/degree-day fashion originated by ASHRAE. The following information is known for the system Fluid - Water (Cp = 4.19 kJ/kg- C) Starting day of simulation - 8th day of year (January 8) Latitude - 40 N Hourly solar radiation and ambient temperature values are available in a data file for the week of January 8 - January 14. Collector Area Ac = 50m2 Flow rate per unit area at test conditions Intercept efficiency Negative of the slope of the efficiency curve Negative of the curvature of the efficiency curve Incidence angle modifier constant Linear incidence angle modifier Storage Tank Storage tank volume Fluid density Tank loss coefficient Height Ambient temperature around tank


Gtest = 50 kg/hr-m2 FR()n = 0.7 FRUL = 15 kJ/hr-m2-C FRUL/T = 0 kJ/hr-m2-C2 bo = 0.1 b1 = 0.0

V = 3.00 m3 = 1000 kg/m3 U = 1.5 kJ/hr-m2-C H = 2.5 m Tenv = 21C

Chris Bales, 2007-01-05

Instructions for TRNSYS 16 Exercises

No internal heating elements or gas flue Load and Auxiliary (degree-day house) Overall conductance for heat loss from house Fixed room temperature Flow rate of heat exchanger source fluid Heat exchanger effectiveness Minimum capacitance rate of load heat exchanger

UA = 1200 kJ/hr-C TR = 21C m = 200 kg/hr = 0.4 Cmin = 5000 kJ/hr-C

Components must now be chosen for the simulation. A TYPE 1 MODE 1 collector, pump (TYPE 3), pump controller (TYPE 2), segmented storage tank (TYPE 4) and energy/degree-day house plus auxiliary (TYPE 12) are obvious choices in this simulation. Solar data and ambient temperature are to be read in from cards so a data reader (TYPE 9) will be needed. A solar radiation processor (TYPE 16) will also be needed to convert the solar data into the forms required by the collector (Io, IH and IT). Integrated quantities of the load, auxiliary energy and useful gain necessitate the use of a quantity integrator (TYPE 24). Finally, two printers (TYPE 25) will be needed to output desired information in the form of output and plot files. Summary of Components a) TYPE 3 Pump controller b) TYPE 2 Pump c) TYPE 1 Flat-plate collector d) TYPE 4 Segmented storage tank e) TYPE 12 Energy/(degree-hour) load f) TYPE 9 Data reader g) TYPE 16 Solar radiation processor h) TYPE 24 Quantity integrator i) TYPE 25 Printer The system information flow diagram (Figure EX3.2) can be drawn using the component models. Unit numbers can then be assigned to each of the components. A one segment tank is to be used and the initial temperature (DERIVATIVES) is set at 40 C. Tank storage losses are used to meet part of the heating load. The simulation will last seven days (168 hours), a 1/4 hour time step will be used and error tolerances of 0.01, 0.01 (defaults). The result of the TRNSYS simulation is presented on the following pages. Comment on Output The following information is printed at daily intervals during the simulation. QU - useful gain of collector
Instructions for TRNSYS 16 Exercises


Chris Bales, 2007-01-05


change in internal energy of the tank (final-initial) losses from storage tank total heating energy supplied to the load portion of QLOAD supplied by auxiliary.

With these energy quantities it is possible to write an energy balance on the system: QIN = ESTORED + QOUT which is QU + QAUX = DELTU + QENV + QLOAD
0.7 40 0


1 2 3 4 5 6 UNIT 10 TYPE 16 SOLAR RADIATION PROCESSOR 45 6 9 10



1 2 3 UNIT 12 TYPE 3 PUMP 1 2

12 34 56 78 910 UNIT 3 TYPE 1 COLLECTOR 1 2 3

1 2 3 4 UNIT 4 TYPE 12 DEGREE-DAY HOUSE 1234 6

21 0 0 1 23 4 5 6 7 UNIT 5 TYPE 4 STORAGE TANK 1 23 4 5 7 12 1 2 3 4 UNIT 6 TYPE 24 QUANTITY INTEGRATOR 12 3 4 123 45 UNIT 7 TYPE 25 PRINTER

1 2 3 4 UNIT 8 TYPE 25 PRINTER

Figure EX3.2: Information Flow Diagram for Example 3

If this energy balance does not close it means there is an integration error (too large a time step or too large error tolerances) or a programming error. It is strongly recommended the user always make an energy balance on his or her system to check for closure. In this example: QU + QAUX = 1.675 x 106 + 3.248 x 106 = 4.923 x 106

Instructions for TRNSYS 16 Exercises


Chris Bales, 2007-01-05

DELTU + QENV + QLOAD = -2.689 x 104 + 2.397 x 104 + 4.875 x 106 = 4.872 x 106 LACK OF CLOSURE = 5.1 x 104 %LACK OF CLOSURE = 1.03 % Because a lack of closure greater than 1% is considered to high for this example, the example was solved again using algebraic and differential equation tolerances of 0.0001 and a new energy balance and closure were computed (EX3A). QU + QAUX = 1.658 x 106 + 3.227 x 106 = 4.885 x 106 DELTU + QENV + QLOAD = -1.374 x 104 + 2.492 x 104 + 4.874 x 106 = 4.88518 x 106 LACK OF CLOSURE = 180 %LACK OF CLOSURE = .0037 %

Instructions for TRNSYS 16 Exercises


Chris Bales, 2007-01-05