ALGORITHMIC_MODEL Climate ABSTRACT "Process CLIMATE data from file; calc sun pos; send data to facade. Purpose: Climate model. The model receives data from a climate file; it calculates and delivers the following data: TAir Air temperature TSky Sky temperature TGround Temperature of ground HumAir Humidity ratio of air IDirNorm Direct normal radiation IDiffHor Diffuse radiation on a horizontal surface WindDir Direction of wind WindVel Velocity of wind ElevSun Elevation angle of sun AzimutSun Azimut angle of sun The integration time, which is in seconds, is used to calculate time of year, needed for calculation of sun's position. Integration time has to start at the beginning of a year. Standard clock time (w/o daylight saving) is used for integration time and is fetched by this model. Typically, a simulation will affect year 0, or possibly a few years from year 0 and onwards. The years 0-3 will be generic years, having 365 days. The ICE application (IDA Indoor Climate and Energy) specifies integration period in calendar format, to allow year dependent schedules. ICE uses Universal Time, i.e. integration time is measured from Jan 1st, 1900. ICE accepts years in the range 1901-2399 and handles leap years correctly in this period. Date: 25th February 1997 Made by: Jari Hyttinen Call: SATPRES HUMRAT Reference: Sun position calculation: Suvanen, M.,PhD Thesis: 'Passiivisten aurinkotalojen laskennallinen simulointi'. Helsinki University of Technology 1982. In Finnish. " /* ?? Limits: ? JH WindProf = correlation height definition chk Aussie papers: B, E, Omega modify daylite saving 980126 AB Min limit for atmospheric pressure 980121 AB Replace sawtooth event by sinusoidal 980114 AB Error if not calendar time 971110 AB Event at solar midnight 971023 AB Introduce Universal Time 971016 MV Defaults for CO2 970922 AB Correct for system Time in seconds. 970604 AB 10E5 -> 1E5 */ EQUATIONS /* Copy variables from IN to OUT link */ PAir2 := PAir; TAir2 := TAir; XAir2 := XAir; WindDir2 := WindDir; IDirNorm2 := IDirNorm; IDiffHor2 := IDiffHor; /* Calculate temperatures and humidity ratio */ /* Good approximation for sky temperature */ TSky := TAir - 5; /* Simple approximation for ground temperature */ TGround := TAir; /* Saturation pressure in TAir */ PSat := SATPRES(TAir); PVap := PSat * RelHum/100; HumAir := HUMRAT(PAir + 1E5, PVap); /* Calulate on-site wind velocity from measured velocity */ WindVel := WindVelRef * a0_coeff * (Height/HeightRef)**a_exp; /* ***************** Common w SYNTHET.NMF ******************** */ /* CALCULATE SUN POSITION */ /* Transform from time in Universal Time to hours within year */ /* Calculate day number and hour, starting from January 1st */ /* Remove four year periods, after the non leap year 1900; then remove full 365 day years. The last day in a leap year will wrap around to the 1st. */ Seconds := Time; DayFrom1901 := Seconds/24/3600 - 365; If DayFrom1901 < 0 THEN /* year 0 */ DayInYear := DayFrom1901 + 365; ELSE /* year 1.., calulate leap year; can be Universal Time for ICE */ DayInFourYears := DayFrom1901 - Int(DayFrom1901/1461) * 1461; DayInYear := DayInFourYears - Int(DayInFourYears/365) * 365; END_IF; IF DayInYear < 0 OR DayInYear > 365 THEN CALL nmf_error ("Integration time must be non-negative"); END_IF; TimeHr := DayInYear * 24; DayNr := INT (DayInYear) + 1; Hour := TimeHr - 24*(DayNr-1); /* Help variables to calculate solar time */ Declination := 23.45*deg2rad * SIN(2*PI * (284+DayNr)/365); B := 2*PI * (DayNr-81)/364; E := 9.87*SIN(2*B) - 7.53*COS(B) - 1.5*SIN(B); SolTime := Hour + 4*(LongTimezone - Long)/60 + E/60; /* Check if SolTime is <0 or >24 */ SolarTime := IF (SolTime < 0) THEN SolTime + 24; ELSE_IF (SolTime > 24) THEN SolTime - 24; ELSE SolTime END_IF; /* Calculate hour angle from south, positive westward */ Omega := (SolarTime-12)*15*deg2rad; /* Elevation angle of Sun */ /* ASHRAE Fundamentals Chapter 27 */ SinElevSun := COS(Lat*deg2rad)*COS(Declination)*COS(Omega) + SIN(Lat*deg2rad)*SIN(Declination); ElevSun := ASIN(SinElevSun)*rad2deg; /* Azimuth angle of Sun, counted positive westward from South. It will thus be negative if solar time is less than 12. Cf ASHRAE Fundamentals Chapter 27 */ CosAzimSun := (SinElevSun*SIN(Lat*deg2rad) - SIN(Declination)) /(COS(ElevSun*deg2rad)*COS(Lat*deg2rad)); AzimutSun := IF CosAzimSun < -1 THEN 180 ELSE_IF CosAzimSun > 1 THEN 0 ELSE_IF (SolarTime < 12) THEN (-ACOS(CosAzimSun)*rad2deg) ELSE ACOS(CosAzimSun)*rad2deg END_IF; /* ************** End of common w SYNTHET.NMF ***************** */ /* Create event at solar midnight */ /* dummy1 := eventn (dummy2, SolarTime - OldSolarTime); OldSolarTime := SolarTime; */ dummy1 := eventn (dummy2, ( SolarTime - 12) * min (SolarTime, 24 - SolarTime)); LINKS /* type name variables .... */ /* Input data, from file or equivalent */ ClimData DataIn PAir, TAir, XAir, RelHum, WindDir, WindVelRef, IDirNorm, IDiffHor; /* Output data */ Clim2Face DataOut PAir2, TAir2, XAir2, HumAir, TGround, TSky, WindDir2, WindVel, IDirNorm2, IDiffHor2, ElevSun, AzimutSun; VARIABLES /* type name role def min max description*/ Pressure PAir IN 1325 -50000 BIG "(Atmospheric press)-1E5" Temp TAir IN 20 ABS_ZERO BIG "Temperature of air" Fraction_y XAir IN 594 0 BIG "CO2 fraction" Factor RelHum IN 50 0 100 "Rel humidity of air" Angle WindDir IN 0 0 360 "Direction of wind" Vel WindVelRef IN 1 0 BIG "Speed of meteorological wind" RadA IDirNorm IN 0 0 BIG "Direct normal rad" RadA IDiffHor IN 0 0 BIG "Diffuse rad on hor surf" Pressure PAir2 OUT 1325 SMALL BIG "Atmospheric pressure" Temp TAir2 OUT 20 ABS_ZERO BIG "Temperature of air" Fraction_y XAir2 OUT 594 0 BIG "CO2 fraction" HumRatio HumAir OUT 0.073 0 BIG "Humidity ratio of air" Temp TGround OUT 20 ABS_ZERO BIG "Temperature of ground" Temp TSky OUT 15 ABS_ZERO BIG "Temperature of sky" Angle WindDir2 OUT 0 0 360 "Direction of wind" Vel WindVel OUT 1 0 BIG "Speed of on-site wind" RadA IDirNorm2 OUT 0 0 BIG "Direct normal rad" RadA IDiffHor2 OUT 0 0 BIG "Diffuse rad on hor surf" Angle ElevSun OUT 27.0 -90 90 "Elevation angle of sun" Angle AzimutSun OUT 26.05 -180 180 "Azimut angle of sun" Pressure PSat LOC 2365 SMALL BIG "Saturation pressure of water vapor" Pressure PVap LOC 1182 SMALL BIG "Partial pressure of water vapor" Generic DayNr LOC 80 1 366 "Whole day number in year, 1 = January 1st" Generic DayInYear LOC 80 1 366 "Broken day nr in year, 0 = January 1st" Generic DayInFourYears LOC 80 1 366 "Broken day nr in four year leap period, 0 = January 1st" Generic DayFrom1901 LOC 80 1 366 "Broken day nr from 1901-01-01, 0-.." Generic Hour LOC 14 0 24 "Hour number in day, std clock time" Generic Seconds LOC 86400 0 BIG "Time from 1900-01-01" Generic TimeHr LOC 0 -BIG BIG "Integration time [hr]" AngleR Declination LOC -0.007 SMALL BIG "Declination angle" Angle B LOC -0.017 -BIG BIG "Help var for solar time" Angle E LOC -7.84 -BIG BIG "Help var for solar time" AngleR Omega LOC 0.402 -BIG BIG "Hour angle from south, 15 deg/hour" Hour SolTime LOC 13.54 0 24 "Help var for solar time" Hour SolarTime LOC 13.54 0 24 "Local solar time" /* Hour OldSolarTime A_S 13.54 0 24 "Previous solar time" */ Hour Dummy1 LOC 13.54 -24 24 "Dummy for event" Hour Dummy2 A_S 13.54 -24 24 "Dummy for event" Factor SinElevSun LOC 0.454 -1 1 "Help var, SIN(ElevSun)" Factor CosAzimSun LOC 0.898 -1 1 "Help var, COS(AzimutSun)" PARAMETERS /* type name role def min max description*/ Angle Lat S_P 60 -90 90 "Local latitude" Angle Long S_P -25 -180 180 "Local longitude" Angle LongTimezone S_P -30 -180 180 "Time zone longitude" Factor HeightRef S_P 10 0 BIG "Height of meteorological wind measurements" Factor Height S_P 6 0 BIG "Height of building" Factor a_exp S_P 0.1 SMALL BIG "Wind profile exponent" Factor a0_coeff S_P 1 SMALL BIG "Wind profile coefficient" Factor deg2rad C_P 0.0175 SMALL BIG "Conversion factor Deg to Rad" Factor rad2deg C_P 57.296 SMALL BIG "Conversion factor Rad to Deg" PARAMETER_PROCESSING /* Conversion factor from Deg to Rad and vice-versa */ deg2rad := PI/180.0; rad2deg := 180.0/PI; END_MODEL