Buildings.BoundaryConditions.WeatherData

Weather data reader

Information

This package contains models to read weather data. It also contains the expandable connector Buildings.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
Buildings.BoundaryConditions.WeatherData.Bus Bus Data bus that stores weather data
Buildings.BoundaryConditions.WeatherData.ReaderTMY3 ReaderTMY3 Reader for TMY3 weather data
Buildings.BoundaryConditions.WeatherData.Examples Examples Collection of models that illustrate model use and test models
Buildings.BoundaryConditions.WeatherData.Validation Validation Collection of validation models
Buildings.BoundaryConditions.WeatherData.BaseClasses BaseClasses Package with base classes for Buildings.BoundaryConditions.WeatherData

Buildings.BoundaryConditions.WeatherData.Bus Buildings.BoundaryConditions.WeatherData.Bus

Data bus that stores weather data

Buildings.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).

Contents

TypeNameDescription
TemperatureTDryBulDry bulb temperature [K]
TemperatureTWetBulWet bulb temperature [K]
TemperatureTDewPoiDew point temperature [K]
TemperatureTBlaSkyBlack-body sky temperature [K]
RealrelHumRelative humidity [1]
RealHDirNorDirect normal solar irradiation [W/m2]
RealHGloHorGlobal horizontal solar irradiation [W/m2]
RealHDifHorDiffuse horizontal solar irradiation [W/m2]
RealHHorIRHorizontal infrared irradiation [W/m2]
AnglewinDirWind direction [rad]
VelocitywinSpeWind speed [m/s]
HeightceiHeiCloud cover ceiling height [m]
RealnOpaOpaque sky cover [1]
RealnTotTotal sky cover [1]
AnglelatLatitude of the location [rad]
AnglelonLongitude of the location [rad]
HeightaltLocation altitude above sea level [m]
AbsolutePressurepAtmAtmospheric pressure [Pa]
AnglesolAltSolar altitude angle [rad]
AnglesolDecSolar declination angle [rad]
AnglesolHouAngSolar hour angle [rad]
AnglesolZenSolar zenith angle [rad]
TimesolTimSolar time [s]
TimecloTimModel time [s]

Modelica definition

expandable connector Bus "Data bus that stores weather data" extends Modelica.Icons.SignalBus; Modelica.Units.SI.Temperature TDryBul(displayUnit="degC") "Dry bulb temperature"; Modelica.Units.SI.Temperature TWetBul(displayUnit="degC") "Wet bulb temperature"; Modelica.Units.SI.Temperature TDewPoi(displayUnit="degC") "Dew point temperature"; Modelica.Units.SI.Temperature TBlaSky(displayUnit="degC") "Black-body sky temperature"; Real relHum(final unit="1") "Relative humidity"; Real HDirNor(final unit="W/m2") "Direct normal solar irradiation"; Real HGloHor(final unit="W/m2") "Global horizontal solar irradiation"; Real HDifHor(final unit="W/m2") "Diffuse horizontal solar irradiation"; Real HHorIR(final unit="W/m2") "Horizontal infrared irradiation"; Modelica.Units.SI.Angle winDir "Wind direction"; Modelica.Units.SI.Velocity winSpe "Wind speed"; Modelica.Units.SI.Height ceiHei "Cloud cover ceiling height"; Real nOpa(final unit="1") "Opaque sky cover"; Real nTot(final unit="1") "Total sky cover"; Modelica.Units.SI.Angle lat "Latitude of the location"; Modelica.Units.SI.Angle lon "Longitude of the location"; Modelica.Units.SI.Height alt "Location altitude above sea level"; Modelica.Units.SI.AbsolutePressure pAtm "Atmospheric pressure"; Modelica.Units.SI.Angle solAlt "Solar altitude angle"; Modelica.Units.SI.Angle solDec "Solar declination angle"; Modelica.Units.SI.Angle solHouAng "Solar hour angle"; Modelica.Units.SI.Angle solZen "Solar zenith angle"; Modelica.Units.SI.Time solTim "Solar time"; Modelica.Units.SI.Time cloTim "Model time"; end Bus;

Buildings.BoundaryConditions.WeatherData.ReaderTMY3 Buildings.BoundaryConditions.WeatherData.ReaderTMY3

Reader for TMY3 weather data

Buildings.BoundaryConditions.WeatherData.ReaderTMY3

Information

This component reads TMY3 weather data (Wilcox and Marion, 2008) or user specified weather data. The Modelica built-in variable time determines what row of the weather file is read. The value of time is the number of seconds that have passed since January 1st at midnight (00:00) in the local time zone. The local time zone value, longitude and latitute are also read from the weather data, such that the solar position computations are consistent with the 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 below.

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 Buildings/Resources/weatherdata (or to any directory for which you have write permission).
  3. On a console window, type
      cd Buildings/Resources/weatherdata
      java -jar ../bin/ConvertWeatherData.jar inputFile.epw
    
    if inputFile contains space in the name:
      java -jar ../bin/ConvertWeatherData.jar "inputFile .epw"
    
    This will generate the weather data file inputFile.mos, which can be read by the model Buildings.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 Buildings.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 Buildings.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.

Length of weather data and simulation period

If weather data span a year, which is the default for TMY3 data, or multiple years, then this model can be used for simulations that span multiple years. The simulation start time needs to be set to the clock time of the respective start time. For example, to start at January 2 at 10am, set start time to t=(24+10)*3600 seconds. For this computation, the used date and time (here January 2, 10 am) must be expressed in the same time zone as the one that is used to define the TMY3 file. This is usually the local (winter) time zone. The parameter `timZon` represents the TMY3 file time zone, expressed in seconds compared to UTC.

Moreover, weather data need not span a whole year, or it can span across New Year. In this case, the simulation cannot exceed the time of the weather data file. Otherwise, the simulation stops with an error.

As weather data have one entry at the start of the time interval, the end time of the weather data file is computed as the last time entry plus the average time increment of the file. For example, an hourly weather data file has 8760 entries, starting on January 1 at 0:00. The last entry in the file will be for December 31 at 23:00. As the time increment is 1 hour, the model assumes the weather file to end at December 31 at 23:00 plus 1 hour, e.g., at January 1 at 0:00.

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:

    • When using TMY3 data from a file (e.g. USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos), the units must be the same as the original TMY3 file used by EnergyPlus (e.g. USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw). The TMY3 data used by EnergyPlus are in both SI units and non-SI units. If Resources/bin/ConvertWeatherData.jar is used to convert the .epw file to an .mos file, the units of the TMY3 data are preserved and the file can be directly used by this data reader. The data reader will automatically convert units to the SI units used by Modelica. For example, the dry bulb temperature TDryBul in TMY3 is in degree Celsius. The data reader will automatically convert the data to Kelvin. The wind direction winDir in TMY3 is degrees and will be automatically converted to radians.
    • When using data from a parameter or from an input connector, the data must be in the SI units used by Modelica. For instance, the unit must be Pa for pressure, K for temperature, W/m2 for solar radiations and rad for wind direction.
  3. Hourly and subhourly timestamp are handled in a different way in .epw files. From the EnergyPlus Auxiliary Programs Document (v9.3.0, p. 63): In hourly data the minute field can be 00 or 60. In this case as mentioned in the previous section, the weather data is reported at the hourly value and the minute field has to be ignored, writing 1, 60 or 1, 00 is equivalent. If the minute field is between 00 and 60, the file becomes subhourly, in this case the timestamp corresponds to the minute field in the considered hour. For example: 1, 30 is equivalent to 00:30 and 3, 45 is equivalent to 02:45.
    (Note the offset in the hour digit.)

  4. 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 Buildings 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 Buildings/Resources/bin/ConvertWeatherData.jar that converts EnergyPlus weather data file to Modelica weather data files, and which is described above. The length of the weather data is calculated as the end time stamp minus start time stamp plus average increment, where the average increment is equal to the end time stamp minus start time stamp divided by the number of rows minus 1. This only works correctly for weather files with equidistant time stamps.

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
StringfilNam""Name of weather data file
BooleancomputeWetBulbTemperaturetrueIf true, then this model computes the wet bulb temperature
Data source
DataSourcepAtmSouBuildings.BoundaryConditions...Atmospheric pressure
PressurepAtm101325Atmospheric pressure (used if pAtmSou=Parameter) [Pa]
DataSourceTDryBulSouBuildings.BoundaryConditions...Dry bulb temperature
TemperatureTDryBul293.15Dry bulb temperature (used if TDryBul=Parameter) [K]
DataSourceTDewPoiSouBuildings.BoundaryConditions...Dew point temperature
TemperatureTDewPoi283.15Dew point temperature (used if TDewPoi=Parameter) [K]
DataSourceTBlaSkySouBuildings.BoundaryConditions...Black-body sky temperature
TemperatureTBlaSky273.15Black-body sky temperature (used if TBlaSkySou=Parameter) [K]
DataSourcerelHumSouBuildings.BoundaryConditions...Relative humidity
RealrelHum0.5Relative humidity (used if relHum=Parameter) [1]
DataSourcewinSpeSouBuildings.BoundaryConditions...Wind speed
VelocitywinSpe1Wind speed (used if winSpe=Parameter) [m/s]
DataSourcewinDirSouBuildings.BoundaryConditions...Wind direction
AnglewinDir1.0Wind direction (used if winDir=Parameter) [rad]
DataSourceHInfHorSouBuildings.BoundaryConditions...Infrared horizontal radiation
HeatFluxHInfHor0.0Infrared horizontal radiation (used if HInfHorSou=Parameter) [W/m2]
RadiationDataSourceHSouBuildings.BoundaryConditions...Global, diffuse, and direct normal radiation
DataSourceceiHeiSouBuildings.BoundaryConditions...Ceiling height
RealceiHei20000Ceiling height (used if ceiHei=Parameter) [m]
DataSourcetotSkyCovSouBuildings.BoundaryConditions...Total sky cover
RealtotSkyCov0.5Total sky cover (used if totSkyCov=Parameter). Use 0 <= totSkyCov <= 1 [1]
DataSourceopaSkyCovSouBuildings.BoundaryConditions...Opaque sky cover
RealopaSkyCov0.5Opaque sky cover (used if opaSkyCov=Parameter). Use 0 <= opaSkyCov <= 1 [1]
Advanced
Sky temperature
SkyTemperatureCalculationcalTSkyBuildings.BoundaryConditions...Model choice for black-body sky temperature calculation

Connectors

TypeNameDescription
BusweaBusWeather data bus
input RealInputpAtm_inInput pressure [Pa]
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]
input RealInputceiHei_inInput ceiling height [m]
input RealInputtotSkyCov_inInput total sky cover [1]
input RealInputopaSkyCov_inInput opaque sky cover [1]

Modelica definition

block ReaderTMY3 "Reader for TMY3 weather data" Bus weaBus "Weather data bus"; //-------------------------------------------------------------- parameter String filNam="" "Name of weather data file"; parameter Boolean computeWetBulbTemperature = true "If true, then this model computes the wet bulb temperature"; //-------------------------------------------------------------- // Atmospheric pressure parameter Buildings.BoundaryConditions.Types.DataSource pAtmSou=Buildings.BoundaryConditions.Types.DataSource.Parameter "Atmospheric pressure"; parameter Modelica.Units.SI.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 == Buildings.BoundaryConditions.Types.DataSource.Input) "Input pressure"; //-------------------------------------------------------------- // Dry bulb temperature parameter Buildings.BoundaryConditions.Types.DataSource TDryBulSou=Buildings.BoundaryConditions.Types.DataSource.File "Dry bulb temperature"; parameter Modelica.Units.SI.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 == Buildings.BoundaryConditions.Types.DataSource.Input) "Input dry bulb temperature"; //-------------------------------------------------------------- // Dew point temperature parameter Buildings.BoundaryConditions.Types.DataSource TDewPoiSou=Buildings.BoundaryConditions.Types.DataSource.File "Dew point temperature"; parameter Modelica.Units.SI.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 == Buildings.BoundaryConditions.Types.DataSource.Input) "Input dew point temperature"; //-------------------------------------------------------------- // Black body sky temperature parameter Buildings.BoundaryConditions.Types.DataSource TBlaSkySou=Buildings.BoundaryConditions.Types.DataSource.File "Black-body sky temperature"; parameter Modelica.Units.SI.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 == Buildings.BoundaryConditions.Types.DataSource.Input) "Black-body sky temperature"; //-------------------------------------------------------------- // Relative humidity parameter Buildings.BoundaryConditions.Types.DataSource relHumSou=Buildings.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 == Buildings.BoundaryConditions.Types.DataSource.Input) "Input relative humidity"; //-------------------------------------------------------------- // Wind speed parameter Buildings.BoundaryConditions.Types.DataSource winSpeSou=Buildings.BoundaryConditions.Types.DataSource.File "Wind speed"; parameter Modelica.Units.SI.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 == Buildings.BoundaryConditions.Types.DataSource.Input) "Input wind speed"; //-------------------------------------------------------------- // Wind direction parameter Buildings.BoundaryConditions.Types.DataSource winDirSou=Buildings.BoundaryConditions.Types.DataSource.File "Wind direction"; parameter Modelica.Units.SI.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 == Buildings.BoundaryConditions.Types.DataSource.Input) "Input wind direction"; //-------------------------------------------------------------- // Infrared horizontal radiation parameter Buildings.BoundaryConditions.Types.DataSource HInfHorSou=Buildings.BoundaryConditions.Types.DataSource.File "Infrared horizontal radiation"; parameter Modelica.Units.SI.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 == Buildings.BoundaryConditions.Types.DataSource.Input) "Input infrared horizontal radiation"; parameter Buildings.BoundaryConditions.Types.RadiationDataSource HSou=Buildings.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 == Buildings.BoundaryConditions.Types.RadiationDataSource.Input_HGloHor_HDifHor or HSou == Buildings.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 == Buildings.BoundaryConditions.Types.RadiationDataSource.Input_HGloHor_HDifHor or HSou == Buildings.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 == Buildings.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HDifHor or HSou == Buildings.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HGloHor) "Input direct normal radiation"; //-------------------------------------------------------------- // Ceiling height parameter Buildings.BoundaryConditions.Types.DataSource ceiHeiSou=Buildings.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 == Buildings.BoundaryConditions.Types.DataSource.Input) "Input ceiling height"; //-------------------------------------------------------------- // Total sky cover parameter Buildings.BoundaryConditions.Types.DataSource totSkyCovSou=Buildings.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 == Buildings.BoundaryConditions.Types.DataSource.Input) "Input total sky cover"; // Opaque sky cover parameter Buildings.BoundaryConditions.Types.DataSource opaSkyCovSou=Buildings.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 == Buildings.BoundaryConditions.Types.DataSource.Input) "Input opaque sky cover"; parameter Buildings.BoundaryConditions.Types.SkyTemperatureCalculation calTSky=Buildings.BoundaryConditions.Types.SkyTemperatureCalculation.TemperaturesAndSkyCover "Model choice for black-body sky temperature calculation"; final parameter Modelica.Units.SI.Angle lon(displayUnit="deg") = Buildings.BoundaryConditions.WeatherData.BaseClasses.getLongitudeTMY3(filNam) "Longitude"; final parameter Modelica.Units.SI.Angle lat(displayUnit="deg") = Buildings.BoundaryConditions.WeatherData.BaseClasses.getLatitudeTMY3(filNam) "Latitude"; final parameter Modelica.Units.SI.Time timZon(displayUnit="h") = Buildings.BoundaryConditions.WeatherData.BaseClasses.getTimeZoneTMY3(filNam) "Time zone"; final parameter Modelica.Units.SI.Length alt(displayUnit="m") = Buildings.BoundaryConditions.WeatherData.BaseClasses.getAltitudeLocationTMY3( filNam) "Location altitude above sea level"; protected final parameter Modelica.Units.SI.Time[2] timeSpan= Buildings.BoundaryConditions.WeatherData.BaseClasses.getTimeSpanTMY3(filNam, "tab1") "Start time, end time of weather data"; Modelica.Blocks.Tables.CombiTable1Ds datRea( final tableOnFile=true, final tableName="tab1", final fileName=filNam, verboseRead=false, 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,8}) "Data reader"; BaseClasses.SourceSelector pAtmSel( final datSou=pAtmSou, final p=pAtm) "Source selection for atmospheric pressure"; BaseClasses.SourceSelector TDewPoiSel( final datSou=TDewPoiSou, final p=TDewPoi) "Source selection for dewpoint temperature pressure"; BaseClasses.SourceSelector TDryBulSel( final datSou=TDryBulSou, final p=TDryBul) "Source selection for drybulb temperature pressure"; BaseClasses.SourceSelector TBlaSkySel( final datSou=TBlaSkySou, final p=TBlaSky) "Source selection for sky black body radiation"; BaseClasses.SourceSelector relHumSel( final datSou=relHumSou, final p=relHum) "Source selection for relative humidity"; BaseClasses.SourceSelector opaSkyCovSel( final datSou=opaSkyCovSou, final p=opaSkyCov) "Source selection for opaque sky cover"; BaseClasses.SourceSelector ceiHeiSel( final datSou=ceiHeiSou, final p=ceiHei) "Source selection for ceiling height"; BaseClasses.SourceSelector totSkyCovSel( final datSou=totSkyCovSou, final p=totSkyCov) "Source selection for total sky cover"; BaseClasses.SourceSelector winSpeSel( final datSou=winSpeSou, final p=winSpe) "Source selection for wind speed"; BaseClasses.SourceSelector winDirSel( final datSou=winDirSou, final p=winDir) "Source selection for wind speed"; BaseClasses.SourceSelector horInfRadSel( final datSou=HInfHorSou, final p=HInfHor) "Source selection for horizontal infrared radiation"; BaseClasses.SourceSelectorRadiation souSelRad( final datSou=HSou) "Source selection for solar irradiation"; BaseClasses.CheckDryBulbTemperature cheTemDryBul "Check dry bulb temperature "; Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckDewPointTemperature cheTemDewPoi "Check dew point temperature"; Modelica.Blocks.Math.Gain conRelHum(final k=0.01) if relHumSou == Buildings.BoundaryConditions.Types.DataSource.File "Convert the relative humidity from percentage to [0, 1] "; BaseClasses.CheckPressure chePre "Check the air pressure"; Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterRelativeHumidity limRelHum "Limiter for relative humidity"; Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterTotalSkyCover limTotSkyCov "Limits the total sky cover"; Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterOpaqueSkyCover limOpaSkyCov "Limits the opaque sky cover"; Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterCeilingHeight limCeiHei "Limits the ceiling height"; Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterWindSpeed limWinSpe "Limits the wind speed"; Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterHorizontalInfraredIrradiation limHorInfRad "Limits the horizontal infrared irradiation"; Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterWindDirection limWinDir "Limits the wind direction"; SkyTemperature.BlackBody TBlaSkyCom(final calTSky=calTSky) if TBlaSkySou == Buildings.BoundaryConditions.Types.DataSource.File "Computation of the black-body sky temperature"; Buildings.Utilities.Time.ModelTime modTim "Model time"; Modelica.Blocks.Math.Add add30Min "Add 30 minutes to time to shift weather data reader"; Modelica.Blocks.Sources.Constant con30Min(final k=1800) "Constant used to shift weather data reader"; Buildings.BoundaryConditions.WeatherData.BaseClasses.LocalCivilTime locTim( final lon=lon, final timZon=timZon) "Local civil time"; Modelica.Blocks.Tables.CombiTable1Ds datRea30Min( final tableOnFile=true, final tableName="tab1", final fileName=filNam, verboseRead=false, final smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative, final columns=9:11) "Data reader with 30 min offset for solar irradiation"; Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertTime conTimMin(final weaDatStaTim=timeSpan[1], final weaDatEndTim=timeSpan[2]) "Convert simulation time to calendar time"; Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertTime conTim( final weaDatStaTim = timeSpan[1], final weaDatEndTim = timeSpan[2]) "Convert simulation time to calendar time"; BaseClasses.EquationOfTime eqnTim "Equation of time"; BaseClasses.SolarTime solTim "Solar time"; Modelica.Blocks.Math.UnitConversions.From_deg conWinDir "Convert the wind direction unit from [deg] to [rad]"; Modelica.Blocks.Math.UnitConversions.From_degC conTDryBul; Modelica.Blocks.Math.UnitConversions.From_degC conTDewPoi "Convert the dew point temperature form [degC] to [K]"; SolarGeometry.BaseClasses.AltitudeAngle altAng "Solar altitude angle"; SolarGeometry.BaseClasses.ZenithAngle zenAng "Zenith angle"; SolarGeometry.BaseClasses.Declination decAng "Declination angle"; SolarGeometry.BaseClasses.SolarHourAngle solHouAng "Solar hour angle"; Latitude latitude(final latitude=lat) "Latitude"; Longitude longitude(final longitude=lon) "Longitude"; Altitude altitude(final Altitude=alt) "Altitude"; //--------------------------------------------------------------------------- // 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. Buildings.Utilities.Psychrometrics.TWetBul_TDryBulPhi tWetBul_TDryBulXi( redeclare package Medium = Buildings.Media.Air, TDryBul(displayUnit="degC")) if computeWetBulbTemperature; //--------------------------------------------------------------------------- // Conversion blocks for sky cover Modelica.Blocks.Math.Gain conTotSkyCov(final k=0.1) if totSkyCovSou == Buildings.BoundaryConditions.Types.DataSource.File "Convert sky cover from [0...10] to [0...1]"; Modelica.Blocks.Math.Gain conOpaSkyCov(final k=0.1) if opaSkyCovSou == Buildings.BoundaryConditions.Types.DataSource.File "Convert sky cover from [0...10] to [0...1]"; Buildings.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.Units.SI.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.Units.SI.Angle longitude "Longitude"; Modelica.Blocks.Interfaces.RealOutput y( unit="rad", displayUnit="deg") "Longitude of the location"; equation y = longitude; end Longitude; block Altitude "Generate constant signal of type Real" extends Modelica.Blocks.Icons.Block; parameter Modelica.Units.SI.Length Altitude "Location altitude above sea level"; Modelica.Blocks.Interfaces.RealOutput y( unit="m") "Location altitude above sea level"; equation y = Altitude; end Altitude; equation connect(modTim.y, add30Min.u2); connect(con30Min.y, add30Min.u1); connect(add30Min.y, conTimMin.modTim); connect(conTimMin.calTim, datRea30Min.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(datRea.y[11], conWinDir.u); connect(datRea.y[1], conTDryBul.u); connect(datRea.y[2], conTDewPoi.u); connect(conRelHum.u, datRea.y[3]); 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); connect(limOpaSkyCov.nOpa, TBlaSkyCom.nOpa); connect(limRelHum.relHum, tWetBul_TDryBulXi.phi); connect(pAtmSel.y, chePre.PIn); connect(pAtmSel.uCon, pAtm_in); connect(datRea.y[4], pAtmSel.uFil); connect(cheTemDewPoi.TIn, TDewPoiSel.y); connect(TDewPoiSel.uFil, conTDewPoi.y); connect(TDewPoiSel.uCon, TDewPoi_in); connect(TDryBulSel.y, cheTemDryBul.TIn); connect(TDryBulSel.uFil, conTDryBul.y); connect(TDryBulSel.uCon, TDryBul_in); connect(TBlaSkySel.y, cheTemBlaSky.TIn); connect(TBlaSkyCom.TBlaSky, TBlaSkySel.uFil); connect(TBlaSky_in, TBlaSkySel.uCon); connect(relHumSel.y, limRelHum.u); connect(relHumSel.uFil, conRelHum.y); connect(relHum_in, relHumSel.uCon); connect(conOpaSkyCov.y, opaSkyCovSel.uFil); connect(opaSkyCov_in, opaSkyCovSel.uCon); connect(ceiHeiSel.y, limCeiHei.u); connect(ceiHeiSel.uFil, datRea.y[16]); connect(ceiHeiSel.uCon, ceiHei_in); connect(totSkyCovSel.uFil, conTotSkyCov.y); connect(totSkyCovSel.uCon, totSkyCov_in); connect(totSkyCovSel.y, limTotSkyCov.u); connect(winSpeSel.y, limWinSpe.u); connect(conTotSkyCov.u, datRea.y[13]); connect(winSpeSel.uFil, datRea.y[12]); connect(winSpeSel.uCon, winSpe_in); connect(winDirSel.y, limWinDir.u); connect(conWinDir.y, winDirSel.uFil); connect(winDirSel.uCon, winDir_in); connect(conOpaSkyCov.u, datRea.y[14]); connect(horInfRadSel.y, limHorInfRad.u); connect(horInfRadSel.uFil, datRea.y[26]); connect(horInfRadSel.uCon, HInfHor_in); connect(souSelRad.HDifHorFil, datRea30Min.y[3]); connect(souSelRad.HDifHorIn, HDifHor_in); connect(souSelRad.HDirNorFil, datRea30Min.y[2]); connect(souSelRad.HDirNorIn, HDirNor_in); connect(souSelRad.HGloHorIn, HGloHor_in); connect(souSelRad.zen, zenAng.zen); connect(souSelRad.HGloHorFil, datRea30Min.y[1]); connect(TBlaSkyCom.HHorIR, limHorInfRad.HHorIR); connect(opaSkyCovSel.y, limOpaSkyCov.u); connect(cheTemDryBul.TDryBul, TBlaSkyCom.TDryBul); connect(cheTemDryBul.TDryBul, tWetBul_TDryBulXi.TDryBul); connect(chePre.pAtm, tWetBul_TDryBulXi.p); connect(cheTemDewPoi.TDewPoi, TBlaSkyCom.TDewPoi); // Connections to weather data bus connect(cheTemDryBul.TDryBul, weaBus.TDryBul); connect(cheTemDewPoi.TDewPoi, weaBus.TDewPoi); connect(tWetBul_TDryBulXi.TWetBul, weaBus.TWetBul); connect(limRelHum.relHum, weaBus.relHum); connect(souSelRad.HDirNor, weaBus.HDirNor); connect(souSelRad.HDifHor, weaBus.HDifHor); connect(souSelRad.HGloHor, weaBus.HGloHor); connect(cheTemBlaSky.TBlaSky, weaBus.TBlaSky); connect(limHorInfRad.HHorIR, weaBus.HHorIR); connect(limWinSpe.winSpe, weaBus.winSpe); connect(limWinDir.winDir, weaBus.winDir); connect(limCeiHei.ceiHei, weaBus.ceiHei); connect(limTotSkyCov.nTot, weaBus.nTot); connect(limOpaSkyCov.nOpa, weaBus.nOpa); connect(modTim.y, weaBus.cloTim); connect(solTim.solTim, weaBus.solTim); 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(altitude.y, weaBus.alt); connect(chePre.pAtm, weaBus.pAtm); connect(latitude.y, zenAng.lat); end ReaderTMY3;

Buildings.BoundaryConditions.WeatherData.ReaderTMY3.Latitude Buildings.BoundaryConditions.WeatherData.ReaderTMY3.Latitude

Generate constant signal of type Real

Buildings.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.Units.SI.Angle latitude "Latitude"; Modelica.Blocks.Interfaces.RealOutput y( unit="rad", displayUnit="deg") "Latitude of the location"; equation y = latitude; end Latitude;

Buildings.BoundaryConditions.WeatherData.ReaderTMY3.Longitude Buildings.BoundaryConditions.WeatherData.ReaderTMY3.Longitude

Generate constant signal of type Real

Buildings.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.Units.SI.Angle longitude "Longitude"; Modelica.Blocks.Interfaces.RealOutput y( unit="rad", displayUnit="deg") "Longitude of the location"; equation y = longitude; end Longitude;

Buildings.BoundaryConditions.WeatherData.ReaderTMY3.Altitude Buildings.BoundaryConditions.WeatherData.ReaderTMY3.Altitude

Generate constant signal of type Real

Buildings.BoundaryConditions.WeatherData.ReaderTMY3.Altitude

Information

Block to output the altitude of the location. This block is added so that the altitude 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 Altitude 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
LengthAltitude Location altitude above sea level [m]

Connectors

TypeNameDescription
output RealOutputyLocation altitude above sea level [m]

Modelica definition

block Altitude "Generate constant signal of type Real" extends Modelica.Blocks.Icons.Block; parameter Modelica.Units.SI.Length Altitude "Location altitude above sea level"; Modelica.Blocks.Interfaces.RealOutput y( unit="m") "Location altitude above sea level"; equation y = Altitude; end Altitude;