NREL / OpenStudio

OpenStudio is a cross-platform collection of software tools to support whole building energy modeling using EnergyPlus and advanced daylight analysis using Radiance.
https://www.openstudio.net/
Other
494 stars 188 forks source link

E+ 9.3.0: Realign OS:SizingPeriod:DesignDay with E+ IDD #3910

Closed jmarrec closed 2 years ago

jmarrec commented 4 years ago

Enhancement Request

In E+ 9.3.0, SizingPeriod:DesignDay gains a few field, but OS IDD has become quite out of line with E+

It would be nice to re-align, but this is an enhancement request.

joseph-robertson commented 3 years ago

DesignDay is missing:

Anything else?

jmarrec commented 3 years ago

You're probably correct. I'd probably go the extra mile and try to re-order the rest of the fields. Perhaps also rename a couple (well: deprecate old name and point to new name), such as Humidity Indicating Type (OS) versus Humidity Condition Type

Maybe that's just me, but when I read the E+ doc I kinda like the idea of being able to infer the OS method name directly...

[7] OS-build(main)> os_fields = get_fields(osIdd)
=> {"Handle"=>0,
 "Name"=>1,
 "Maximum Dry-Bulb Temperature"=>2,
 "Daily Dry-Bulb Temperature Range"=>3,
 "Humidity Indicating Conditions at Maximum Dry-Bulb"=>4,
 "Barometric Pressure"=>5,
 "Wind Speed"=>6,
 "Wind Direction"=>7,
 "Sky Clearness"=>8,
 "Rain Indicator"=>9,
 "Snow Indicator"=>10,
 "Day of Month"=>11,
 "Month"=>12,
 "Day Type"=>13,
 "Daylight Saving Time Indicator"=>14,
 "Humidity Indicating Type"=>15,
 "Humidity Indicating Day Schedule Name"=>16,
 "Dry-Bulb Temperature Range Modifier Type"=>17,
 "Dry-Bulb Temperature Range Modifier Schedule Name"=>18,
 "Solar Model Indicator"=>19,
 "Beam Solar Day Schedule Name"=>20,
 "Diffuse Solar Day Schedule Name"=>21,
 "ASHRAE Taub"=>22,
 "ASHRAE Taud"=>23,
 "Daily Wet-Bulb Temperature Range"=>24}

[8] OS-build(main)> ep_fields = get_fields(iddObject)
=> {"Name"=>0,
 "Month"=>1,
 "Day of Month"=>2,
 "Day Type"=>3,
 "Maximum Dry-Bulb Temperature"=>4,
 "Daily Dry-Bulb Temperature Range"=>5,
 "Dry-Bulb Temperature Range Modifier Type"=>6,
 "Dry-Bulb Temperature Range Modifier Day Schedule Name"=>7,
 "Humidity Condition Type"=>8,
 "Wetbulb or DewPoint at Maximum Dry-Bulb"=>9,
 "Humidity Condition Day Schedule Name"=>10,
 "Humidity Ratio at Maximum Dry-Bulb"=>11,
 "Enthalpy at Maximum Dry-Bulb"=>12,
 "Daily Wet-Bulb Temperature Range"=>13,
 "Barometric Pressure"=>14,
 "Wind Speed"=>15,
 "Wind Direction"=>16,
 "Rain Indicator"=>17,
 "Snow Indicator"=>18,
 "Daylight Saving Time Indicator"=>19,
 "Solar Model Indicator"=>20,
 "Beam Solar Day Schedule Name"=>21,
 "Diffuse Solar Day Schedule Name"=>22,
 "ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub)"=>23,
 "ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud)"=>24,
 "Sky Clearness"=>25,
 "Maximum Number Warmup Days"=>26,
 "Begin Environment Reset Mode"=>27}
[9] OS-build(main)> missing_fields = ep_fields.keys - os_fields.keys
=> ["Dry-Bulb Temperature Range Modifier Day Schedule Name",
 "Humidity Condition Type",
 "Wetbulb or DewPoint at Maximum Dry-Bulb",
 "Humidity Condition Day Schedule Name",
 "Humidity Ratio at Maximum Dry-Bulb",
 "Enthalpy at Maximum Dry-Bulb",
 "ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub)",  # false alarm
 "ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud)",  # false alarm
 "Maximum Number Warmup Days",
 "Begin Environment Reset Mode"]

[10] OS-build(main)> extra_fields = os_fields.keys - ep_fields.keys
=> ["Handle",
 "Humidity Indicating Conditions at Maximum Dry-Bulb",
 "Humidity Indicating Type",
 "Humidity Indicating Day Schedule Name",
 "Dry-Bulb Temperature Range Modifier Schedule Name",
 "ASHRAE Taub",   # false alarm
 "ASHRAE Taud",   # false alarm
]
jmarrec commented 3 years ago

I forgot to provide my helpers (change the path to your ProposedEnergy+.idd... in locate_object_current_proposed_eplus_idd)


# Helper to locate a given IddObject via Name in the current IDD
# by using IddFileAndFactoryWrapper
#
# @param object_name [String] eg 'OS:ZoneHVAC:TerminalUnit:VariableRefrigerantFlow'
# @return [OpenStudio::IddObject] the IddObject
# raises if not found
def locate_object_in_current_idd(object_name)
  factory = OpenStudio::IddFileAndFactoryWrapper.new("OpenStudio".to_IddFileType)
  obj = factory.getObject(object_name)
  raise "Cannot locate #{object_name} in current IDD" if obj.empty?
  return obj.get
end

def locate_object_current_proposed_eplus_idd(object_name)
  idd_path = File.join(ENV["HOME"],
                     'Software/Others/OpenStudio/resources/energyplus/ProposedEnergy+.idd')
  raise "Cannot locate '#{idd_path}'" if !File.exist?(idd_path)
  oIddFile = OpenStudio::IddFile::load(idd_path)
  raise "Couldn't load #{idd_path}" if oIddFile.empty?
  iddFile = oIddFile.get
  objs = iddFile.objects.select{|obj| obj.name == object_name }
  raise "Cannot find #{object_name} in #{idd_path}" if objs.size != 1
  return objs[0]
end

# Scans all fields for an IddObject and reutrn hash of {fieldname: index}
#
# @param iddObject [OpenStudio::IddObject] the IddObject to scan
# @return [Hash] : keys are the field names, values are the indices (0-indexed)
def get_fields(iddObject)
  num_fields = iddObject.numFields
  fields = []
  fields_h = {}
  for i in 0..num_fields-1
    f = iddObject.getField(i).get
    fields << [f.name.to_s]
    fields_h[f.name.to_s] = i
  end
  return fields_h
end
osIdd = locate_object_in_current_idd("OS:SizingPeriod:DesignDay")

iddObject = locate_object_current_proposed_eplus_idd("SizingPeriod:DesignDay")
joseph-robertson commented 3 years ago

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">

OpenStudio | EnergyPlus |   -- | -- | --   |   |   Maximum Dry-Bulb Temperature | Maximum Dry-Bulb Temperature |   Daily Dry-Bulb Temperature Range | Daily Dry-Bulb Temperature Range |   Barometric Pressure | Barometric Pressure |   Wind Speed | Wind Speed |   Wind Direction | Wind Direction |   Sky Clearness | Sky Clearness |   Rain Indicator | Rain Indicator | Int to Str Snow Indicator | Snow Indicator | Int to Str Day of Month | Day of Month |   Month | Month |   Day Type | Day Type |   Daylight Saving Time Indicator | Daylight Saving Time Indicator | Int to Str Humidity Indicating Type | Humidity Condition Type | DEPRECATE Humidity Indicating Day Schedule Name | Humidity Condition Day Schedule Name | DEPRECATE Dry-Bulb Temperature Range Modifier Type | Dry-Bulb Temperature Range Modifier Type |   Dry-Bulb Temperature Range Modifier Schedule Name | Dry-Bulb Temperature Range Modifier Day Schedule Name | DEPRECATE Solar Model Indicator | Solar Model Indicator |   Beam Solar Day Schedule Name | Beam Solar Day Schedule Name |   Diffuse Solar Day Schedule Name | Diffuse Solar Day Schedule Name |   ASHRAE Taub | ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) | DEPRECATE ASHRAE Taud | ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud) | DEPRECATE Daily Wet-Bulb Temperature Range | Daily Wet-Bulb Temperature Range |   Humidity Indicating Conditions at Maximum Dry-Bulb |   | REMOVED   | Wetbulb or DewPoint at Maximum Dry-Bulb | EXTRA   | Humidity Ratio at Maximum Dry-Bulb | EXTRA   | Enthalpy at Maximum Dry-Bulb | EXTRA   | Maximum Number Warmup Days | EXTRA   | Begin Environment Reset Mode | EXTRA

joseph-robertson commented 2 years ago

Closed in https://github.com/NREL/OpenStudio/pull/4402