Buildings.BoundaryConditions.WeatherData.BaseClasses

Package with base classes for Buildings.BoundaryConditions.WeatherData

Information

This package contains base classes that are used to construct the models in Buildings.BoundaryConditions.WeatherData.

Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).

Package Content

Name Description
Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckBlackBodySkyTemperature CheckBlackBodySkyTemperature Check the validity of the black-body sky temperature data
Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckDewPointTemperature CheckDewPointTemperature Check the validity of the dew point temperature data
Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckDryBulbTemperature CheckDryBulbTemperature Check the validity of the dry bulb temperature data
Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckPressure CheckPressure Ensures that the interpolated pressure is between prescribed bounds
Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertTime ConvertTime Converts the simulation time to calendar time in scale of 1 year (365 days), or a multiple of a year
Buildings.BoundaryConditions.WeatherData.BaseClasses.EquationOfTime EquationOfTime Equation of time
Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterCeilingHeight LimiterCeilingHeight Block that limits the relative humidity
Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterHorizontalInfraredIrradiation LimiterHorizontalInfraredIrradiation Block that limits the horizontal infrared irradiation
Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterOpaqueSkyCover LimiterOpaqueSkyCover Block that limits the opaque sky cover
Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterRelativeHumidity LimiterRelativeHumidity Block that limits the relative humidity
Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterTotalSkyCover LimiterTotalSkyCover Block that limits the total sky cover
Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterWindDirection LimiterWindDirection Block that limits the wind direction
Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterWindSpeed LimiterWindSpeed Block that limits the wind speed
Buildings.BoundaryConditions.WeatherData.BaseClasses.LocalCivilTime LocalCivilTime Converts the clock time to local civil time.
Buildings.BoundaryConditions.WeatherData.BaseClasses.PartialLimiter PartialLimiter Partial block to limit a signal
Buildings.BoundaryConditions.WeatherData.BaseClasses.PartialLimiterMin PartialLimiterMin Partial block to limit a signal
Buildings.BoundaryConditions.WeatherData.BaseClasses.SolarTime SolarTime Solar time
Buildings.BoundaryConditions.WeatherData.BaseClasses.SourceSelector SourceSelector Block that selects as its output either a parameter value or its input
Buildings.BoundaryConditions.WeatherData.BaseClasses.SourceSelectorRadiation SourceSelectorRadiation Block that selects the solar radiation source and outputs the solar radiation quantities
Buildings.BoundaryConditions.WeatherData.BaseClasses.getAbsolutePath getAbsolutePath Gets the absolute path of a URI
Buildings.BoundaryConditions.WeatherData.BaseClasses.getAltitudeLocationTMY3 getAltitudeLocationTMY3 Gets the altitude from TMY3 file
Buildings.BoundaryConditions.WeatherData.BaseClasses.getHeaderElementTMY3 getHeaderElementTMY3 Gets an element from the header of a TMY3 weather data file
Buildings.BoundaryConditions.WeatherData.BaseClasses.getLastHeaderElementTMY3 getLastHeaderElementTMY3 Gets last element from the header of a TMY3 weather data file
Buildings.BoundaryConditions.WeatherData.BaseClasses.getLatitudeTMY3 getLatitudeTMY3 Gets the latitude from a TMY3 weather data file
Buildings.BoundaryConditions.WeatherData.BaseClasses.getLongitudeTMY3 getLongitudeTMY3 Gets the longitude from a TMY3 weather data file
Buildings.BoundaryConditions.WeatherData.BaseClasses.getTimeSpanTMY3 getTimeSpanTMY3 Get the time span of the weather data from the file
Buildings.BoundaryConditions.WeatherData.BaseClasses.getTimeZoneTMY3 getTimeZoneTMY3 Gets the time zone from a TMY3 weather data file
Buildings.BoundaryConditions.WeatherData.BaseClasses.Examples Examples Collection of models that illustrate model use and test models

Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckBlackBodySkyTemperature Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckBlackBodySkyTemperature

Check the validity of the black-body sky temperature data

Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckBlackBodySkyTemperature

Information

This component checks the value of the black-body sky temperature. If the temperature is outside TMin and TMax, the simulation will stop with an error.

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

Parameters

TypeNameDefaultDescription
TemperatureTMin203.15Minimum allowed temperature [K]
TemperatureTMax343.15Maximum allowed temperature [K]

Connectors

TypeNameDescription
input RealInputTInBlack-body sky temperature [K]
output RealOutputTBlaSkyBlack-body sky temperature [K]

Modelica definition

block CheckBlackBodySkyTemperature "Check the validity of the black-body sky temperature data" extends Modelica.Blocks.Icons.Block; parameter Modelica.Units.SI.Temperature TMin(displayUnit="degC") = 203.15 "Minimum allowed temperature"; parameter Modelica.Units.SI.Temperature TMax(displayUnit="degC") = 343.15 "Maximum allowed temperature"; Modelica.Blocks.Interfaces.RealInput TIn( final quantity="ThermodynamicTemperature", final unit="K", displayUnit="degC") "Black-body sky temperature"; Modelica.Blocks.Interfaces.RealOutput TBlaSky( final quantity="ThermodynamicTemperature", final unit="K", displayUnit="degC") "Black-body sky temperature"; equation TBlaSky = TIn; assert(noEvent(TIn > TMin and TIn < TMax), "In " + getInstanceName() + ": Weather data black-body sky temperature out of bounds.\n" + " TIn = " + String(TIn)); end CheckBlackBodySkyTemperature;

Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckDewPointTemperature Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckDewPointTemperature

Check the validity of the dew point temperature data

Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckDewPointTemperature

Information

This component checks the value of temperature. If the temperature is outside TMin and TMax, the simulation will stop with an error.

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

Parameters

TypeNameDefaultDescription
TemperatureTMin203.15Minimum allowed temperature [K]
TemperatureTMax343.15Maximum allowed temperature [K]

Connectors

TypeNameDescription
input RealInputTInInput Temperature [K]
output RealOutputTDewPoiDew point temperature [K]

Modelica definition

block CheckDewPointTemperature "Check the validity of the dew point temperature data" extends Modelica.Blocks.Icons.Block; Modelica.Blocks.Interfaces.RealInput TIn( final quantity="ThermodynamicTemperature", final unit="K", displayUnit="degC") "Input Temperature"; Modelica.Blocks.Interfaces.RealOutput TDewPoi( final quantity="ThermodynamicTemperature", final unit="K", displayUnit="degC") "Dew point temperature"; parameter Modelica.Units.SI.Temperature TMin(displayUnit="degC") = 203.15 "Minimum allowed temperature"; parameter Modelica.Units.SI.Temperature TMax(displayUnit="degC") = 343.15 "Maximum allowed temperature"; equation TDewPoi = TIn; assert(noEvent(TIn > TMin and TIn < TMax), "In " + getInstanceName() + ": Weather data dew point temperature out of bounds.\n" + " TIn = " + String( TIn)); end CheckDewPointTemperature;

Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckDryBulbTemperature Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckDryBulbTemperature

Check the validity of the dry bulb temperature data

Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckDryBulbTemperature

Information

This component checks the value of the dry bulb temperature. If the temperature is outside TMin and TMax, the simulation will stop with an error.

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

Parameters

TypeNameDefaultDescription
TemperatureTMin203.15Minimum allowed temperature [K]
TemperatureTMax343.15Maximum allowed temperature [K]

Connectors

TypeNameDescription
input RealInputTInInput Temperature [K]
output RealOutputTDryBulDry bulb temperature [K]

Modelica definition

block CheckDryBulbTemperature "Check the validity of the dry bulb temperature data" extends Modelica.Blocks.Icons.Block; Modelica.Blocks.Interfaces.RealInput TIn( final quantity="ThermodynamicTemperature", final unit="K", displayUnit="degC") "Input Temperature"; Modelica.Blocks.Interfaces.RealOutput TDryBul( final quantity="ThermodynamicTemperature", final unit="K", displayUnit="degC") "Dry bulb temperature"; parameter Modelica.Units.SI.Temperature TMin(displayUnit="degC") = 203.15 "Minimum allowed temperature"; parameter Modelica.Units.SI.Temperature TMax(displayUnit="degC") = 343.15 "Maximum allowed temperature"; equation TDryBul = TIn; assert(noEvent(TIn > TMin and TIn < TMax), "In " + getInstanceName() + ": Weather data dry bulb temperature out of bounds.\n" + " TIn = " + String( TIn)); end CheckDryBulbTemperature;

Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckPressure Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckPressure

Ensures that the interpolated pressure is between prescribed bounds

Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckPressure

Information

This component ensures that the interpolated pressure is between 31,000 Pa and 120,000 Pa.

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

Connectors

TypeNameDescription
input RealInputPInAtmospheric pressure [Pa]
output RealOutputpAtmAtmospheric pressure [Pa]

Modelica definition

block CheckPressure "Ensures that the interpolated pressure is between prescribed bounds" extends Modelica.Blocks.Icons.Block; Modelica.Blocks.Interfaces.RealInput PIn( final quantity="Pressure", final unit="Pa") "Atmospheric pressure"; Modelica.Blocks.Interfaces.RealOutput pAtm( final quantity="Pressure", final unit="Pa") "Atmospheric pressure"; constant Modelica.Units.SI.Pressure PMin=3100 "Minimum allowed pressure"; constant Modelica.Units.SI.Pressure PMax=120000 "Maximum allowed pressure"; equation pAtm = PIn; assert(noEvent(PIn > PMin and PIn < PMax), "In " + getInstanceName() + ": Weather data atmospheric pressure out of bounds.\n" + " PIn = " + String(PIn)); end CheckPressure;

Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertTime Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertTime

Converts the simulation time to calendar time in scale of 1 year (365 days), or a multiple of a year

Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertTime

Information

This component converts the simulation time to calendar time in a scale of 1 year (365 days), or a multiple of it, if this is the length of the weather file.

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

Parameters

TypeNameDefaultDescription
TimeweaDatStaTim Start time of weather data [s]
TimeweaDatEndTim End time of weather data [s]

Connectors

TypeNameDescription
input RealInputmodTimSimulation time [s]
output RealOutputcalTimCalendar time [s]

Modelica definition

block ConvertTime "Converts the simulation time to calendar time in scale of 1 year (365 days), or a multiple of a year" extends Modelica.Blocks.Icons.Block; parameter Modelica.Units.SI.Time weaDatStaTim(displayUnit="d") "Start time of weather data"; parameter Modelica.Units.SI.Time weaDatEndTim(displayUnit="d") "End time of weather data"; Modelica.Blocks.Interfaces.RealInput modTim( final quantity="Time", final unit="s") "Simulation time"; Modelica.Blocks.Interfaces.RealOutput calTim( final quantity="Time", final unit="s") "Calendar time"; protected constant Modelica.Units.SI.Time shiftSolarRad=1800 "Number of seconds for the shift for solar radiation calculation"; parameter Modelica.Units.SI.Time lenWea=weaDatEndTim - weaDatStaTim "Length of weather data"; parameter Boolean canRepeatWeatherFile = abs(mod(lenWea, 365*24*3600)) < 1E-2 "=true, if the weather file can be repeated, since it has the length of a year or a multiple of it"; discrete Modelica.Units.SI.Time tNext(start=0, fixed=true) "Start time of next period"; equation when {initial(), canRepeatWeatherFile and modTim > pre(tNext)} then // simulation time stamp went over the end time of the weather file //(last time stamp of the weather file + average increment) tNext = if canRepeatWeatherFile then integer(modTim/lenWea)*lenWea + lenWea else time; end when; calTim = if canRepeatWeatherFile then modTim - tNext + lenWea else modTim; assert(canRepeatWeatherFile or noEvent((time - weaDatEndTim) < shiftSolarRad), "In " + getInstanceName() + ": Insufficient weather data provided for the desired simulation period. The simulation time " + String(time) + " exceeds the end time " + String(weaDatEndTim) + " of the weather data file.", AssertionLevel.error); assert(canRepeatWeatherFile or noEvent(time >= weaDatStaTim), "In " + getInstanceName() + ": Insufficient weather data provided for the desired simulation period. The simulation time " + String(time) + " is less than the start time " + String(weaDatStaTim) + " of the weather data file.", AssertionLevel.error); end ConvertTime;

Buildings.BoundaryConditions.WeatherData.BaseClasses.EquationOfTime Buildings.BoundaryConditions.WeatherData.BaseClasses.EquationOfTime

Equation of time

Buildings.BoundaryConditions.WeatherData.BaseClasses.EquationOfTime

Information

This component computes the difference between solar noon and noon of local civic time.

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

Connectors

TypeNameDescription
input RealInputnDayZero-based day number in seconds (January 1=0, January 2=86400) [s]
output RealOutputeqnTimEquation of time [s]

Modelica definition

block EquationOfTime "Equation of time" extends Modelica.Blocks.Icons.Block; Modelica.Blocks.Interfaces.RealInput nDay( quantity="Time", unit="s") "Zero-based day number in seconds (January 1=0, January 2=86400)"; Modelica.Blocks.Interfaces.RealOutput eqnTim( final quantity="Time", final unit="s", displayUnit="min") "Equation of time"; protected Real Bt "Intermediate variable"; equation Bt = Modelica.Constants.pi*((nDay + 86400)/86400 - 81)/182 "Our unit is s instead of day in (A.4.2b)"; eqnTim = 60*(9.87*Modelica.Math.sin(2*Bt) - 7.53*Modelica.Math.cos(Bt) - 1.5* Modelica.Math.sin(Bt)) "Our unit is s instead of min in (A.4.2a)"; end EquationOfTime;

Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterCeilingHeight Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterCeilingHeight

Block that limits the relative humidity

Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterCeilingHeight

Information

Block that limits the cloud cover ceiling height to be positive.

This block is used because interpolation of weather data can lead to slightly negative values.

Extends from PartialLimiterMin (Partial block to limit a signal).

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output RealOutputceiHeiCloud cover ceiling height [m]

Modelica definition

block LimiterCeilingHeight "Block that limits the relative humidity" extends PartialLimiterMin; Modelica.Blocks.Interfaces.RealOutput ceiHei( final unit="m") = max(0, u) "Cloud cover ceiling height"; end LimiterCeilingHeight;

Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterHorizontalInfraredIrradiation Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterHorizontalInfraredIrradiation

Block that limits the horizontal infrared irradiation

Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterHorizontalInfraredIrradiation

Information

Block that limits the horizontal infrared irradiation to be positive.

This block is used because interpolation of weather data can lead to slightly negative values.

Extends from PartialLimiterMin (Partial block to limit a signal).

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output RealOutputHHorIRHorizontal infrared irradiation [W/m2]

Modelica definition

block LimiterHorizontalInfraredIrradiation "Block that limits the horizontal infrared irradiation" extends PartialLimiterMin; Modelica.Blocks.Interfaces.RealOutput HHorIR( final unit="W/m2") = max(0, u) "Horizontal infrared irradiation"; end LimiterHorizontalInfraredIrradiation;

Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterOpaqueSkyCover Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterOpaqueSkyCover

Block that limits the opaque sky cover

Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterOpaqueSkyCover

Information

Block that limits the opaque sky cover.

This block is used because interpolation of weather data can lead to slightly negative values.

Extends from PartialLimiter (Partial block to limit a signal).

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output RealOutputnOpaOpaque sky cover [1]

Modelica definition

block LimiterOpaqueSkyCover "Block that limits the opaque sky cover" extends PartialLimiter; Modelica.Blocks.Interfaces.RealOutput nOpa( final unit="1") "Opaque sky cover"; equation nOpa = min(uMax, max(uMin, u)); end LimiterOpaqueSkyCover;

Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterRelativeHumidity Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterRelativeHumidity

Block that limits the relative humidity

Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterRelativeHumidity

Information

Block that limits the relative humidity.

This block is used because interpolation of weather data can lead to slightly negative values.

Extends from PartialLimiter (Partial block to limit a signal).

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output RealOutputrelHumRelative humidity [1]

Modelica definition

block LimiterRelativeHumidity "Block that limits the relative humidity" extends PartialLimiter; Modelica.Blocks.Interfaces.RealOutput relHum( final unit="1") "Relative humidity"; equation relHum = min(uMax, max(uMin, u)); end LimiterRelativeHumidity;

Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterTotalSkyCover Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterTotalSkyCover

Block that limits the total sky cover

Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterTotalSkyCover

Information

Block that limits the total sky cover.

This block is used because interpolation of weather data can lead to slightly negative values.

Extends from PartialLimiter (Partial block to limit a signal).

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output RealOutputnTotTotal sky cover [1]

Modelica definition

block LimiterTotalSkyCover "Block that limits the total sky cover" extends PartialLimiter; Modelica.Blocks.Interfaces.RealOutput nTot( final unit="1") "Total sky cover"; equation nTot = min(uMax, max(uMin, u)); end LimiterTotalSkyCover;

Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterWindDirection Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterWindDirection

Block that limits the wind direction

Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterWindDirection

Information

Block that limits the wind direction.

This block is used because interpolation of weather data can lead to slightly negative values.

Extends from PartialLimiter (Partial block to limit a signal).

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output RealOutputwinDirWind direction [rad]

Modelica definition

block LimiterWindDirection "Block that limits the wind direction" extends PartialLimiter( final uMax=2*Modelica.Constants.pi); Modelica.Blocks.Interfaces.RealOutput winDir( final unit="rad") "Wind direction"; equation winDir = min(uMax, max(uMin, u)); end LimiterWindDirection;

Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterWindSpeed Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterWindSpeed

Block that limits the wind speed

Buildings.BoundaryConditions.WeatherData.BaseClasses.LimiterWindSpeed

Information

Block that limits the wind speed to be positive.

This block is used because interpolation of weather data can lead to slightly negative values.

Extends from PartialLimiterMin (Partial block to limit a signal).

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output RealOutputwinSpeWind speed [m/s]

Modelica definition

block LimiterWindSpeed "Block that limits the wind speed" extends PartialLimiterMin; Modelica.Blocks.Interfaces.RealOutput winSpe( final unit="m/s") = max(0, u) "Wind speed"; end LimiterWindSpeed;

Buildings.BoundaryConditions.WeatherData.BaseClasses.LocalCivilTime Buildings.BoundaryConditions.WeatherData.BaseClasses.LocalCivilTime

Converts the clock time to local civil time.

Buildings.BoundaryConditions.WeatherData.BaseClasses.LocalCivilTime

Information

This component converts the clock time to local civil time. The parameter timZon represents the time zone of the facility (relative to Greenwich Mean Time or the 0th meridian). Time zones west of GMT (e.g. North America) are represented as negative; east of GMT as positive. Fraction of hours are represented in decimals (e.g. for 6:30, use 6.5).

The formula is based on Michael Wetter's thesis (A4.1):

  locTim = greTim + (lon*180/pi)*86400/360 = cloTim - timZon + lon*43200/pi

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

Parameters

TypeNameDefaultDescription
TimetimZon Time zone [s]
Anglelon Longitude [rad]

Connectors

TypeNameDescription
input RealInputcloTimClock time [s]
output RealOutputlocTimLocal civil time [s]

Modelica definition

block LocalCivilTime "Converts the clock time to local civil time." extends Modelica.Blocks.Icons.Block; Modelica.Blocks.Interfaces.RealInput cloTim( final quantity="Time", final unit="s") "Clock time"; parameter Modelica.Units.SI.Time timZon(displayUnit="h") "Time zone"; parameter Modelica.Units.SI.Angle lon(displayUnit="deg") "Longitude"; Modelica.Blocks.Interfaces.RealOutput locTim( final quantity="Time", final unit="s") "Local civil time"; protected final parameter Modelica.Units.SI.Time diff=-timZon + lon*43200/Modelica.Constants.pi "Difference between local and clock time"; equation locTim = cloTim + diff; end LocalCivilTime;

Buildings.BoundaryConditions.WeatherData.BaseClasses.PartialLimiter Buildings.BoundaryConditions.WeatherData.BaseClasses.PartialLimiter

Partial block to limit a signal

Buildings.BoundaryConditions.WeatherData.BaseClasses.PartialLimiter

Information

Block that computes y_internal=min(uMax, max(uMin, u)), where y_internal is a protected connector.

This block is used because interpolation of weather data can lead to a slight overshoot of values. This block is extended by other blocks that then provide the output connector. Extending this block is needed for the output connector to have the correct comment string in the weather data bus, because the weather data bus displays the comment string of the output signal that is connected to the weather data bus. Without this construct, the weather data bus would simply show "Connector of Real output signal".

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

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal

Modelica definition

partial block PartialLimiter "Partial block to limit a signal" extends Modelica.Blocks.Icons.Block; constant Real uMin = 0 "Minimum value"; constant Real uMax = 1 "Maximum value"; Modelica.Blocks.Interfaces.RealInput u "Connector of Real input signal"; end PartialLimiter;

Buildings.BoundaryConditions.WeatherData.BaseClasses.PartialLimiterMin Buildings.BoundaryConditions.WeatherData.BaseClasses.PartialLimiterMin

Partial block to limit a signal

Buildings.BoundaryConditions.WeatherData.BaseClasses.PartialLimiterMin

Information

Partial block that is used to limit a signal by a minimum value.

This block is used because interpolation of weather data can lead to slightly negative values. This block is extended by other blocks that then provide the output connector. Extending this block is needed for the output connector to have the correct comment string in the weather data bus, because the weather data bus displays the comment string of the output signal that is connected to the weather data bus. Without this construct, the weather data bus would simply show "Connector of Real output signal".

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

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal

Modelica definition

partial block PartialLimiterMin "Partial block to limit a signal" extends Modelica.Blocks.Icons.Block; Modelica.Blocks.Interfaces.RealInput u "Connector of Real input signal"; end PartialLimiterMin;

Buildings.BoundaryConditions.WeatherData.BaseClasses.SolarTime Buildings.BoundaryConditions.WeatherData.BaseClasses.SolarTime

Solar time

Buildings.BoundaryConditions.WeatherData.BaseClasses.SolarTime

Information

This component computes the local solar time.

Note: To avoid events, this block does not convert solar time to a scale of 24 hours.

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

Connectors

TypeNameDescription
input RealInputlocTimLocal time [s]
input RealInputequTimEquation of time [s]
output RealOutputsolTimSolar time [s]

Modelica definition

block SolarTime "Solar time" extends Modelica.Blocks.Icons.Block; Modelica.Blocks.Interfaces.RealInput locTim(quantity="Time", unit="s") "Local time"; Modelica.Blocks.Interfaces.RealInput equTim(quantity="Time", unit="s") "Equation of time"; Modelica.Blocks.Interfaces.RealOutput solTim( final quantity="Time", final unit="s", displayUnit="s") "Solar time"; equation solTim = locTim + equTim "Our unit is s in stead of h in (A.4.3)"; end SolarTime;

Buildings.BoundaryConditions.WeatherData.BaseClasses.SourceSelector Buildings.BoundaryConditions.WeatherData.BaseClasses.SourceSelector

Block that selects as its output either a parameter value or its input

Buildings.BoundaryConditions.WeatherData.BaseClasses.SourceSelector

Information

Block that produces at its output the input value uCon, uFil or the parameter value p depending on the parameter value datSou.

Extends from Modelica.Blocks.Interfaces.SO (Single Output continuous control block).

Parameters

TypeNameDefaultDescription
DataSourcedatSou Data source
Realp Parameter value

Connectors

TypeNameDescription
output RealOutputyConnector of Real output signal
input RealInputuFilInput signal from file reader
input RealInputuConInput signal from input connector

Modelica definition

block SourceSelector "Block that selects as its output either a parameter value or its input" extends Modelica.Blocks.Interfaces.SO; parameter Buildings.BoundaryConditions.Types.DataSource datSou "Data source"; parameter Real p "Parameter value"; Modelica.Blocks.Interfaces.RealInput uFil if datSou == Buildings.BoundaryConditions.Types.DataSource.File "Input signal from file reader"; Modelica.Blocks.Interfaces.RealInput uCon if datSou == Buildings.BoundaryConditions.Types.DataSource.Input "Input signal from input connector"; equation if datSou == Buildings.BoundaryConditions.Types.DataSource.Parameter then y = p; end if; connect(uCon, y); connect(uFil, y); end SourceSelector;

Buildings.BoundaryConditions.WeatherData.BaseClasses.SourceSelectorRadiation Buildings.BoundaryConditions.WeatherData.BaseClasses.SourceSelectorRadiation

Block that selects the solar radiation source and outputs the solar radiation quantities

Buildings.BoundaryConditions.WeatherData.BaseClasses.SourceSelectorRadiation

Information

Block that outputs the direct normal, diffuse horizontal and diffuse global solar irradiation. This block computes these output quantities based on conditionally provided input signals.

The computations are based on Wetter (2004).

References

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

Parameters

TypeNameDefaultDescription
RadiationDataSourcedatSou Data source

Connectors

TypeNameDescription
input RealInputHDirNorFilDirect normal solar irradiation from weather data file [W/m2]
input RealInputHDirNorInDirect normal solar irradiation from input connector [W/m2]
input RealInputHDifHorFilDiffuse horizontal solar irradiation from weather data file [W/m2]
input RealInputHDifHorInDiffuse horizontal solar irradiation from input connector [W/m2]
input RealInputHGloHorFilGlobal horizontal solar irradiation from weather data file [W/m2]
input RealInputHGloHorInGlobal horizontal solar irradiation from input connector [W/m2]
input RealInputzenZenith angle [rad]
output RealOutputHDirNorDirect normal solar irradiation [W/m2]
output RealOutputHDifHorDiffuse horizontal solar irradiation [W/m2]
output RealOutputHGloHorGlobal horizontal solar irradiation [W/m2]

Modelica definition

block SourceSelectorRadiation "Block that selects the solar radiation source and outputs the solar radiation quantities" extends Modelica.Blocks.Icons.Block; parameter Buildings.BoundaryConditions.Types.RadiationDataSource datSou "Data source"; Modelica.Blocks.Interfaces.RealInput HDirNorFil( final quantity="RadiantEnergyFluenceRate", final unit="W/m2") if datSou == Buildings.BoundaryConditions.Types.RadiationDataSource.File "Direct normal solar irradiation from weather data file"; Modelica.Blocks.Interfaces.RealInput HDirNorIn( final quantity="RadiantEnergyFluenceRate", final unit="W/m2") if datSou == Buildings.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HDifHor or datSou == Buildings.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HGloHor "Direct normal solar irradiation from input connector"; Modelica.Blocks.Interfaces.RealInput HDifHorFil( final quantity="RadiantEnergyFluenceRate", final unit="W/m2") if datSou == Buildings.BoundaryConditions.Types.RadiationDataSource.File "Diffuse horizontal solar irradiation from weather data file"; Modelica.Blocks.Interfaces.RealInput HDifHorIn( final quantity="RadiantEnergyFluenceRate", final unit="W/m2") if datSou == Buildings.BoundaryConditions.Types.RadiationDataSource.Input_HGloHor_HDifHor or datSou == Buildings.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HDifHor "Diffuse horizontal solar irradiation from input connector"; Modelica.Blocks.Interfaces.RealInput HGloHorFil( final quantity="RadiantEnergyFluenceRate", final unit="W/m2") if datSou == Buildings.BoundaryConditions.Types.RadiationDataSource.File "Global horizontal solar irradiation from weather data file"; Modelica.Blocks.Interfaces.RealInput HGloHorIn( final quantity="RadiantEnergyFluenceRate", final unit="W/m2") if datSou == Buildings.BoundaryConditions.Types.RadiationDataSource.Input_HGloHor_HDifHor or datSou == Buildings.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HGloHor "Global horizontal solar irradiation from input connector"; Modelica.Blocks.Interfaces.RealInput zen( final quantity="Angle", final unit="rad") "Zenith angle"; Modelica.Blocks.Interfaces.RealOutput HDirNor( final quantity="RadiantEnergyFluenceRate", final unit="W/m2") "Direct normal solar irradiation"; Modelica.Blocks.Interfaces.RealOutput HDifHor( final quantity="RadiantEnergyFluenceRate", final unit="W/m2") "Diffuse horizontal solar irradiation"; Modelica.Blocks.Interfaces.RealOutput HGloHor( final quantity="RadiantEnergyFluenceRate", final unit="W/m2") "Global horizontal solar irradiation"; protected constant Real epsCos = 1e-6 "Small value to avoid division by 0"; constant Modelica.Units.SI.HeatFlux solCon=1367.7 "Solar constant"; // Conditional connectors 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"; equation // Conditional connect statements connect(HGloHor_in_internal, HGloHorFil); connect(HDifHor_in_internal, HDifHorFil); connect(HDirNor_in_internal, HDirNorFil); connect(HGloHor_in_internal, HGloHorIn); connect(HDifHor_in_internal, HDifHorIn); connect(HDirNor_in_internal, HDirNorIn); //--------------------------------------------------------------------------- // Select global horizontal radiation connector if datSou == Buildings.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HDifHor then HGloHor = max(0, HDirNor_in_internal*cos(zen)+HDifHor_in_internal) "Calculate the HGloHor using HDirNor and HDifHor according to (A.4.14) and (A.4.15)"; HGloHor_in_internal = 0; else HGloHor = max(0, HGloHor_in_internal) "Get HGloHor using weather data file or input connector of weather data reader"; end if; //--------------------------------------------------------------------------- // Select diffuse horizontal radiation connector if datSou == Buildings.BoundaryConditions.Types.RadiationDataSource.Input_HDirNor_HGloHor then HDifHor = max(0, HGloHor_in_internal - HDirNor_in_internal*cos(zen)) "Calculate the HGloHor using HDirNor and HDifHor according to (A.4.14) and (A.4.15)"; HDifHor_in_internal = 0; else HDifHor = max(0, HDifHor_in_internal) "Get HDifHor using weather data file or input connector of weather data reader"; end if; //--------------------------------------------------------------------------- // Select direct normal radiation connector if datSou == Buildings.BoundaryConditions.Types.RadiationDataSource.Input_HGloHor_HDifHor then HDirNor = max(0, min( solCon, (HGloHor_in_internal -HDifHor_in_internal)* Buildings.Utilities.Math.Functions.spliceFunction( x=cos(zen), pos=Buildings.Utilities.Math.Functions.inverseXRegularized(cos(zen), epsCos), neg=0, deltax=epsCos))) "Calculate the HDirNor using HGloHor and HDifHor according to (A.4.14) and (A.4.15)"; HDirNor_in_internal = 0; else HDirNor = max(0, HDirNor_in_internal) "Get HDirNor using weather data file or input connector of weather data reader"; end if; end SourceSelectorRadiation;

Buildings.BoundaryConditions.WeatherData.BaseClasses.getAbsolutePath Buildings.BoundaryConditions.WeatherData.BaseClasses.getAbsolutePath

Gets the absolute path of a URI

Information

The function returns the absolute path of a uniform resource identifier (URI) or local file name. If the file is not found, then this function terminates with an assert.

This function has been introduced to allow users to specify the name of weather data files with a path that is relative to the library path. This allows users to change the current working directory while still being able to read the files.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
Stringuri A URI

Outputs

TypeNameDescription
StringpathThe absolute path of the file pointed to by the URI

Modelica definition

pure function getAbsolutePath "Gets the absolute path of a URI" extends Modelica.Icons.Function; input String uri "A URI"; output String path "The absolute path of the file pointed to by the URI"; algorithm path := Modelica.Utilities.Files.loadResource(uri); end getAbsolutePath;

Buildings.BoundaryConditions.WeatherData.BaseClasses.getAltitudeLocationTMY3 Buildings.BoundaryConditions.WeatherData.BaseClasses.getAltitudeLocationTMY3

Gets the altitude from TMY3 file

Information

This function returns the altitude of the TMY3 weather data file.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
StringfilNam Name of weather data file

Outputs

TypeNameDescription
LengthaltAltitude of TMY3 location [m]

Modelica definition

impure function getAltitudeLocationTMY3 "Gets the altitude from TMY3 file" extends Modelica.Icons.Function; input String filNam "Name of weather data file"; output Modelica.Units.SI.Length alt "Altitude of TMY3 location"; protected Integer nexInd "Next index, used for error handling"; String element "String representation of the returned element"; algorithm element := Buildings.BoundaryConditions.WeatherData.BaseClasses.getLastHeaderElementTMY3( filNam=filNam, start="#LOCATION", name = "Altitude"); (nexInd, alt) :=Modelica.Utilities.Strings.Advanced.scanReal( string=element, startIndex=1, unsigned=false); end getAltitudeLocationTMY3;

Buildings.BoundaryConditions.WeatherData.BaseClasses.getHeaderElementTMY3 Buildings.BoundaryConditions.WeatherData.BaseClasses.getHeaderElementTMY3

Gets an element from the header of a TMY3 weather data file

Information

This function scans the weather data file for a line that starts with the string
start
where start is a parameter. When this line is found, the function returns the element at the position number position, where position is a parameter. A comma is used as the delimiter of the elements.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
StringfilNam Name of weather data file
Stringstart Start of the string that contains the elements
Stringname Name of data element, used in error reporting
Integerposition Position of the element on the line that contains 'start'

Outputs

TypeNameDescription
StringelementElement at position 'pos' of the line that starts with 'start'

Modelica definition

impure function getHeaderElementTMY3 "Gets an element from the header of a TMY3 weather data file" extends Modelica.Icons.Function; input String filNam "Name of weather data file"; input String start "Start of the string that contains the elements"; input String name "Name of data element, used in error reporting"; input Integer position(min=1) "Position of the element on the line that contains 'start'"; output String element "Element at position 'pos' of the line that starts with 'start'"; protected String lin "Line that is used in parser"; Integer iLin "Line number"; Integer index = 0 "Index of string #LOCATION"; Integer staInd "Start index used when parsing a real number"; Integer nexInd "Next index used when parsing a real number"; Boolean found "Flag, true if #LOCATION has been found"; Boolean EOF "Flag, true if EOF has been reached"; String fouDel "Found delimiter"; algorithm // Get line that starts with 'start' iLin :=0; EOF :=false; while (not EOF) and (index == 0) loop iLin:=iLin + 1; (lin, EOF) :=Modelica.Utilities.Streams.readLine(fileName=filNam, lineNumber=iLin); index :=Modelica.Utilities.Strings.find( string=lin, searchString=start, startIndex=1, caseSensitive=false); end while; assert(not EOF, "Error: Did not find '" + start + "' when scanning the weather file." + "\n Check for correct weather file syntax."); // Loop over the tokens until the position is reached nexInd :=1; for i in 1:position-1 loop nexInd :=Modelica.Utilities.Strings.find( string=lin, searchString = ",", startIndex=nexInd+1); assert(nexInd > 0, "Error when scanning weather file. Not enough tokens to find " + name + "." + "\n Check for correct file syntax." + "\n The scanned line is '" + lin + "'."); end for; staInd := nexInd; // Find the next delimiter nexInd :=Modelica.Utilities.Strings.find( string=lin, searchString = ",", startIndex=nexInd+1); assert(nexInd > 0, "Error when scanning weather file. Not enough tokens to find " + name + "." + "\n Check for correct file syntax." + "\n The scanned line is '" + lin + "'."); // Get the element element :=Modelica.Utilities.Strings.substring(lin, startIndex=staInd+1, endIndex=nexInd-1); end getHeaderElementTMY3;

Buildings.BoundaryConditions.WeatherData.BaseClasses.getLastHeaderElementTMY3 Buildings.BoundaryConditions.WeatherData.BaseClasses.getLastHeaderElementTMY3

Gets last element from the header of a TMY3 weather data file

Information

This function scans the weather data file for a line that starts with the string
start
where start is a parameter. When this line is found, the function returns the element at the position number position, where position is a parameter. A comma is used as the delimiter of the elements.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
StringfilNam Name of weather data file
Stringstart Start of the string that contains the elements
Stringname Name of data element, used in error reporting

Outputs

TypeNameDescription
StringelementElement at position 'pos' of the line that starts with 'start'

Modelica definition

impure function getLastHeaderElementTMY3 "Gets last element from the header of a TMY3 weather data file" extends Modelica.Icons.Function; input String filNam "Name of weather data file"; input String start "Start of the string that contains the elements"; input String name "Name of data element, used in error reporting"; output String element "Element at position 'pos' of the line that starts with 'start'"; protected String lin "Line that is used in parser"; Integer iLin "Line number"; Integer index = 0 "Index of string #LOCATION"; Integer staInd "Start index used when parsing a real number"; Integer lasInd "Next index used when parsing a real number"; Boolean EOF "Flag, true if EOF has been reached"; algorithm // Get line that starts with 'start' iLin :=0; EOF :=false; while (not EOF) and (index == 0) loop iLin:=iLin + 1; (lin, EOF) :=Modelica.Utilities.Streams.readLine(fileName=filNam, lineNumber=iLin); index :=Modelica.Utilities.Strings.find( string=lin, searchString=start, startIndex=1, caseSensitive=false); end while; assert(not EOF, "Error: Did not find '" + start + "' when scanning the weather file." + "\n Check for correct weather file syntax."); // gest first and last index of the last string header element staInd := Modelica.Utilities.Strings.findLast( string=lin, searchString = ",", startIndex=0); lasInd := integer(Modelica.Utilities.Strings.length(lin)); // Get the element element :=Modelica.Utilities.Strings.substring(lin, startIndex=staInd+1, endIndex=lasInd); end getLastHeaderElementTMY3;

Buildings.BoundaryConditions.WeatherData.BaseClasses.getLatitudeTMY3 Buildings.BoundaryConditions.WeatherData.BaseClasses.getLatitudeTMY3

Gets the latitude from a TMY3 weather data file

Information

This function returns the latitude of the TMY3 weather data file.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
StringfilNam Name of weather data file

Outputs

TypeNameDescription
AnglelatLatitude from the weather file [rad]

Modelica definition

impure function getLatitudeTMY3 "Gets the latitude from a TMY3 weather data file" extends Modelica.Icons.Function; input String filNam "Name of weather data file"; output Modelica.Units.SI.Angle lat "Latitude from the weather file"; protected Integer nexInd "Next index, used for error handling"; String element "String representation of the returned element"; algorithm element := Buildings.BoundaryConditions.WeatherData.BaseClasses.getHeaderElementTMY3( filNam=filNam, start="#LOCATION", name = "latitude", position=7); (nexInd, lat) :=Modelica.Utilities.Strings.Advanced.scanReal( string=element, startIndex=1, unsigned=false); assert(nexInd > 1, "Error when converting the latitude '" + element + "' from a String to a Real."); // Convert from degree to rad lat :=lat*Modelica.Constants.pi/180; // Check if latitude is valid assert(abs(lat) <= Modelica.Constants.pi+Modelica.Constants.eps, "Wrong value for latitude. Received lat = " + String(lat) + " (= " + String(lat*180/Modelica.Constants.pi) + " degrees)."); end getLatitudeTMY3;

Buildings.BoundaryConditions.WeatherData.BaseClasses.getLongitudeTMY3 Buildings.BoundaryConditions.WeatherData.BaseClasses.getLongitudeTMY3

Gets the longitude from a TMY3 weather data file

Information

This function returns the longitude of the TMY3 weather data file.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
StringfilNam Name of weather data file

Outputs

TypeNameDescription
AnglelonLongitude from the weather file [rad]

Modelica definition

impure function getLongitudeTMY3 "Gets the longitude from a TMY3 weather data file" extends Modelica.Icons.Function; input String filNam "Name of weather data file"; output Modelica.Units.SI.Angle lon "Longitude from the weather file"; protected Integer nexInd "Next index, used for error handling"; String element "String representation of the returned element"; algorithm element := Buildings.BoundaryConditions.WeatherData.BaseClasses.getHeaderElementTMY3( filNam=filNam, start="#LOCATION", name = "longitude", position=8); (nexInd, lon) :=Modelica.Utilities.Strings.Advanced.scanReal( string=element, startIndex=1, unsigned=false); assert(nexInd > 1, "Error when converting the longitude '" + element + "' from a String to a Real."); // Convert from degree to rad lon :=lon*Modelica.Constants.pi/180; // Check if longitude is valid assert(abs(lon) < 2*Modelica.Constants.pi, "Wrong value for longitude. Received lon = " + String(lon) + " (= " + String(lon*180/Modelica.Constants.pi) + " degrees)."); end getLongitudeTMY3;

Buildings.BoundaryConditions.WeatherData.BaseClasses.getTimeSpanTMY3 Buildings.BoundaryConditions.WeatherData.BaseClasses.getTimeSpanTMY3

Get the time span of the weather data from the file

Information

This function returns the start time (first time stamp) and end time (last time stamp plus average increment) of the TMY3 weather data file.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
StringfilNam Name of weather data file
StringtabNam Name of table on weather file

Outputs

TypeNameDescription
TimetimeSpan[2]Start time, end time of weather data [s]

Modelica definition

impure function getTimeSpanTMY3 "Get the time span of the weather data from the file" extends Modelica.Icons.Function; input String filNam "Name of weather data file"; input String tabNam "Name of table on weather file"; output Modelica.Units.SI.Time[2] timeSpan "Start time, end time of weather data"; external "C" getTimeSpan(filNam, tabNam, timeSpan); end getTimeSpanTMY3;

Buildings.BoundaryConditions.WeatherData.BaseClasses.getTimeZoneTMY3 Buildings.BoundaryConditions.WeatherData.BaseClasses.getTimeZoneTMY3

Gets the time zone from a TMY3 weather data file

Information

This function returns the time zone of the TMY3 weather data file.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
StringfilNam Name of weather data file

Outputs

TypeNameDescription
TimetimZonTime zone from the weather file [s]

Modelica definition

impure function getTimeZoneTMY3 "Gets the time zone from a TMY3 weather data file" extends Modelica.Icons.Function; input String filNam "Name of weather data file"; output Modelica.Units.SI.Time timZon "Time zone from the weather file"; protected Integer nexInd "Next index, used for error handling"; String element "String representation of the returned element"; algorithm element := Buildings.BoundaryConditions.WeatherData.BaseClasses.getHeaderElementTMY3( filNam=filNam, start="#LOCATION", name = "longitude", position=9); (nexInd, timZon) :=Modelica.Utilities.Strings.Advanced.scanReal( string=element, startIndex=1, unsigned=false); assert(nexInd > 1, "Error when converting the time zone '" + element + "' from a String to a Real."); timZon :=timZon*3600; // Check if time zone is valid assert(abs(timZon) < 24*3600, "Wrong value for time zone. Received timZon = " + String(timZon) + " (= " + String(timZon/3600) + " hours)."); end getTimeZoneTMY3;