-
Notifications
You must be signed in to change notification settings - Fork 392
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
Remove select_case_var
s & enum class
cleanup
#9385
Conversation
auto const SELECT_CASE_var(this->zoneEqSizing(this->curZoneEqNum).SizingMethod(DataHVACGlobals::CoolingAirflowSizing)); | ||
if ((SELECT_CASE_var == DataSizing::SupplyAirFlowRate) || (SELECT_CASE_var == DataSizing::None) || | ||
(SELECT_CASE_var == DataSizing::FlowPerFloorArea)) { | ||
switch (this->zoneEqSizing(this->curZoneEqNum).SizingMethod(DataHVACGlobals::CoolingAirflowSizing)) { |
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'm not going to harp on this because I want this stuff merged, but this is a good candidate for
auto & thisZoneEqSizing = this->zoneEqSizing(this->curZoneEqNum);
etc.
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.
Actually, given what we are seeing in the debug builds and the desire to move to EPVector
I will be harping on this more. 😁
auto const SELECT_CASE_var(this->curDuctType); | ||
if (SELECT_CASE_var == DataHVACGlobals::Main) { | ||
switch (this->curDuctType) { | ||
case DataHVACGlobals::Main: { |
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.
Main
, Other
, and default
are all the same case
. Can be combined.
} | ||
} | ||
} else { | ||
switch (this->curDuctType) { |
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.
And also here.
state, DXCoilNum, CompressorOperation::On, FirstHVACIteration, PartLoadRatio, FanOpMode, CompCycRatio, _, AirFlowRatio, MaxCap); | ||
} break; | ||
case CoilVRF_Heating: { | ||
CalcDXHeatingCoil(state, DXCoilNum, PartLoadRatio, FanOpMode, AirFlowRatio, MaxCap); |
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.
Should this be VRF?
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 VRF heating coil model re-uses the old DX heating coil calc routine. The VRF cooling coil has a few different equations so that coil type has it's own calc routine although we could probably incorporate new routine equations into the old if needed.
|
||
} break; | ||
default: { | ||
ShowSevereError(state, "Error detected in DX Coil=" + std::string{CompName}); |
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.
Mmmmm ... could this be an assert
? Wouldn't getInput
have caught this?
state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType + " \"" + state.dataDXCoils->DXCoil(DXCoilNum).Name + | ||
"\" - Requested enhanced dehumidification mode not available."); | ||
} | ||
if (state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType_Num == CoilDX_CoolingTwoStageWHumControl) { |
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.
auto & dxCoil = state.dataDXCoils->DXCoils(DXCoilNum);
default: { | ||
if (state.dataSurface->Surface(numSurf).ExtBoundCond > 0) { // interzone partition | ||
// use companion surface in adjacent zone | ||
switch (state.dataSurface->Surface(state.dataSurface->Surface(numSurf).ExtBoundCond).Class) { |
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.
Can probably make this into a lookup std::array
.
Par[1] = 1.0; | ||
} else { | ||
Par[1] = 0.0; | ||
switch (DesicDehum(DesicDehumNum).RegenCoilType_Num) { |
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.
auto & desicDehum = state.dataDesicDehum->DesicDehum(DesicDehumNum);
is a much more useful shortcut than auto & DesicDehum = state.dataDesicDehum->DesicDehum;
. In general, don't have shortcut references to arrays, use them for individual elements.
Par[1] = 0.0; | ||
} | ||
Par[2] = RegenCoilLoad; | ||
General::SolveRoot( |
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.
📌 Replace this templated function with actual lambdas. There is an issue about this.
} else if (SELECT_CASE_var == Coil_HeatingDesuperheater) { | ||
coilObjClassName = "Coil:Heating:Desuperheater"; | ||
} | ||
switch (state.dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num) { |
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.
📌 Should be able to get these from the constexpr std::array<std::string_view>
once these are converted to enum class
.
SPE = 1, // Specific people object | ||
OBJ = 2, // People object average | ||
PEO = 3, // People number average | ||
NO, // No multiple people objects |
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.
These names!
@Myoldmopar @amirroth I'll make a separate follow-up branch to pick up all comments here. |
Sounds like a plan to me @dareumnam, let's get this merged in, thanks! |
state, state.dataOutRptPredefined->pdchHeatCoilNomCap, HeatingCoil(CoilNum).Name, HeatingCoil(CoilNum).NominalCapacity); | ||
PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomEff, HeatingCoil(CoilNum).Name, HeatingCoil(CoilNum).Efficiency); | ||
} | ||
switch (HeatingCoil(CoilNum).HCoilType_Num) { |
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.
auto & heatingCoil = state.dataHeatingCoils->HeatingCoil(CoilNum);
} else if (SELECT_CASE_var == "NO") { | ||
state.dataUserDefinedComponents->UserCoil(CompLoop).PlantIsConnected = false; | ||
} | ||
if (cAlphaArgs(8) == "YES") { |
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 should probably be a function for this like bool getBoolValue(std::string_view str)
.
Pull request overview
select_case_var
s inenum class
cleanupNOTE: ENHANCEMENTS MUST FOLLOW A SUBMISSION PROCESS INCLUDING A FEATURE PROPOSAL AND DESIGN DOCUMENT PRIOR TO SUBMITTING CODE
Pull Request Author
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
Reviewer
This will not be exhaustively relevant to every PR.