-
Notifications
You must be signed in to change notification settings - Fork 398
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
Refactor RAFN CheckEquipName for forced air zone equipment #10452
Conversation
@@ -2676,7 +2697,7 @@ namespace RoomAir { | |||
std::string const &EquipName, // Equipment Name | |||
std::string &SupplyNodeName, // Supply node name | |||
std::string &ReturnNodeName, // Return node name | |||
int TotNumEquip, // how many of this equipment type | |||
int EquipIndex, // Equipment index |
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 no need for TotNumEquip. EquipIndex is added to get index for each type of zone equipment
SupplyNodeName = Alphas(6); | ||
ReturnNodeName = Alphas(5); | ||
SupplyNodeNum = state.dataFanCoilUnits->FanCoil(EquipIndex).AirOutNode; | ||
ReturnNodeNum = state.dataFanCoilUnits->FanCoil(EquipIndex).AirInNode; |
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.
Get air inlet and outlet nodes directly from FanCoilUnits based on EquipIndex
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.
@Myoldmopar At some point in the past, we frowned on looking directly into other components' data structures, e.g.
SupplyNodeNum = state.dataFanCoilUnits->FanCoil(EquipIndex).AirOutNode;
and preferred using mining functions, e.g.
SupplyNodeNum = HVACVariableRefrigerantFlow::GetVRFTUZoneInletAirNode(state, EquipIndex);
What's our current preference?
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 are two questions here. One is whether we should use access functions or direct access. There are two benefits to using access functions:
- The ability to control/enforce simultaneous and internally consistent of related member variables.
- The ability to support an external API.
The downside of course is overhead, both in terms of code but also at runtime.
If we want to go with access functions, there are two choices:
- Mining functions that take an object index: overhead is higher, but can double as an API if needed (I think not). We use this pattern fairly extensively.
- Methods: low overhead, but no API support. We hardly use this.
Unfortunately, there is also a non-choice that we use extensively:
- Mining functions that take an object name and have to search for the object on every call. Yikes! We need to sweep this idiom out and the most recent fans PR does that for that module.
I personally favor direct access, but there are some advantages to access methods and if people want to go that round I would not scream too loud.
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 only reason I see for using mining functions is the call to getInput. If the fan coil has been read in then accessing that data, so the user doesn't have to provide it, seems reasonable (line 2735 above). If the fan coil has not been read in, then a mining function will do the trick. I envision keeping the getIndex for each component type and using direct access for everything else. The problem here is EquipIndex = state.dataZoneEquip->ZoneEquipList(iZone).EquipIndex(thisZoneEquipNum);
may still be 0 at this point (I didn't trace back to see if all the equipment has been read in) or does not necessarily point to the component index and could instead point to the index from 1-n of the type of zone equipment (e.g. PTAC 1 to 3, or PTHP 1 to 4, etc). So index = 1 would point to UnitarySystem 1 of 7. Since we don't have example files with various mixes of component types, the mistakes don't show up until a user provides a broken input file with a mix of multiple equipment types.
I've tried to explain this concept as best I can in the past.
This is what gets passed back from the simulate function:
CompIndex = this->m_EquipCompNum;
And this is how that variable gets set (because of zone availability managers):
// zone equipment require a 1-n index for access to zone availability managers
switch (getPTUnitType) {
case 1: // Excuse me?
++numPTAC;
thisSys.m_EquipCompNum = numPTAC;
break;
case 2: // Baking powder?
++numPTHP;
thisSys.m_EquipCompNum = numPTHP;
break;
case 3:
++numPTWSHP;
thisSys.m_EquipCompNum = numPTWSHP;
break;
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.
Out of curiosity, this is what PackagedTerminalHeatPump did prior to #9052:
// Find the correct packaged terminal heat pump
if (CompIndex == 0) {
PTUnitNum = UtilityRoutines::FindItemInList(CompName, state.dataPTHP->PTUnit);
if (PTUnitNum == 0) {
ShowFatalError(state, "SimPackagedTerminalUnit: Unit not found=" + std::string{CompName});
}
CompIndex = state.dataPTHP->PTUnit(PTUnitNum).PTObjectIndex;
} else {
{
auto const SELECT_CASE_var(PTUnitType);
if (SELECT_CASE_var == PkgTermHPAirToAir_Num) {
PTUnitNum = CompIndex;
} else if (SELECT_CASE_var == PkgTermACAirToAir_Num) {
PTUnitNum = CompIndex + state.dataPTHP->NumPTHP;
} else if (SELECT_CASE_var == PkgTermHPWaterToAir_Num) {
PTUnitNum = CompIndex + state.dataPTHP->NumPTHP + state.dataPTHP->NumPTAC;
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 ran another example file as FanCoilAutoSize.idf to see if which one of getRoomAirModeInput and getFanCoilInput gets first. The getRoomAirModeInput comes first, and getFanCoilInput comes much later. Therefore, the direct access may not work well for every case. In order to be consistent, I use the access functions for every zone equipment type check.
SupplyNodeName = Alphas(4); | ||
ReturnNodeName = Alphas(3); | ||
SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirOutNode(state, EquipName, 0, errorfound); | ||
ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirInNode(state, EquipName, 0, errorfound); |
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.
Get inlet and outlet nodes from existing functions
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 problem here is that EquipIndex is the index to the type of PTUnit equipment (i.e., PTAC, PTHP, or PTWSHP) which is not the same as the index to the unitarySys struct.
// zone equipment require a 1-n index for access to zone availability managers
switch (getPTUnitType) {
case 1: // Excuse me?
++numPTAC;
thisSys.m_EquipCompNum = numPTAC;
break;
case 2: // Baking powder?
++numPTHP;
thisSys.m_EquipCompNum = numPTHP;
break;
case 3:
++numPTWSHP;
thisSys.m_EquipCompNum = numPTWSHP;
break;
default:
assert(true);
}
int thisSysNum = state.dataUnitarySystems->numUnitarySystems - 1;
state.dataUnitarySystems->unitarySys[thisSysNum] = thisSys;
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.
@rraustad I am going to check it.
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.
@rraustad What I need is to find UnitarySys index from state.dataZoneEquip->ZoneEquipList
int EquipIndex = 0;
for (int thisZoneEquipNum = 1; thisZoneEquipNum <= state.dataZoneEquip->ZoneEquipList(iZone).NumOfEquipTypes;
++thisZoneEquipNum) {
if (Util::SameString(state.dataZoneEquip->ZoneEquipList(iZone).EquipName(thisZoneEquipNum), roomAFNNodeHVAC.Name)) {
EquipIndex = state.dataZoneEquip->ZoneEquipList(iZone).EquipIndex(thisZoneEquipNum);
}
}
Then I look at UnitarySys inlet and outlet nodes. thisSys.m_EquipCompNum is irrelevant for this Check.
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.
thisSys.m_EquipCompNum is the value that gets passed back from void UnitarySys::simulate
to the calling function. It is VERY relevant.
CompIndex = this->m_EquipCompNum;
} break; | ||
case DataZoneEquipment::ZoneEquipType::BaseboardElectric: { // ZoneHVAC : Baseboard : RadiantConvective : Electric | ||
// convective equipment without node connection. Will handle later |
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.
WIll handle in Phase 2
ReturnNodeName = ""; | ||
// Air teminal components are handled later | ||
// SupplyNodeName = Alphas(1); | ||
// ReturnNodeName = ""; |
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.
Will handle in Phase 3
if (check) { | ||
EXPECT_EQ("SupplyNode", SupplyNodeName); | ||
EXPECT_EQ("ReturnNode", ReturnNodeName); | ||
} |
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 last 2 unit tests are looking at the PTAC unitarySys object (report the object type and name to find out) and since you are using the same node names and node 1 and 2, all these results give the same answer. This unit test should use unique node names and multiple PTUnits and UnitarySystems. For zone equipment, PTAC, PTHP, PTWSHP and UnitarySystem all have indexes 1 - n.
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.
@rraustad Although I use the same name, I did debug it and found they are correct.
int EquipIndex = 0; | ||
for (int thisZoneEquipNum = 1; thisZoneEquipNum <= state.dataZoneEquip->ZoneEquipList(iZone).NumOfEquipTypes; | ||
++thisZoneEquipNum) { | ||
if (Util::SameString(state.dataZoneEquip->ZoneEquipList(iZone).EquipName(thisZoneEquipNum), roomAFNNodeHVAC.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.
This should also check roomAFNNodeHVAC.zoneEquipType
. It's not common, but it is allowable for different types of zone equipment to have the same 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.
A good suggestion. Done!
for (int thisZoneEquipNum = 1; thisZoneEquipNum <= state.dataZoneEquip->ZoneEquipList(iZone).NumOfEquipTypes; | ||
++thisZoneEquipNum) { | ||
if (Util::SameString(state.dataZoneEquip->ZoneEquipList(iZone).EquipName(thisZoneEquipNum), roomAFNNodeHVAC.Name)) { | ||
EquipIndex = state.dataZoneEquip->ZoneEquipList(iZone).EquipIndex(thisZoneEquipNum); |
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.
@rraustad Would it work here to save this value, then pass it in to CheckEquipName
to be used for the equipment types supported by unitarysystem?
HVACSystemData * compPointer;
compPointer = state.dataZoneEquip->ZoneEquipList(iZone).compPointer[thisZoneEquipNum];
See SimZoneEquipment
EnergyPlus/src/EnergyPlus/ZoneEquipmentManager.cc
Lines 3288 to 3309 in 8c14f4b
case ZoneEquipType::PackagedTerminalHeatPump: // 'ZoneHVAC:PackagedTerminalHeatPump' | |
case ZoneEquipType::PackagedTerminalAirConditioner: // 'ZoneHVAC:PackagedTerminalAirConditioner' | |
case ZoneEquipType::PackagedTerminalHeatPumpWaterToAir: // 'ZoneHVAC:WaterToAirHeatPump' | |
case ZoneEquipType::UnitarySystem: { // 'AirloopHVAC:UnitarySystem' | |
int AirLoopNum = 0; | |
bool HeatingActive = false; | |
bool CoolingActive = false; | |
int OAUnitNum = 0; | |
Real64 OAUCoilOutTemp = 0.0; | |
bool ZoneEquipFlag = true; | |
zoneEquipList.compPointer[EquipPtr]->simulate(state, | |
state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, | |
FirstHVACIteration, | |
AirLoopNum, | |
zoneEquipList.EquipIndex(EquipPtr), | |
HeatingActive, | |
CoolingActive, | |
OAUnitNum, | |
OAUCoilOutTemp, | |
ZoneEquipFlag, | |
SysOutputProvided, | |
LatOutputProvided); |
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.
It should. I can't say if this pointer is available on the first call to RoomAirModelManager (calling order) but once available the pointer is saved in the index to the equipment in the equipment list (not the component index). If the UnitarySystem (or other types managed by UnitarySystem) is 4th in the equipment list then it is .compPointer[4]
.
thisZoneEquipList.compPointer.resize(thisZoneEquipList.NumOfEquipTypes + 1);
HVACSystemData * compPointer = state.dataZoneEquip->ZoneEquipList(iZone).compPointer[1 <= n <= NumOfEquipTypes];
@@ -2676,7 +2697,7 @@ namespace RoomAir { | |||
std::string const &EquipName, // Equipment Name | |||
std::string &SupplyNodeName, // Supply node name | |||
std::string &ReturnNodeName, // Return node 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.
In one of your later phases, these should be changed to NodeNum instead of passing and saving node names.
EquipIndex = state.dataZoneEquip->ZoneEquipList(iZone).EquipIndex(thisZoneEquipNum); | ||
break; | ||
} | ||
} | ||
IntEquipError = CheckEquipName(state, |
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.
Minor, but the name IntEquipError
is misleading, better would be IntEquipFound
?
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!
Thanks for all valuable comments. I will take care after my vacation. |
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.
@lgu1234 This is a great improvement, but I have some concerns about the impact of this causing a getinput call for the various system types in a full simulation. The only example file with RoomAir:Node:AirflowNetwork:HVACEquipment is all PTAC equipment. It would be good to add Room AFN to a couple of other example files with different equipment types to make sure the possibly early getinput doesn't break anything. Maybe a fancoil, and a heat pump water heater just to cover some different system types. I'm not suggesting these as formal example files, just a quick test to make sure it runs ok.
zoneEquipType = DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal; | ||
state->dataHVACVarRefFlow->NumVRFTU = 1; | ||
check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); | ||
if (check) { |
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.
All of these if (check)
blocks should be replaced with EXPECT_TRUE(check)
. As it stands if the check fails the unit test will pass, because the other EXPECT_EQ
s will not execute.
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.
@lgu1234 this definitely needs to be changed. Do you see what is happening? If check
comes back false
, then you simply won't execute the EXPECT_EQ
comparisons. So the test would pass. Instead, as @mjwitte says, you should convert:
if (check) {
EXPECT_EQ("SupplyNode1", SupplyNodeName);
}
to:
EXPECT_TRUE(check);
EXPECT_EQ("SupplyNode1", SupplyNodeName);
@mjwitte I am going to create more test files with different equipment types, such as fan coils and others. |
@mjwitte Thanks for your comments. Before calling CheckEngineName, EquipIndex is available for 4 types of zone equipment in the function processZoneEquipmentInput to process EquipIndex
The EquipIndex of the rest of equipment types is obtained from the function SimZoneEquipment in the ZoneequipmentManager after calling CheckEngineName. I slightly modified both functions to get FanCoil inlet and outlet node by adding one more argument as EquipName:
If EquipIndex = 0, the function will search supply and return node number based on EquipName. Please take a look at code modification of FanCoil and let me know what you think. Thanks. |
SupplyNodeName = Alphas(4); | ||
ReturnNodeName = Alphas(3); | ||
SupplyNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirOutNode(state, EquipName, 0, errorfound); | ||
ReturnNodeNum = state.dataUnitarySystems->unitarySys[EquipIndex - 1].getAirInNode(state, EquipName, 0, errorfound); |
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.
@lgu1234 and I discussed using a getIndex function in the parent objects, specifically for all objects managed by UnitarySystem, to directly access the state variables for UnitarySystem. So this should look like:
int usIndex = UnitarySys::GetIndex(state, EquipName); <-- this will need EquipType if names are not unique
SupplyNodeNum = state.dataUnitarySystems->unitarySys[usIndex].AirOutNode;
ReturnNodeNum = state.dataUnitarySystems->unitarySys[usIndex].AirInNode;
@rraustad The revision provides correct index for Unitary systems. Please check it. |
getIndex(EnergyPlusData &state, std::string const &UnitarySysName, DataZoneEquipment::ZoneEquipType zoneEquipType, bool &errFlag) | ||
{ | ||
|
||
int EquipIndex = 0; |
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 index should be initialized to -1 for 0-based array
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.
@rraustad Corrected.
Can confirm locally @rraustad :
|
@lgu1234 I'm confused. I see "WaterHeater:HeatPump" as a valid key choice in RoomAir:Node:AirflowNetwork:HVACEquipment and there's a case for it in the new function:
|
@mjwitte I made a mistake. The HPWH should be allowed. I created a test file and uploaded it a while ago. The original HPWH type was outdated. It was replaced by two types: WaterHeater:HeatPump:PumpedCondenser and WaterHeater:HeatPump:WrappedCondenser, so that I revised idd equipment type. Please see idd change. |
idd/Energy+.idd.in
Outdated
@@ -21222,7 +21223,8 @@ RoomAir:Node:AirflowNetwork:HVACEquipment, | |||
\key ZoneHVAC:IdealLoadsAirSystem | |||
\key ZoneHVAC:RefrigerationChillerSet | |||
\key Fan:ZoneExhaust | |||
\key WaterHeater:HeatPump | |||
\key WaterHeater:HeatPump:PumpedCondenser | |||
\key WaterHeater:HeatPump:WrappedCondenser |
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.
Update new HPWH types
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.
OK, so I only left 3 comments:
- A big comment talking about how repetitive these changes are and throwing a future-looking vision for named objects (@kbenne may have thought this is what we should do about 10 years ago or more).
- You don't necessarily have to change anything here, but indeed I'm not happy with so many near-identical functions.
- A comment about functions where HPNum or another index is actually passed in, yet we go ahead and call get input anyway. Is this right? Overcautious?
- I would like discussion here, and maybe changes if justified.
- @mjwitte noted an issue with the unit test.
- I agree, this does need to be tweaked. It should be minimal. Let me know if you need me to do it.
src/EnergyPlus/UnitHeater.cc
Outdated
int getUnitHeaterIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag) | ||
{ | ||
if (state.dataUnitHeaters->GetUnitHeaterInputFlag) { | ||
GetUnitHeaterInput(state); | ||
state.dataUnitHeaters->GetUnitHeaterInputFlag = false; | ||
} | ||
int EquipIndex = 0; | ||
for (int UnitHeatNum = 1; UnitHeatNum <= state.dataUnitHeaters->NumOfUnitHeats; ++UnitHeatNum) { | ||
if (Util::SameString(state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, CompName)) { | ||
EquipIndex = UnitHeatNum; | ||
} | ||
} | ||
|
||
if (EquipIndex == 0) errFlag = true; | ||
return EquipIndex; | ||
} |
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 am growing concerned about the repeated getter pattern here. Maybe it's fine. But, I have thoughts:
- I believe this passive "if flag then call getinput and set flag to false" pattern is being moved to a more active/intentional pattern over in Move getInputs to init_state and update unit tests #10585. Does adding all these calls make it more work to move them over there?
- Either way, as a temporary step, is it worthwhile to just move the "if flag then get input and set flag false" inside the GetInput routine itself? It would mean a call to GetInput, but I imagine that is extremely cheap compared to the other things we are doing. And then each of these functions could be much smaller. Like:
int getUnitHeaterIndex(EnergyPlusData &state, std::string_view CompName, bool &errFlag)
{
GetUnitHeaterInput(state); // it will check and set the flag itself
for (int UnitHeatNum = 1; UnitHeatNum <= state.dataUnitHeaters->NumOfUnitHeats; ++UnitHeatNum) {
if (Util::SameString(state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, CompName)) {
return UnitHeatNum;
}
}
errFlag = true;
return 0;
}
I think we could also just not pass the errFlag, and instead rely on the return value from the function as a signal for error condition (zero, or negative one in the future).
I'm not saying this stuff has to be changed, I'm just surprised at the repetitive nature here. I will also say there's a way to go much more interesting with this that leads to a broad cleanup of the objects and get inputs. I quickly stubbed some of it out here (https://godbolt.org/z/oxPvs3jP7) for anyone interested. Note that with the little sample link there, the array index lookup is zero/one agnostic. The pattern would throw regardless of whether it is used with Array1D or vector.
Anyway, I'll just carry on reviewing for now.
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.
@Myoldmopar Based on your suggestion. Here is a function:
int getUnitHeaterIndex(EnergyPlusData &state, std::string_view CompName)
{
if (state.dataUnitHeaters->GetUnitHeaterInputFlag) {
GetUnitHeaterInput(state);
state.dataUnitHeaters->GetUnitHeaterInputFlag = false;
}
for (int UnitHeatNum = 1; UnitHeatNum <= state.dataUnitHeaters->NumOfUnitHeats; ++UnitHeatNum) {
if (Util::SameString(state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, CompName)) {
return UnitHeatNum;
}
}
return 0;
}
Here is what I change:
- Remove errFlag
- Remove int EquipIndex
- Keep state.dataUnitHeaters->GetUnitHeaterInputFlag to ensure that GetUnitHeaterInput will not be called more than once
Please let me know what you think. I will make any changes after I get your feedback.
Thanks.
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.
That looks good, just make sure to check if the return value is zero wherever you call it and you should be good to go. Thanks!
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.
@lgu1234 did you end up doing this? It appears on GitHub like it's still as it was before... I could be seeing it wrong.
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.
@Myoldmopar I completed changes last week and will upload it today.
src/EnergyPlus/WaterThermalTanks.cc
Outdated
if (state.dataWaterThermalTanks->getWaterThermalTankInputFlag) { | ||
GetWaterThermalTankInput(state); | ||
state.dataWaterThermalTanks->getWaterThermalTankInputFlag = false; | ||
} |
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.
Is this real? We actually need to call GetInput even on functions when we are passing in HPNum??
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.
@Myoldmopar You are right. It is not necessary to call GetInput with HPNum available. This function is not used anymore. I am going to delete functions of GetHeatPumpWaterHeaterAirOutletNodeNum and GetHeatPumpWaterHeaterAirInletNodeNum.
zoneEquipType = DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal; | ||
state->dataHVACVarRefFlow->NumVRFTU = 1; | ||
check = CheckEquipName(*state, EquipName, SupplyNodeName, ReturnNodeName, EquipIndex, zoneEquipType); | ||
if (check) { |
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.
@lgu1234 this definitely needs to be changed. Do you see what is happening? If check
comes back false
, then you simply won't execute the EXPECT_EQ
comparisons. So the test would pass. Instead, as @mjwitte says, you should convert:
if (check) {
EXPECT_EQ("SupplyNode1", SupplyNodeName);
}
to:
EXPECT_TRUE(check);
EXPECT_EQ("SupplyNode1", SupplyNodeName);
@Myoldmopar Done
|
Thanks @lgu1234 I'll get my review updated when I see new commits. |
Thanks @lgu1234, I'll check it out once CI finishes this morning. |
@Myoldmopar It is ready to review again. Thanks. |
All good here still, merging away, thanks @lgu1234 |
Pull request overview
The existing CheckEquipName uses Alpha fields of object inputs to get supply and return node names. When any object inputs change, the code has to be revised accordingly. The function refactor will use inlet and outlet node number from different zone equipment directly. There is no potential maintenance issue.
There are 3 types of zone equipment: forced air, convective and radiative, and terminal units. Phase 1 refactors forced air zone equipment, while Phase 2 and 3 will handle convective and radiative, and terminal units, respectively and will start after Phase 1 is merged.
Phase 1 use inlet and outlet nodes directly from each force air zone equipment. Since this module is called after calling GetZoneEquipmentData in the DataZoneEquipment module, all inlet and outlet node information is available before calling CheckEquipName function.
The test file is an example file as RoomAirflowNetwork.idf.
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.