Skip to content

Commit

Permalink
const
Browse files Browse the repository at this point in the history
  • Loading branch information
rraustad committed Dec 24, 2024
1 parent 0605297 commit cf6b3af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/EnergyPlus/WaterToAirHeatPump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2317,7 +2317,7 @@ namespace WaterToAirHeatPump {
// Hugh I. Henderson, Jr., P.E., Kannan Rengarajan, P.E.

// Using/Aliasing
auto &heatPump = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum);
auto const &heatPump = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum);

// Return value
Real64 SHReff; // Effective sensible heat ratio, includes degradation due to cycling effects
Expand Down
27 changes: 13 additions & 14 deletions src/EnergyPlus/WaterToAirHeatPumpSimple.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ namespace WaterToAirHeatPumpSimple {
}
}

auto &simpleWAHP(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum));
auto const &simpleWAHP = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum);

if (simpleWAHP.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit) {
// Cooling mode
Expand Down Expand Up @@ -1275,8 +1275,7 @@ namespace WaterToAirHeatPumpSimple {
// METHODOLOGY EMPLOYED:
// Obtains heating capacities and flow rates from the zone or system sizing arrays.

auto &ZoneEqSizing(state.dataSize->ZoneEqSizing);
auto &simpleWatertoAirHP(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum));
auto &simpleWatertoAirHP = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum);

// SUBROUTINE PARAMETER DEFINITIONS:
static constexpr std::string_view RoutineName("SizeWaterToAirCoil");
Expand Down Expand Up @@ -1523,7 +1522,7 @@ namespace WaterToAirHeatPumpSimple {
}
// cooling design day calculations
if (VolFlowRate >= HVAC::SmallAirVolFlow) {
auto &finalSysSizing(state.dataSize->FinalSysSizing(state.dataSize->CurSysNum));
auto const &finalSysSizing = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum);
if (state.dataSize->CurOASysNum > 0) { // coil is in the OA stream
MixTemp = finalSysSizing.OutTempAtCoolPeak;
MixHumRat = finalSysSizing.OutHumRatAtCoolPeak;
Expand Down Expand Up @@ -1658,7 +1657,7 @@ namespace WaterToAirHeatPumpSimple {
if (VolFlowRate >= HVAC::SmallAirVolFlow) {
// cooling design calculations
if (state.dataSize->ZoneEqDXCoil) {
if (ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) {
if (state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) {
MixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInTemp;
MixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInHumRat;
// calculate mixed air temperature and humidity with system airflow
Expand Down Expand Up @@ -1797,7 +1796,7 @@ namespace WaterToAirHeatPumpSimple {
VolFlowRate = HeatingAirVolFlowRateDes; // system air flow
}
if (VolFlowRate >= HVAC::SmallAirVolFlow) {
auto &finalSysSizing(state.dataSize->FinalSysSizing(state.dataSize->CurSysNum));
auto const &finalSysSizing = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum);
if (state.dataSize->CurOASysNum > 0) { // coil is in the OA stream
MixTemp = finalSysSizing.OutTempAtCoolPeak;
MixHumRat = finalSysSizing.OutHumRatAtCoolPeak;
Expand Down Expand Up @@ -1913,7 +1912,7 @@ namespace WaterToAirHeatPumpSimple {
}
if (VolFlowRate >= HVAC::SmallAirVolFlow) {
if (state.dataSize->ZoneEqDXCoil) {
if (ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) {
if (state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) {
MixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInTemp;
MixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInHumRat;
} else {
Expand Down Expand Up @@ -2012,8 +2011,8 @@ namespace WaterToAirHeatPumpSimple {
if (!HardSizeNoDesRun) {
if (RatedCapCoolTotalAutoSized) {
if (simpleWatertoAirHP.CompanionHeatingCoilNum > 0) {
auto &companionHeatingCoil(
state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionHeatingCoilNum));
auto const &companionHeatingCoil =
state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionHeatingCoilNum);
if (companionHeatingCoil.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPHeatingEquationFit &&
companionHeatingCoil.RatedCapHeat > 0) {
// case 1: companion heating coil has a user-specified capacity
Expand Down Expand Up @@ -2353,7 +2352,7 @@ namespace WaterToAirHeatPumpSimple {
}
// heating design day calculations
if (VolFlowRate >= HVAC::SmallAirVolFlow) {
auto &finalSysSizing(state.dataSize->FinalSysSizing(state.dataSize->CurSysNum));
auto const &finalSysSizing = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum);
if (state.dataSize->CurOASysNum > 0) { // coil is in the OA stream
HeatMixTemp = finalSysSizing.HeatOutTemp;
HeatMixHumRat = finalSysSizing.HeatOutHumRat;
Expand Down Expand Up @@ -2471,7 +2470,7 @@ namespace WaterToAirHeatPumpSimple {
}
if (VolFlowRate >= HVAC::SmallAirVolFlow) {
if (state.dataSize->ZoneEqDXCoil) {
if (ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) {
if (state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) {
HeatMixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatCoilInTemp;
HeatMixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatCoilInHumRat;
// calculate mixed air temperature with system airflow
Expand Down Expand Up @@ -2887,8 +2886,8 @@ namespace WaterToAirHeatPumpSimple {
} else if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Cooling) {
// use companion heating coil capacity to calculate volumetric flow rate
if (simpleWatertoAirHP.CompanionHeatingCoilNum > 0) {
auto &companionHeatingCoil(
state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionHeatingCoilNum));
auto const &companionHeatingCoil =
state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionHeatingCoilNum);
if (companionHeatingCoil.RatedCapHeat == DataSizing::AutoSize) {
SystemCapacity = simpleWatertoAirHP.RatedCapCoolTotal; // but you should use condenser capacity?
} else {
Expand Down Expand Up @@ -3719,7 +3718,7 @@ namespace WaterToAirHeatPumpSimple {
Real64 Error; // Error for iteration (DO) loop
Real64 LHRmult; // Latent Heat Ratio (LHR) multiplier. The effective latent heat ratio LHR = (1-SHRss)*LHRmult

auto &simpleWatertoAirHP(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum));
auto const &simpleWatertoAirHP = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum);

Twet_Rated = simpleWatertoAirHP.Twet_Rated;
Gamma_Rated = simpleWatertoAirHP.Gamma_Rated;
Expand Down

3 comments on commit cf6b3af

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

CppCheck-consts (rraustad) - x86_64-Linux-Ubuntu-24.04-gcc-13.3: OK (2918 of 2918 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

CppCheck-consts (rraustad) - x86_64-Linux-Ubuntu-24.04-gcc-13.3-UnitTestsCoverage-RelWithDebInfo: OK (2100 of 2100 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

CppCheck-consts (rraustad) - x86_64-Linux-Ubuntu-24.04-gcc-13.3-IntegrationCoverage-RelWithDebInfo: OK (801 of 801 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.