how do I export Space name and SpaceType name into csv with an OpenStudio measure?
My goal is to exporta a CSV file with information about spaces and zones. I'm writing a measure in which I first loop through spaces and get the names (space.name) and spacetypes (space.spaceType). The problem is that for spacetype I get the handle instead of the name. So I need to get the spacetype name using that handle. Space loop:
spaces.each do |space|
spaceHandle = space.handle
spaceName = space.name
spaceType = space.spaceType
spaceList << [space.handle, space.name,spaceType,0,]
end
Then I loop through the spacetypes and (try to) get their names by matching spacetype handles I stored in the previous loop.
spaceTypes = model.getSpaceTypes
spaceList.each do |row|
spaceTypes.each do |spaceType|
if row[2] == spaceType.handle
row[3] == spaceType.name
end
end
end
The script never goes into the if statement because space.spaceType never matches the spaceType...
spaceType.handle = {f34459af-1179-4794-8987-3ac9e38bd80d}
space.spaceType = #<OpenStudio::Model::OptionalSpaceType:0x00000006b639c8>
I'm a bit lost. Can somebody enlighten me? Is there a better way to achieve this?
just wondering, is this part of open studio/energy plus, or you are using csv output and a third-party compiler?