-
Notifications
You must be signed in to change notification settings - Fork 233
#5368 - Wrap OutputTableAnnual and OutputTableMonthly #5369
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6cc528b
Naive add Output:Table:Monthly and Annual
jmarrec a0d7948
GenerateClass.rb
jmarrec f0bf1c1
Modify IDD
jmarrec 28f2560
model API for OutputTableMonthly
jmarrec ae929d8
Model tests for OutputTableMonthly
jmarrec c6df0c0
SWIG it in ModelCore
jmarrec acc2a5a
FT + RT + tests for OutputTableMonthly
jmarrec 1429817
Model Implementation for OutputTableAnnual
jmarrec f48fccf
FT and RT + Tests for OutputTableAnnual
jmarrec 74d0e06
Swig the helper classes
jmarrec d125bc4
Update TDB release notes a bit
jmarrec c0d7e8d
missing ' in ostream.
jmarrec 958b921
clang-format
jmarrec e1475f3
cppcheck
jmarrec 586445b
Handle advanced aggregation types, which should be allowed more than …
jmarrec 9fe3714
Add a Factory method to create the reports in E+ datasets/StandardRep…
jmarrec 6c57fa2
Minor tweaks
jmarrec ea0e2a7
Remove TODOs
jmarrec 1445362
Ensure ScheduleTypeRegistry is working correctly.
jmarrec 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
55 changes: 55 additions & 0 deletions
55
src/energyplus/ForwardTranslator/ForwardTranslateOutputTableAnnual.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,55 @@ | ||
| /*********************************************************************************************************************** | ||
| * OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. | ||
| * See also https://openstudio.net/license | ||
| ***********************************************************************************************************************/ | ||
|
|
||
| #include "../ForwardTranslator.hpp" | ||
| #include "../../model/Model.hpp" | ||
|
|
||
| #include "../../model/OutputTableAnnual.hpp" | ||
|
|
||
| #include "../../model/Schedule.hpp" | ||
| #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
|
|
||
| #include <utilities/idd/Output_Table_Annual_FieldEnums.hxx> | ||
| #include <utilities/idd/IddEnums.hxx> | ||
|
|
||
| using namespace openstudio::model; | ||
|
|
||
| namespace openstudio { | ||
|
|
||
| namespace energyplus { | ||
|
|
||
| boost::optional<IdfObject> ForwardTranslator::translateOutputTableAnnual(model::OutputTableAnnual& modelObject) { | ||
|
|
||
| if (modelObject.numberofAnnualVariableGroups() == 0) { | ||
| return boost::none; | ||
| } | ||
|
|
||
| // Instantiate an IdfObject of the class to store the values | ||
| IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Output_Table_Annual, modelObject); | ||
|
|
||
| // Filter: boost::optional<std::string> | ||
| if (boost::optional<std::string> filter_ = modelObject.filter()) { | ||
| idfObject.setString(Output_Table_AnnualFields::Filter, filter_.get()); | ||
| } | ||
|
|
||
| // Schedule Name: Optional Object | ||
| if (boost::optional<Schedule> schedule_ = modelObject.schedule()) { | ||
| if (boost::optional<IdfObject> wo_ = translateAndMapModelObject(schedule_.get())) { | ||
| idfObject.setString(Output_Table_AnnualFields::ScheduleName, wo_->nameString()); | ||
| } | ||
| } | ||
|
|
||
| for (const auto& group : modelObject.annualVariableGroups()) { | ||
| IdfExtensibleGroup eg = idfObject.pushExtensibleGroup(); | ||
| eg.setString(Output_Table_AnnualExtensibleFields::VariableorMeterorEMSVariableorFieldName, group.variableorMeterorEMSVariableorField()); | ||
| eg.setString(Output_Table_AnnualExtensibleFields::AggregationTypeforVariableorMeter, group.aggregationType()); | ||
| eg.setInt(Output_Table_AnnualExtensibleFields::DigitsAfterDecimal, group.digitsAfterDecimal()); | ||
| } | ||
|
|
||
| return idfObject; | ||
| } // End of translate function | ||
|
|
||
| } // end namespace energyplus | ||
| } // end namespace openstudio | ||
45 changes: 45 additions & 0 deletions
45
src/energyplus/ForwardTranslator/ForwardTranslateOutputTableMonthly.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,45 @@ | ||
| /*********************************************************************************************************************** | ||
| * OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. | ||
| * See also https://openstudio.net/license | ||
| ***********************************************************************************************************************/ | ||
|
|
||
| #include "../ForwardTranslator.hpp" | ||
| #include "../../model/Model.hpp" | ||
|
|
||
| #include "../../model/OutputTableMonthly.hpp" | ||
|
|
||
| #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
|
|
||
| #include <utilities/idd/Output_Table_Monthly_FieldEnums.hxx> | ||
| #include <utilities/idd/IddEnums.hxx> | ||
|
|
||
| using namespace openstudio::model; | ||
|
|
||
| namespace openstudio { | ||
|
|
||
| namespace energyplus { | ||
|
|
||
| boost::optional<IdfObject> ForwardTranslator::translateOutputTableMonthly(model::OutputTableMonthly& modelObject) { | ||
|
|
||
| if (modelObject.numberofMonthlyVariableGroups() == 0) { | ||
| return boost::none; | ||
| } | ||
|
|
||
| // Instantiate an IdfObject of the class to store the values | ||
| IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Output_Table_Monthly, modelObject); | ||
|
|
||
| // Digits After Decimal: Optional Integer, we set it in ctor | ||
| const int digitsAfterDecimal = modelObject.digitsAfterDecimal(); | ||
| idfObject.setInt(Output_Table_MonthlyFields::DigitsAfterDecimal, digitsAfterDecimal); | ||
|
|
||
| for (const auto& group : modelObject.monthlyVariableGroups()) { | ||
| IdfExtensibleGroup eg = idfObject.pushExtensibleGroup(); | ||
| eg.setString(Output_Table_MonthlyExtensibleFields::VariableorMeterName, group.variableOrMeterName()); | ||
| eg.setString(Output_Table_MonthlyExtensibleFields::AggregationTypeforVariableorMeter, group.aggregationType()); | ||
| } | ||
|
|
||
| return idfObject; | ||
| } // End of translate function | ||
|
|
||
| } // end namespace energyplus | ||
| } // end 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.
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.
So at least 1 group must be present to FT this object. And the IDD requires at least 1 group. The ctor doesn't add any groups. No message is issued when there aren't any groups; the object is just skipped? (I'm not saying this is wrong. I'm just confirming.)
Uh oh!
There was an error while loading. Please reload this page.
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.
Yes. I figured issuing a LOG(Warn or Info would be kinda pointless and I know we have people in the ecosystem who are very sensitive to not having useless warnings.
I feel like having a blank OutputTable is quite harmless.
Maybe I should issue a log anyways?
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.
The ctor doesnt push an extensible group because it'd be quite annoying to have to clear the extensible groups before adding yours.
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.
This isn't that unsual to have the minFields set to indicate that there should be at least one extensible group, but the ctor doesn't add it: