The BuildingStory class is unique to OpenStudio. It's indeed very handy for managing spaces in a model (e.g. placeholder for common default construction sets), for GUI visualization (as per your client requirements), etc. Yet it is neither forward translated to an IDF model, nor reverse translated from an IDF model. To the best of my knowledge, there's nothing one can add to an IDF file that will trigger new BuildingStory instances during reverse translation.
As suggested here and elsewhere, a limited number of IDF objects get reverse translated. How does one figure out which IDF objects get reverse translated (and how)? By exploring OpenStudio's ReverseTranslator.cpp (starting from Line 254). For instance, you alluded to ZoneList objects (Line 1032). Going over the actual code and comments (Line 40), one understands this is reverse translated as a SpaceType. Not what you're (initially) after ... (see EDIT below).
You could instead add BuildingStory instances to the reverse translated OSM model/file. Since you appear to be coding a solution (towards generating IDF files), it shouldn't be that challenging to interact with the generated OSM model using the SDK/API. Here's a Ruby example (Line 44) of reverse translating an IDF, and then accessing the generated OSM model.
An EnergyPlus Zone gets reverse translated (Line 33) as both an OpenStudio ThermalZone and Space. Only the latter can be linked to a BuildingStory. As you already seem to know which zones should be grouped under which building story, it should boil down to:
- adding to the generated OSM model as many BuildingStory instances as needed
- looping through each OSM space to identify its unique thermal zone
- assigning each space's building story as required (see setBuildingStory)
That should do the trick. There are other ways of doing something similar. This neat example (Line 62) sorts spaces vs building stories based on the Z-axis values of floor vertices - a more general solution, IMO.
EDIT: As you seem quite comfortable with ZoneLists, here's a Ruby script example that populates an OSM with BuildingStory instances from newly-created SpaceType instances (resulting from reverse translating an IDF holding ZoneList objects). Adapt the files/directories as needed.
file = File.join(__dir__, "files/idfs/test.idf")
path = OpenStudio::Path.new(file)
workspace = OpenStudio::Workspace.load(path)
raise("Empty Workspace?") if workspace.empty?
workspace = workspace.get
rt = OpenStudio::EnergyPlus::ReverseTranslator.new
model = rt.translateWorkspace(workspace)
raise("Existing Building Stories?") unless model.getBuildingStorys.empty?
model.getSpaceTypes.each do |type|
name = type.nameString
story = OpenStudio::Model::BuildingStory.new(model)
story.setName("#{name} STORY")
type.spaces.each { |space| space.setBuildingStory(story) }
end
file2 = File.join(__dir__, "files/osms/test.osm")
model.save(file2, true)
Tested it on IDFs. Works on my end. If this works for you, great!
EDIT 2: Here's a hack that offers what you're after, strictly using the OpenStudio Application. The following screenshots are based on an imported IDF of the US Warehouse Prototype. An OSM version of the model holds a single ... (more)