Skip to content

Conversation

@jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Mar 17, 2025

Pull request overview

Pull Request Author

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: #5368 - Wrap OutputTableAnnual and OutputTableMonthly OpenStudio-resources#217
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp): N/A
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified

@jmarrec jmarrec added Enhancement Request component - Model component - IDF Translation Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. IDDChange labels Mar 17, 2025
@jmarrec jmarrec self-assigned this Mar 17, 2025
jmarrec added 5 commits March 17, 2025 21:25
…once.

Technically speaking, there should be a non-advanced aggregation type in between both, but it's way overkilled to try to enforce that
Comment on lines 150 to 154
boost::optional<unsigned> existingIndex_ = monthlyVariableGroupIndex(monthlyVariableGroup);
if (existingIndex_) {
LOG(Warn, "For " << briefDescription() << ", MonthlyVariableGroup already exists: " << monthlyVariableGroup);
return false;
}
Copy link
Collaborator Author

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')

Copy link
Collaborator Author

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

Copy link
Collaborator

@joseph-robertson joseph-robertson left a 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.

Comment on lines +25 to +27
if (modelObject.numberofAnnualVariableGroups() == 0) {
return boost::none;
}
Copy link
Collaborator

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.)

Copy link
Collaborator Author

@jmarrec jmarrec Mar 19, 2025

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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);
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

@jmarrec jmarrec Mar 19, 2025

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").get

truncated 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");
Copy link
Collaborator

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.

Copy link
Collaborator

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.

Copy link
Collaborator Author

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

OutputTableMonthly::OutputTableMonthly(const Model& model) : ModelObject(OutputTableMonthly::iddObjectType(), model) {
OS_ASSERT(getImpl<detail::OutputTableMonthly_Impl>());
bool ok = true;
ok = setDigitsAfterDecimal(2);
OS_ASSERT(ok);
}

@jmarrec
Copy link
Collaborator Author

jmarrec commented Mar 19, 2025

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-commercialbuildings
Copy link
Collaborator

ci-commercialbuildings commented Mar 19, 2025

CI Results for 1445362:

@jmarrec jmarrec merged commit 5777550 into develop Mar 19, 2025
3 of 6 checks passed
@jmarrec jmarrec deleted the 5368-OutputTable branch March 19, 2025 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component - IDF Translation component - Measures component - Model Enhancement Request IDDChange Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrap E+ Output:Table:Monthly

4 participants