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

Fix #6435 - WaterUse:Storage Design Inflow Rate not respected #8399

Merged
merged 4 commits into from
Dec 11, 2020

Conversation

jmarrec
Copy link
Contributor

@jmarrec jmarrec commented Dec 1, 2020

Pull request overview

The problem is actually slightly different than originally stated, it's a problem of float valve control. When it goes below the ValveOnCapacity, it fills up. But at the next timestep, regardless of whether it's went above the ValveOffCapacity or not, it checks again if it's below ValveOnCapacity and determines that it doesn't need to keep filling up.

Defect file on EnergyPlusDevSupport: https://github.com/NREL/EnergyPlusDevSupport/blob/d37b70ea2df0e180cc527b222f827913c81ecf5d/DefectFiles/6000s/6435/in.idf#L9647-L9681

Running the defect file before and after. As you can see, in the before case, the last graph "Storage Tank Volume [m3]", you have the tank filling up only during one timestep, while the ValveOffCapacity which is 3m3 isn't achieved. The Timestep in the file is 6, so it fills up between 14:40 and 14:50. In the after case, the tank fills up during one more timestep until it's ValveOffCapacity is achieved.

image

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

@jmarrec jmarrec added the Defect Includes code to repair a defect in EnergyPlus label Dec 1, 2020
@jmarrec jmarrec self-assigned this Dec 1, 2020
Copy link
Contributor Author

@jmarrec jmarrec left a comment

Choose a reason for hiding this comment

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

Left a Walkthrough. The unit test is commented and should be self explanatory so I didn't add walkthrough comments.

@@ -121,6 +121,7 @@ namespace DataWater {
int OverflowTankSupplyARRID;
Real64 ValveOnCapacity; // tank capacity at lower control range [m3]
Real64 ValveOffCapacity; // tank capacity at upper control range [m3]
bool LastTimeStepFilling; // Indicates that tank was filling up at last timestep, to determine whether to continue until ValveOffCapacity
Copy link
Contributor Author

Choose a reason for hiding this comment

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

New attribute

: MaxCapacity(0.0), OverflowMode(Overflow::Unassigned), OverflowTankID(0), OverflowTankSupplyARRID(0), ValveOnCapacity(0.0), ValveOffCapacity(0.0), ControlSupply(ControlSupplyType::Unassigned), GroundWellID(0), SupplyTankID(0), SupplyTankDemandARRID(0), BackupMainsCapacity(0.0), InitialVolume(0.0),
MaxInFlowRate(0.0), MaxOutFlowRate(0.0), ThermalMode(TankThermalMode::Unassigned), InitialTankTemp(20.0), TempSchedID(0), AmbientTempIndicator(AmbientTempType::Unassigned),
: MaxCapacity(0.0), OverflowMode(Overflow::Unassigned), OverflowTankID(0), OverflowTankSupplyARRID(0), ValveOnCapacity(0.0),
ValveOffCapacity(0.0), LastTimeStepFilling(false), ControlSupply(ControlSupplyType::Unassigned), GroundWellID(0), SupplyTankID(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.

Init to false in Ctor

Comment on lines +1052 to +1058

if ( ((VolumePredict) < state.dataWaterData->WaterStorage(TankNum).ValveOnCapacity) ||
state.dataWaterData->WaterStorage(TankNum).LastTimeStepFilling )
{ // turn on supply to fill tank
FillVolRequest = state.dataWaterData->WaterStorage(TankNum).ValveOffCapacity - VolumePredict;

state.dataWaterData->WaterStorage(TankNum).LastTimeStepFilling = true;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you go below ValveOnCapacity, you start filling, and you set the LastTimeStepFilling to true.
Or if LastTimeStepFilling is already true, you keep filling.

Comment on lines +1088 to +1091
if (state.dataWaterData->WaterStorage(TankNum).ThisTimeStepVolume >= state.dataWaterData->WaterStorage(TankNum).ValveOffCapacity) {
state.dataWaterData->WaterStorage(TankNum).LastTimeStepFilling = false;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At the end of the iteration, you check whether you are above or equal to ValveOffCapacity, in which case you switch LastTimeStepFilling to false.

@jmarrec jmarrec added the NotIDDChange Code does not impact IDD (can be merged after IO freeze) label Dec 1, 2020
@jmarrec
Copy link
Contributor Author

jmarrec commented Dec 2, 2020

regression.5ZoneWaterSystems has a difference in WELL 1:Water System Groundwater Well Requested Volume Flow Rate [m3/s] which is expected. The failed one is the SolarShadingGPU as usual.

@mitchute
Copy link
Collaborator

I've confirmed the fix here. Everything looks good. Merging.

@mitchute mitchute merged commit edb5081 into develop Dec 11, 2020
@mitchute mitchute deleted the 6435_WaterStorage_Fill_Valve branch December 11, 2020 17:10
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 NotIDDChange Code does not impact IDD (can be merged after IO freeze)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WaterUse:Storage Design Inflow Rate not respected
6 participants