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

Error when testing portions of OS Measure Test Code

I am using a text editor to build an OS measure which sets the occupancy load of a building. In building the measure, I am using the following code to test what the old definitions for occupancy load are:

require 'openstudio'
require 'openstudio/ruleset/ShowRunnerOutput'
require 'test/unit'

class SetNew_Test < Test::Unit::TestCase

def test_SetNew_a

# load the test model
translator = OpenStudio::OSVersion::VersionTranslator.new
path = OpenStudio::Path.new(File.dirname(__FILE__) + "/OldModel.osm")
model = translator.loadModel(path)
assert((not model.empty?))
model = model.get
puts "Model Loaded"

model.getSpaceTypes.each do |space_tp|
    #loop through all people definitions in the space type
    space_tp.people.each do |people|
      #get the old od from the existing definition, if exists  
        old_people = people.peopleDefinition.peoplePerFloorArea.get
        puts old_people
    end
end

end
end

I checked the file in OS and the building does define the occupancy load in terms of people per floor area, however, I get the following error from the command line:

undefined method 'peoplePerFloorArea'

I have tried several different classes that should exist, such as lighting power density, schedules, etc. However, each time I get the same error that the method does not exist . . . I would appreciate any comments that might lend some insight into what I am doing wrong

'Undefined Method' Error when testing portions of OS Measure Test Code

I am using a text editor to build an OS measure which sets the occupancy load of a building. In building the measure, I am using the following code to test what the old definitions for occupancy load are:

require 'openstudio'
require 'openstudio/ruleset/ShowRunnerOutput'
require 'test/unit'

class SetNew_Test < Test::Unit::TestCase

def test_SetNew_a

# load the test model
translator = OpenStudio::OSVersion::VersionTranslator.new
path = OpenStudio::Path.new(File.dirname(__FILE__) + "/OldModel.osm")
model = translator.loadModel(path)
assert((not model.empty?))
model = model.get
puts "Model Loaded"

model.getSpaceTypes.each do |space_tp|
    #loop through all people definitions in the space type
    space_tp.people.each do |people|
      #get the old od from the existing definition, if exists  
        old_people = people.peopleDefinition.peoplePerFloorArea.get
        puts old_people
    end
end

end
end

I checked the file in OS and the building does define the occupancy load in terms of people per floor area, however, I get the following error from the command line:

undefined method 'peoplePerFloorArea'

I have tried several different classes that should exist, such as lighting power density, schedules, etc. However, each time I get the same error that the method does not exist . . . I would appreciate any comments that might lend some insight into what I am doing wrong

'Undefined Method' Error when testing portions of OS Measure Test Code

I am using a text editor to build an OS measure which sets the occupancy load of a building. In building the measure, I am using the following code to test what the old definitions for occupancy load are:

require 'openstudio'
require 'openstudio/ruleset/ShowRunnerOutput'
require 'test/unit'

class SetNew_Test < Test::Unit::TestCase

def test_SetNew_a

# load the test model
translator = OpenStudio::OSVersion::VersionTranslator.new
path = OpenStudio::Path.new(File.dirname(__FILE__) + "/OldModel.osm")
model = translator.loadModel(path)
assert((not model.empty?))
model = model.get
puts "Model Loaded"

model.getSpaceTypes.each do |space_tp|
    #loop through all people definitions in the space type
    space_tp.people.each do |people|
      #get the old od from the existing definition, if exists  
        old_people = people.peopleDefinition.peoplePerFloorArea.get
        puts old_people
    end
end

end
end

I checked the file in OS and the building does define the occupancy load in terms of people per floor area, however, I get the following error from the command line:

undefined method 'peoplePerFloorArea'

I have tried several different classes that should exist, such as lighting power density, schedules, etc. However, each time I get the same error that the method does not exist . . . I would appreciate any comments that might lend some insight into what I am doing wrong

'Undefined Method' Error when testing portions of OS Measure Test Code

I am using a text editor to build an OS measure which sets the occupancy load of a building. In building the measure, I am using the following code to test what the old definitions for occupancy load are:

require 'openstudio'
require 'openstudio/ruleset/ShowRunnerOutput'
require 'test/unit'

class SetNew_Test < Test::Unit::TestCase

def test_SetNew_a

# load the test model
translator = OpenStudio::OSVersion::VersionTranslator.new
path = OpenStudio::Path.new(File.dirname(__FILE__) + "/OldModel.osm")
model = translator.loadModel(path)
assert((not model.empty?))
model = model.get
puts "Model Loaded"

model.getSpaceTypes.each do |space_tp|
    #loop through all people definitions in the space type
    space_tp.people.each do |people|
      #get the old od from the existing definition, if exists  
        old_people = people.peopleDefinition.peoplePerFloorArea.get
        puts old_people
    end
end

end
end

I checked the file in OS and the building does define the occupancy load in terms of people per floor area, however, I get the following error from the command line:

undefined method 'peoplePerFloorArea'

I have tried several different classes that should exist, such as lighting power density, schedules, etc. However, each time I get the same error that the method does not exist . . . I would appreciate any comments that might lend some insight into what I am doing wrong