Open Studio Ruby - Undefined method from openstudio standards
Hi there,
I am getting an undefined method error from the openstudio standards. I have require 'openstudio-standards'
at the top of the measure so unclear if I should be importing any other libraries. Any ideas on how I can resolve this?
Error: undefined method `spaces' for "DOAS - Building Story 1":String:/ruby/2.7.0/gems/openstudio-standards-0.3.0/lib/openstudio-standards/standards/Standards.ThermalZone.rb:12:in `thermal_zone_outdoor_airflow_rate':/ruby/2.7.0/gems/openstudio-standards-0.3.0/lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb:1343:in `block in model_add_doas':/ruby/2.7.0/gems/openstudio-standards-0.3.0/lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb:1342:in `each':/ruby/2.7.0/gems/openstudio-standards-0.3.0/lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb:1342:in `model_add_doas':/ruby/2.7.0/gems/openstudio-standards-0.3.0/lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb:6448:in `model_add_hvac_system'
Thank you!
Does your measure call the openstudio-standards
thermal_zone_outdoor_airflow_rate
method? If so, it seems like you're passing in the name of the thermal zone as an argument instead of the thermal zone object itself.No, the measure does not call the mentioned method. It's possible that a method I'm calling from the openstudio standards calls
thermal_zone_outdoor_airflow_rate
, but I am unsure.Well the comment still applies that I think you're passing in a thermal zone name instead of a thermal zone object to one of the openstudio standards methods. Maybe the
model_add_hvac_system
method?Ah right, thanks for the pointer. I'm now using the following
thermal_zone = model.getThermalZoneByName(thermal_zone_name)
, but still seeing that undefined error method for now the Optional Thermal Zone object.You need to use
thermal_zone = model.getThermalZoneByName(thermal_zone_name).get
. Refer to the section "OpenStudio Measures and the boost::optional Type" in the measure writing guide.