Add function to associate airloop index to variable speed coil#11243
Add function to associate airloop index to variable speed coil#11243
Conversation
| return state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio; | ||
| } | ||
|
|
||
| void SetVarSpeedDXCoilAirLoopNumber(EnergyPlusData &state, std::string const &CoilName, int const AirLoopNum) |
There was a problem hiding this comment.
New function to associate airloop index to variable speed coil.
| state->dataVariableSpeedCoils->GetCoilsInputFlag = false; | ||
| state->dataVariableSpeedCoils->VarSpeedCoil.allocate(2); | ||
| state->dataVariableSpeedCoils->VarSpeedCoil(1).Name = "Super Coil"; | ||
| state->dataVariableSpeedCoils->VarSpeedCoil(2).Name = "Super Heating Coil"; | ||
|
|
||
| state->afn->validate_distribution(); | ||
| compare_err_stream(""); |
There was a problem hiding this comment.
Adapt existing unit test to check for the error stream.
There was a problem hiding this comment.
I've confirmed the defect by adding these to develop and testing.
$ make -j 23 && ctest -R AirflowNetwork_ValidateDistCoils --output-on-failure
...
[ 76%] Built target TestEnergyPlusCallbacks
[100%] Built target energyplus_tests
Test project /home/mitchute/Projects/EnergyPlus/build
Start 899: EnergyPlusFixture.AirflowNetwork_ValidateDistCoils
1/1 Test #899: EnergyPlusFixture.AirflowNetwork_ValidateDistCoils ...SIGTRAP***Exception: 1.22 sec
Note: Google Test filter = EnergyPlusFixture.AirflowNetwork_ValidateDistCoils
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from EnergyPlusFixture
[ RUN ] EnergyPlusFixture.AirflowNetwork_ValidateDistCoils
/home/mitchute/Projects/EnergyPlus/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc:219: Failure
Expected equality of these values:
expected_string
Which is: ""
stream_str
Which is: " ** Severe ** SetDXCoilAirLoopNumber: Could not find Coil \"Name=\"Super Coil\"\n ** Severe ** SetDXCoilAirLoopNumber: Could not find Coil \"Name=\"Super Heating Coil\"\n"
With diff:
@@ -1,1 +1,2 @@
-""
+ ** Severe ** SetDXCoilAirLoopNumber: Could not find Coil \"Name=\"Super Coil\"
+ ** Severe ** SetDXCoilAirLoopNumber: Could not find Coil \"Name=\"Super Heating Coil\"\n
| ErrorsFound = true; | ||
| } else { | ||
| SetDXCoilAirLoopNumber(m_state, DisSysCompCoilData(i).name, DisSysCompCoilData(i).AirLoopNum); | ||
| SetVarSpeedDXCoilAirLoopNumber(m_state, DisSysCompCoilData(i).name, DisSysCompCoilData(i).AirLoopNum); |
|
|
||
| WhichCoil = Util::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); | ||
| if (WhichCoil != 0) { | ||
| state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).AirLoopNum = AirLoopNum; |
There was a problem hiding this comment.
Where exactly is this used? AirFlowNetwork?
There was a problem hiding this comment.
I mean, how does the VS coil use this information? AirflowNetwork already knows the AirLoopNum and is passing that number to the coil model. Why does the coil need to know the AirLoopNum?
There was a problem hiding this comment.
I see. The DXCoil model uses that information like this. I don't see either of these variables set in the VS coil model.
state.dataAirLoop->LoopDXCoilRTF = max(thisDXCoil.CoolingCoilRuntimeFraction, thisDXCoil.HeatingCoilRuntimeFraction);
if (thisDXCoil.AirLoopNum > 0) {
state.dataAirLoop->AirLoopAFNInfo(thisDXCoil.AirLoopNum).AFNLoopDXCoilRTF =
max(thisDXCoil.CoolingCoilRuntimeFraction, thisDXCoil.HeatingCoilRuntimeFraction);
}
So the VS coil model would also have to do things like this so that AFN has that information.
There was a problem hiding this comment.
What is strange with these functions that set the air loop num in a coil model, is that when the coil is simulated the global state.dataSize->CurSysNum is always set when air loops are simulated. So the coil model already knows the AirLoopNum associated with this coil. These functions aren't even needed. Now it may be tricky to internally set up this coil variable based on whether or not AFN is active but I think this could be done as a one-time check in init. Anyway, this is the way it's done now so no reason to go out of scope for this issue. I still think there is more work in the VS coil model before this would work as AFN intends (e.g., the coil model needs the code I show above). I think that's the only other thing needed in the VS coil code.
There was a problem hiding this comment.
@rraustad Airloopnum is also used for reporting the airloop name to some of the table reports (but I'm not sure it's consistent across all of the coil types).
And then there's the coil selection report that has it's own tracking of the coil airloopnum and sets this is (nearly?) every ReportCoilSelection::setCoil* function:
c->airloopNum = curSysNum;.
And here's some of the table output for the HeatPumpAuto example file. The first two tables don't know the airloop name, but the next one does?

And then later, we have other reports that show the airloop name

And equivalent tables for heating coils do not even report airloop name.

@rraustad I agree that every coil should simply store it's airloop num from curSysNum at the top of its sizing function. Maybe there's a timing issue for the AFN usage?
@lymereJ Maybe we can fix the "N/A" in the "DX Heating Coils" tables in this PR by adding thisDXCoil.AirLoopNum=state.dataSize->CurSysNum at the top of SizeDXCoil?
There was a problem hiding this comment.
@lymereJ @rraustad Oh, but now I see and AirloopNum>0 is being used to tell the DX coil if it's in an AFN loop?!
Then setting AirLoopNum could break things. That should really be a separate flag that gets set from AFN on the coil.
I'll work on a separate PR to fix the table (just use CurSysNum instead of the coil's AirLoopNum). And I'll check other coil types to see if any others are assuming (incorrectly) that AirLoopNum (or equivalent) is set properly for non-AFN runs.
There was a problem hiding this comment.
Setting AirloopNum to know if AFN is active is kind of klunky because that data is also used for table reporting. Whatever the AFN variables are then if AFN == Active && AirloopNum > 0 would be better.
There was a problem hiding this comment.
Setting AirloopNum to know if AFN is active is kind of klunky because that data is also used for table reporting. Whatever the AFN variables are then
if AFN == Active && AirloopNum > 0would be better.
Can we assume if there's AFN with distribution, then all coils are part of that. Or should the current AFN function calls to the coils be used to set a coil-specific AFN flag?
There was a problem hiding this comment.
I am not sure how that is set up but it sounds like your on the right track with thinking AirLoopNum > 0 is the key to knowing when AFN is active and using that coil model.
src/EnergyPlus/VariableSpeedCoils.cc
Outdated
| if (varSpeedCoil.AirLoopNum > 0) { | ||
| state.dataAirLoop->AirLoopAFNInfo(varSpeedCoil.AirLoopNum).AFNLoopDXCoilRTF = max(varSpeedCoil.RunFracCool, varSpeedCoil.RunFracHeat); | ||
| } |
| state->dataVariableSpeedCoils->GetCoilsInputFlag = false; | ||
| state->dataVariableSpeedCoils->VarSpeedCoil.allocate(2); | ||
| state->dataVariableSpeedCoils->VarSpeedCoil(1).Name = "Super Coil"; | ||
| state->dataVariableSpeedCoils->VarSpeedCoil(2).Name = "Super Heating Coil"; | ||
|
|
||
| state->afn->validate_distribution(); | ||
| compare_err_stream(""); |
There was a problem hiding this comment.
I've confirmed the defect by adding these to develop and testing.
$ make -j 23 && ctest -R AirflowNetwork_ValidateDistCoils --output-on-failure
...
[ 76%] Built target TestEnergyPlusCallbacks
[100%] Built target energyplus_tests
Test project /home/mitchute/Projects/EnergyPlus/build
Start 899: EnergyPlusFixture.AirflowNetwork_ValidateDistCoils
1/1 Test #899: EnergyPlusFixture.AirflowNetwork_ValidateDistCoils ...SIGTRAP***Exception: 1.22 sec
Note: Google Test filter = EnergyPlusFixture.AirflowNetwork_ValidateDistCoils
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from EnergyPlusFixture
[ RUN ] EnergyPlusFixture.AirflowNetwork_ValidateDistCoils
/home/mitchute/Projects/EnergyPlus/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc:219: Failure
Expected equality of these values:
expected_string
Which is: ""
stream_str
Which is: " ** Severe ** SetDXCoilAirLoopNumber: Could not find Coil \"Name=\"Super Coil\"\n ** Severe ** SetDXCoilAirLoopNumber: Could not find Coil \"Name=\"Super Heating Coil\"\n"
With diff:
@@ -1,1 +1,2 @@
-""
+ ** Severe ** SetDXCoilAirLoopNumber: Could not find Coil \"Name=\"Super Coil\"
+ ** Severe ** SetDXCoilAirLoopNumber: Could not find Coil \"Name=\"Super Heating Coil\"\n
@mjwitte no rush on this, just pulling it out here so we don't lose it. |
Pull request overview
Description of the purpose of this PR
Pull Request Author
Reviewer