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
497 stars 190 forks source link

OpenStudio Crashes When Clicking Measures Tab If Material Conductivity Is Not Set #1979

Closed pflaumingo closed 8 years ago

pflaumingo commented 8 years ago

When creating a new material in the OpenStudio plug-in for SketchUp it does not set a default material conductivity. If the model is then opened in the GUI and the measures tab is selected then an unhandled exception is thrown per the attached image. OpenStudio 1.9.3 was used. matconductivityexception

pflaumingo commented 8 years ago

Tested in v1.9.5 and the same issue occurs.

DavidGoldwasser commented 8 years ago

@macumber looks like other objects like load definition also appear to have blank required values, however having an empty light definition doesn't crash like an empty material does. For the crash to happen as described by @pflaumingo you don't have to even have any measures in your workflow, just going to the tab will cause the crash.

Not sure what you think easiest fix, I thought API request for new material starts with default values for required fields, but maybe not? or maybe the plugin by-passes this.

macumber commented 8 years ago

Thanks guys. There are two possible fixes:

  1. Disable the add button for these objects in SketchUp
  2. Try to provide sensible default values in SketchUp and keep these synchronized with defaults in the OS App (wondering where the default values in the app come from too @evanweaver ?)
  3. Add default values to the IDD for everything (again where to get good default values?)

@kbenne and I have been down route 2 before and it is a constant source of bugs. I'd vote to add IDD defaults where they make sense but then go with option 1. Removing the + button for all objects with required fields that don't have defaults is going to severely reduce the number of objects you can make in SketchUp but that is fine with me.

macumber commented 8 years ago

Changed to blocker because of crash

macumber commented 8 years ago

This also crashes on the materials tab (which I would expect). The crash on the measures tab is due to translating the current model to idf for computing arguments of EnergyPlus measures

macumber commented 8 years ago

Here is a script that prints all the objects which have this issue if created in the plugin:

require 'openstudio'

file = nil
File.open('skp_iddobjects.txt', 'r') do |f|
  file = f.read.split("\n")
end

factory = OpenStudio::IddFileAndFactoryWrapper.new()
file.each do |object_name|
  object_name = object_name.strip
  next if object_name.empty?
  object = factory.getObject(object_name)
  next if object.empty?
  object = object.get

  object.nonextensibleFields.each do |field|
    next if field.name.to_s == "Name"
    next if field.name.to_s == "Handle"
    properties = field.properties
    if properties.required && properties.stringDefault.empty?
      puts "#{object_name}:#{field.name}"
    end
  end

  object.extensibleGroup.each do |field|
    properties = field.properties
    if properties.required && properties.stringDefault.empty?
      puts "#{object_name}:#{field.name}"
    end
  end
end
macumber commented 8 years ago

And the objects:

OS_RunPeriodControl_DaylightSavingTime:Start Date OS_RunPeriodControl_DaylightSavingTime:End Date OS_Site_WaterMainsTemperature:Calculation Method OS_SizingPeriod_WeatherFileConditionType:Period Selection OS_SizingPeriod_WeatherFileDays:Begin Month OS_SizingPeriod_WeatherFileDays:Begin Day of Month OS_SizingPeriod_WeatherFileDays:End Month OS_SizingPeriod_WeatherFileDays:End Day of Month OS_WeatherProperty_SkyTemperature:Calculation Type OS_WeatherProperty_SkyTemperature:Schedule Name OS_Rendering_Color:Rendering Red Value OS_Rendering_Color:Rendering Green Value OS_Rendering_Color:Rendering Blue Value OS_Material:Roughness OS_Material:Thickness OS_Material:Conductivity OS_Material:Density OS_Material:Specific Heat OS_Material_NoMass:Roughness OS_Material_NoMass:Thermal Resistance OS_WindowMaterial_Gas:Gas Type OS_WindowMaterial_Gas:Thickness OS_WindowMaterial_GasMixture:Thickness OS_WindowMaterial_GasMixture:Number of Gases in Mixture OS_WindowMaterial_GasMixture:Gas 1 Type OS_WindowMaterial_GasMixture:Gas 1 Fraction OS_WindowMaterial_GasMixture:Gas 2 Type OS_WindowMaterial_GasMixture:Gas 2 Fraction OS_WindowMaterial_Glazing:Optical Data Type OS_WindowMaterial_Glazing:Thickness OS_WindowMaterial_GlazingGroup_Thermochromic:Optical Data Temperature OS_WindowMaterial_GlazingGroup_Thermochromic:Window Material Glazing Name OS_WindowMaterial_Glazing_RefractionExtinctionMethod:Thickness OS_WindowMaterial_Glazing_RefractionExtinctionMethod:Solar Index of Refraction OS_WindowMaterial_Glazing_RefractionExtinctionMethod:Solar Extinction Coefficient OS_WindowMaterial_Glazing_RefractionExtinctionMethod:Visible Index of Refraction OS_WindowMaterial_Glazing_RefractionExtinctionMethod:Visible Extinction Coefficient OS_WindowMaterial_SimpleGlazingSystem:U-Factor OS_WindowMaterial_SimpleGlazingSystem:Solar Heat Gain Coefficient OS_Construction:Layer OS_Construction_CfactorUndergroundWall:C-Factor OS_Construction_CfactorUndergroundWall:Height OS_Construction_FfactorGroundFloor:F-Factor OS_Construction_FfactorGroundFloor:Area OS_Construction_FfactorGroundFloor:PerimeterExposed OS_Construction_InternalSource:Layer OS_Construction_InternalSource:Layer OS_Schedule_Day:Hour OS_Schedule_Day:Minute OS_Schedule_Day:Value Until Time OS_Schedule_Year:Month OS_Schedule_Year:Day OS_Schedule_Year:Week Schedule Until Date OS_Schedule_FixedInterval:Interval Length OS_Schedule_FixedInterval:Value OS_Schedule_VariableInterval:Month OS_Schedule_VariableInterval:Day OS_Schedule_VariableInterval:Hour OS_Schedule_VariableInterval:Minute OS_Schedule_VariableInterval:Value Until Time OS_ElectricEquipment_Definition:Design Level Calculation Method OS_GasEquipment_Definition:Design Level Calculation Method OS_HotWaterEquipment_Definition:Design Level Calculation Method OS_Lights_Definition:Design Level Calculation Method OS_People_Definition:Number of People Calculation Method OS_People_Definition:Fraction Radiant OS_InternalMass_Definition:Design Level Calculation Method OS_ElectricEquipment:Electric Equipment Definition Name OS_GasEquipment:Gas Equipment Definition Name OS_HotWaterEquipment:Hot Water Equipment Definition Name OS_SteamEquipment:Steam Equipment Definition Name OS_OtherEquipment:Other Equipment Definition Name OS_Lights:Lights Definition Name OS_People:People Definition Name OS_SpaceInfiltration_DesignFlowRate:Design Flow Rate Calculation Method OS_SpaceInfiltration_EffectiveLeakageArea:Effective Air Leakage Area OS_SpaceInfiltration_EffectiveLeakageArea:Stack Coefficient OS_SpaceInfiltration_EffectiveLeakageArea:Wind Coefficient OS_InternalMass:Internal Mass Definition Name OS_Output_Variable:Variable Name

macumber commented 8 years ago

Another option is to make these fields not required. Just because they are required at simulation time (e+) does not mean they need to be required at modeling time (os). However that would require changing the api which is not great. @kbenne @mbadams5 I'm interested in your thoughts

kbenne commented 8 years ago

I totally agree with statement, "just because they are required at simulation time (e+) does not mean they need to be required at modeling time (os)." That is a way of life in HVAC, otherwise you'd have to define an entire system at once. The criteria for required should be much lower for OS.

I'm not sure what you do about existing APIs though? I guess about the best you could do is deprecate the old required APIs and add new optional APIs, and let the old API throw some kind of error if they are used but the optional is not defined. Doesn't seem very client friendly but I can't see many options.

macumber commented 8 years ago

This is the kind of thing that could be done for 2.0? GUIs would also have to be updated to the new APIs.

kbenne commented 8 years ago

I think you are in the best position to estimate how many folks this might be impacted and how much pain it will be.

macumber commented 8 years ago

https://docs.google.com/spreadsheets/d/1hcgtoAJEcuQAHFC8j-L1wdNexWOS-Iu4qqLJLOP5qJA/edit#gid=0&vpid=A1

Biggest holes are going to be the inability to add SpaceInfiltration:DesignFlowRate and SpaceInfiltration:EffectiveLeakageArea objects (no way to do this in the app). Also the inspector gives a nice way to edit output variable and meter names, going to remove this as well