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

Space Sizing and HVAC Part 3 #10205

Merged
merged 52 commits into from
Sep 21, 2023
Merged

Space Sizing and HVAC Part 3 #10205

merged 52 commits into from
Sep 21, 2023

Conversation

mjwitte
Copy link
Contributor

@mjwitte mjwitte commented Sep 6, 2023

Pull request overview

  • More Space sizing and HVAC - more details to follow.
  • Build on Extend Spaces to Sizing and HVAC #9982 and Space Sizing and HVAC part2 - Code cleanups #10174
  • More refactoring of internal gains:
    • eliminate duplicate variables in dataHeatBal->ZoneIntGain that weren't being used in the heat balance and were simply copied to equivalent variables in dataHeatBal->ZoneRpt (and the same for space).
    • accumulate zone values by summing space values instead of accumulating both from the individual internal gain objects.
    • Fixed space allocation for ZoneBaseboard:OutdoorTemperatureControlled, previously if this was applied to a zone with multiple spaces, the entire load was assigned to each space instead of allocating by floor area.
  • Fixed "Space Heat Balance *" output variables (previously always zero).
  • When space heat balance is not active, set space air temperature and humidity to the zone conditions.
  • Use Space air temperature and humidity always (regardless of space heat balance setting) for:
    • Surface heat balance
    • etc.
  • Flesh out some SpaceHVAC features:
    • SpaceHVAC:ZoneEquipmentSplitter thermostat control options and space fraction sizing
    • SpaceHVAC:ZoneEquipmentMixer

ToDo

  • More documentation
  • Unit tests
  • Test various feature options

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

@mjwitte mjwitte added the NewFeature Includes code to add a new feature to EnergyPlus label Sep 6, 2023
@Myoldmopar
Copy link
Member

OK, still marked as draft, so I'm passing over this one for now. @mjwitte please advise if I should stop and look a little closer here before freeze.

@mjwitte mjwitte added this to the EnergyPlus 23.2 milestone Sep 13, 2023
@mjwitte
Copy link
Contributor Author

mjwitte commented Sep 13, 2023

@Myoldmopar I'm planning to finish this soon. It's built on #10174 which should be ready to merge first.

@mjwitte
Copy link
Contributor Author

mjwitte commented Sep 20, 2023

Ok, so, essentially two lines of code needed to change. Not perfect, but much better than before.

  • Zone sizing stays the same with or without Do Space Heat Balance for Sizing (or Simulation) for zones that have a single space.
  • For zones with multiple spaces, the zone sizing changes slightly when Space Sizing is active (on the order of 1-2%).
  • For zones with a single space, the space sizing matches its zone sizing.

@Myoldmopar @rraustad This should be ready go now, except for some doc changes and unit tests which can be in another PR.

@mjwitte
Copy link
Contributor Author

mjwitte commented Sep 20, 2023

Diffs

  • 5ZoneAirCooledWithSpaceHeatBalance - All of the Space Air * variables were zero before, now they have values.
  • 5ZoneAirCooledWithSpacesHVAC - Lots of changes to the plumbing here, so diffs expected in sizing on down.
  • Small diffs on other files on the order of 1e-15 (relative) due to the changes in summing for zone-level internal gains output variables. Previously, zones and spaces summed across the individual instances of e.g. electric equipment. Now, the spaces sum the instances, and the zones sum the space values.

@rraustad
Copy link
Contributor

Ok, so, essentially two lines of code needed to change. Not perfect, but much better than before.

  • Zone sizing stays the same with or without Do Space Heat Balance for Sizing (or Simulation) for zones that have a single space.
  • For zones with multiple spaces, the zone sizing changes slightly when Space Sizing is active (on the order of 1-2%).
  • For zones with a single space, the space sizing matches its zone sizing.

@Myoldmopar @rraustad This should be ready go now, except for some doc changes and unit tests which can be in another PR.

The 1-2% change for multiple spaces is either something that was fixed or something that is missing. I suspect a change like thisZoneBBHeat.CapatHighTemperature = IHGNumbers(3) * spaceFrac; would cause a diff as something fixed.

Since the "space" files show big diffs in space and zone sizing I think it would be a good idea to compare the zone sizing results to the original 5ZoneAirCooled zone sizing results as a sanity check (assuming zone equipment lines up with space equipment).

As far as other changes here, the walk-thru makes sense and the "well, I can't recall" comment reminds me of branches I have worked on in the past. Docs and unit tests in a different branch is OK with me although doc changes should accompany these changes (except that use of spaces is probably not yet wide-spread). Now that changes have settled down a final pass through code wouldn't hurt.

@mjwitte
Copy link
Contributor Author

mjwitte commented Sep 20, 2023

Here's a comparison of eio sizing output for 5ZoneAirCooledWithSpaceHeatBalance vs 5ZoneAirCooled. This is with one space per zone. The current 5ZoneAirCooledWithSpaces is not equivalent to 5ZoneAirCooled (it has different internal gain objects). I'll make a version that should be equivalent next.

image

@mjwitte
Copy link
Contributor Author

mjwitte commented Sep 20, 2023

Here's the sizing for 5ZoneAirCooledWithSpacesAndSameInternalGains vs 5ZoneAirCooled. There are more walls in 5ZoneAirCooledWithSpacesAndSameInternalGains so I would expect some small changes.
image

And here is 5ZoneAirCooledWithSpacesAndSameInternalGains with space sizing active vs no space sizing. Note how the cooling sizing changes slightly but the heating sizing is the same. That's a clue that maybe a humidity value isn't what is should be? Or some internal gain value is different? That'll have to wait for another day.

image

@mjwitte
Copy link
Contributor Author

mjwitte commented Sep 20, 2023

@Myoldmopar I see conflicts now. I'll work on that.

@mjwitte
Copy link
Contributor Author

mjwitte commented Sep 20, 2023

doc changes should accompany these changes
@rraustad The main I/O Ref changes were included in Part 1 #9982 Some fine-tuning of that and adding the figure you worked on plus some Engineering Ref comments about space are needed. Not a show-stopper if those don't make it into 23.2.

thisZeqSplitter.Name,
DataLoopNode::NodeFluidType::Air,
DataLoopNode::ConnectionType::Outlet,
NodeInputManager::CompFluidStream::Primary,
objectIsParent);
if (thisZeqSplitter.controlSpaceIndex == thisZeqSpace.spaceIndex) {
thisZeqSplitter.controlSpaceNumber = spaceCount;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Picks up the control space index (took a minute to see what this was doing).

thisSpace.fraction);
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could combine these 2 switch blocks. For another day.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, the motivation to separate them was to calculate spacesTotal first, then check to see if it's zero before using it to divide. But I'm open to other suggestions (on another day).

auto &inletNodes = (state.dataHeatBal->doSpaceHeatBalance) ? state.dataZoneEquip->spaceEquipConfig(this->spaceNum).InletNode
: state.dataZoneEquip->ZoneEquipConfig(Zone).InletNode;
for (int nodeNum : inletNodes) {
auto &inNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(Zone).InletNode(nodeNum));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Due to the comment above, I realize this line is incorrect and should have caused a subscript error, but this code is not covered in the integration tests, how is that? Nothing in the integration tests ever sets
state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneSupplyAirTemp

Anyways, will address this shortly along with other comments.

@mjwitte mjwitte self-assigned this Sep 20, 2023
latentRatio = (state.dataZoneEnergyDemand->spaceSysMoistureDemand(maxSpaceIndex).RemainingOutputRequired /
thisZoneMoistureDemand.RemainingOutputRequired) /
maxSpaceFrac;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It took me a minute to see why you were saving the original zone loads and I see now the space loads can be different depending on how the fraction is derived.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this was an attempt to avoid having e v-e r-y piece of HVAC equipment look to see if it should be controlling to the zone load or a specific space load. It' working, kindof, but the controls are not as precise as I expected. Room for improvement in the next cycle.

thisSpaceHB.ZT = thisSpaceHB.MAT;
// save for use with thermal comfort control models (Fang, Pierce, and KSU)
thisSpaceHB.ZTAV = 0.0;
thisSpaceHB.airHumRatAvg = 0.0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since zone is now a space sum, this/these is/are always executed.

state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).predictSystemLoad(
state, ShortenTimeStepSys, UseZoneTimeStepHistory, PriorTimeStep, zoneNum, spaceNum);
} else if (ShortenTimeStepSys) {
state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).MAT = thisZoneHB.MAT;
state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).airHumRat = thisZoneHB.airHumRat;
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't the spaces be able to float to temperatures other than the zone MAT? i.e., shouldn't the space MAT be the last time step space MAT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Won't the spaces be able to float to temperatures other than the zone MAT? i.e., shouldn't the space MAT be the last time step space MAT?

This is an else if after if (state.dataHeatBal->doSpaceHeatBalance) so it only fires if there's no space heat balance active. Yes, this has gotten a bit messy. By moving surfaces, etc. to use space air temp and humrat (again to avoid having ifs all over the place to select space or zone), if space heat balance is not active, the space conditions need to stay in synch with the zone conditions. So any time the zone temps get moved around, the space temps need to be reset. I'd love to come up with a cleaner approach.

thisSpaceHB.MAT = thisZoneHB.MAT;
thisSpaceHB.airHumRat = thisZoneHB.airHumRat;
thisSpaceHB.airRelHum = thisZoneHB.airRelHum;
// thisSpaceHB.ZTAVComf = thisZoneHB.ZTAVComf;
Copy link
Contributor

Choose a reason for hiding this comment

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

This else section makes sense when no space HB is performed.

thisSpaceHVACMixer.size(state);
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

A little out of the ordinary where sizing occurs on the call to each object, but OK, this happens after system sizing so space splitter/mixer can be sized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A little out of the ordinary where sizing occurs on the call to each object, but OK, this happens after system sizing so space splitter/mixer can be sized.

Yah, fer sure dat. This was a bit of a punt. Would love a better suggestion from the sizing guru, for another day.

@rraustad
Copy link
Contributor

@Myoldmopar I have made another pass. Other than the few changes/conflicts @mjwitte is making now, this branch appears ready to merge. I wonder if the one thing @mjwitte found today with subscript error would change the diff's compared to 5ZoneAirCooled? Those diff's looked reasonable. As for heating diff's being small, the heating DesignDay uses a constant outdoor temperature so storage terms are negligable. Comparing the spaces zone sizing to zone sizing of 5ZoneAirCooled is a good future check.

@@ -251,7 +251,7 @@ Real64 SurfaceData::getInsideAirTemperature(EnergyPlusData &state, const int t_S
auto &inletNodes = (state.dataHeatBal->doSpaceHeatBalance) ? state.dataZoneEquip->spaceEquipConfig(this->spaceNum).InletNode
: state.dataZoneEquip->ZoneEquipConfig(Zone).InletNode;
for (int nodeNum : inletNodes) {
auto &inNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(Zone).InletNode(nodeNum));
auto &inNode = state.dataLoopNodes->Node(nodeNum);
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh dear, yeah, I missed that entirely.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the unit test that covers this, there just happens to be 4 inlet nodes, and the node numbers are 1-4, so it worked. I'll try to remember to improve that unit test (all of the inlet node conditions are the same currently, so it could be a better test).

@mjwitte
Copy link
Contributor Author

mjwitte commented Sep 20, 2023

@Myoldmopar @rraustad Conflicts resolved, updated with develop, comments addressed or responded to or deferred. This should be the final commit assuming CI comes back clean (except for the noted diffs.

@Myoldmopar
Copy link
Member

Well, Windows came back clean, as expected. Mac should be done very soon I expect.

@Myoldmopar
Copy link
Member

Mac came back exactly as planned, assuming Linux doesn't find anything weird, this will merge later. Thanks for this @mjwitte !

@Myoldmopar Myoldmopar merged commit e7398af into develop Sep 21, 2023
@Myoldmopar Myoldmopar deleted the SpaceSizingHVACPart3 branch September 21, 2023 02:17
@mjwitte mjwitte mentioned this pull request Jun 17, 2024
25 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NewFeature Includes code to add a new feature to EnergyPlus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants