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

NameDescription
Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckCeilingHeight CheckCeilingHeight Ensures that the ceiling height is above a lower bound
Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckPressure CheckPressure Ensures that the interpolated pressure is between prescribed bounds
Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckSkyCover CheckSkyCover Constrains the sky cover to [0, 1]
Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckWindDirection CheckWindDirection Constrains the wind direction to [0, 2*pi] degree
Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckWindSpeed CheckWindSpeed Ensures that the wind speed is non-negative
Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertRadiation ConvertRadiation Converts the units and ensures that the radiation is not smaller than 0
Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertRelativeHumidity ConvertRelativeHumidity Converts the relative humidity from percentage to [0, 1] and constrains it to [0, 1]
Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertTemperature ConvertTemperature Converts the temperature unit from Celsius to Kelvin and checks the validity of data
Buildings.BoundaryConditions.WeatherData.BaseClasses.EquationOfTime EquationOfTime Equation of time
Buildings.BoundaryConditions.WeatherData.BaseClasses.LocalCivilTime LocalCivilTime Converts the clock time to local civil time.
Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertTime ConvertTime Converts the simulation time to calendar time in scale of 1 year (365 days)
Buildings.BoundaryConditions.WeatherData.BaseClasses.SolarTime SolarTime Solar time
Buildings.BoundaryConditions.WeatherData.BaseClasses.getHeaderElementTMY3 getHeaderElementTMY3 Gets an element from the header of a TMY3 weather data file
Buildings.BoundaryConditions.WeatherData.BaseClasses.getLongitudeTMY3 getLongitudeTMY3 Gets the longitude from a TMY3 weather data 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.CheckCeilingHeight Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckCeilingHeight

Ensures that the ceiling height is above a lower bound

Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckCeilingHeight

Information


This component ensures that the ceiling height is at least 0 meters.

Extends from Modelica.Blocks.Interfaces.BlockIcon (Basic graphical layout of input/output block).

Connectors

TypeNameDescription
input RealInputceiHeiInInput ceiling height [m]
output RealOutputceiHeiOutCeiling height [m]

Modelica definition

block CheckCeilingHeight 
  "Ensures that the ceiling height is above a lower bound"
  extends Modelica.Blocks.Interfaces.BlockIcon;
public 
  Modelica.Blocks.Interfaces.RealInput ceiHeiIn(final quantity="Height", final unit=
           "m") "Input ceiling height";
  Modelica.Blocks.Interfaces.RealOutput ceiHeiOut(final quantity="Height",
      final unit="m") "Ceiling height";
  constant Modelica.SIunits.Height ceiHeiMin=0 "Minimum allowed ceiling height";
equation 

  ceiHeiOut = Buildings.Utilities.Math.Functions.smoothMax(
    ceiHeiIn,
    ceiHeiMin,
    0.1);

end CheckCeilingHeight;

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.Interfaces.BlockIcon (Basic graphical layout of input/output block).

Connectors

TypeNameDescription
input RealInputPInInput pressure [Pa]
output RealOutputPOutAtmospheric pressure [Pa]

Modelica definition

block CheckPressure 
  "Ensures that the interpolated pressure is between prescribed bounds"
  extends Modelica.Blocks.Interfaces.BlockIcon;
public 
  Modelica.Blocks.Interfaces.RealInput PIn(final quantity="Pressure", final unit=
           "Pa") "Input pressure";
  Modelica.Blocks.Interfaces.RealOutput POut(final quantity="Pressure", final unit=
           "Pa") "Atmospheric pressure";
  constant Modelica.SIunits.Pressure PMin=3100 "Minimum allowed pressure";
  constant Modelica.SIunits.Pressure PMax=120000 "Maximum allowed pressure";
equation 
  assert(PIn > PMin, "Pressure out of bounds.\n" + "   PIn = " + realString(PIn));
  assert(PIn < PMax, "Pressure out of bounds.\n" + "   PIn = " + realString(PIn));
  POut = PIn;

end CheckPressure;

Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckSkyCover Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckSkyCover

Constrains the sky cover to [0, 1]

Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckSkyCover

Information


This component constrains the interpolated sky cover between 0 and 10.

Extends from Modelica.Blocks.Interfaces.BlockIcon (Basic graphical layout of input/output block).

Connectors

TypeNameDescription
input RealInputnInInput sky cover [0, 10]
output RealOutputnOutSky cover [0, 10] [1]

Modelica definition

block CheckSkyCover "Constrains the sky cover to [0, 1]"
  extends Modelica.Blocks.Interfaces.BlockIcon;
public 
  Modelica.Blocks.Interfaces.RealInput nIn "Input sky cover [0, 10]";
  Modelica.Blocks.Interfaces.RealOutput nOut(unit="1") "Sky cover [0, 10]";

  constant Real delta=0.01 "Smoothing parameter";
protected 
  constant Real nMin=delta "Lower bound";
  constant Real nMax=10 - delta "Upper bound";
equation 
  nOut = Buildings.Utilities.Math.Functions.smoothLimit(
    nIn,
    nMin,
    nMax,
    delta/10)/10;
end CheckSkyCover;

Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckWindDirection Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckWindDirection

Constrains the wind direction to [0, 2*pi] degree

Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckWindDirection

Information


This component constrains the interpolated wind direction between 0 and 360 degree.

Extends from Modelica.Blocks.Interfaces.BlockIcon (Basic graphical layout of input/output block).

Connectors

TypeNameDescription
input RealInputnInInput wind direction [deg]
output RealOutputnOutWind direction [rad]

Modelica definition

block CheckWindDirection 
  "Constrains the wind direction to [0, 2*pi] degree"
  extends Modelica.Blocks.Interfaces.BlockIcon;
public 
  Modelica.Blocks.Interfaces.RealInput nIn(
    final quantity="Angle",
    final unit="deg",
    displayUnit="deg") "Input wind direction";
  Modelica.Blocks.Interfaces.RealOutput nOut(
    final quantity="Angle",
    final unit="rad",
    displayUnit="deg") "Wind direction";

  constant Real delta=0.01 "Smoothing parameter";
protected 
  constant Real nMin=0 "Lower bound";
  constant Real nMax=2*Modelica.Constants.pi "Upper bound";
equation 

  nOut = Buildings.Utilities.Math.Functions.smoothLimit(
    nIn/360*nMax,
    nMin,
    nMax,
    delta/10);
end CheckWindDirection;

Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckWindSpeed Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckWindSpeed

Ensures that the wind speed is non-negative

Buildings.BoundaryConditions.WeatherData.BaseClasses.CheckWindSpeed

Information


This component ensures that the wind speed is non-negative.

Extends from Modelica.Blocks.Interfaces.BlockIcon (Basic graphical layout of input/output block).

Connectors

TypeNameDescription
input RealInputwinSpeInInput wind speed [m/s]
output RealOutputwinSpeOutWind speed [m/s]

Modelica definition

block CheckWindSpeed "Ensures that the wind speed is non-negative"
  extends Modelica.Blocks.Interfaces.BlockIcon;
public 
  Modelica.Blocks.Interfaces.RealInput winSpeIn(final quantity="Velocity",
      final unit="m/s") "Input wind speed";
  Modelica.Blocks.Interfaces.RealOutput winSpeOut(final quantity="Velocity",
      final unit="m/s") "Wind speed";
  constant Modelica.SIunits.Velocity winSpeMin=1e-6 
    "Minimum allowed wind speed";

equation 
  // Modelica Table will interpolate data when it reads the weather data file.
  // It can generate negative values due to the interpolation.
  winSpeOut = Buildings.Utilities.Math.Functions.smoothMax(
    x1=winSpeIn,
    x2=winSpeMin,
    deltaX=winSpeMin/10);

end CheckWindSpeed;

Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertRadiation Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertRadiation

Converts the units and ensures that the radiation is not smaller than 0

Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertRadiation

Information


This component ensures that the radiation is not smaller than 0. It also converts the weather data from Wh/m2, which is the unit used in the Typical Meteorological Year weather format, to W/m2.

Extends from Modelica.Blocks.Interfaces.BlockIcon (Basic graphical layout of input/output block).

Connectors

TypeNameDescription
input RealInputHInInput radiation (Wh/m2) [W.h/m2]
output RealOutputHOutRadiation [W/m2]

Modelica definition

block ConvertRadiation 
  "Converts the units and ensures that the radiation is not smaller than 0"
  extends Modelica.Blocks.Interfaces.BlockIcon;
public 
  Modelica.Blocks.Interfaces.RealInput HIn(final unit="W.h/m2") 
    "Input radiation (Wh/m2)";
  Modelica.Blocks.Interfaces.RealOutput HOut(final quantity=
        "RadiantEnergyFluenceRate", final unit="W/m2") "Radiation";

  constant Modelica.SIunits.HeatFlux HMin=0.0001 "Minimum value for radiation";
equation 
  // Modelica Table will interpolate data when it reads the weather data file.
  // It can generate negative value due to the interpolation.
  HOut = Buildings.Utilities.Math.Functions.smoothMax(
    x1=HIn,
    x2=HMin,
    deltaX=HMin/10);
end ConvertRadiation;

Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertRelativeHumidity Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertRelativeHumidity

Converts the relative humidity from percentage to [0, 1] and constrains it to [0, 1]

Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertRelativeHumidity

Information


This component converts the relative humidity from percentage to a range of [0, 1]. Input is the relative humidity in percentage, as this is the data format that is used in the Typical Meteorological Year weather data.

Extends from Modelica.Blocks.Interfaces.BlockIcon (Basic graphical layout of input/output block).

Connectors

TypeNameDescription
input RealInputrelHumInInput relative humidity data in percentage [1]
output RealOutputrelHumOutRelative humidity in (0, 1) [1]

Modelica definition

block ConvertRelativeHumidity 
  "Converts the relative humidity from percentage to [0, 1] and constrains it to [0, 1]"
  extends Modelica.Blocks.Interfaces.BlockIcon;
public 
  Modelica.Blocks.Interfaces.RealInput relHumIn(unit="1") 
    "Input relative humidity data in percentage";
  Modelica.Blocks.Interfaces.RealOutput relHumOut(unit="1") 
    "Relative humidity in (0, 1)";

  constant Real delta=0.01 "Smoothing parameter";
protected 
  constant Real relHumMin=delta "Lower bound";
  constant Real relHumMax=1 - delta "Upper bound";
equation 
  relHumOut = Buildings.Utilities.Math.Functions.smoothLimit(
    relHumIn/100,
    relHumMin,
    relHumMax,
    delta/10);
end ConvertRelativeHumidity;

Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertTemperature Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertTemperature

Converts the temperature unit from Celsius to Kelvin and checks the validity of data

Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertTemperature

Information


This component converts the temperature from Celsius to Kelvin. If the temperature is outside TMin and TMax, the simulation will stop with an error.

Extends from Modelica.Blocks.Interfaces.BlockIcon (Basic graphical layout of input/output block).

Connectors

TypeNameDescription
input RealInputTemCTemperature in Celsius [degC]
output RealOutputTemKTemperature in Kelvin [K]

Modelica definition

block ConvertTemperature 
  "Converts the temperature unit from Celsius to Kelvin and checks the validity of data"
  extends Modelica.Blocks.Interfaces.BlockIcon;
public 
  Modelica.Blocks.Interfaces.RealInput TemC(
      final quantity="Temperature",
      final unit="degC",
      displayUnit="degC") "Temperature in Celsius";
  Modelica.Blocks.Interfaces.RealOutput TemK(
      final quantity="Temperature",
      final unit="K",
      displayUnit="degC") "Temperature in Kelvin";

  constant Modelica.SIunits.Temperature TMin=273.15 - 70 
    "Minimum allowed temperature";
  constant Modelica.SIunits.Temperature TMax=273.15 + 70 
    "Maximum allowed temperature";
equation 
  TemK = TemC - Modelica.Constants.T_zero;
  assert(TemK > TMin, "Temperature out of bounds.\n" + "   TemK = " +
    realString(TemK));
  assert(TemK < TMax, "Temperature out of bounds.\n" + "   TemK = " +
    realString(TemK));

end ConvertTemperature;

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.Interfaces.BlockIcon (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.Interfaces.BlockIcon;
public 
  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;
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.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.Interfaces.BlockIcon (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.Interfaces.BlockIcon;
public 
  Modelica.Blocks.Interfaces.RealInput cloTim(final quantity="Time", final unit=
       "s") "Clock time";
  parameter Modelica.SIunits.Time timZon(displayUnit="h") "Time zone";
  parameter Modelica.SIunits.Angle lon(displayUnit="deg") "Longitude";
  Modelica.Blocks.Interfaces.RealOutput locTim(final quantity="Time", final unit=
           "s") "Local civil time";

equation 
  locTim = cloTim - timZon + lon*43200/Modelica.Constants.pi;

end LocalCivilTime;

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

Converts the simulation time to calendar time in scale of 1 year (365 days)

Buildings.BoundaryConditions.WeatherData.BaseClasses.ConvertTime

Information


This component converts the simulation time to calendar time in a scale of 1 year (365 days).

Extends from Modelica.Blocks.Interfaces.BlockIcon (Basic graphical layout of input/output block).

Connectors

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

Modelica definition

block ConvertTime 
  "Converts the simulation time to calendar time in scale of 1 year (365 days)"
  extends Modelica.Blocks.Interfaces.BlockIcon;
public 
  Modelica.Blocks.Interfaces.RealInput simTim(final quantity="Time", final unit=
       "s") "Simulation time";
  Modelica.Blocks.Interfaces.RealOutput calTim(final quantity="Time", final unit=
           "s") "Calendar time";
equation 
  calTim = simTim - integer(simTim/31536000)*31536000;
end ConvertTime;

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.

Extends from Modelica.Blocks.Interfaces.BlockIcon (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.Interfaces.BlockIcon;
public 
  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";
algorithm 
  solTim := locTim + equTim "Our unit is s in stead of h in (A.4.3)";

end SolarTime;

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.

Inputs

TypeNameDefaultDescription
StringfilNam Name of weather data file
Stringstart Start of the string that contains the elements
Stringname"longitude"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

function getHeaderElementTMY3 
  "Gets an element from the header of a TMY3 weather data file"
 input String filNam "Name of weather data file";
 input String start "Start of the string that contains the elements";
 input String name = "longitude" 
    "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 "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.getLongitudeTMY3

Gets the longitude from a TMY3 weather data file

Information


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

Inputs

TypeNameDefaultDescription
StringfilNam Name of weather data file

Outputs

TypeNameDescription
AnglelonLongitude from the weather file [rad]

Modelica definition

function getLongitudeTMY3 
  "Gets the longitude from a TMY3 weather data file"
 input String filNam "Name of weather data file";
 output Modelica.SIunits.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 = " +
       realString(lon) + " (= " + realString(lon*180/Modelica.Constants.pi) + " degrees).");

end getLongitudeTMY3;

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.

Inputs

TypeNameDefaultDescription
StringfilNam Name of weather data file

Outputs

TypeNameDescription
TimetimZonTime zone from the weather file [s]

Modelica definition

function getTimeZoneTMY3 
  "Gets the time zone from a TMY3 weather data file"
 input String filNam "Name of weather data file";
 output Modelica.SIunits.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 = " +
       realString(timZon) + " (= " + realString(timZon/3600) + " hours).");

end getTimeZoneTMY3;

Automatically generated Fri May 06 14:11:06 2011.