Skip to content

Conversation

@rraustad
Copy link
Contributor

@rraustad rraustad commented Aug 12, 2025

Pull request overview

  • Adds TES tank capacity autosizing.

The following components report their chilled water flow rate to the TES system to accomodate autosizing tank capacity:

  • Coil:Cooling:Water
  • Coil:Cooling:Water:DetailedGeometry
  • AirTerminal:SingleDuct:ConstantVolume:CooledBeam
  • AirTerminal:SingleDuct:ConstantVolume:FourPipeBeam
  • ZoneHVAC:CoolingPanel:RadiantConvective:Water
  • LoadProfile:Plant

Description of the purpose of this PR

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

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

@rraustad rraustad added NewFeature Includes code to add a new feature to EnergyPlus IDDChange Code changes impact the IDD file (cannot be merged after IO freeze) labels Aug 12, 2025
auto &plntSizData = state.dataSize->PlantSizData(PltSizNum);
int startPeak = 9 * state.dataGlobal->TimeStepsInHour; // 9:00 AM
int endPeak = 22 * state.dataGlobal->TimeStepsInHour; // 10:00 PM
Real64 sizingFactor = 0.36;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So far these 3 things are needed for autosizing TES tank capacity. On-peak period start and end, and a sizingFactor to allow adjustment for plant configuration (e.g., if chiller is on during the on-peak period the tank can be downsized).

BaseSizer::reportSizerOutput(state, tankType, this->Name, "Design Size Capacity [GJ]", tankCapacity * Constant::rSecsInHour / 1.0E9);
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  ThermalStorage:Ice:Detailed,
    Ice Tank,                !- Name
    ON,                      !- Availability Schedule Name
!   0.5,                     !- Capacity {GJ}
    autosize,                !- Capacity {GJ}


Component Sizing Information, ThermalStorage:Ice:Detailed, ICE TANK, Design Size Capacity [GJ], 0.49726

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit e286658

Regression Summary
  • Audit: 7
  • EIO: 7
  • Table Big Diffs: 7

@rraustad rraustad self-assigned this Aug 13, 2025
@rraustad rraustad added this to the EnergyPlus 25.2 IO Freeze milestone Aug 13, 2025
@rraustad rraustad changed the title Initial effort to add TES tank sizing New Feature to add TES tank auto sizing tank capacity Aug 15, 2025
Real64 Cp = plntLoop.glycol->getSpecificHeat(state, plntSizData.ExitTemp, callingRoutine);
Real64 rho = plntLoop.glycol->getDensity(state, plntSizData.ExitTemp, callingRoutine);
Real64 onPeakEnergy =
onPeakSumWaterFlow * rho * Cp * plntSizData.DeltaT * Constant::rSecsInHour; // need Joules here, J = m3/s * kg/m3 * J/kg-C * C * sec
Copy link
Contributor Author

@rraustad rraustad Aug 16, 2025

Choose a reason for hiding this comment

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

To calculate onPeakEnergy, onPeakSumWaterFlow is summed (1471 to 1477) from start to end of on peak period. This means that any demand side component that will be served by this tank needs to log it's time step load. See epluspsz.csv. Then converted to joules. This is the amount of energy (accounting for the sizing factor) that the tank needs to meet. The time step water flow rate is estimated in CoolingWaterFlowSizing.cc, via calcCoilWaterFlowRates and stored in state.dataPlnt->PlantLoop(loopNum).compDesWaterFlowRate[coilNumOnPlant].tsDesWaterFlowRate[timeStep]. Those data are summed into plntLoop.plantDesWaterFlowRate[ts]. The sum is used to find the plant load via line 1481. From here the tank size is calculated at line 1491. kWh for the detailed model and J for the simple model.

return coilInHumRat;
}

void BaseSizer::calcCoilWaterFlowRates(EnergyPlusData &state,
Copy link
Contributor Author

@rraustad rraustad Aug 16, 2025

Choose a reason for hiding this comment

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

There is a epluszsz.csv (zone), eplusssz (system), and now a epluspsz.csv (plant). The psz file reports the demand side component water flow rate that ultimately sizes the plant. I needed this to make sure I was summing the time step water flow rate correctly and then it seemed it was a good output for user inspection. This branch only sums the water coils. There are other component types that add to the plant load that will eventually need to be included. e.g., water source HPs, LoadProfile, etc. Those can be included with a copy of CoolingWaterflowSizing.cc line 169 to the appropriate model code (hopefully).


std::vector<Real64> tmpFlowData;
tmpFlowData.resize(size_t(24 * state.dataGlobal->TimeStepsInHour + 1));
tmpFlowData[0] = compNum;
Copy link
Contributor Author

@rraustad rraustad Aug 16, 2025

Choose a reason for hiding this comment

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

Note state.dataPlnt->PlantLoop(loopNum).compDesWaterFlowRate[i].tsDesWaterFlowRate[0] holds the comp index. How to differentiate between different model indexes is TBD (e.g. between a water coil index, a plant load profile index, or a water source HP coil index). The array state.dataPlnt->PlantLoop(loopNum).plantCoilObjectNames holds the name of the component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that line 748 and 749 have name and type now so differentiating across object types should not be a problem.

}
}

void ReportPlantCompWaterFlowData(EnergyPlusData &state)
Copy link
Contributor Author

@rraustad rraustad Aug 16, 2025

Choose a reason for hiding this comment

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

Report out what was found for demand side component water flow rate per time step on the peak day for each demand side component. On a per component basis in epluspsz.csv. Currently applies to Coil:Cooling:Water* object types.

image

I had to go back and check where that "Des Cool Volume Flow" came from. Probably needs to be changed to be generic.

image

@rraustad rraustad changed the title New Feature to add TES tank auto sizing tank capacity New Feature to add autosizing of Thermal Energy Storage tank capacity Aug 16, 2025
@rraustad rraustad changed the title New Feature to add autosizing of Thermal Energy Storage tank capacity New Feature to allow autosizing of Thermal Energy Storage tank capacity Aug 16, 2025
state.dataPlnt->PlantLoop(LoopNum).plantDesWaterFlowRate[ts] += thisCoil.tsDesWaterFlowRate[ts + 1];
}
}
}
Copy link
Contributor Author

@rraustad rraustad Aug 19, 2025

Choose a reason for hiding this comment

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

Above sums plant component water flow rates into the master plantDesWaterFlowRate array. The below reports to epluspsz.csv.

}
}

void HeatExchangerStruct::updateCompFlowData(EnergyPlusData &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.

The fluid to fluid HX logic copies the coil data from the plant loop on the supply side of the HX (downstream side, i.e., to a secondary loop) to the plant loop on the demand side of the HX (upstream side). This moves the comp flow rates (load surrogate) to the upstream plant.

@rraustad
Copy link
Contributor Author

rraustad commented Sep 13, 2025

This is looking better. I was able to get the TES to meet the on peak load (hrs 9 - 22) without the chiller. The chiller charges the tank and the tank meets the on peak load. The tank fraction varies between 1 and 0.28 on these summer days. Pretty close to expectations.

image

@rraustad
Copy link
Contributor Author

New example file design day simulation. TES tank is depleted to 47% remaining charge.

image

Tank fraction over an annual simulation:

image

@mitchute mitchute self-requested a review September 24, 2025 18:21
This alpha field specifies the name of the ThermalStorage:Sizing object name. If the capacity field is autosized this object is required.

Following is an example input for the THERMAL STORAGE:ICE:SIMPLE object.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn’t necessary, but it might be helpful to include one more example IDF that uses autosizing like:

\begin{lstlisting}
  ThermalStorage:Ice:Simple,
  Ice Tank,                !- Name
  IceOnCoilInternal,       !- Ice Storage Type
  autosize,                !- Capacity {GJ}
  Ice Tank Inlet Node,     !- Inlet Node Name
  Ice Tank Outlet Node,    !- Outlet Node Name
  TESSizing;               !- Thermal Storage Sizing Object Name
\end{lstlisting}

(Copied from the new testfile)

@dareumnam
Copy link
Collaborator

I built it locally with the latest develop branch pulled in and ran the newly added test files with various on/off-peak schedules and sizing factors. The results look reasonable across the different cases, and all related documentation looks great.
The tank is sizing a little larger than expected, but we can look into that later and open a follow-up PR. This one looks good to be merged in. @mitchute
Thanks so much for the effort, @rraustad it’s amazing to finally have autosizing TES. 👍

@mitchute
Copy link
Collaborator

Thanks everyone for all the great work here. Merging.

@mitchute mitchute merged commit a6a538e into develop Oct 10, 2025
11 checks passed
@mitchute mitchute deleted the TESSizing branch October 10, 2025 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

IDDChange Code changes impact the IDD file (cannot be merged after IO freeze) NewFeature Includes code to add a new feature to EnergyPlus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants