-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merging FloorSpaceJS strips out climate zone assignment. #4166
Comments
mm.mergeModels is the the C++ json code in OpenStudio. We'll need to investigate a bit more but it might be in the core openstudio. |
@DavidGoldwasser Do you have a MCVE for me to reproduce this issue effectively? |
Let me rephrase a bit perhaps... In Then the ruby code calls this: So if you look a the C++, "Remove objects from current model that are not in new model". So since the json doesn't have CZ, it's removed. OpenStudio/src/model/ModelMerger.cpp Lines 994 to 1026 in 1de7dfe
This portion of code is at least 3 years old according to a quick git blame. The list of stuff to always merge also hasn't suffered any deletion of climate zones in the past few years: OpenStudio/src/model/ModelMerger.cpp Lines 92 to 101 in 1de7dfe
Am I missing something here? Was the above really working with 3.0.0? |
@jmarrec yes this used to work. If the OSM already had a climate zone, like this one, then it wasn't removed when geometry was merged in from FloorSpaceJS. |
@DavidGoldwasser I put some OS_ASSERTs in MergeModels to try and see when the climate zone was deleted. It turns out, it happens here: OpenStudio/src/model/ModelMerger.cpp Lines 1011 to 1018 in 1de7dfe
Your floorSpace json does not contain Site information. So the OS:Site from the SDCC model is deleted.... and with it it's children and there are tons of it, and that includes thermal zone: Lines 148 to 152 in 1de7dfe
The PR that introduced this regression is this one by @macumber #4055. By adding As far as how to resolve this, I'm unclear about what the intent was... If the intent was to make the floorspace json have a REQUIRED site object, then your floorspace json object in that test needs to be updated. I suppose what you have in there is a corner case, and in general the floorspace json thing would be created on the fly by the OSApp (or another gui) and so would already contain that Site object, being present in the original model. |
OpenStudio/src/model/ThreeJSReverseTranslator.hpp Lines 62 to 65 in 1de7dfe
I would have expected to see additions in the ThreeJSReverseTranslator.cpp file though, that would catch the Site, Facility, and Building objects... One unit test manually does the mapping: OpenStudio/src/model/test/FloorplanJSForwardTranslator_GTest.cpp Lines 411 to 414 in 1de7dfe
|
wait @DavidGoldwasser in there: https://github.com/NREL/openstudio-model-articulation-gem/blob/a4df0b2c3bbeb51f76d71787faf7c440c7d594b4/lib/measures/merge_floorspace_js_with_model/measure.rb#L121-L122 Why aren't you first calling With this, your measure works: mm = OpenStudio::Model::ModelMerger.new
handleMap = mm.suggestHandleMapping(model, new_model)
mm.mergeModels(model, new_model, handleMap) If I follow correctly, using the rt.handleMapping() would be fine if the scene just got created probably, but using a json file it probably isn't. |
The intent of the pull request was to update the north angle and other building/site level information from the FloorspaceJSON to OSM. The In the OS App we are explicitly adding those matches to the reverse translator's handle mapping here: It might make sense to add a helper method to add these objects to either |
I copied the code for FloorSpaceJS measure from a residential (multi-family) measure, but I assume that code may have originated with @macumber. My use case is to use FloorSpaceJS in an OSW to define building geometry. I always use the ChangeBuildingLocation measure when I'm creating a model from an empty seed in an OSW, because not only do I want to setup the EPW and climate zone, but also design days and water main temperatures. I also often sweep across EPWs and dynamically pull climate zone from stat file. ChangeBuildingLocation is typically the first measure in the workflow because some other measures like create_typical that apples constructions needs the climate zone. |
@DavidGoldwasser Is this fixed then? |
No, I don't think so, unless something has changed. until FloorSpaceJS has the option to store ASHRAE climate zone, I want merging FloorSpaceJS into OSM to not strip out already assigned climate zones. |
Proposed fix in #4245 along with detailed unit testing. |
Fix #4166 - Merging FloorSpaceJS can delete unique model Objects such as Facility, Building, Site (and children)
Issue overview
Issue is described in this measure gem issue. This worked in 2.x and broker either an 3.0.0 or 3.1.0
NREL/openstudio-model-articulation-gem#57
Current Behavior
Most workflows using this ran change building location and then brought in the JSON, now the climate zone assignment is striped out.
Expected Behavior
Climate zone and weather file should not be impacted by this.
Context
This is not an issue with FloorSpaceJS or the files it makes it is about how they are merged into an OSM. When I get time I can investigate more but just wanted to document for others. The work around has been to re-order measures so climate zone is setup after this core OS method is used.
I believe this is the problematic code
https://github.com/NREL/openstudio-model-articulation-gem/blob/develop/lib/measures/merge_floorspace_js_with_model/measure.rb#L121-L122
mm = OpenStudio::Model::ModelMerger.new
mm.mergeModels(model, new_model, rt.handleMapping)
The text was updated successfully, but these errors were encountered: