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

Revision history [back]

click to hide/show revision 1
initial version

New measure crashed

Dear All,

I am very new to writing measures by myself.

Currently, to add natural ventilation calculation to my model, I am preparing the method based on existing one. I didn't change much but I cannot solve a problem.

I would like any tips from you to solve this.

Error message is like; "undifined method 'getSchedules' for #-----"

image description

The code of my measure is (only the part seemed to be related to this problem):

   def arguments(model)
   args = OpenStudio::Ruleset::OSArgumentVector.new

(omitted)

#populate choice argument for schedules in the model
sch_handles = OpenStudio::StringVector.new
sch_display_names = OpenStudio::StringVector.new

#putting schedule names into hash
sch_hash = {}
sch_hash << "autocalculate"
    sch_hash << "user defined"
    model.getSchedules.each do |sch|
  sch_hash[sch.name.to_s] = sch
end

#looping through sorted hash of schedules
sch_hash.sort.map do |sch_name, sch|
  if not sch.scheduleTypeLimits.empty?
      sch_handles << sch.handle.to_s
      sch_display_names << sch_name
  end
end

#add empty handle to string vector with schedules
sch_handles << OpenStudio::toUUID("").to_s

#make an argument for cooling schedule
vent_sch = OpenStudio::Ruleset::OSArgument::makeChoiceArgument("vent_sch", sch_handles, sch_display_names, true)
vent_sch.setDisplayName("Opening Area Fraction Schedule Name")
vent_sch.setDefaultValue("Always On Discrete 1 WindStack")
args << vent_sch

I am very happy if you would give me any tips about this problem.

Thank you.

New measure crashed

Dear All,

I am very new to writing measures by myself.

Currently, to add natural ventilation calculation to my model, I am preparing the method based on existing one. I didn't change much but I cannot solve a problem.

I would like any tips from you to solve this.

Error message is like; "undifined method 'getSchedules' for #-----"

image description

The code of my measure is (only the part seemed to be related to this problem):

   def arguments(model)
   args = OpenStudio::Ruleset::OSArgumentVector.new

(omitted)

#populate choice argument for schedules in the model
sch_handles = OpenStudio::StringVector.new
sch_display_names = OpenStudio::StringVector.new

#putting schedule names into hash
sch_hash = {}
sch_hash << "autocalculate"
    sch_hash << "user defined"
    model.getSchedules.each do |sch|
  sch_hash[sch.name.to_s] = sch
end

#looping through sorted hash of schedules
sch_hash.sort.map do |sch_name, sch|
  if not sch.scheduleTypeLimits.empty?
      sch_handles << sch.handle.to_s
      sch_display_names << sch_name
  end
end

#add empty handle to string vector with schedules
sch_handles << OpenStudio::toUUID("").to_s

#make an argument for cooling schedule
vent_sch = OpenStudio::Ruleset::OSArgument::makeChoiceArgument("vent_sch", sch_handles, sch_display_names, true)
vent_sch.setDisplayName("Opening Area Fraction Schedule Name")
vent_sch.setDefaultValue("Always On Discrete 1 WindStack")
args << vent_sch

I am very happy if you would give me any tips about this problem.

Thank you.