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 2023-06-22 18:04:01 -0500

MDW's avatar

updated 2023-06-28 07:30:19 -0500

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!

edit retag flag offensive close merge delete

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  ( 2023-06-22 19:01:51 -0500 )edit

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  ( 2023-06-23 07:56:45 -0500 )edit

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  ( 2023-06-23 08:47:22 -0500 )edit

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  ( 2023-06-23 16:25:06 -0500 )edit
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  ( 2023-06-23 19:00:40 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-06-27 08:35:18 -0500

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.

edit flag offensive delete link more

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: 2023-06-22 18:04:01 -0500

Seen: 90 times

Last updated: Jun 27 '23