Skip to content

Comments

Allow multistage electric coil to be supplemental coil of UnitarySystem#9414

Merged
rraustad merged 39 commits intodevelopfrom
allow_multistage_backup_coil
Jun 14, 2022
Merged

Allow multistage electric coil to be supplemental coil of UnitarySystem#9414
rraustad merged 39 commits intodevelopfrom
allow_multistage_backup_coil

Conversation

@yzhou601
Copy link
Contributor

@yzhou601 yzhou601 commented May 5, 2022

Pull request overview

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

@yzhou601 yzhou601 self-assigned this May 5, 2022
@yzhou601 yzhou601 added Defect Includes code to repair a defect in EnergyPlus IDDChange Code changes impact the IDD file (cannot be merged after IO freeze) labels May 5, 2022

HeatingCoils::CalcMultiStageElectricHeatingCoil(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, QActual);

Residuum = Par[2] - QActual;
Copy link
Collaborator

@rraustad rraustad May 19, 2022

Choose a reason for hiding this comment

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

Usually these RootSolver functions return a fraction of load met, e.g., (Par[2] - QActual)/Par[2]. If the tolerance is 0.001 then that means with this math the RootSolver function will iterate to within 0.001 W. That's OK for heating coils most of the time because heating coils usually return the exact load request.

@rraustad
Copy link
Collaborator

Those diffs in the html show a change in ventilation. That probably means a change in supply air flow rate. You can compare SA and OA flow rate between this branch and develop and see if those show a change in operation.

SuppPLR = this->m_SuppHeatPartLoadFrac;
// only need to test for high supply air temp if supplemental coil is operating
if (SuppPLR > 0.0) {
if (SupHeaterLoad > 0.0 && this->m_DesignSuppHeatingCapacity > 0.0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change might be why there are diffs. I would revert this logic unless there is good reason for it. The cooling and heating coil are modeled first to determine the air flow rate and PLRs. If after that the supp heater is needed, then SuppPLR will be > 0 and the supp heater will turn on. Also, if (... && this->m_DesignSuppHeatingCapacity > 0.0), of course it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes to this part are needed to allow multistage backup coils, but I will try reverting the logic to be as close to previous one as possible for other cases.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You could use something like this (here and other places) just to get it to work and we can figure out better logic later. There should be no diffs from adding a coil that doesn't exist yet.

if (this->m_SuppCoilExists) {
    if( stagedheatingcoil) {
        insert your logic
    } else {
       existing code
    }
}


auto &HeatingCoil(state.dataHeatingCoils->HeatingCoil);
auto &heatingCoil = state.dataHeatingCoils->HeatingCoil(CoilNum);

This comment was marked as off-topic.

HeatingCoil(CoilNum).HeatingCoilLoad = MSHPMassFlowRateHigh * (HSFullLoadOutAirEnth - InletAirEnthalpy) * SpeedRatio +
MSHPMassFlowRateLow * (LSFullLoadOutAirEnth - InletAirEnthalpy) * (1.0 - SpeedRatio);
ElecHeatingCoilPower = heatingCoil.ElecUseLoad;
heatingCoil.HeatingCoilLoad = TotCapHS * SpeedRatio + TotCapLS * (1.0 - SpeedRatio);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am trying to find a reason for the diff in _MultiSpeedACElecFurnace.idf. That example file uses AirLoopHVAC:UnitaryHeatPump:AirToAir:MultiSpeed (no changes) with Coil:Heating:Electric:MultiStage so it must be some change in HeatingCoils that changed that answer. It looks like these are the same but I wonder if there is a rounding difference that causes the diff. Have you plotted SA and OA air flow rate and heating coil rate to see if they are very similar?

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
Collaborator

Choose a reason for hiding this comment

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

If you find actual bugs during development you should open a new issue and put those few lines in a seperate PR and then get that PR merged. Then when you pull develop those diffs, related to that necessary change, will be gone. And the defect documented with an issue and PR specific to that bug.

OpMode); // Autodesk:OPTIONAL SpeedRatio, PartLoadRatio, StageNum used without PRESENT check
} else if (state.dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num == Coil_HeatingGasOrOtherFuel) {
OpMode,
QCoilActual2); // Autodesk:OPTIONAL SpeedRatio, PartLoadRatio, StageNum used without PRESENT check
Copy link
Collaborator

Choose a reason for hiding this comment

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

Regarding diffs, the other change I see is you are now passing &QCoilActual so I am wondering if this fixed something now that the Calc function has more information.

latOut);
// check that heating coil air outlet node is at maximum supply air temperature
//
// This is not passing because main heating coil is not limited by Maximum Supply Temperature correctly.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rraustad Please see this. I have fixed the maximum supply air issue on supp coil side, but the main coil is still not correct. It is because the recalculated loads are not used in calcUnitaryHeatingSystem so the PLR is not recalculated.
I changed the unitary system parent object in the newly added test file, so the existing test file is possible to operate differently.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, that's OK. The main heating coil does not limit coil outlet air temp. And if sized properly should not present high outlet temps. This is the reason I suggested autosizing this file since the Sizing:Zone object has a supply air temp input. With these final changes I think this is ready to merge but I will make a final pass to make sure.

@rraustad
Copy link
Collaborator

rraustad commented Jun 10, 2022

This is working well, the supp heating coil can limit max outlet temp. And this is so much better now, the main heating coil outlet temp is around 35 C, that seems very reasonable.

AirLoopHVAC:UnitarySystem,
  45.0,                    !- Maximum Supply Air Temperature {C}

image

if (this->m_NumOfSpeedSuppHeating > 0) {
this->calcMultiStageSuppCoilStageByLoad(state, MaxHeatCoilLoad, FirstHVACIteration);
}
this->calcUnitarySuppHeatingSystem(state, FirstHVACIteration, SuppPLR, MaxHeatCoilLoad);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is the call that bothers me. To call a new supp heater model, and then call the calcUnitarySuppHeatingSystem function to simulate that coil model is redundant. It seems the call to the new coil model can be incorporated into existing calls. This can be resolved later since UnitarySystem needs a major overhaul to clean things up. This is working so well that I hesitate to muck with it now.

@rraustad
Copy link
Collaborator

rraustad commented Jun 12, 2022

@yzhou601 this does look good for load based control. I changed the control for the new example file to Setpoint and found an issue. I haven't locked in on an answer yet (#9482 is in play) but RootSolver is calling the DX coil model for the supp MS heating coil. This should be easy to resolve. The new example file is SingleFamilyHouse_TwoSpeed_MultiStageElectricSuppCoil_SPControl,

image

@rraustad
Copy link
Collaborator

Warning is addressed in #9482. The problem with set point control is here where the heating coil is called instead of the supp heater.

Par[9] = true; // is supplemental coil
if (this->m_SuppHeatingSpeedNum > 1) {
    Par[4] = CycRatio;
    General::SolveRoot(state, Acc, MaxIte, SolFla, SpeedRatio, this->heatingCoilVarSpeedResidual, 0.0, 1.0, Par);
    this->m_SuppHeatingCycRatio = CycRatio;


Real64 UnitarySys::heatingCoilVarSpeedResidual(EnergyPlusData &state,
                                               Real64 const SpeedRatio,       // compressor speed ratio (1.0 is max, 0.0 is min)
                                               std::vector<Real64> const &Par // par(1) = DX coil number

    switch (thisSys.m_HeatingCoilType_Num) {

and here

Real64 UnitarySys::heatingCoilVarSpeedCycResidual(EnergyPlusData &state,
                                                  Real64 const CycRatio,         // compressor cycling ratio (1.0 is continuous, 0.0 is off)
                                                  std::vector<Real64> const &Par // par(1) = DX coil number

    switch (thisSys.m_HeatingCoilType_Num) {

}
LatLoad = 0.0;
this->m_FanOpMode = 1; // why is this here?
// this->m_FanOpMode = 1; // why is this here?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Deleted in #9482.

@rraustad
Copy link
Collaborator

The new load based example file:

image

@rraustad
Copy link
Collaborator

The new set point based example file:

image

@rraustad
Copy link
Collaborator

rraustad commented Jun 13, 2022

Added issue #9484 to address control issue with Coil:Cooling:DX:MultiSpeed. See top left figure above for new example file using set point control.

@rraustad
Copy link
Collaborator

@yzhou601 I think this is ready to merge. Waiting on review and merge of #9482 and any comments you may have on changes made over the weekend.

@yzhou601
Copy link
Contributor Author

@rraustad Thanks for fixing a few issues, these commits look good to me. Good catch!

@rraustad rraustad marked this pull request as ready for review June 13, 2022 16:19
@rraustad
Copy link
Collaborator

Unit tests run clean locally. Warnings in err file are described in #9484 and should be cleaned up with that effort. Expect CI to be all green.

@rraustad
Copy link
Collaborator

This all looks good, CI is green. There is a little time before merging for anyone to look over this.

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.

I left a few comments in here. In general, these changes are exactly what I would expect for this new capability. The two things I mentioned that could be address are not related to algorithmic changes:

  • In format statements we shouldn't create std::string objects as args unnecessarily
  • Your new residual functions mimic the existing residual functions, and they are a bit more verbose than necessary.

I don't actually think that either of these necessitate additional commits on their own. If any other commits are needed, please address these as part of that.

@yzhou601
Copy link
Contributor Author

Thanks @Myoldmopar , pushed a cleanup commit that addressed your comments.

@rraustad
Copy link
Collaborator

This branch is 25 commits behind develop and diff is from SurfLWR example file. No need to run another CI cycle.

@rraustad rraustad merged commit 2c94536 into develop Jun 14, 2022
@rraustad rraustad deleted the allow_multistage_backup_coil branch June 14, 2022 10:42
Copy link
Contributor Author

@yzhou601 yzhou601 left a comment

Choose a reason for hiding this comment

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

@rraustad This PR was merged but these two lines of changes were reverted. I want to point them out to make sure you realize it.

PartLoadRatio = HeatPLR;
} else if (state.dataGlobal->DoCoilDirectSolutions && state.dataUnitarySystems->HeatingLoad &&
this->m_HeatingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating) {
this->m_CoolingCoilType_Num == DataHVACGlobals::CoilDX_MultiSpeedHeating) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rraustad Hi, Richard, just want to point out that in this commit I reverted two lines of codes to eliminate changes unrelated to my added feature. But these two lines look very suspicious, could you double check if these are bugs?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, this looks wrong.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, this one was here before this branch.

FanOpMode = int(Par[6]);

HeatingCoils::CalcMultiStageGasHeatingCoil(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode);
HeatingCoils::CalcMultiStageElectricHeatingCoil(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, QActual);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line as well

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, this also looks wrong.

    case DataHVACGlobals::Coil_HeatingGas_MultiStage: {
        CycRatio = Par[4];
        SpeedNum = int(Par[5]);
        FanOpMode = int(Par[6]);

        HeatingCoils::CalcMultiStageElectricHeatingCoil(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, QActual, SuppHeat);

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree, these bugs were here before this branch.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This one appears to have been correct and is now incorrect.

Copy link
Collaborator

Choose a reason for hiding this comment

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

They are both bugs at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Defect Includes code to repair a defect in EnergyPlus IDDChange Code changes impact the IDD file (cannot be merged after IO freeze)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UnitarySystem multi-speed supplemental heating coils do not control correctly when using Setpoint control

10 participants