Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Apply Direct solution in new dx coil #7899

Merged
merged 18 commits into from
Sep 4, 2020
Merged

Conversation

lgu1234
Copy link
Contributor

@lgu1234 lgu1234 commented Apr 2, 2020

Pull request overview

This PR will apply DirectSolution to Coil:Cooling:DX with single speed and multiple speeds.
issue #8216

NOTE: 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.

  • Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context)
  • Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish
  • Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair
  • Author should provide a "walkthrough" of relevant code changes using a GitHub code review comment process
  • If any diffs are expected, author must demonstrate they are justified using plots and descriptions
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions
  • If any defect files are updated to a more recent version, upload new versions here or on DevSupport
  • If IDD requires transition, transition source, rules, ExpandObjects, and IDFs must be updated, and add IDDChange label
  • If structural output changes, add to output rules file and add OutputChange label
  • If adding/removing any LaTeX docs or figures, update that document's CMakeLists file dependencies

Reviewer

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • If branch is behind develop, merge develop and build locally to check for side effects of the merge
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified
  • Check that performance is not impacted (CI Linux results include performance check)
  • Run Unit Test(s) locally
  • Check any new function arguments for performance impacts
  • Verify IDF naming conventions and styles, memos and notes and defaults
  • If new idf included, locally check the err file and other outputs

@Myoldmopar Myoldmopar added this to the EnergyPlus 9.4.0 milestone Apr 14, 2020
@Myoldmopar Myoldmopar added the Performance Includes code changes that are directed at improving the runtime performance of EnergyPlus label May 18, 2020
@lgu1234
Copy link
Contributor Author

lgu1234 commented May 18, 2020

Add 3 test files by adding an object:
PerformancePrecisionTradeoffs,
Yes; !- Use Coil Direct Solutions
UnitarySystem_MultiSpeedDX_DirectSolution.idf.txt
UnitarySystem_SingleSpeedDX_DirectSolution.idf.txt
UnitarySystem_SubcoolReheatDX_DirectSolution.idf.txt

The original 3 examples files are
UnitarySystem_MultiSpeedDX.idf
UnitarySystem_SingleSpeedDX.idf
UnitarySystem_SubcoolReheatDX.idf

@Myoldmopar
Copy link
Member

Well, CI is perfectly green, and the branch isn't conflicted, so we are off to a good review start. I'll look at the code changes now.

Copy link
Member

@Myoldmopar Myoldmopar left a comment

Choose a reason for hiding this comment

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

No major issues, a couple typos and then I'd like you to confirm my understanding of the implementation and comment on the last section so I know its purpose.

@@ -1045,6 +1045,13 @@ \subsection{PerformancePrecisionTradeoffs}\label{performanceprecisiontradeoffs}
\end{longtable}

Note: The choice of Load in the Control Type of the AirLoopHVAC:UnitarySystem object is required for all coils listed in the above table.
In addition, when Coil:Cooling:DX is specified under AirLoopHVAC:UnitarySystem, the following coil configurations are supported for Direct Solution:

Single speed mode at Norminal Speed Number = 1 in the Coil:Cooling:DX:CurveFit:OperatingMode
Copy link
Member

Choose a reason for hiding this comment

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

Typo: Norminal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Myoldmopar Corrected at Nominal. Thanks

@@ -4542,6 +4542,10 @@ namespace UnitarySystems {
}
}

if (DataGlobals::DoCoilDirectSolutions && thisSys.m_NumOfSpeedCooling > 1) {
thisSys.FullOutput.resize(thisSys.m_NumOfSpeedCooling + 1);
}
Copy link
Member

Choose a reason for hiding this comment

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

OK, so we start by allocating the full output array to the number of cooling speeds + 1.

@@ -6678,7 +6682,7 @@ namespace UnitarySystems {
thisSys.m_HeatMassFlowRate.resize(thisSys.m_NumOfSpeedHeating + 1);
thisSys.m_HeatVolumeFlowRate.resize(thisSys.m_NumOfSpeedHeating + 1);
thisSys.m_MSHeatingSpeedRatio.resize(thisSys.m_NumOfSpeedHeating + 1);
if (DataGlobals::DoCoilDirectSolutions) {
if (DataGlobals::DoCoilDirectSolutions && thisSys.m_NumOfSpeedCooling < thisSys.m_NumOfSpeedHeating) {
thisSys.FullOutput.resize(thisSys.m_NumOfSpeedHeating + 1);
}
Copy link
Member

Choose a reason for hiding this comment

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

Then we just increase the size in case heating is larger.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@lgu1234 I see that you are resizing twice for CoolingCoilType CoilDX_SubcoolReheat here and here. Because the later is always executed whether the cooling type coil is SubCoolReheat or NOT. Is this intentional?

if (DataGlobals::DoCoilDirectSolutions && this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling) {
if (DataGlobals::DoCoilDirectSolutions &&
(this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling ||
(this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling && this->m_NumOfSpeedCooling > 1))) {
Copy link
Member

Choose a reason for hiding this comment

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

This is just adding the new coil to this section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

This is just filling this->FullOutput[SpeedNum] variable for the new DX cooling coil.

HXUnitOn,
HeatCoilLoad,
SupHeaterLoad,
CompressorONFlag);
Copy link
Member

Choose a reason for hiding this comment

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

OK, so first you call to run with cooling PLR of 1.0 to get the full output.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Myoldmopar Yes, in order to get full outputs at PLR = 1.0.

HeatCoilLoad,
SupHeaterLoad,
CompressorONFlag);
CoolPLR = (ZoneLoad - SensOutputOff) / (SensOutputOn - SensOutputOff);
Copy link
Member

Choose a reason for hiding this comment

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

Then calculate a new cooling PLR using a simple ratio.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

HXUnitOn,
HeatCoilLoad,
SupHeaterLoad,
CompressorONFlag);
Copy link
Member

Choose a reason for hiding this comment

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

Then just recalculate the system performance at that PLR, and take what it gets.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

HeatCoilLoad,
SupHeaterLoad,
CompressorONFlag);
PartLoadRatio = CoolPLR;
Copy link
Member

Choose a reason for hiding this comment

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

Of course handle the single speed case here too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Myoldmopar Yes for a single speed coil.

HeatCoilLoad,
SupHeaterLoad,
CompressorONFlag);
PartLoadRatio = CoolPLR;
Copy link
Member

Choose a reason for hiding this comment

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

How does this extra section fit into the grand scheme?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Myoldmopar The extra code is used for a multiple speed coil to recalculate output based on cycleratio (SpeedNumber = 1) or SpeedRatio (SpeedNumber>1) using Direct solution results.

Copy link
Contributor

Choose a reason for hiding this comment

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

@lgu1234 This is not part of this change but wanted to understand that CoolingCycRatio and CoolingSpeedRatio are passed as CoolPLR to calcUnitarySystemToLoad() function. So, the calcUnitarySystemToLoad() handles the difference between the two variables?

@nrel-bot-2
Copy link

@lgu1234 @lgentile it has been 28 days since this pull request was last updated.

@nrel-bot
Copy link

@lgu1234 @lgentile it has been 28 days since this pull request was last updated.

@Nigusse Nigusse self-requested a review August 18, 2020 17:30
@Nigusse
Copy link
Contributor

Nigusse commented Aug 18, 2020

Built and ran with develop pulled into the branch. All unit tests passed. @lgu1234 If you reply to my comment regarding FullOutput array resizing, this branch will be ready for merging.

@lgu1234
Copy link
Contributor Author

lgu1234 commented Aug 18, 2020

@Nigusse Where is your comment of FullOutput? I am not able to locate it.

@Nigusse
Copy link
Contributor

Nigusse commented Aug 18, 2020

@lgu1234 I see that you are resizing twice for CoolingCoilType CoilDX_SubcoolReheat here and here. Because the later is always executed whether the cooling type coil is SubCoolReheat or NOT. Is this intentional?

Copy link
Contributor

@Nigusse Nigusse left a comment

Choose a reason for hiding this comment

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

This branch is ready for merging pending @lgu1234 addressing the review comments about array re-sizing.

@@ -1056,7 +1056,7 @@ \subsection{PerformancePrecisionTradeoffs}\label{performanceprecisiontradeoffs}
\midrule
\endfirsthead

AirLoopHVAC:UnitarySystem & Coil:Cooling:DX:SingleSpeed, Coil:Heating:DX:SingleSpeed, Coil:Heating:Electric, Coil:Heating:Fuel, Coil:Heating:DX:MultiSpeed\tabularnewline
AirLoopHVAC:UnitarySystem & Coil:Cooling:DX:SingleSpeed, Coil:Heating:DX:SingleSpeed, Coil:Heating:Electric, Coil:Heating:Fuel, Coil:Heating:DX:MultiSpeed, Coil:Cooling:DX\tabularnewline
Copy link
Contributor

Choose a reason for hiding this comment

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

Updated I/O ref documentation; added the new DX cooling coil type Coil:Cooling:DX.


Multi speed mode at Nominal Speed Number > 1 in the Coil:Cooling:DX:CurveFit:OperatingMode

Single speed SubcoolReheat mode. The SubcoolReheat mode requires all inputs of 3 fields in the Coil:Cooling:DX:CurveFit:Performance: Base Operating Mode, Alternative Operating Mode 1, and Alternative Operating Mode 2.
Copy link
Contributor

Choose a reason for hiding this comment

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

Updated I/O ref documentation; Coil:Cooling:DX coil model in AirLoopHVAC:UnitarySystem supports Direct Solution for load based control of Single Speed, Multi Speed and Single Speed SubcoolReheat operating modes.

ShowContinueError(
"Setpoint control is not available for SubcoolReheat cooling coil. Load control is forced. Simulation continues.");
ShowContinueError("Setpoint control is not available for SubcoolReheat cooling coil. Load control is forced. "
"Simulation continues.");
Copy link
Contributor

Choose a reason for hiding this comment

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

If the Coil:Cooling:DX coil type operating mode specified is SubcoolReheat operating mode and the UnitarySystem is SetPoint control, then the UnitarySystem control type is reset to Load. Because SubcoolReheat operating mode is supported in Load based control only.

@@ -6678,7 +6682,7 @@ namespace UnitarySystems {
thisSys.m_HeatMassFlowRate.resize(thisSys.m_NumOfSpeedHeating + 1);
thisSys.m_HeatVolumeFlowRate.resize(thisSys.m_NumOfSpeedHeating + 1);
thisSys.m_MSHeatingSpeedRatio.resize(thisSys.m_NumOfSpeedHeating + 1);
if (DataGlobals::DoCoilDirectSolutions) {
if (DataGlobals::DoCoilDirectSolutions && thisSys.m_NumOfSpeedCooling < thisSys.m_NumOfSpeedHeating) {
thisSys.FullOutput.resize(thisSys.m_NumOfSpeedHeating + 1);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@lgu1234 I see that you are resizing twice for CoolingCoilType CoilDX_SubcoolReheat here and here. Because the later is always executed whether the cooling type coil is SubCoolReheat or NOT. Is this intentional?

if (DataGlobals::DoCoilDirectSolutions && this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling) {
if (DataGlobals::DoCoilDirectSolutions &&
(this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedCooling ||
(this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_Cooling && this->m_NumOfSpeedCooling > 1))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just filling this->FullOutput[SpeedNum] variable for the new DX cooling coil.

HeatCoilLoad,
SupHeaterLoad,
CompressorONFlag);
PartLoadRatio = CoolPLR;
Copy link
Contributor

Choose a reason for hiding this comment

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

@lgu1234 This is not part of this change but wanted to understand that CoolingCycRatio and CoolingSpeedRatio are passed as CoolPLR to calcUnitarySystemToLoad() function. So, the calcUnitarySystemToLoad() handles the difference between the two variables?

latOut);
EXPECT_NEAR(thisSys->m_CycRatio, 1.000, 0.001);
EXPECT_NEAR(thisSys->m_SpeedRatio, 0.238771, 0.02);
EXPECT_NEAR(sensOut, -11998.0, 210.0);
Copy link
Contributor

@Nigusse Nigusse Aug 18, 2020

Choose a reason for hiding this comment

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

The unit tests Direct and Iterative solution methods results are identical. The unit test demonstrates the new method very well.

Copy link
Member

Choose a reason for hiding this comment

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

👍

@Nigusse
Copy link
Contributor

Nigusse commented Aug 19, 2020

@Myoldmopar @lgu1234 I ran the UnitarySystem_MultiSpeedDX.idf and UnitarySystem_MultiSpeedDX_DirectSolution.idf example files provided. The only difference between these two files is that the later has PerformancePrecisionTradeoffs object set to Yes. And I see diffs based on two days of RunPeriods weather file simulation. See below the minimum and maximum diffs observed for a selected variables. Is this acceptable diffs?

MultSpeedMinMaxDiss

@Myoldmopar
Copy link
Member

Most of them look acceptable, but the sys 5 heating rate is the obvious outlier. Can you show a profile of the difference in that variable over the course of the simulation? Or show the annual energy difference?

@lgu1234
Copy link
Contributor Author

lgu1234 commented Aug 19, 2020

@Nigusse Yes. You are correct. The only difference in these files is Yes or No. I compared zone air temperature. If energy use is compared, it is better to compare sum, instead of timestep comparison.

@Nigusse
Copy link
Contributor

Nigusse commented Aug 19, 2020

Ok. I will do the profile comparison of system 5 and annual energy use comparison. In the meantime see below the zone air temperature comparisons and both methods show almost identical profile.

MultSpeedZoneAirTemp

@Nigusse
Copy link
Contributor

Nigusse commented Aug 19, 2020

See below plots of SYS 5 FURNACE DX COOL HEATING COIL:Heating Coil Heating Rate [W][Hourly] report variables and diffs profiles.

MultSpeedSys5HeatingCoil

@Nigusse
Copy link
Contributor

Nigusse commented Aug 19, 2020

Annual energy use differences and minimum and maximum hourly energy use differences for a selected variables.

MultSpeedSys5HeatingCoilAnnualE

Also see the annual energy use and differences for system 5 for the two solution techniques:

MultSpeedSys5HeatingCoilAnnualEUse

@Myoldmopar
Copy link
Member

The Linux diffs appear to be because the branch was out of date when that ran. I will pull develop into here and look it over.

@Myoldmopar
Copy link
Member

Built and ran fine with develop pulled in locally, we'll let CI verify. I'll also take a final pass over the code now.

@Myoldmopar
Copy link
Member

Code changes look fine to me. If CI is also happy I assume this will drop in shortly. If anyone wants to look it over, have at it.

@Myoldmopar
Copy link
Member

Regressions are all gone, this is clean and good to go. I'll give it a few minutes and wait for the unit test and windows to finish but then merge. Thanks @lgu1234

@Myoldmopar
Copy link
Member

All good, merging.

@Myoldmopar Myoldmopar merged commit 8f6f2b3 into develop Sep 4, 2020
@Myoldmopar Myoldmopar deleted the DirectSolution-in-new-DX-coil branch September 4, 2020 16:48
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Performance Includes code changes that are directed at improving the runtime performance of EnergyPlus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants