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

Enum Refactor: DataZoneEquipment #9163

Merged
merged 22 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/EnergyPlus/AirflowNetworkBalanceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12325,9 +12325,6 @@ namespace AirflowNetworkBalanceManager {
// PURPOSE OF THIS SUBROUTINE:
// This subroutine validate zone exhaust fan and associated surface

// Using/Aliasing
using DataZoneEquipment::ZoneExhaustFan_Num;
Copy link
Member

Choose a reason for hiding this comment

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

A simple but nice change.


// SUBROUTINE PARAMETER DEFINITIONS:
static constexpr std::string_view RoutineName("ValidateExhaustFanInput: "); // include trailing blank space

Expand Down Expand Up @@ -12425,7 +12422,7 @@ namespace AirflowNetworkBalanceManager {
for (j = 1; j <= state.dataGlobal->NumOfZones; ++j) {
if (!state.dataZoneEquip->ZoneEquipConfig(j).IsControlled) continue;
for (EquipTypeNum = 1; EquipTypeNum <= state.dataZoneEquip->ZoneEquipList(j).NumOfEquipTypes; ++EquipTypeNum) {
if (state.dataZoneEquip->ZoneEquipList(j).EquipType_Num(EquipTypeNum) == ZoneExhaustFan_Num) {
if (state.dataZoneEquip->ZoneEquipList(j).EquipTypeEnum(EquipTypeNum) == DataZoneEquipment::ZoneEquip::ZoneExhaustFan) {
found = false;
for (k = 1; k <= state.dataZoneEquip->ZoneEquipConfig(j).NumExhaustNodes; ++k) {
for (i = 1; i <= state.dataAirflowNetwork->AirflowNetworkNumOfExhFan; ++i) {
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/BaseboardElectric.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ namespace BaseboardElectric {
using DataSizing::CapacityPerFloorArea;
using DataSizing::FractionOfAutosizedHeatingCapacity;
using DataSizing::HeatingDesignCapacity;
using DataZoneEquipment::BBElectricConvective_Num;
using GlobalNames::VerifyUniqueBaseboardName;

// SUBROUTINE PARAMETER DEFINITIONS:
Expand Down Expand Up @@ -338,7 +337,8 @@ namespace BaseboardElectric {

for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) {
for (ZoneEquipTypeNum = 1; ZoneEquipTypeNum <= state.dataZoneEquip->ZoneEquipList(CtrlZone).NumOfEquipTypes; ++ZoneEquipTypeNum) {
if (state.dataZoneEquip->ZoneEquipList(CtrlZone).EquipType_Num(ZoneEquipTypeNum) == BBElectricConvective_Num &&
if (state.dataZoneEquip->ZoneEquipList(CtrlZone).EquipTypeEnum(ZoneEquipTypeNum) ==
DataZoneEquipment::ZoneEquip::BBElectricConvective &&
state.dataZoneEquip->ZoneEquipList(CtrlZone).EquipName(ZoneEquipTypeNum) == thisBaseboard.EquipName) {
thisBaseboard.ZonePtr = CtrlZone;
}
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/ChilledCeilingPanelSimple.cc
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ void GetCoolingPanelInput(EnergyPlusData &state)
// search zone equipment list structure for zone index
for (int ctrlZone = 1; ctrlZone <= state.dataGlobal->NumOfZones; ++ctrlZone) {
for (int zoneEquipTypeNum = 1; zoneEquipTypeNum <= state.dataZoneEquip->ZoneEquipList(ctrlZone).NumOfEquipTypes; ++zoneEquipTypeNum) {
if (state.dataZoneEquip->ZoneEquipList(ctrlZone).EquipType_Num(zoneEquipTypeNum) == DataZoneEquipment::CoolingPanel_Num &&
if (state.dataZoneEquip->ZoneEquipList(ctrlZone).EquipTypeEnum(zoneEquipTypeNum) == DataZoneEquipment::ZoneEquip::CoolingPanel &&
state.dataZoneEquip->ZoneEquipList(ctrlZone).EquipName(zoneEquipTypeNum) == ThisCP.EquipID) {
ThisCP.ZonePtr = ctrlZone;
}
Expand Down
42 changes: 21 additions & 21 deletions src/EnergyPlus/ConvectionCoefficients.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5823,9 +5823,9 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu
EquipNum <= state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex).NumOfEquipTypes;
++EquipNum) {

switch (state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex).EquipType_Num(EquipNum)) {
case AirDistUnit_Num:
case PurchasedAir_Num:
switch (state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex).EquipTypeEnum(EquipNum)) {
case DataZoneEquipment::ZoneEquip::AirDistUnit:
case DataZoneEquipment::ZoneEquip::PurchasedAir:
Copy link
Member

Choose a reason for hiding this comment

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

This reads so much nicer.

if (!(allocated(state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
.EquipData(EquipNum)
.OutletNodeNums)))
Expand Down Expand Up @@ -5858,15 +5858,15 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu
}
}
break;
case WindowAC_Num:
case PkgTermHPAirToAir_Num:
case PkgTermACAirToAir_Num:
case ZoneDXDehumidifier_Num:
case PkgTermHPWaterToAir_Num:
case FanCoil4Pipe_Num:
case UnitVentilator_Num:
case UnitHeater_Num:
case OutdoorAirUnit_Num:
case DataZoneEquipment::ZoneEquip::WindowAC:
case DataZoneEquipment::ZoneEquip::PkgTermHPAirToAir:
case DataZoneEquipment::ZoneEquip::PkgTermACAirToAir:
case DataZoneEquipment::ZoneEquip::ZoneDXDehumidifier:
case DataZoneEquipment::ZoneEquip::PkgTermHPWaterToAir:
case DataZoneEquipment::ZoneEquip::FanCoil4Pipe:
case DataZoneEquipment::ZoneEquip::UnitVentilator:
case DataZoneEquipment::ZoneEquip::UnitHeater:
case DataZoneEquipment::ZoneEquip::OutdoorAirUnit:
if (!(allocated(state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
.EquipData(EquipNum)
.OutletNodeNums)))
Expand Down Expand Up @@ -5898,11 +5898,11 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu
}
}
break;
case CoolingPanel_Num:
case BBSteam_Num:
case BBWaterConvective_Num:
case BBElectricConvective_Num:
case BBWater_Num:
case DataZoneEquipment::ZoneEquip::CoolingPanel:
case DataZoneEquipment::ZoneEquip::BBSteam:
case DataZoneEquipment::ZoneEquip::BBWaterConvective:
case DataZoneEquipment::ZoneEquip::BBElectricConvective:
case DataZoneEquipment::ZoneEquip::BBWater:
if (state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex).EquipData(EquipNum).ON) {
EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx);
FlowRegimeStack[EquipOnCount] = ConvectionConstants::InConvFlowRegime::B;
Expand All @@ -5914,8 +5914,8 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu
.CoolingPriority(EquipNum);
}
break;
case BBElectric_Num:
case HiTempRadiant_Num:
case DataZoneEquipment::ZoneEquip::BBElectric:
case DataZoneEquipment::ZoneEquip::HiTempRadiant:
if (state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex).EquipData(EquipNum).ON) {
EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx);
FlowRegimeStack[EquipOnCount] = ConvectionConstants::InConvFlowRegime::B;
Expand All @@ -5927,8 +5927,8 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu
.CoolingPriority(EquipNum);
}
break;
case VentilatedSlab_Num:
case LoTempRadiant_Num:
case DataZoneEquipment::ZoneEquip::VentilatedSlab:
case DataZoneEquipment::ZoneEquip::LoTempRadiant:
if (state.dataZoneEquip->ZoneEquipConfig(ZoneNum).InFloorActiveElement) {
for (SurfLoop = Zone(ZoneNum).HTSurfaceFirst; SurfLoop <= Zone(ZoneNum).HTSurfaceLast; ++SurfLoop) {
if (!state.dataSurface->SurfIntConvSurfHasActiveInIt(SurfLoop)) continue;
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/DataAirLoop.hh
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ namespace DataAirLoop {
int OAControllerIndex; // OA controller index in OAController
Array1D_string ComponentName;
Array1D_string ComponentType;
Array1D<SimAirServingZones::CompType> ComponentType_Num; // Parameterized (see above) Component Types this
Array1D<SimAirServingZones::CompType> ComponentTypeEnum; // Parameterized (see above) Component Types this
// module can address
Array1D_int ComponentIndex; // Which one in list -- updated by routines called from here
std::vector<HVACSystemData *> compPointer;
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/DataDefineEquip.hh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace DataDefineEquip {
int NumComponents; // number of subcomponents (=1)
int NumControls; // number of controls (not used; =0)
Array1D_string EquipType; // Pointer identifying type of subcomponent
Array1D<DataDefineEquip::iZnAirLoopEquipType> EquipType_Num;
Array1D<DataDefineEquip::iZnAirLoopEquipType> EquipTypeEnum;
///// Note use of shared_ptr here is not a good pattern, not to be replicated without further discussion.
std::shared_ptr<AirTerminalUnit> airTerminalPtr;
Array1D_string EquipName; // name of subcomponent
Expand Down Expand Up @@ -131,7 +131,7 @@ namespace DataDefineEquip {
// Default Constructor
ZoneAirEquip()
: OutletNodeNum(0), NumComponents(0), NumControls(0), EquipType(MaxZoneAirComponents),
EquipType_Num(MaxZoneAirComponents, DataDefineEquip::iZnAirLoopEquipType::Unassigned), airTerminalPtr(nullptr),
EquipTypeEnum(MaxZoneAirComponents, DataDefineEquip::iZnAirLoopEquipType::Unassigned), airTerminalPtr(nullptr),
EquipName(MaxZoneAirComponents), EquipIndex(MaxZoneAirComponents, 0), AirTerminalSizingSpecIndex(0), TermUnitSizingNum(0),
UpStreamLeakFrac(0.0), DownStreamLeakFrac(0.0), MassFlowRateUpStrLk(0.0), MassFlowRateDnStrLk(0.0), MassFlowRateTU(0.0),
MassFlowRateZSup(0.0), MassFlowRateSup(0.0), MassFlowRatePlenInd(0.0), MaxAvailDelta(0.0), MinAvailDelta(0.0), InletNodeNum(0),
Expand Down
Loading