-
Notifications
You must be signed in to change notification settings - Fork 222
#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
Conversation
```bash $os_build3/Products/openstudio GenerateClass.rb -c "OutputTableMonthly" -b "ModelObject" -i "OS:Output:Table:Monthly" -s model -o /Users/julien/Software/Others/OpenStudio3/src/model/ -p -f -r ` ``
…once. Technically speaking, there should be a non-advanced aggregation type in between both, but it's way overkilled to try to enforce that
src/model/OutputTableMonthly.cpp
Outdated
| boost::optional<unsigned> existingIndex_ = monthlyVariableGroupIndex(monthlyVariableGroup); | ||
| if (existingIndex_) { | ||
| LOG(Warn, "For " << briefDescription() << ", MonthlyVariableGroup already exists: " << monthlyVariableGroup); | ||
| return false; | ||
| } |
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.
AANNND I just realized that this is too restrictrive, because you have the so called "Advanced Aggregation" types.
One example of which: https://github.com/NREL/EnergyPlus/blob/116998ec7fcec5435df31d05505bd4b38837276b/datasets/StandardReports.idf#L69-L87
[openstudio.model.OutputTableMonthly] <0> For Object of type 'OS:Output:Table:Monthly' and named 'Zone Cooling Summary', MonthlyVariableGroup already exists: (Output Variable or Meter = 'Site Outdoor Air Drybulb Temperature', Aggregation Type = 'ValueWhenMaximumOrMinimum')
[openstudio.energyplus.ReverseTranslator] <0> Extensible group 6(0-indexed) is already present, not adding it twice
[openstudio.model.OutputTableMonthly] <0> For Object of type 'OS:Output:Table:Monthly' and named 'Zone Cooling Summary', MonthlyVariableGroup already exists: (Output Variable or Meter = 'Site Outdoor Air Wetbulb Temperature', Aggregation Type = 'ValueWhenMaximumOrMinimum')
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.
I implemented a bypass check for that in 586445b
I thought about just removing it, but it was actually easier (or at least not more complicated) to handle it
joseph-robertson
left a comment
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.
Looks good to me. Just a couple questions.
| if (modelObject.numberofAnnualVariableGroups() == 0) { | ||
| return boost::none; | ||
| } |
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.)
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:
factory = OpenStudio::IddFileAndFactoryWrapper.new("OpenStudio".to_IddFileType)
factory.objects.select {|o| o.numFields < o.properties.minFields}.map(&:name)
=> ["OS:ComponentData",
"OS:WindowMaterial:GlazingGroup:Thermochromic",
"OS:Construction",
"OS:Construction:InternalSource",
"OS:Schedule:Compact",
"OS:ShadingSurface",
"OS:Surface",
"OS:SubSurface",
"OS:ShadingControl",
"OS:ZoneProperty:UserViewFactors:BySurfaceName",
"OS:SurfaceProperty:SurroundingSurfaces",
"OS:SurfaceProperty:GroundSurfaces",
"OS:AirLoopHVAC:DedicatedOutdoorAirSystem",
"OS:GroundHeatExchanger:Vertical",
"OS:Coil:Cooling:DX:CurveFit:OperatingMode",
"OS:Connector:Mixer",
"OS:Connector:Splitter",
"OS:WaterUse:Connections",
"OS:UtilityCost:Charge:Block",
"OS:UtilityCost:Computation",
"OS:EnergyManagementSystem:ProgramCallingManager",
"OS:EnergyManagementSystem:Program",
"OS:EnergyManagementSystem:Subroutine",
"OS:PythonPlugin:Variable",
"OS:AirflowNetworkDetailedOpening"]m = Model.new
ems = OpenStudio::Model::EnergyManagementSystemProgram.new(m)
puts ems
OS:EnergyManagementSystem:Program,
{b988fdde-8d6b-4776-97fd-5e28e3e48316}, !- Handle
Energy_Management_System_Program_1; !- Name
puts ems.iddObject
OS:EnergyManagementSystem:Program,
\memo This input defines an Erl program
\memo Each field after the name is a line of EMS Runtime Language
\extensible:1
\min-fields 3
A1, \field Handle
\type handle
\required-field
A2, \field Name
\note No spaces allowed in names for ErlProgramNames
\type alpha
\required-field
\reference ErlProgramNames
\reference ErlProgramSubroutineNames
A3; \field Program Line
\type alpha
\required-field
\begin-extensible| class MODEL_API AnnualVariableGroup | ||
| { | ||
| public: | ||
| AnnualVariableGroup(std::string variableorMeterorEMSVariableorField, std::string aggregationType = "SumOrAverage", int digitsAfterDecimal = 2); |
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.
Name is required, but aggregation type and digits have default values.
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.
"SumOrAverage" is accoridng to the I/O reference, the most common option.
Digits after decimal = 2 is the E+ IDD default
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.
SumOrAverage is probably the most common choice for aggregation type.
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.
factory = OpenStudio::IddFileAndFactoryWrapper.new("EnergyPlus".to_IddFileType)
puts factory.getObject("Output:Table:Annual").gettruncated output:
Output:Table:Annual,
\extensible:3
A1, \field Name
A2, \field Filter
A3, \field Schedule Name
A4, \field Variable or Meter or EMS Variable or Field Name
\type external-list
+ \begin-extensible
\external-list autoRDDvariableMeter
A5, \field Aggregation Type for Variable or Meter
\type choice
\key SumOrAverage
\key Maximum
[... other keys but no default ...]
N1; \field Digits After Decimal
\type integer
\minimum 0
\maximum 10
+ \default 2| class MODEL_API MonthlyVariableGroup | ||
| { | ||
| public: | ||
| MonthlyVariableGroup(std::string variableOrMeterName, std::string aggregationType = "SumOrAverage"); |
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.
Monthly doesn't have a default value for digits because this field doesn't exist like it does for Annual.
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.
Edit: Digits doesn't exist at the group level. It does exist at the object level.
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, it is an object one here, not per extensible group (one of the weirdness of E+...), and that one is set in the ctor
OpenStudio/src/model/OutputTableMonthly.cpp
Lines 822 to 827 in ea0e2a7
| OutputTableMonthly::OutputTableMonthly(const Model& model) : ModelObject(OutputTableMonthly::iddObjectType(), model) { | |
| OS_ASSERT(getImpl<detail::OutputTableMonthly_Impl>()); | |
| bool ok = true; | |
| ok = setDigitsAfterDecimal(2); | |
| OS_ASSERT(ok); | |
| } |
|
I'm going to merge this after CI completes, we have too many open PRs that are related. Happy to hotfix anything if my answers weren't satisfying to you @joseph-robertson though. And thanks for the review. |
|
CI Results for 1445362:
|
Pull request overview
Output:Table:Monthly#5368Pull Request Author
src/model/test)src/energyplus/Test)src/osversion/VersionTranslator.cpp): N/ALabels:
IDDChangeAPIChangePull Request - Ready for CIso that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.