Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
0

Open Studio Ruby - Undefined method from openstudio standards

asked 1 year ago

MDW's avatar

updated 1 year ago

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!

Preview: (hide)

Comments

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.

shorowit's avatar shorowit  ( 1 year ago )

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.

MDW's avatar MDW  ( 1 year ago )

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?

shorowit's avatar shorowit  ( 1 year ago )

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.

Error: undefined method `spaces' for #<OpenStudio::Model::OptionalThermalZone:0x000001caa0521928>
MDW's avatar MDW  ( 1 year ago )
3

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.

shorowit's avatar shorowit  ( 1 year ago )

1 Answer

Sort by » oldest newest most voted
1

answered 1 year ago

MDW's avatar

The model_add_hvac_systemmethod is called, which requires input thermal zones to be the thermal zone object rather than the name of the thermal zone.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 1 year ago

Seen: 154 times

Last updated: Jun 27 '23