IEA EBC Annex 60 EBC logo

Annex60.BoundaryConditions.WeatherData

Weather data reader

Information

This package contains models to read weather data. It also contains the expandable connector Annex60.BoundaryConditions.WeatherData.Bus that is used in the library to provide weather data to the different models.

Extends from Modelica.Icons.VariantsPackage (Icon for package containing variants).

Package Content

Name Description
Annex60.BoundaryConditions.WeatherData.Bus Bus Data bus that stores weather data
Annex60.BoundaryConditions.WeatherData.ReaderTMY3 ReaderTMY3 Reader for TMY3 weather data
Annex60.BoundaryConditions.WeatherData.Examples Examples Collection of models that illustrate model use and test models
Annex60.BoundaryConditions.WeatherData.Validation Validation Collection of validation models
Annex60.BoundaryConditions.WeatherData.BaseClasses BaseClasses Package with base classes for Annex60.BoundaryConditions.WeatherData

Annex60.BoundaryConditions.WeatherData.Bus Annex60.BoundaryConditions.WeatherData.Bus

Data bus that stores weather data

Annex60.BoundaryConditions.WeatherData.Bus

Information

This component is an expandable connector that is used to implement a bus that contains the weather data.

Extends from Modelica.Icons.SignalBus (Icon for signal bus).

Modelica definition

expandable connector Bus "Data bus that stores weather data" extends Modelica.Icons.SignalBus; end Bus;

Annex60.BoundaryConditions.WeatherData.ReaderTMY3 Annex60.BoundaryConditions.WeatherData.ReaderTMY3

Reader for TMY3 weather data

Annex60.BoundaryConditions.WeatherData.ReaderTMY3

Information

This component reads TMY3 weather data (Wilcox and Marion, 2008) or user specified weather data. The weather data format is the Typical Meteorological Year (TMY3) as obtained from the EnergyPlus web site at http://energyplus.net/weather. These data, which are in the EnergyPlus format, need to be converted as described in the next paragraph.

Output to weaBus

The following variables serve as output and are accessible via weaBus:

Name Unit Description
HDifHor W/m2 Horizontal diffuse solar radiation.
HDifNor W/m2 Direct normal radiation.
HGloHor W/m2 Horizontal global radiation.
HHorIR W/m2 Horizontal infrared irradiation.
TBlaSky K Output temperature.
TDewPoi K Dew point temperature.
TDryBul K Dry bulb temperature at ground level.
TWetBul K Wet bulb temperature.
celHei m Ceiling height.
cloTim s One-based day number in seconds.
lat rad Latitude of the location.
lon rad Longitude of the location.
nOpa 1 Opaque sky cover [0, 1].
nTot 1 Total sky Cover [0, 1].
pAtm Pa Atmospheric pressure.
relHum 1 Relative humidity.
solAlt rad Altitude angle.
solDec rad Declination angle.
solHouAng rad Solar hour angle.
solTim s Solar time.
solZen rad Zenith angle.
winDir rad Wind direction.
winSpe m/s Wind speed.

Adding new weather data

To add new weather data, proceed as follows:

  1. Download the weather data file with the epw extension from http://energyplus.net/weather.
  2. Add the file to Annex60/Resources/weatherdata (or to any directory for which you have write permission).
  3. On a console window, type
      cd Annex60/Resources/weatherdata
      java -jar ../bin/ConvertWeatherData.jar inputFile.epw
    
    This will generate the weather data file inputFile.mos, which can be read by the model Annex60.BoundaryConditions.WeatherData.ReaderTMY3.

Location data that are read automatically from the weather data file

The following location data are automatically read from the weather file:

Wet bulb temperature

By default, the data bus contains the wet bulb temperature. This introduces a nonlinear equation. However, we have not observed an increase in computing time because of this equation. To disable the computation of the wet bulb temperature, set computeWetBulbTemperature=false.

Using constant or user-defined input signals for weather data

This model has the option of using a constant value, using the data from the weather file, or using data from an input connector for the following variables:

By default, all data are obtained from the weather data file, except for the atmospheric pressure, which is set to the parameter pAtm=101325 Pascals.

The parameter *Sou configures the source of the data. For the atmospheric pressure, temperatures, relative humidity, wind speed and wind direction, the enumeration Annex60.BoundaryConditions.Types.DataSource is used as follows:

Parameter *Sou Data used to compute weather data.
File Use data from file.
Parameter Use value specified by the parameter.
Input Use value from the input connector.

Because global, diffuse and direct radiation are related to each other, the parameter HSou is treated differently. It is set to a value of the enumeration Annex60.BoundaryConditions.Types.RadiationDataSource, and allows the following configurations:

Parameter HSou Data used to compute weather data.
File Use data from file.
Input_HGloHor_HDifHor Use global horizontal and diffuse horizontal radiation from input connector.
Input_HDirNor_HDifHor Use direct normal and diffuse horizontal radiation from input connector.
Input_HDirNor_HGloHor Use direct normal and global horizontal radiation from input connector.

Notes

  1. In HVAC systems, when the fan is off, changes in atmospheric pressure can cause small air flow rates in the duct system due to change in pressure and hence in the mass of air that is stored in air volumes (such as in fluid junctions or in the room model). This may increase computing time. Therefore, the default value for the atmospheric pressure is set to a constant. Furthermore, if the initial pressure of air volumes are different from the atmospheric pressure, then fast pressure transients can happen in the first few seconds of the simulation. This can cause numerical problems for the solver. To avoid this problem, set the atmospheric pressure to the same value as the medium default pressure, which is typically set to the parameter Medium.p_default. For medium models for moist air and dry air, the default is Medium.p_default=101325 Pascals.

  2. Different units apply depending on whether data are obtained from a file, or from a parameter or an input connector:

  3. The ReaderTMY3 should only be used with TMY3 data. It contains a time shift for solar radiation data that is explained below. This time shift needs to be removed if the user may want to use the ReaderTMY3 for other weather data types.

Implementation

Start and end data for annual weather data files

The TMY3 weather data, as well as the EnergyPlus weather data, start at 1:00 AM on January 1, and provide hourly data until midnight on December 31. Thus, the first entry for temperatures, humidity, wind speed etc. are values at 1:00 AM and not at midnight. Furthermore, the TMY3 weather data files can have values at midnight of December 31 that may be significantly different from the values at 1:00 AM on January 1. Since annual simulations require weather data that start at 0:00 on January 1, data need to be provided for this hour. Due to the possibly large change in weatherdata between 1:00 AM on January 1 and midnight at December 31, the weather data files in the Annex60 library do not use the data entry from midnight at December 31 as the value for t=0. Rather, the value from 1:00 AM on January 1 is duplicated and used for 0:00 on January 1. To maintain a data record with 8760 hours, the weather data record from midnight at December 31 is deleted. These changes in the weather data file are done in the Java program that converts EnergyPlus weather data file to Modelica weather data files, and which is described below.

Time shift for solar radiation data

To read weather data from the TMY3 weather data file, there are two data readers in this model. One data reader obtains all data except solar radiation, and the other data reader reads only the solar radiation data, shifted by 30 minutes. The reason for this time shift is as follows: The TMY3 weather data file contains for solar radiation the "...radiation received on a horizontal surface during the 60-minute period ending at the timestamp." Thus, as the figure below shows, a more accurate interpolation is obtained if time is shifted by 30 minutes prior to reading the weather data.

image

References

Parameters

TypeNameDefaultDescription
BooleancomputeWetBulbTemperaturetrueIf true, then this model computes the wet bulb temperature
StringfilNam""Name of weather data file
Data source
DataSourcepAtmSouAnnex60.BoundaryConditions.T...Atmospheric pressure
PressurepAtm101325Atmospheric pressure (used if pAtmSou=Parameter) [Pa]
DataSourceceiHeiSouAnnex60.BoundaryConditions.T...Ceiling height
RealceiHei20000Ceiling height (used if ceiHei=Parameter) [m]
DataSourcetotSkyCovSouAnnex60.BoundaryConditions.T...Total sky cover
RealtotSkyCov0.5Total sky cover (used if totSkyCov=Parameter). Use 0 <= totSkyCov <= 1 [1]
DataSourceopaSkyCovSouAnnex60.BoundaryConditions.T...Opaque sky cover
RealopaSkyCov0.5Opaque sky cover (used if opaSkyCov=Parameter). Use 0 <= opaSkyCov <= 1 [1]
DataSourceTDryBulSouAnnex60.BoundaryConditions.T...Dry bulb temperature
TemperatureTDryBul293.15Dry bulb temperature (used if TDryBul=Parameter) [K]
DataSourceTDewPoiSouAnnex60.BoundaryConditions.T...Dew point temperature
TemperatureTDewPoi283.15Dew point temperature (used if TDewPoi=Parameter) [K]
DataSourceTBlaSkySouAnnex60.BoundaryConditions.T...Black-body sky temperature
TemperatureTBlaSky273.15Black-body sky temperature (used if TBlaSkySou=Parameter) [K]
DataSourcerelHumSouAnnex60.BoundaryConditions.T...Relative humidity
RealrelHum0.5Relative humidity (used if relHum=Parameter) [1]
DataSourcewinSpeSouAnnex60.BoundaryConditions.T...Wind speed
VelocitywinSpe1Wind speed (used if winSpe=Parameter) [m/s]
DataSourcewinDirSouAnnex60.BoundaryConditions.T...Wind direction
AnglewinDir1.0Wind direction (used if winDir=Parameter) [rad]
DataSourceHInfHorSouAnnex60.BoundaryConditions.T...Infrared horizontal radiation
HeatFluxHInfHor0.0Infrared horizontal radiation (used if HInfHorSou=Parameter) [W/m2]
RadiationDataSourceHSouAnnex60.BoundaryConditions.T...Global, diffuse, and direct normal radiation
Sky temperature
SkyTemperatureCalculationcalTSkyAnnex60.BoundaryConditions.T...Computation of black-body sky temperature

Connectors

TypeNameDescription
input RealInputpAtm_inInput pressure [Pa]
input RealInputceiHei_inInput ceiling height [m]
input RealInputtotSkyCov_inInput total sky cover [1]
input RealInputopaSkyCov_inInput opaque sky cover [1]
input RealInputTDryBul_inInput dry bulb temperature [K]
input RealInputTDewPoi_inInput dew point temperature [K]
input RealInputTBlaSky_inBlack-body sky temperature [K]
input RealInputrelHum_inInput relative humidity [1]
input RealInputwinSpe_inInput wind speed [m/s]
input RealInputwinDir_inInput wind direction [rad]
input RealInputHInfHor_inInput infrared horizontal radiation [W/m2]
input RealInputHGloHor_inInput global horizontal radiation [W/m2]
input RealInputHDifHor_inInput diffuse horizontal radiation [W/m2]
input RealInputHDirNor_inInput direct normal radiation [W/m2]
BusweaBusWeather data bus

Modelica definition

block ReaderTMY3 "Reader for TMY3 weather data" parameter Boolean computeWetBulbTemperature = true "If true, then this model computes the wet bulb temperature"; //-------------------------------------------------------------- // Atmospheric pressure parameter Annex60.BoundaryConditions.Types.DataSource pAtmSou=Annex60.BoundaryConditions.Types.DataSource.Parameter "Atmospheric pressure"; parameter Modelica.SIunits.Pressure pAtm=101325 "Atmospheric pressure (used if pAtmSou=Parameter)"; Modelica.Blocks.Interfaces.RealInput pAtm_in( final quantity="Pressure", final unit="Pa", displayUnit="Pa") if (pAtmSou == Annex60.BoundaryConditions.Types.DataSource.Input) "Input pressure"; //-------------------------------------------------------------- // Ceiling height parameter Annex60.BoundaryConditions.Types.DataSource ceiHeiSou=Annex60.BoundaryConditions.Types.DataSource.File "Ceiling height"; parameter Real ceiHei( final quantity="Height", final unit="m", displayUnit="m") = 20000 "Ceiling height (used if ceiHei=Parameter)"; Modelica.Blocks.Interfaces.RealInput ceiHei_in( final quantity="Height", final unit="m", displayUnit="m") if (ceiHeiSou == Annex60.BoundaryConditions.Types.DataSource.Input) "Input ceiling height"; //-------------------------------------------------------------- // Total sky cover parameter Annex60.BoundaryConditions.Types.DataSource totSkyCovSou=Annex60.BoundaryConditions.Types.DataSource.File "Total sky cover"; parameter Real totSkyCov( min=0, max=1, unit="1") = 0.5 "Total sky cover (used if totSkyCov=Parameter). Use 0 <= totSkyCov <= 1"; Modelica.Blocks.Interfaces.RealInput totSkyCov_in( min=0, max=1, unit="1") if (totSkyCovSou == Annex60.BoundaryConditions.Types.DataSource.Input) "Input total sky cover"; // Opaque sky cover parameter Annex60.BoundaryConditions.Types.DataSource opaSkyCovSou=Annex60.BoundaryConditions.Types.DataSource.File "Opaque sky cover"; parameter Real opaSkyCov( min=0, max=1, unit="1") = 0.5 "Opaque sky cover (used if opaSkyCov=Parameter). Use 0 <= opaSkyCov <= 1"; Modelica.Blocks.Interfaces.RealInput opaSkyCov_in( min=0, max=1, unit="1") if (opaSkyCovSou == Annex60.BoundaryConditions.Types.DataSource.Input) "Input opaque sky cover"; //-------------------------------------------------------------- // Dry bulb temperature parameter Annex60.BoundaryConditions.Types.DataSource TDryBulSou=Annex60.BoundaryConditions.Types.DataSource.File "Dry bulb temperature"; parameter Modelica.SIunits.Temperature TDryBul(displayUnit="degC") = 293.15 "Dry bulb temperature (used if TDryBul=Parameter)"; Modelica.Blocks.Interfaces.RealInput TDryBul_in( final quantity="ThermodynamicTemperature", final unit="K", displayUnit="degC") if (TDryBulSou == Annex60.BoundaryConditions.Types.DataSource.Input) "Input dry bulb temperature"; //-------------------------------------------------------------- // Dew point temperature parameter Annex60.BoundaryConditions.Types.DataSource TDewPoiSou=Annex60.BoundaryConditions.Types.DataSource.File "Dew point temperature"; parameter Modelica.SIunits.Temperature TDewPoi(displayUnit="degC") = 283.15 "Dew point temperature (used if TDewPoi=Parameter)"; Modelica.Blocks.Interfaces.RealInput TDewPoi_in( final quantity="ThermodynamicTemperature", final unit="K", displayUnit="degC") if (TDewPoiSou == Annex60.BoundaryConditions.Types.DataSource.Input) "Input dew point temperature"; //-------------------------------------------------------------- // Black body sky temperature parameter Annex60.BoundaryConditions.Types.DataSource TBlaSkySou=Annex60.BoundaryConditions.Types.DataSource.File "Black-body sky temperature"; parameter Modelica.SIunits.Temperature TBlaSky=273.15 "Black-body sky temperature (used if TBlaSkySou=Parameter)"; Modelica.Blocks.Interfaces.RealInput TBlaSky_in( final quantity="ThermodynamicTemperature", displayUnit="degC", final unit="K") if (TBlaSkySou == Annex60.BoundaryConditions.Types.DataSource.Input) "Black-body sky temperature"; //-------------------------------------------------------------- // Relative humidity parameter Annex60.BoundaryConditions.Types.DataSource relHumSou=Annex60.BoundaryConditions.Types.DataSource.File "Relative humidity"; parameter Real relHum( min=0, max=1, unit="1") = 0.5 "Relative humidity (used if relHum=Parameter)"; Modelica.Blocks.Interfaces.RealInput relHum_in( min=0, max=1, unit="1") if (relHumSou == Annex60.BoundaryConditions.Types.DataSource.Input) "Input relative humidity"; //-------------------------------------------------------------- // Wind speed parameter Annex60.BoundaryConditions.Types.DataSource winSpeSou=Annex60.BoundaryConditions.Types.DataSource.File "Wind speed"; parameter Modelica.SIunits.Velocity winSpe(min=0) = 1 "Wind speed (used if winSpe=Parameter)"; Modelica.Blocks.Interfaces.RealInput winSpe_in( final quantity="Velocity", final unit="m/s", min=0) if (winSpeSou == Annex60.BoundaryConditions.Types.DataSource.Input) "Input wind speed"; //-------------------------------------------------------------- // Wind direction parameter Annex60.BoundaryConditions.Types.DataSource winDirSou=Annex60.BoundaryConditions.Types.DataSource.File "Wind direction"; parameter Modelica.SIunits.Angle winDir=1.0 "Wind direction (used if winDir=Parameter)"; Modelica.Blocks.Interfaces.RealInput winDir_in( final quantity="Angle", final unit="rad", displayUnit="deg") if (winDirSou == Annex60.BoundaryConditions.Types.DataSource.Input) "Input wind direction"; //-------------------------------------------------------------- // Infrared horizontal radiation parameter Annex60.BoundaryConditions.Types.DataSource HInfHorSou=Annex60.BoundaryConditions.Types.DataSource.File "Infrared horizontal radiation"; parameter Modelica.SIunits.HeatFlux HInfHor=0.0 "Infrared horizontal radiation (used if HInfHorSou=Parameter)"; Modelica.Blocks.Interfaces.RealInput HInfHor_in( final quantity="RadiantEnergyFluenceRate", final unit="W/m2") if (HInfHorSou == Annex60.BoundaryConditions.Types.DataSource.Input) "Input infrared horizontal radiation"; parameter Annex60.BoundaryConditions.Types.RadiationDataSource HSou=Annex60.BoundaryConditions.Types.RadiationDataSource.File "Global, diffuse, and direct normal radiation"; //-------------------------------------------------------------- // Global horizontal radiation Modelica.Blocks.Interfaces.RealInput HGloHor_in( final quantity="RadiantEnergyFluenceRate", final unit="W/m2") if (HSou == Annex60.BoundaryConditions.Types.RadiationDataSource.Input_HGloHor_HDifHor or HSou == Annex60.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HGloHor) "Input global horizontal radiation"; //-------------------------------------------------------------- // Diffuse horizontal radiation Modelica.Blocks.Interfaces.RealInput HDifHor_in( final quantity="RadiantEnergyFluenceRate", final unit="W/m2") if (HSou == Annex60.BoundaryConditions.Types.RadiationDataSource.Input_HGloHor_HDifHor or HSou == Annex60.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HDifHor) "Input diffuse horizontal radiation"; //-------------------------------------------------------------- // Direct normal radiation Modelica.Blocks.Interfaces.RealInput HDirNor_in(final quantity="RadiantEnergyFluenceRate", final unit="W/m2") if (HSou == Annex60.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HDifHor or HSou == Annex60.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HGloHor) "Input direct normal radiation"; //-------------------------------------------------------------- parameter String filNam="" "Name of weather data file"; final parameter Modelica.SIunits.Angle lon(displayUnit="deg")= Annex60.BoundaryConditions.WeatherData.BaseClasses.getLongitudeTMY3( absFilNam) "Longitude"; final parameter Modelica.SIunits.Angle lat(displayUnit="deg")= Annex60.BoundaryConditions.WeatherData.BaseClasses.getLatitudeTMY3( absFilNam) "Latitude"; final parameter Modelica.SIunits.Time timZon(displayUnit="h")= Annex60.BoundaryConditions.WeatherData.BaseClasses.getTimeZoneTMY3(absFilNam) "Time zone"; Bus weaBus "Weather data bus"; parameter Annex60.BoundaryConditions.Types.SkyTemperatureCalculation calTSky=Annex60.BoundaryConditions.Types.SkyTemperatureCalculation.TemperaturesAndSkyCover "Computation of black-body sky temperature"; constant Real epsCos = 1e-6 "Small value to avoid division by 0"; constant Modelica.SIunits.HeatFlux solCon = 1367.7 "Solar constant"; protected final parameter String absFilNam = Annex60.BoundaryConditions.WeatherData.BaseClasses.getAbsolutePath(filNam) "Absolute path of the file"; Modelica.Blocks.Tables.CombiTable1Ds datRea( final tableOnFile=true, final tableName="tab1", final fileName=absFilNam, final smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative, final columns={2,3,4,5,6,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27, 28,29,30}) "Data reader"; Annex60.BoundaryConditions.WeatherData.BaseClasses.CheckTemperature cheTemDryBul "Check dry bulb temperature "; Annex60.BoundaryConditions.WeatherData.BaseClasses.CheckTemperature cheTemDewPoi "Check dew point temperature"; Annex60.BoundaryConditions.WeatherData.BaseClasses.ConvertRelativeHumidity conRelHum "Convert the relative humidity from percentage to [0, 1] "; BaseClasses.CheckPressure chePre "Check the air pressure"; BaseClasses.CheckSkyCover cheTotSkyCov "Check the total sky cover"; BaseClasses.CheckSkyCover cheOpaSkyCov "Check the opaque sky cover"; BaseClasses.CheckRadiation cheGloHorRad "Check the global horizontal radiation"; BaseClasses.CheckRadiation cheDifHorRad "Check the diffuse horizontal radiation"; BaseClasses.CheckRadiation cheDirNorRad "Check the direct normal radiation"; BaseClasses.CheckCeilingHeight cheCeiHei "Check the ceiling height"; BaseClasses.CheckWindSpeed cheWinSpe "Check the wind speed"; BaseClasses.CheckIRRadiation cheHorRad "Check the horizontal infrared irradiation"; BaseClasses.CheckWindDirection cheWinDir "Check the wind direction"; SkyTemperature.BlackBody TBlaSkyCom(final calTSky=calTSky) if not (TBlaSkySou == Annex60.BoundaryConditions.Types.DataSource.Parameter or TBlaSkySou == Annex60.BoundaryConditions.Types.DataSource.Input) "Computation of the black-body sky temperature"; Utilities.Time.ModelTime modTim "Model time"; Modelica.Blocks.Math.Add add "Add 30 minutes to time to shift weather data reader"; Modelica.Blocks.Sources.Constant con30mins(final k=1800) "Constant used to shift weather data reader"; Annex60.BoundaryConditions.WeatherData.BaseClasses.LocalCivilTime locTim( final lon=lon, final timZon=timZon) "Local civil time"; Modelica.Blocks.Tables.CombiTable1Ds datRea1( final tableOnFile=true, final tableName="tab1", final fileName=absFilNam, final smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative, final columns=8:11) "Data reader"; Annex60.BoundaryConditions.WeatherData.BaseClasses.ConvertTime conTim1 "Convert simulation time to calendar time"; BaseClasses.ConvertTime conTim "Convert simulation time to calendar time"; BaseClasses.EquationOfTime eqnTim "Equation of time"; BaseClasses.SolarTime solTim "Solar time"; // Conditional connectors Modelica.Blocks.Interfaces.RealInput pAtm_in_internal( final quantity="Pressure", final unit="Pa", displayUnit="bar") "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput ceiHei_in_internal( final quantity="Height", final unit="m", displayUnit="m") "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput totSkyCov_in_internal( final quantity="1", min=0, max=1) "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput opaSkyCov_in_internal( final quantity="1", min=0, max=1) "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput TDryBul_in_internal( final quantity="ThermodynamicTemperature", final unit="K", displayUnit="degC") "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput TDewPoi_in_internal( final quantity="ThermodynamicTemperature", final unit="K", displayUnit="degC") "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput TBlaSky_in_internal( final quantity="ThermodynamicTemperature", final unit="K", displayUnit="degC") "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput relHum_in_internal( final quantity="1", min=0, max=1) "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput winSpe_in_internal( final quantity="Velocity", final unit="m/s") "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput winDir_in_internal( final quantity="Angle", final unit="rad", displayUnit="deg") "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput HGloHor_in_internal( final quantity="RadiantEnergyFluenceRate", final unit="W/m2") "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput HDifHor_in_internal( final quantity="RadiantEnergyFluenceRate", final unit="W/m2") "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput HDirNor_in_internal( final quantity="RadiantEnergyFluenceRate", final unit="W/m2") "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput HInfHor_in_internal( final quantity="RadiantEnergyFluenceRate", final unit="W/m2") "Needed to connect to conditional connector"; Modelica.Blocks.Math.UnitConversions.From_deg conWinDir "Convert the wind direction unit from [deg] to [rad]"; Modelica.Blocks.Math.UnitConversions.From_degC conTDryBul; BaseClasses.ConvertRadiation conHorRad; Modelica.Blocks.Math.UnitConversions.From_degC conTDewPoi "Convert the dew point temperature form [degC] to [K]"; BaseClasses.ConvertRadiation conDirNorRad; BaseClasses.ConvertRadiation conGloHorRad; BaseClasses.ConvertRadiation conDifHorRad; BaseClasses.CheckRelativeHumidity cheRelHum; SolarGeometry.BaseClasses.AltitudeAngle altAng "Solar altitude angle"; SolarGeometry.BaseClasses.ZenithAngle zenAng( final lat = lat) "Zenith angle"; SolarGeometry.BaseClasses.Declination decAng "Declination angle"; SolarGeometry.BaseClasses.SolarHourAngle solHouAng; Latitude latitude(final latitude=lat) "Latitude"; Longitude longitude(final longitude=lon) "Longitude"; //--------------------------------------------------------------------------- // Optional instanciation of a block that computes the wet bulb temperature. // This block may be needed for evaporative cooling towers. // By default, it is enabled. This introduces a nonlinear equation, but // we have not observed an increase in computing time because of this equation. Annex60.Utilities.Psychrometrics.TWetBul_TDryBulPhi tWetBul_TDryBulXi( redeclare package Medium = Annex60.Media.Air, TDryBul(displayUnit="degC")) if computeWetBulbTemperature; //--------------------------------------------------------------------------- // Conversion blocks for sky cover Modelica.Blocks.Math.Gain conTotSkyCov(final k=0.1) if totSkyCovSou == Annex60.BoundaryConditions.Types.DataSource.File "Convert sky cover from [0...10] to [0...1]"; Modelica.Blocks.Math.Gain conOpaSkyCov(final k=0.1) if opaSkyCovSou == Annex60.BoundaryConditions.Types.DataSource.File "Convert sky cover from [0...10] to [0...1]"; Annex60.BoundaryConditions.WeatherData.BaseClasses.CheckBlackBodySkyTemperature cheTemBlaSky(TMin=0) "Check black body sky temperature"; // Blocks that are added in order to set the name of the output signal, // which then is displayed in the GUI of the weather data connector. block Latitude "Generate constant signal of type Real" extends Modelica.Blocks.Icons.Block; parameter Modelica.SIunits.Angle latitude "Latitude"; Modelica.Blocks.Interfaces.RealOutput y( unit="rad", displayUnit="deg") "Latitude of the location"; equation y = latitude; end Latitude; block Longitude "Generate constant signal of type Real" extends Modelica.Blocks.Icons.Block; parameter Modelica.SIunits.Angle longitude "Longitude"; Modelica.Blocks.Interfaces.RealOutput y( unit="rad", displayUnit="deg") "Longitude of the location"; equation y = longitude; end Longitude; equation //--------------------------------------------------------------------------- // Select atmospheric pressure connector if pAtmSou == Annex60.BoundaryConditions.Types.DataSource.Parameter then pAtm_in_internal = pAtm; elseif pAtmSou == Annex60.BoundaryConditions.Types.DataSource.File then connect(datRea.y[4], pAtm_in_internal); else connect(pAtm_in, pAtm_in_internal); end if; connect(pAtm_in_internal, chePre.PIn); //--------------------------------------------------------------------------- // Select ceiling height connector if ceiHeiSou == Annex60.BoundaryConditions.Types.DataSource.Parameter then ceiHei_in_internal = ceiHei; elseif ceiHeiSou == Annex60.BoundaryConditions.Types.DataSource.Input then connect(ceiHei_in, ceiHei_in_internal); else connect(datRea.y[16], ceiHei_in_internal); end if; connect(ceiHei_in_internal, cheCeiHei.ceiHeiIn); //--------------------------------------------------------------------------- // Select total sky cover connector if totSkyCovSou == Annex60.BoundaryConditions.Types.DataSource.Parameter then totSkyCov_in_internal = totSkyCov; elseif totSkyCovSou == Annex60.BoundaryConditions.Types.DataSource.Input then connect(totSkyCov_in, totSkyCov_in_internal); else connect(conTotSkyCov.u, datRea.y[13]); connect(conTotSkyCov.y, totSkyCov_in_internal); end if; connect(totSkyCov_in_internal, cheTotSkyCov.nIn); //--------------------------------------------------------------------------- // Select opaque sky cover connector if opaSkyCovSou == Annex60.BoundaryConditions.Types.DataSource.Parameter then opaSkyCov_in_internal = opaSkyCov; elseif opaSkyCovSou == Annex60.BoundaryConditions.Types.DataSource.Input then connect(opaSkyCov_in, opaSkyCov_in_internal); else connect(conOpaSkyCov.u, datRea.y[14]); connect(conOpaSkyCov.y, opaSkyCov_in_internal); end if; connect(opaSkyCov_in_internal, cheOpaSkyCov.nIn); //--------------------------------------------------------------------------- // Select dew point temperature connector if TDewPoiSou == Annex60.BoundaryConditions.Types.DataSource.Parameter then TDewPoi_in_internal = TDewPoi; elseif TDewPoiSou == Annex60.BoundaryConditions.Types.DataSource.Input then connect(TDewPoi_in, TDewPoi_in_internal); else connect(conTDewPoi.y, TDewPoi_in_internal); end if; connect(TDewPoi_in_internal, cheTemDewPoi.TIn); //--------------------------------------------------------------------------- // Select dry bulb temperature connector if TDryBulSou == Annex60.BoundaryConditions.Types.DataSource.Parameter then TDryBul_in_internal = TDryBul; elseif TDryBulSou == Annex60.BoundaryConditions.Types.DataSource.Input then connect(TDryBul_in, TDryBul_in_internal); else connect(conTDryBul.y, TDryBul_in_internal); end if; connect(TDryBul_in_internal, cheTemDryBul.TIn); //--------------------------------------------------------------------------- // Select sky black body temperature connector if TBlaSkySou == Annex60.BoundaryConditions.Types.DataSource.Parameter then TBlaSky_in_internal = TBlaSky; elseif TBlaSkySou == Annex60.BoundaryConditions.Types.DataSource.Input then connect(TBlaSky_in, TBlaSky_in_internal); else connect(TBlaSkyCom.TBlaSky, TBlaSky_in_internal); end if; connect(TBlaSky_in_internal, cheTemBlaSky.TIn); //--------------------------------------------------------------------------- // Select relative humidity connector if relHumSou == Annex60.BoundaryConditions.Types.DataSource.Parameter then relHum_in_internal = relHum; elseif relHumSou == Annex60.BoundaryConditions.Types.DataSource.Input then connect(relHum_in, relHum_in_internal); else connect(conRelHum.relHumOut, relHum_in_internal); end if; connect(relHum_in_internal, cheRelHum.relHumIn); //--------------------------------------------------------------------------- // Select wind speed connector if winSpeSou == Annex60.BoundaryConditions.Types.DataSource.Parameter then winSpe_in_internal = winSpe; elseif winSpeSou == Annex60.BoundaryConditions.Types.DataSource.Input then connect(winSpe_in, winSpe_in_internal); else connect(datRea.y[12], winSpe_in_internal); end if; connect(winSpe_in_internal, cheWinSpe.winSpeIn); //--------------------------------------------------------------------------- // Select wind direction connector if winDirSou == Annex60.BoundaryConditions.Types.DataSource.Parameter then winDir_in_internal = winDir; elseif winDirSou == Annex60.BoundaryConditions.Types.DataSource.Input then connect(winDir_in, winDir_in_internal); else connect(conWinDir.y, winDir_in_internal); end if; connect(winDir_in_internal, cheWinDir.nIn); //--------------------------------------------------------------------------- // Select global horizontal radiation connector if HSou == Annex60.BoundaryConditions.Types.RadiationDataSource.Input_HGloHor_HDifHor or HSou == Annex60.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HGloHor then connect(HGloHor_in, HGloHor_in_internal) "Get HGloHor using user input file"; elseif HSou == Annex60.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HDifHor then HDirNor_in_internal*cos(zenAng.zen)+HDifHor_in_internal = HGloHor_in_internal "Calculate the HGloHor using HDirNor and HDifHor according to (A.4.14) and (A.4.15)"; else connect(conGloHorRad.HOut, HGloHor_in_internal) "Get HGloHor using weather data file"; end if; connect(HGloHor_in_internal, cheGloHorRad.HIn); //--------------------------------------------------------------------------- // Select diffuse horizontal radiation connector if HSou == Annex60.BoundaryConditions.Types.RadiationDataSource.Input_HGloHor_HDifHor or HSou == Annex60.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HDifHor then connect(HDifHor_in, HDifHor_in_internal) "Get HDifHor using user input file"; elseif HSou == Annex60.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HGloHor then HGloHor_in_internal - HDirNor_in_internal*cos(zenAng.zen) = HDifHor_in_internal "Calculate the HGloHor using HDirNor and HDifHor according to (A.4.14) and (A.4.15)"; else connect(conDifHorRad.HOut, HDifHor_in_internal) "Get HDifHor using weather data file"; end if; connect(HDifHor_in_internal, cheDifHorRad.HIn); //--------------------------------------------------------------------------- // Select direct normal radiation connector if HSou == Annex60.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HGloHor or HSou == Annex60.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HDifHor then connect(HDirNor_in, HDirNor_in_internal) "Get HDirNor using user input file"; elseif HSou == Annex60.BoundaryConditions.Types.RadiationDataSource.Input_HGloHor_HDifHor then Annex60.Utilities.Math.Functions.smoothMin( solCon, (HGloHor_in_internal -HDifHor_in_internal)* Annex60.Utilities.Math.Functions.spliceFunction( x=cos(zenAng.zen), pos=Annex60.Utilities.Math.Functions.inverseXRegularized(cos(zenAng.zen),epsCos), neg=0, deltax=epsCos), 0.1) = HDirNor_in_internal "Calculate the HDirNor using HGloHor and HDifHor according to (A.4.14) and (A.4.15)"; else connect(conDirNorRad.HOut, HDirNor_in_internal) "Get HDirNor using weather data file"; end if; connect(HDirNor_in_internal, cheDirNorRad.HIn); //--------------------------------------------------------------------------- // Select infrared radiation connector if HInfHorSou == Annex60.BoundaryConditions.Types.DataSource.Parameter then HInfHor_in_internal = HInfHor; elseif HInfHorSou == Annex60.BoundaryConditions.Types.DataSource.Input then connect(HInfHor_in, HInfHor_in_internal); else connect(conHorRad.HOut, HInfHor_in_internal); end if; connect(HInfHor_in_internal, cheHorRad.HIn); connect(chePre.POut, weaBus.pAtm); connect(cheTotSkyCov.nOut, weaBus.nTot); connect(cheOpaSkyCov.nOut, weaBus.nOpa); connect(cheGloHorRad.HOut, weaBus.HGloHor); connect(cheDifHorRad.HOut, weaBus.HDifHor); connect(cheDirNorRad.HOut, weaBus.HDirNor); connect(cheCeiHei.ceiHeiOut, weaBus.celHei); connect(cheWinSpe.winSpeOut, weaBus.winSpe); connect(cheHorRad.HOut, weaBus.HHorIR); connect(cheWinDir.nOut, weaBus.winDir); connect(cheOpaSkyCov.nOut, TBlaSkyCom.nOpa); connect(cheHorRad.HOut, TBlaSkyCom.HHorIR); connect(modTim.y, weaBus.cloTim); connect(modTim.y, add.u2); connect(con30mins.y, add.u1); connect(add.y, conTim1.modTim); connect(conTim1.calTim, datRea1.u); connect(modTim.y, locTim.cloTim); connect(modTim.y, conTim.modTim); connect(conTim.calTim, datRea.u); connect(modTim.y, eqnTim.nDay); connect(eqnTim.eqnTim, solTim.equTim); connect(locTim.locTim, solTim.locTim); connect(solTim.solTim, weaBus.solTim); connect(datRea.y[11], conWinDir.u); connect(datRea1.y[1], conHorRad.HIn); connect(cheTemDryBul.TOut, TBlaSkyCom.TDryBul); connect(datRea.y[1], conTDryBul.u); connect(datRea.y[2], conTDewPoi.u); connect(cheTemDewPoi.TOut, weaBus.TDewPoi); connect(TBlaSkyCom.TDewPoi, cheTemDewPoi.TOut); connect(datRea1.y[3], conDirNorRad.HIn); connect(datRea1.y[2], conGloHorRad.HIn); connect(datRea1.y[4], conDifHorRad.HIn); connect(conRelHum.relHumIn, datRea.y[3]); connect(cheRelHum.relHumOut, weaBus.relHum); connect(cheTemDryBul.TOut, weaBus.TDryBul); connect(decAng.decAng, zenAng.decAng); connect(solHouAng.solHouAng, zenAng.solHouAng); connect(solHouAng.solTim, solTim.solTim); connect(decAng.nDay, modTim.y); connect(zenAng.zen, altAng.zen); // Connectors for wet bulb temperature. // These are removed if computeWetBulbTemperature = false connect(chePre.POut, tWetBul_TDryBulXi.p); connect(tWetBul_TDryBulXi.TWetBul, weaBus.TWetBul); connect(cheTemDryBul.TOut, tWetBul_TDryBulXi.TDryBul); connect(cheRelHum.relHumOut, tWetBul_TDryBulXi.phi); connect(altAng.alt, weaBus.solAlt); connect(zenAng.zen, weaBus.solZen); connect(decAng.decAng, weaBus.solDec); connect(solHouAng.solHouAng, weaBus.solHouAng); connect(longitude.y, weaBus.lon); connect(latitude.y, weaBus.lat); connect(cheTemBlaSky.TOut, weaBus.TBlaSky); end ReaderTMY3;

Annex60.BoundaryConditions.WeatherData.ReaderTMY3.Latitude Annex60.BoundaryConditions.WeatherData.ReaderTMY3.Latitude

Generate constant signal of type Real

Annex60.BoundaryConditions.WeatherData.ReaderTMY3.Latitude

Information

Block to output the latitude of the location. This block is added so that the latitude is displayed with a comment in the GUI of the weather bus connector.

Implementation

If Modelica.Blocks.Sources.Constant where used, then the comment for the latitude would be "Connector of Real output signal". As this documentation string cannot be overwritten, a new block was implemented.

Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).

Parameters

TypeNameDefaultDescription
Anglelatitude Latitude [rad]

Connectors

TypeNameDescription
output RealOutputyLatitude of the location [rad]

Modelica definition

block Latitude "Generate constant signal of type Real" extends Modelica.Blocks.Icons.Block; parameter Modelica.SIunits.Angle latitude "Latitude"; Modelica.Blocks.Interfaces.RealOutput y( unit="rad", displayUnit="deg") "Latitude of the location"; equation y = latitude; end Latitude;

Annex60.BoundaryConditions.WeatherData.ReaderTMY3.Longitude Annex60.BoundaryConditions.WeatherData.ReaderTMY3.Longitude

Generate constant signal of type Real

Annex60.BoundaryConditions.WeatherData.ReaderTMY3.Longitude

Information

Block to output the longitude of the location. This block is added so that the longitude is displayed with a comment in the GUI of the weather bus connector.

Implementation

If Modelica.Blocks.Sources.Constant where used, then the comment for the longitude would be "Connector of Real output signal". As this documentation string cannot be overwritten, a new block was implemented.

Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).

Parameters

TypeNameDefaultDescription
Anglelongitude Longitude [rad]

Connectors

TypeNameDescription
output RealOutputyLongitude of the location [rad]

Modelica definition

block Longitude "Generate constant signal of type Real" extends Modelica.Blocks.Icons.Block; parameter Modelica.SIunits.Angle longitude "Longitude"; Modelica.Blocks.Interfaces.RealOutput y( unit="rad", displayUnit="deg") "Longitude of the location"; equation y = longitude; end Longitude;

http://iea-annex60.org