-
Notifications
You must be signed in to change notification settings - Fork 235
V26.2.0-IOFreeze: new ZoneMRTCalculation object #5649
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
Open
joseph-robertson
wants to merge
13
commits into
develop
Choose a base branch
from
v26.2.0-IOFreeze-ZoneMRTCalc
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
afefd66
Update both IDDs for new ZoneMRTCalculation object.
joseph-robertson 03627f1
Add model files for new ZoneMRTCalculation object.
joseph-robertson 23d26d2
Add ft and rt for new ZoneMRTCalculation object.
joseph-robertson 0c8684f
Add model and translation tests for new ZoneMRTCalculation object.
joseph-robertson 5e92cbc
Expand new tests to cover more throw/error scenarios.
joseph-robertson 222ac39
Another pass through model and tests with additions and cleanups.
joseph-robertson 0f9a938
Address updates in ft and test, and model cpp.
joseph-robertson d56eff7
Updates related to stale people references, nan, weighting factors su…
joseph-robertson c5bc900
Override people remove so we can modify zone mrt extensible groups.
joseph-robertson 445c0f6
Add optional proactive extensible group removal for People, update mr…
joseph-robertson 5ac4ad6
Remove alpha type from Thermal Zone Name field in idd.
joseph-robertson 4b08232
Clean typo in clone log and throw.
joseph-robertson 435380b
Update ThermalZone with ZoneMRT remove and new output variable.
joseph-robertson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
src/energyplus/ForwardTranslator/ForwardTranslateZoneMRTCalculation.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| /*********************************************************************************************************************** | ||
| * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| * See also https://openstudio.net/license | ||
| ***********************************************************************************************************************/ | ||
|
|
||
| #include "../ForwardTranslator.hpp" | ||
|
|
||
| #include "../../model/Model.hpp" | ||
| #include "../../model/People.hpp" | ||
| #include "../../model/People_Impl.hpp" | ||
| #include "../../model/PeopleDefinition.hpp" | ||
| #include "../../model/PeopleDefinition_Impl.hpp" | ||
| #include "../../model/Space.hpp" | ||
| #include "../../model/Space_Impl.hpp" | ||
| #include "../../model/ThermalZone.hpp" | ||
| #include "../../model/ThermalZone_Impl.hpp" | ||
| #include "../../model/ZoneMRTCalculation.hpp" | ||
| #include "../../model/ZoneMRTCalculation_Impl.hpp" | ||
|
|
||
| #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
|
|
||
| #include <utilities/idd/IddEnums.hxx> | ||
| #include <utilities/idd/ZoneMRTCalculation_FieldEnums.hxx> | ||
|
|
||
| using namespace openstudio::model; | ||
|
|
||
| namespace openstudio { | ||
|
|
||
| namespace energyplus { | ||
|
|
||
| boost::optional<IdfObject> ForwardTranslator::translateZoneMRTCalculation(ZoneMRTCalculation& modelObject) { | ||
| ThermalZone zone = modelObject.thermalZone(); | ||
| boost::optional<IdfObject> _zone = translateAndMapModelObject(zone); | ||
| if (!_zone) { | ||
| LOG(Error, "ZoneMRTCalculation references a zone '" << zone.nameString() << "' that was not translated, so it will not be translated either"); | ||
| return boost::none; | ||
| } | ||
|
|
||
| std::vector<MRTWeightingFactor> mrtWeightingFactors = modelObject.mrtWeightingFactors(); | ||
| if (mrtWeightingFactors.empty()) { | ||
| LOG(Error, | ||
| "ZoneMRTCalculation for zone '" << zone.nameString() << "' doesn't have at least one MRT weighting factor, it will not be translated."); | ||
| return boost::none; | ||
| } | ||
|
|
||
| std::vector<std::pair<std::string, double>> translatedMRTWeightingFactors; | ||
| double sum = 0.0; | ||
|
|
||
| for (const MRTWeightingFactor& mrtWeightingFactor : mrtWeightingFactors) { | ||
| People people = mrtWeightingFactor.people(); | ||
|
|
||
| boost::optional<Space> space = people.space(); | ||
| boost::optional<ThermalZone> thermalZone; | ||
| if (space) { | ||
| thermalZone = space->thermalZone(); | ||
| } | ||
|
|
||
| if (!thermalZone || (thermalZone->handle() != zone.handle())) { | ||
| LOG(Error, "Could not translate an MRTWeightingFactor group for " << modelObject.briefDescription() << " because " | ||
| << people.briefDescription() | ||
| << " is not assigned to the ZoneMRTCalculation ThermalZone."); | ||
| continue; | ||
| } | ||
|
|
||
| if (people.peopleDefinition().numThermalComfortModelTypes() == 0) { | ||
| LOG(Error, "Could not translate an MRTWeightingFactor group for " << modelObject.briefDescription() << " because " | ||
| << people.briefDescription() | ||
| << " does not select at least one Thermal Comfort Model Type."); | ||
| continue; | ||
| } | ||
|
|
||
| boost::optional<IdfObject> _people = translateAndMapModelObject(people); | ||
|
|
||
| if (_people) { | ||
| double value = mrtWeightingFactor.mrtWeightingFactor(); | ||
| sum += value; | ||
| if (sum > 1.0) { | ||
| LOG(Error, "Could not translate an MRTWeightingFactor group for " << modelObject.briefDescription() | ||
| << " because the MRT Weighting Factors would sum to " << sum | ||
| << ", which is greater than 1."); | ||
| sum -= value; | ||
| continue; | ||
| } | ||
|
|
||
| translatedMRTWeightingFactors.emplace_back(_people->name().get(), value); | ||
| } else { | ||
| LOG(Error, "Could not translate an MRTWeightingFactor group for " << modelObject.briefDescription() << ". Continuing with the rest."); | ||
| } | ||
| } | ||
|
|
||
| if (translatedMRTWeightingFactors.empty()) { | ||
| LOG(Error, "ZoneMRTCalculation for zone '" << zone.nameString() | ||
| << "' doesn't have at least one valid MRT weighting factor, it will not be translated."); | ||
| return boost::none; | ||
| } | ||
|
|
||
| IdfObject idfObject(openstudio::IddObjectType::ZoneMRTCalculation); | ||
| m_idfObjects.push_back(idfObject); | ||
|
|
||
| idfObject.setString(ZoneMRTCalculationFields::ZoneName, _zone->name().get()); | ||
|
|
||
| for (const auto& translatedMRTWeightingFactor : translatedMRTWeightingFactors) { | ||
| auto eg = idfObject.pushExtensibleGroup(); | ||
| eg.setString(ZoneMRTCalculationExtensibleFields::PeopleName, translatedMRTWeightingFactor.first); | ||
| eg.setDouble(ZoneMRTCalculationExtensibleFields::MRTWeightingFactor, translatedMRTWeightingFactor.second); | ||
| } | ||
|
|
||
| return idfObject; | ||
| } | ||
|
|
||
| } // namespace energyplus | ||
|
|
||
| } // namespace openstudio | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d56eff7