Skip to content
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

Fix #4185 - Wrap Fan:ComponentModel in OS SDK #4193

Merged
merged 40 commits into from
Mar 4, 2021
Merged

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Jan 27, 2021

Pull request overview

Pull Request Author

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • 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: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Checked behavior in OpenStudioApplication, adjusted policies as needed (src/openstudio_lib/library/OpenStudioPolicy.xml)
  • 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

```
$os_build/Products/openstudio GenerateClass.rb -c "FanComponentModel" -b "StraightComponent"  -i "OS:Fan:ComponentModel" -s model -o /home/julien/Software/Others/OpenStudio/src/model/ -p -f -r
```
@jmarrec jmarrec added this to the OpenStudio SDK 3.2.0 milestone Jan 27, 2021
@jmarrec jmarrec self-assigned this Jan 27, 2021
Comment on lines +408 to +411
case openstudio::IddObjectType::Curve_ExponentialDecay: {
modelObject = translateCurveExponentialDecay(workspaceObject);
break;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

While testing, I realized the RT existed but it wasn't actually used for Curve:ExponentialDecay

Comment on lines +550 to +553
case openstudio::IddObjectType::Fan_ComponentModel: {
modelObject = translateFanComponentModel(workspaceObject);
break;
}
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 enabled the RT for the object...

Comment on lines +1332 to +1336
} else {
auto componentModelFans = subsetCastVector<FanComponentModel>(comps);
if (!componentModelFans.empty()) {
result = componentModelFans.back();
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Register fan type for AirLoopHVAC

src/model/FanComponentModel.cpp Outdated Show resolved Hide resolved
Comment on lines 21715 to 21951
\type real
\minimum 1.0
\required-field
\note Applied to specified or autosized VFD output power
A7 , \field Fan Pressure Rise Curve Name
\required-field
\type object-list
\object-list FanPressureRiseCurves
\object-list BiVariateTables
\note Pressure rise depends on volumetric flow, system resistances,
\note system leakage, and duct static pressure set point
A8 , \field Duct Static Pressure Reset Curve Name
\required-field
\type object-list
\object-list LinearCurves
\object-list UniVariateTables
\note Function of fan volumetric flow
\note Minimum and maximum fan airflows correspond respectively to
\note minimum and maximum duct static pressure set points
A9 , \field Normalized Fan Static Efficiency Curve Name-Non-Stall Region
\required-field
\type object-list
\object-list ExponentialSkewNormalCurves
\object-list UniVariateTables
\note xfan <= 0
\note Curve should have maximum of 1.0
A10, \field Normalized Fan Static Efficiency Curve Name-Stall Region
\required-field
\type object-list
\object-list ExponentialSkewNormalCurves
\object-list UniVariateTables
\note xfan > 0
\note Curve should have maximum of 1.0
A11 , \field Normalized Dimensionless Airflow Curve Name-Non-Stall Region
\required-field
\type object-list
\object-list SigmoidCurves
\object-list UniVariateTables
\note xspd <= 0
\note Curve should have maximum of 1.0
A12 , \field Normalized Dimensionless Airflow Curve Name-Stall Region
\required-field
\type object-list
\object-list SigmoidCurves
\object-list UniVariateTables
\note xspd > 0
\note Curve should have maximum of 1.0
A13 , \field Maximum Belt Efficiency Curve Name
\type object-list
\object-list QuarticCurves
\object-list UniVariateTables
\note Determines maximum fan drive belt efficiency in log space
\note as function of xbelt,max
\note Curve should have minimum of -4.6 and maximum of 0.0
\note If field blank, assumes output of curve is always 1.0
A14 , \field Normalized Belt Efficiency Curve Name - Region 1
\type object-list
\object-list RectangularHyperbola2Curves
\object-list UniVariateTables
\note Region 1 (0 <= xbelt < xbelt,trans)
\note Curve should have minimum > 0.0 and maximum of 1.0
\note If field blank, assumes output of curve is always 1.0 in Region 1
A15 , \field Normalized Belt Efficiency Curve Name - Region 2
\type object-list
\object-list ExponentialDecayCurves
\object-list UniVariateTables
\note Region 2 (xbelt,trans <= xbelt <= 1)
\note Curve should have minimum > 0.0 and maximum of 1.0
\note If field blank, assumes output of curve is always 1.0 in Region 2
A16 , \field Normalized Belt Efficiency Curve Name - Region 3
\type object-list
\object-list RectangularHyperbola2Curves
\object-list UniVariateTables
\note Determines normalized drive belt efficiency Region 3 (xbelt > 1)
\note Curve should have minimum > 0.0 and maximum of 1.0
\note If field blank, assumes output of curve is always 1.0 in Region 3
A17 , \field Maximum Motor Efficiency Curve Name
\type object-list
\object-list RectangularHyperbola1Curves
\object-list UniVariateTables
\note Curve should have minimum > 0.0 and maximum of 1.0
\note If field blank, assumes output of curve is always 1.0
A18 , \field Normalized Motor Efficiency Curve Name
\type object-list
\object-list RectangularHyperbola2Curves
\object-list UniVariateTables
\note Curve should have minimum > 0.0 and maximum of 1.0
\note If field blank, assumes output of curve is always 1.0
A19 , \field VFD Efficiency Curve Name
\type object-list
\object-list RectangularHyperbola2Curves
\object-list UniVariateTables
\note Determines VFD efficiency as function of motor load or speed fraction
\note Curve should have minimum > 0.0 and maximum of 1.0
\note If field blank, assumes constant VFD efficiency (0.97)
A20 ; \field End-Use Subcategory
\note Any text may be used here to categorize the end-uses in the ABUPS End Uses by Subcategory table.
\type alpha
\retaincase
\required-field
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

IDD. I pretty much made everything required.

Copy link
Contributor

Choose a reason for hiding this comment

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

Love it!

Comment on lines +437 to +457
boost::optional<ZoneHVACComponent> FanComponentModel_Impl::containingZoneHVACComponent() const {

// Note JM 2021-01-26: Only ZoneHVAC:EvaporativeCoolerUnit apparently, which isn't wrapped in the OS SDK currently

//std::vector<ZoneHVACComponent> zoneHVACComponent = this->model().getModelObjects<ZoneHVACComponent>();
//for (const auto& elem : zoneHVACComponent) {
//switch (elem.iddObject().type().value()) {

//// ZoneHVAC:EvaporativeCoolerUnit: not wrapped
//case openstudio::IddObjectType::OS_ZoneHVAC_EvaporativeCoolerUnit: {
//ZoneHVACEnergyRecoveryVentilator component = elem.cast<ZoneHVACEvaporativeCoolerUnit>();
//if (component.supplyAirFan().handle() == this->handle()) return elem;
//break;
//}
//default: {
//break;
//}
//}
//}
return boost::none;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

containingZoneHVACComponent: apparently only ZoneHVAC:EvaporativeCoolerUnit allows it (ref Fans), but it's not wrapped in OS SDK.

ok = setEndUseSubcategory("General");
OS_ASSERT(ok);

// Default from E+ example file: EnergyPlus/testfiles/5ZoneWarmestVFD_FCMAuto.idf, v9.4.0
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Default required fields from the E+ example, where there was no IDD default.

src/model/FanComponentModel.cpp Show resolved Hide resolved
/** @name Constructors and Destructors */
//@{

explicit FanComponentModel(const Model& model);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here, perhaps should change to take 5 required curves

Copy link
Contributor

Choose a reason for hiding this comment

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

I say make an overload.

src/energyplus/Test/FanComponentModel_GTest.cpp Outdated Show resolved Hide resolved
@jmarrec jmarrec added the Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. label Jan 27, 2021
@jmarrec jmarrec requested a review from kbenne January 27, 2021 13:56
@jmarrec
Copy link
Collaborator Author

jmarrec commented Jan 27, 2021

OSX failed test is a usual suspect: ForwardTranslatorTest_MultiThreadedLogMessages

Copy link
Contributor

@kbenne kbenne left a comment

Choose a reason for hiding this comment

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

@jmarrec let me know if you want to adjust (overload) the ctor. Other than that, I'm ready to merge.

jmarrec added 6 commits March 3, 2021 09:37
src/model/FanComponentModel.hpp Outdated Show resolved Hide resolved
src/model/FanComponentModel.hpp Show resolved Hide resolved
src/model/FanComponentModel.cpp Outdated Show resolved Hide resolved
src/model/FanComponentModel.cpp Show resolved Hide resolved
@kbenne kbenne merged commit 56431fd into develop Mar 4, 2021
@kbenne kbenne deleted the 4185_FanComponentModel branch March 4, 2021 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

Provide Access to EnergyPlus object "Fan:ComponentModel" via OS SDK/API
3 participants