# Simulation and Optimization of HVAC Systems A Project Report for the Research Experience fo.pdf

Simulation and Optimization of HVAC SystemsA Project Report for theResearch Experience for Undergraduate Programin Industrial Mathematics and Statisticsat theWorcester Polytechnic InstitutebyAne Coughlin, George D. Ellington, Ellen Phifer, of the packages studied, it was the easiest to startusing quickly.We obtained and analyzed TMY (Typical Meteorological Year) data for Hartford,Connecticut. The data, speci cally dry bulb temperature and dew point, were ap-proximated using the discrete Fourier transform. We selected the frequencies withthe dominant amplitudes to form a sum of cosines with the selected frequencies. Wethen used the function as input for our VisSim model.With a working model, we began to study optimization methods for setting controlparameters in the models. We developed a basic objective function based on a comfortzone and the power consumption of a single fan, pump, and chiller. Using thisobjective function, we tested di erent optimization algorithms, such as the Fletcher-Reeves, Powell, and Polak-Ribiere methods.We explored two approximation methods in the hope of optimization methods:one based on Fourier Analysis and the second based on Dynamic Programming.11 IntroductionThree facts point out the importance of modeling and optimizing HVAC systems: 30-50% of the cost of the construction of oce buildings is in the installationof the HVAC system 30-40% of the national total annual energy consumption is accounted for byoce buildings 90% of one s life is spent in buildingsTo achieve our utilmate goal of minimizing the cost of running a simple HVACsystem for one year, we began by examining various simulation packages. Thesepackages were used to create a simple model to increase our understanding of thephysics and mathematics behind HVAC systems.22 Evaluation of Simulation PackagesOne of the initial goals of the project was to compare simulation packages. Thepackages that we considered were Spark, VisSim, and Transys. These packageswere examined for their applications in simulating an HVAC system.Spark is an equation solver that is driven by a C++ compiler. The coding forSpark is an object-oriented approach. There is a special library in Spark for HVACsystems. This library has classes for the di erent components of an HVAC modelsuch as a chiller, fan, coil, tower, and room. A class is a general template of theequations for a component. The variable de nitions and equations are given in thetemplate. To use a class, an object is declared and the input variables of the objectare de ned. An object is the particular occurrence of the structure that the classde nes. In the HVAC library, an object is a speci c component of the model. Amodel can be created in Spark by linking the input and output variables of di erentobjects. Changing the class de nition can modify the equations for a model.Spark isn t as user friendly as VisSim since running simulations in Spark re-quires the user to write and compile code similar to C++. This is not necessarilya bad feature. It allows more access to the underlying code of the package. It ispossible to have more direct control over the simulation package.TranSys su ers from the same problems as Spark, except that it requires theuser to write and compile Fortran code. This is not necessarily a bad feature, and infact a lot of our understanding of the basic mathematical models comes from studyingthe Transys code. It has also the same advantages as Spark, allowing more accessto the underlying code and hence better chance for trouble-shooting.It is easy to start using VisSim very quickly. VisSim has a windows interfacethat allows the user to build a simulation without complex coding. The package3creates a simulation with blocks. These blocks represent the various components of asimulation such as variables, operations, and output displays. Since there is a largequantity of graphical displays, VisSim simulations are slow. There is a way to speedVisSim up by writing code in other faster languages and link that code to VisSim.These les of executable code are called dynamic linked libraries or DLLs. This isan essential part of using VisSim to run simulations. One disadvantage to VisSim isthat direct access to the code that drives the package isn t permitted. This can resultin problems while debugging simulations.In comparison, VisSim is more user friendly than Spark during the initial stagesof creating a model. VisSim is also more of a black box approach to simulation.Spark allows more direct control over the code behind the simulation than VisSimpermits.43 Simple Room Model for an HVAC SystemTo gain an understanding of HVAC systems and the physics and math which governthem, we built our own simple model. In our model we had a simple fan, a room, asplitter, a mixer and a coilroom.3.1 FanThe equations governing the mechanics of the simple fan which we used are:V = rpm?PtotalA_Vrpm = constant_mout=_Vspeci c volumePfan= 0WhereV is the rate of change of volume ow of the air, rpm is the set rotations perminute of the fan, Ptotalis the total pressure across the system, A is a conversionconstant,_V is the volume ow of the air, _m is the mass ow of the air, and P isthe pressure drop across the fan.Inputs to the fan are the airvector and a pressure feedback. The pressure feedbackis used to determine the pressure created by the fan. In this model we assumed thatthe pressure created by the fan is equal to the sum of all of the pressure drops in thesystem. (This is a pretty safe assumption.) The air vector dictates the mass ow ofthe air into the fan. The mass ow is then used to calculate the volume ow whichis integral in the determination of the rpm setting.Equation (1) is an ODE which is describes the volume ow of the air. In this ODEwe included a fan map. The fan map (in this case a linear map), outputs the exactrpms at which the fan is running. It is realistic that the fan would not instantaneously5reach the set rpm. It takes a small amount of time for the fan to actually reach thecorrect speed and this map is what dictates the speed at which is it actually running.The map takes in the pressure and the rate of volume ow and from those determinethe actually running speed of the fan.3.2 RoomThe room which we chose to model only dealt with enthalpy and mass ow. Wedid not consider humidity or other air qualities in this simple model. The governingequations are:_Qroom;other= C(hother?hroom)_Qroom;out= _mroomhroom_Qroom;in= _mroomhroom;in_Qroom;absorb=_Qroom;in+_Qroom;other?_Qroom;out_hroom= D_Qroom;absorbP = Rroom_mroomProom;in= P + sum of P sWhere_Qroom;otheris the heat ow due to conduction from outside, hotherandhroomare the enthalpy outside and in the room respectively,_Qroom;out;_Qroom;inand_Qroom;absorbare the heat ows out of the room, into the room and the heat owabsorbed in the room by people, machines, etc. P is the pressure drop across theroom and Proom;inis the input pressure in the room.In this room, there is a heat load which accounts for the conduction e ects fromthe outside walls. For example, when it is warmer outside than it is is inside, the6room is going to heat up due to the fact that the walls conduct heat. Just as in thewinter, the room will lose heat to the outside through the walls. In the room, theinput pressure is calculated by taking the pressure drop across the room and addingthat to the sum of the remaining pressure drops in the system. The pressure dropacross the room is equal to the mass ow of the room times the resistance of theroom.As in every component of our system, there is a balance equation which governsthe heat ow in and out of the room. Here the equation says that the heat ow whichis absorbed into the room (by people, machines, etc.) is equal to the heat ow intothe room plus the heat ow from outside, minus the heat ow out of the room.3.3 SplitterThe splitter is where a determined amount of mass ow is directed outside and the restis recycled through the building. The splitter is governed by the following equations:_msplitter;out= _msplitter;in? _mto outside_mto outside= Ehin= hout= hto outsidewhere the last equality holds because there is no pressure change (sum of P s ispassed). In the above set of equations, _msplitter;out, _msplitter;in, and _msplitter;to outsidearethe mass ows out of the splitter (recycled air), into the splitter and vented outside.hin; houtand htooutsideare the enthalpy into the room, out of the room and to theoutside.One main idea in trying to ultimately optimize this system is to be able to usethe splitter wisely and recycle as much air as possible to cut down on costs. In this7very naive splitter model, the amount of air directed outside is set with a control andthe amount recycled is the di erence between the input mass ow and the mass owto outside.We also assumed, for simplicity, that there is no enthalpy change or pressure dropwithin the splitter.3.4 MixerThe mixer is the component in which air is drawn from outside and mixed with theair being recycled. The equations which govern the mechanics of the mixer are asfollows:_Qin;1= _min;1hin;1_Qoutside= _moutsidehoutside_mmix;out= _min;1+ _moutside_Qmix;out= _mmix;outhmix_Qmix;absorb=_Qin;1+_Qoutside?_Qmix;out_hmix= F_Qmix;absorbPmixer= Rmixer_mmix;outPmixer;in= Pmixer+ sum of P sWhere_Qin;1; _min;1and hin;1are the heat ow, mass ow and enthalpy for therecycled air,_Qoutside; _moutsideand houtsideare the heat ow, mass ow and enthalpyof the air from outside and_Qmix;out; _mmix;outand hmix;outare the heat ow, mass owand enthalpy exiting the mixer.The mass ow which is drawn from outside is equal to the amount directed outsidein the splitter. This is to ensure that we do not implode or explode our system. In8this mixer we make the assumption that the mixing of air is complete and through(i.e. there is no strati cation of temperatures). Again we have a balance equationgoverning the heat ow through the mixer and we take into account a pressure dropacross the mixer.3.5 CoilroomThe coilroom is the component which is responsible for the cooling of the air._Qair;absorb=_Qcoilroom;in?_Qcoilroom;out?_Qairtowater_Qcoilroom;in= _mcoilroomhcoilroom;in_Qcoilroom;out= _mcoilroomhcoilroom_Qairtowater= G(hcoilroom?hwater)_hcoilroom= H_Qair;absorb_mwater= I_Qwater;out= _mwaterhwater_Qwater;in= _mwaterhwater;in_Qwater;absorb=_Qwater;in?_Qwater;out+_Qairtowater_hwater= J_Qwater;absorbhfreon= Khwater;in= LPcoilroom= Rcoilroom_mcoilroom9Pcoilroom;in= Pcoilroom+ sum of P sWhere_Qair;absorb;_Qcoilroom;in;_Qcoilroom;outand_Qairtowaterare the heat ows ab-sorbed by the air, into the coilroom, out of the coilroom and absorbed by the waterfrom the air, respectively.Air comes into the coilroom and passes over a coil which contains cold water.In addition to the coil and its balance equation (equation(23)), the coilroom alsocontains a mechanism which cools the water. This mechanism deals with freon andhas its own balance equation (equation(31)). For simplicity, we assumed that theenthalpy and mass ow of the water are set constants, as well as the enthalpy of thefreon. Again there is a pressure drop across the coilroom which contributes to thecalculation of the total system pressure.104 TMY Data AnalysisThe temperature data used by the VisSim simulation is information from Hartford,Connecticut. The TMY (Typical Meteorological Year) data was down-loaded from aninternetsite maintained bybythe Renewable ResourceData Center(http://rredc.nrel.gov/solar/pubs/tmy2/data.html). The data includes temperature, dew point, relative humid-ity and other meteorological data. A C program was written to extract the desirednumerical values from the long list of data that was included in the TMY le. Thedata was sampled at hourly intervals for the entire year (8760 hours), but used datafrom months of di erent years. To use this discrete data in the simulation wouldrequire 8760 temperature entries. To remedy this problem, the TMY data must besimpli ed.One way to simplify the analysis (and speed up the simulation) is to approximatethe TMY temperature data using a Fourier series. In other words, operate in thefrequency domain instead of the time domain. The simpli cation method used em-ploys the Fourier integral transform and spectral analysis of the data. The Fouriertransform for a function h(t) is de ned asH(f) =Z1?1h(t)e?i2ftdt:The Fourier transform changes the given function of time to a function of frequencies.A simple C program was used to calculate the discrete Fourier transform of the TMYtemperature data. The discrete Fourier transform is merely a numerical integrationof the continuous Fourier transform and is de ned asHnNT=N?1Xk=0h(kT)e?i2nkN;where i =p?1, N is the number of sampled data points, and T is the samplinginterval.11The C program produced an array of numbers that correspond to the frequenciesof cosine terms. Then the frequencies with the largest amplitudes were selected anda sum of cosines with the selected frequencies and their corresponding amplitudeswere used to approximate the TMY temperature data with fewer parameters. Thereasoning behind selecting the frequencies with the largest amplitudes is based uponthe assumption that terms with the greatest amplitudes account for most of thedynamics of the temperature function. The dominant frequencies that arose fromthe analysis of the Fourier transform conform to obvious cycles that run their coursewithin the year. The two most prominent cycles that arose were the yearly cycleand the daily cycle (i.e., the cosine term whose period is equal to one year or oneday, respectively). This seemed reasonable, because the temperature tends to havea typical daily and yearly cycle. Other prominent frequencies and other time cyclesalso existed, but most of these cycles did not seem as physically obvious as the twomost prominent cycles.The new sum approximated the TMY data to a reasonable degree of accuracy.However, to increase the degree of this accuracy, adjustments were made to the am-plitudes of each of the cosine terms and phase shifts were added to some of the terms.These amplitude adjustments and phase shifts were added to compensate for the am-plitudes and frequencies of the terms that were left out of the approximation. Thegraphs of the TMY temperature and relative humidity data are shown in Figures 1and 2.12-50510152025temperature2000 4000 6000 8000timeFigure 1: Fourier Temperature Approximation5 Comfort ZonezWhether you are in an oce building or at home, there is a particular range oftemperatures, pollutant levels, and relative humidities that are comfortable for livingand working. The combination of all three is referred to, in our model, as the comfortzone. We began with the simplest possible comfort zone: a cube with comfortabletemperatures ranging from 68 to 72oF, CO2levels ranging from 0 to 0:1%, andrelative humidity levels ranging from 40 to 60%. However, there is a correlationbetween temperature and relative humidity which was not portrayed in thi