-
Notifications
You must be signed in to change notification settings - Fork 448
Avail sch missing dx coils cleanup and converted get input to JSON #11012
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
Avail sch missing dx coils cleanup and converted get input to JSON #11012
Conversation
|
|
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.
Look at my suggested changes and try to propagate.
@@ -2979,895 +2979,978 @@ void GetDXCoils(EnergyPlusData &state) | |||
|
|||
// Loop over the Pumped DX Water Heater Coils and get & load the data | |||
CurrentModuleObject = HVAC::cAllCoilTypes(HVAC::CoilDX_HeatPumpWaterHeaterPumped); | |||
for (DXHPWaterHeaterCoilNum = 1; DXHPWaterHeaterCoilNum <= state.dataDXCoils->NumDXHeatPumpWaterHeaterPumpedCoils; ++DXHPWaterHeaterCoilNum) { | |||
auto &s_ip = state.dataInputProcessing->inputProcessor; |
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 have a giant coil branch in the hopper and there are going to be a lot of conflicts. Just a matter of which one of us will have to fix them. 😄
src/EnergyPlus/DXCoils.cc
Outdated
thisDXCoil.RatedAirVolFlowRate(1) = Numbers(7); | ||
if (thisDXCoil.RatedAirVolFlowRate(1) != Constant::AutoCalculate) { | ||
if (thisDXCoil.RatedAirVolFlowRate(1) <= 0.0) { | ||
std::string const cRatedHeatingCapFieldName = "Rated Heating Capacity"; |
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 can be a constexpr std::string_view
. There is no need to construct a dynamic string object at runtime to represent a constant string.
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.
Done.
src/EnergyPlus/DXCoils.cc
Outdated
cFieldName = "Evaporator Fan Power Included in Rated COP"; | ||
std::string fieldValue = s_ip->getAlphaFieldValue(fields, schemaProps, "evaporator_fan_power_included_in_rated_cop"); // Alphas(2) | ||
BooleanSwitch fanPowerIncluded = static_cast<BooleanSwitch>(getYesNoValue(Util::makeUPPER(fieldValue))); | ||
switch (fanPowerIncluded) { |
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.
A cleaner way to do this. If you are just making a single comparison, if
is better/faster than switch
. Note the ShowSevereInvalidBool
error wrapper.
if (fanPowerIncluded != BooleanSwitch::Invalid) {
thisDXCoil.FanPowerIncludedInCOP = static_cast<bool>(fanPowerIncluded);
} else {
ShowSevereInvalidBool(state, eoh, cFieldName, fieldValue);
ErrorsFound = true;
}
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.
What makes you believe that fieldValue will be anything other than Yes or No? This just seems to be overhead that's not needed. It's a direct read. No warning message, no gymnastics, just read that input to be true or false.
A2 , \field Evaporator Fan Power Included in Rated COP
\type choice
\key Yes
\key No
\default Yes
So what would that 1 line be? I'll paste together what I see here but am probably wrong. 1 line and done.
thisDXCoil.FanPowerIncludedInCOP = static_cast<bool>(static_cast<BooleanSwitch>(getYesNoValue(Util::makeUPPER(fieldValue))));
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 seems to be your corner. That would work. You actually don't need the static_cast<BooleanSwitch>
.
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.
Done.
src/EnergyPlus/DXCoils.cc
Outdated
if (!whPLFCurveName.empty()) { | ||
thisDXCoil.CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, whPLFCurveName); | ||
if (thisDXCoil.CrankcaseHeaterCapacityCurveIndex == 0) { // can't find the curve | ||
ShowSevereError(state, format("{} = {}: {} not found = {}", CurrentModuleObject, thisDXCoil.Name, cFieldName, whPLFCurveName)); |
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.
There is also an error wrapper for missing objects.
ShowSevereItemNotFound(state, eoh, cFieldName, whPLFCurveName);`
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.
Done.
src/EnergyPlus/DXCoils.cc
Outdated
if (!fieldValue.empty()) { | ||
thisDXCoil.HCapFAirFlow = GetCurveIndex(state, fieldValue); | ||
if (thisDXCoil.HCapFAirFlow == 0) { | ||
ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); |
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.
Another ShowSevereItemNotFound
. See UtilityRoutines
for wrappers for the common errors, e.g., EmptyField
, InvalidKey
, DuplicateName
, BadMin
.
@@ -14988,31 +15071,29 @@ void GetFanIndexForTwoSpeedCoil( | |||
int BranchNum; | |||
int CompNum; | |||
|
|||
auto &thisDXCoil = state.dataDXCoils->DXCoil(CoolingCoilIndex); | |||
|
|||
FoundBranch = 0; | |||
FoundAirSysNum = 0; | |||
SupplyFanIndex = 0; | |||
SupplyFanName = "n/a"; | |||
for (AirSysNum = 1; AirSysNum <= NumPrimaryAirSys; ++AirSysNum) { |
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.
While you are at it, may want to downscope the loop induction variables.
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.
Done.
@@ -172,20 +172,22 @@ namespace VariableSpeedCoils { | |||
SpeedCal = SpeedNum; | |||
} | |||
|
|||
if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit) || | |||
(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed)) { | |||
auto &varSpeedCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum); |
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.
Good lord, the conflicts are going to be massive.
src/EnergyPlus/VariableSpeedCoils.cc
Outdated
ShowContinueError(state, format("...required {} is blank.", cAlphaFields(AlfaFieldIncre))); | ||
std::string fieldName; | ||
for (int I = 1; I <= varSpeedCoil.NumOfSpeeds; ++I) { | ||
fieldName = "speed_" + std::to_string(I) + "_reference_unit_gross_rated_total_cooling_capacity"; |
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.
format
instead of string concatenate.
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.
Done.
} | ||
//"defrost_control", | ||
cFieldName = "Defrost Control"; // cAlphaFields(8) | ||
std::string defrostControl = s_ip->getAlphaFieldValue(fields, schemaProps, "defrost_control"); |
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.
getEnumValue
.
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.
Done
// SUBROUTINE LOCAL VARIABLE DECLARATIONS: | ||
int HPNum; // The Water to Air HP that you are currently loading input into | ||
int NumCool; | ||
int NumHeat; |
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 wish I would have told you to hold off on this until I was done with what I was doing. Too late. Get this merged and I will deal with it. Lesson learned.
@amirroth Thanks for your feedback comments; I will address them. This can be merged early, as the new feature will be based on the work from this branch. |
|
@Nigusse are you still intending this to be included in this release? |
@mitchute Yes, it has been ready for review. I will resolve the conflicts and push an updated branch by today. |
|
Below is the unused objects error message running the example file locally:
I am going to remove the unused schedule |
|
@Nigusse I have the Mac build errors fixed locally. I can push them up if you'd like. |
@Nigusse I went ahead and cleaned up those Mac build issues, and ran unit tests locally. All passed. |
|
|
@mitchute Thanks. |
This looks ready. Anything else here? |
I have found that the same fatal error message is missing in other DX Coils as well. I am addressing them all. |
|
@mitchute if this comes back clean then it should be ready to merge. We've pounded on this one for some time now. |
|
Some regressions, as expected, but this is clean otherwise. Merging. |
Pull request overview
Description of the purpose of this PR
Pull Request Author
Reviewer