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

Revision history [back]

The method that you want is space.buildingStory, you can find that in the documentation for the Space object. You will want to do something like this:

#reporting initial condition of model
runner.registerInitialCondition("The building has #{spaces.size} spaces" )

spaces.each do |space|
  #story name, space name
  building_story= space.buildingStory # returns an optional story, might not be available so need to check below

  base_name = "" # needed so you can access this variable outside of the following if statement
  if !building_story.empty?
    base_name = "#{building_story.name} - #{space.name}"
  end
end #end of spaces.each do

The method that you want is space.buildingStory, you can find that in the documentation for the Space object. You will want to do something like this:

#reporting initial condition of model
runner.registerInitialCondition("The building has #{spaces.size} spaces" )

spaces.each do |space|
  #story name, space name
  building_story= space.buildingStory # returns an optional story, might not be available so need to check below

  base_name = "" # needed so you can access this variable outside of the following if statement
  if !building_story.empty?
    building_story = building_story.get # dereference the OptionalBuildingStory to get the BuildingStory
    base_name = "#{building_story.name} - #{space.name}"
  end
end #end of spaces.each do