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

AirLoopHVACUnitarySystem set Method During XXX Operation - option #4905

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Jun 1, 2023

Pull request overview

Cleanup the DuringCooling API. One break, the return of supplyAirFlowRateMethodDuringCooling, which can be avoided (keep returning optional even if always initialized)

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: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • 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

…RateMethodDuringCooling, which can be avoided (keep returning optional even if always initialized)
@@ -130,7 +132,7 @@ namespace model {
boost::optional<HVACComponent> supplementalHeatingCoil() const;

/** In EnergyPlus 8.3.0 and above this property maps to the EnergyPlus field "Cooling Supply Air Flow Rate Method" **/
boost::optional<std::string> supplyAirFlowRateMethodDuringCoolingOperation() const;
std::string supplyAirFlowRateMethodDuringCoolingOperation() const;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Could avoid this API break by keeping it as optional<string> even though it'll always be set.

Comment on lines 2164 to 2187
bool AirLoopHVACUnitarySystem::setSupplyAirFlowRateMethodDuringCoolingOperation(const std::string& supplyAirFlowRateMethodDuringCoolingOperation) {
log_deprecation_and_throw_if_time_to_remove(BOOST_CURRENT_FUNCTION);
return false;
}

void AirLoopHVACUnitarySystem::resetSupplyAirFlowRateMethodDuringCoolingOperation() {
log_deprecation_and_throw_if_time_to_remove(BOOST_CURRENT_FUNCTION);
}

void AirLoopHVACUnitarySystem::resetSupplyAirFlowRateDuringCoolingOperation() {
log_deprecation_and_throw_if_time_to_remove(BOOST_CURRENT_FUNCTION);
}

void AirLoopHVACUnitarySystem::resetSupplyAirFlowRatePerFloorAreaDuringCoolingOperation() {
log_deprecation_and_throw_if_time_to_remove(BOOST_CURRENT_FUNCTION);
}

void AirLoopHVACUnitarySystem::resetFractionofAutosizedDesignCoolingSupplyAirFlowRate() {
log_deprecation_and_throw_if_time_to_remove(BOOST_CURRENT_FUNCTION);
}

void AirLoopHVACUnitarySystem::resetDesignSupplyAirFlowRatePerUnitofCapacityDuringCoolingOperation() {
log_deprecation_and_throw_if_time_to_remove(BOOST_CURRENT_FUNCTION);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All of these become no-op deprecated functions

Copy link
Collaborator

Choose a reason for hiding this comment

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

@jmarrec Can most of this new stuff be removed since (I believe) it pre-dates #4912?

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, replace with something like

DEPRECATED_AT_MSG(3, 7, 0, "Use setSupplyAirFlowRateDuringCoolingOperation instead.");

@@ -298,26 +299,23 @@ namespace model {

void resetSupplementalHeatingCoil();

bool setSupplyAirFlowRateMethodDuringCoolingOperation(boost::optional<std::string> supplyAirFlowRateMethodDuringCoolingOperation);
bool setSupplyAirFlowRateMethodDuringCoolingOperation(const std::string& supplyAirFlowRateMethodDuringCoolingOperation);
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 Impl side is ugly. cleanup the use of unecessary optionals

Comment on lines +345 to +347
bool AirLoopHVACUnitarySystem_Impl::hasCoolingCoil() const {
return !isEmpty(OS_AirLoopHVAC_UnitarySystemFields::CoolingCoilName);
}
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 am NOT using it right now. But if we wanted to disallow calling setSupplyAirFlowRateXXXDuringCoolingOperation to the case where there IS a cooling coil, we'd use that

Comment on lines +735 to +739
bool AirLoopHVACUnitarySystem_Impl::setCoolingCoil(const HVACComponent& coolingCoil) {
const bool result = setPointer(OS_AirLoopHVAC_UnitarySystemFields::CoolingCoilName, coolingCoil.handle());
if (openstudio::istringEqual("None", supplyAirFlowRateMethodDuringCoolingOperation())) {
autosizeSupplyAirFlowRateDuringCoolingOperation();
OS_ASSERT(setSupplyAirFlowRateMethodDuringCoolingOperation("SupplyAirFlowRate"));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

set Cooling Coil: set to SupplyAirFlowRate.

Comment on lines +745 to +751
const bool result = setString(OS_AirLoopHVAC_UnitarySystemFields::CoolingCoilName, "");
OS_ASSERT(result);
OS_ASSERT(setSupplyAirFlowRateMethodDuringCoolingOperation("None"));
resetSupplyAirFlowRateDuringCoolingOperation();
resetSupplyAirFlowRatePerFloorAreaDuringCoolingOperation();
resetFractionofAutosizedDesignCoolingSupplyAirFlowRate();
resetDesignSupplyAirFlowRatePerUnitofCapacityDuringCoolingOperation();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ResetCoolingCoil: set to None, clear out of the other fields.

I'm not sure whether we want to reset all fields at all times or not... Only ONE field will be used in the end, but it may be slightly annoying for people if they are testing things out.

Comment on lines +812 to +819
bool AirLoopHVACUnitarySystem_Impl::setSupplyAirFlowRateDuringCoolingOperation(double supplyAirFlowRateDuringCoolingOperation) {
const bool result =
setDouble(OS_AirLoopHVAC_UnitarySystemFields::SupplyAirFlowRateDuringCoolingOperation, supplyAirFlowRateDuringCoolingOperation);
OS_ASSERT(setSupplyAirFlowRateMethodDuringCoolingOperation("SupplyAirFlowRate"));
// resetSupplyAirFlowRateDuringCoolingOperation();
resetSupplyAirFlowRatePerFloorAreaDuringCoolingOperation();
resetFractionofAutosizedDesignCoolingSupplyAirFlowRate();
resetDesignSupplyAirFlowRatePerUnitofCapacityDuringCoolingOperation();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For each of these setters, you set the field + the method, reset all fields (again, not sure we want to reset all)

@joseph-robertson
Copy link
Collaborator

@jmarrec Seems easier to update the idd Method fields with \default None, no? And then change the return type of the getters to not be optional?

@jmarrec
Copy link
Collaborator Author

jmarrec commented Jun 22, 2023

@joseph-robertson I'm not sure I follow. Which fields do you want to set to None?

@joseph-robertson
Copy link
Collaborator

joseph-robertson commented Jun 22, 2023

@jmarrec Introduce \default None to the following fields:

  • Supply Air Flow Rate Method During Cooling Operation
  • Supply Air Flow Rate Method During Heating Operation

Then you wouldn't need that special code inside supplyAirFlowRateMethodDuringCoolingOperation().

@jmarrec
Copy link
Collaborator Author

jmarrec commented Jun 29, 2023

Yeah I think that makes sense. Up to you really.

@joseph-robertson joseph-robertson added Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. severity - Minor Bug and removed Developer Issue labels Jul 13, 2023
@ci-commercialbuildings
Copy link
Collaborator

ci-commercialbuildings commented Jul 14, 2023

@joseph-robertson joseph-robertson merged commit b053f33 into airloop-hvac-unitary-sys-opmethod Jul 14, 2023
@joseph-robertson joseph-robertson deleted the airloop-hvac-unitary-sys-opmethod2 branch July 14, 2023 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component - HVAC component - Model Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. severity - Minor Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants