Skip to content

Conversation

@mjwitte
Copy link
Contributor

@mjwitte mjwitte commented Dec 9, 2025

Pull request overview

  • Prevents duplicate view factor calculations when they would be identical for both the solar and radiant enclosure calculations.
  • There are two special cases where the view factors are different for radiant vs solar enclosures:
    • When PerformancePrecisionTradeoffs "Use Representative Surfaces for Calculations" is Yes, because the solar calcs use all surfaces and the radiant calcs use only the representative surfaces.
    • When there are any DaylightingDevice:Shelf "Inside Shelf Name", because the inside shelf area is doubled for heat transfer calculations, but not for solar distribution.

Pull Request Author

  • 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
  • If adding/removing any output files (e.g., eplustbl.*)
    • Update ..\scripts\Epl-run.bat
    • Update ..\scripts\RunEPlus.bat
    • Update ..\src\EPLaunch\ MainModule.bas, epl-ui.frm, and epl.vbp (VersionComments)
    • Update ...github\workflows\energyplus.py

Reviewer

  • 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 Performance Includes code changes that are directed at improving the runtime performance of EnergyPlus label Dec 9, 2025
@github-actions
Copy link

⚠️ Regressions detected on ubuntu-24.04 for commit 8b6adab

Regression Summary
  • EIO: 29
  • Table Big Diffs: 20
  • ERR: 1
  • ESO Small Diffs: 1
  • Table Small Diffs: 1

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 8b6adab

Regression Summary
  • EIO: 29
  • Table Big Diffs: 20
  • ERR: 1
  • ESO Small Diffs: 1
  • Table Small Diffs: 1

@mjwitte mjwitte changed the title Avoid duplicate view factor calculations Avoid duplicate view factor calculations (Plan B) Dec 10, 2025
Copy link
Contributor Author

@mjwitte mjwitte left a comment

Choose a reason for hiding this comment

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

Code walk-thru

Comment on lines -152 to +153
bool AndShadingControlInModel = false; // true if there is any window shading control for any fenestration surface
bool AnyShadingControlInModel = false; // true if there is any window shading control for any fenestration surface
bool AnyInsideShelf = false; // true if these is any inside daylighting shelf
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add new flag to track if there are any inside light shelves.
Fixed the name of "AndShadingControlInModel" to "AnyShading...."

if (ShelfSurf > 0) {
// Double surface area so that both sides of the shelf are treated as internal mass
state.dataSurface->Surface(ShelfSurf).Area *= 2.0;
state.dataGlobal->AnyInsideShelf = true; // Set this to force recalc for radiant view factors due to area change
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Set the flag here. This is where the shelf area gets doubled (after InitSolarViewFactors and before InitInteriorRadExchange).

Comment on lines +525 to +527
if (state.dataHeatBalIntRadExchg->CarrollMethod) {
thisEnclosure.Fp.dimension(numEnclosureSurfaces, 1.0);
thisEnclosure.FMRT.dimension(numEnclosureSurfaces, 0.0);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are only used for CarrollMethod.

Comment on lines 601 to 604
// For radiant enclosures:
// If UseRepresentativeSurfaceCalculations is true and there are no user input view factors, then calc approx view factors
// (If User supplied view factors are present, then UseRepresentativeSurfaceCalculations is skipped in SufaceGeometry::GetSurfaceData)
// Otherwise, copy final view factors from the solar enclosure
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are the new rules to decide if the solar view factors can be used for radiant exchange or if they need to be recalculated.
oops - need to add a line about the daylighting inside shelf.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

int NumZonesWithUserFbyS = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject);
if (NumZonesWithUserFbyS > 0) {

GetInputViewFactorsbyName(state,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are gotten in InitSolarViewFactors so no need to get them again.
Hmm, but what if there are user input view factors and an inside light shelf? Argh. May need to revert this part.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, see below.

Comment on lines 609 to 616
bool useSolarViewFactors = ((!state.dataSurface->UseRepresentativeSurfaceCalculations || NumZonesWithUserFbyS > 0) &&
!state.dataGlobal->AnyInsideShelf && !state.dataViewFactor->EnclSolInfo(enclosureNum).F.empty());

if (useSolarViewFactors) {
thisEnclosure.F = state.dataViewFactor->EnclSolInfo(enclosureNum).F;
} else {
// Calculate the view factors and make sure they satisfy reciprocity
CalcApproximateViewFactors(state,
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 is the heart of the change. Either copy the solar view factors or calculate approximate view factors. Plus some later reporting that is skipped when useSolarViewFactors is true.

@mjwitte mjwitte marked this pull request as ready for review December 17, 2025 17:00
@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit b84e7b8

Regression Summary
  • EIO: 28
  • Table Big Diffs: 20
  • ERR: 1

@github-actions
Copy link

⚠️ Regressions detected on ubuntu-24.04 for commit b84e7b8

Regression Summary
  • EIO: 28
  • Table Big Diffs: 20
  • ERR: 1

@mjwitte
Copy link
Contributor Author

mjwitte commented Dec 17, 2025

A tiny performance improvement.
image

eso diffs are gone now. eio, table and err diffs are as expected.

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit ddd6005

Regression Summary
  • EIO: 28
  • Table Big Diffs: 20
  • ERR: 1

@github-actions
Copy link

⚠️ Regressions detected on ubuntu-24.04 for commit ddd6005

Regression Summary
  • EIO: 28
  • Table Big Diffs: 20
  • ERR: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

6 participants