2

SetpointManager:ReturnTemperature:Chilled/HotWater never reads PlantLoop fluid glycol (E+ Bugfix)

THIS POST WAS MODIFIED AS MY FIRST SOLUTION CAUSED A BUG

Hello to anyone interested in this post,

First, I work in E+ 9.4 but I have checked that this error is still in the most recent version of EP, that is why I made it as a bugfix proposal.

While working in Design Builder and E+ modelling a thermal energy storage system with heatpumps and cold water storage I found the object "SetpointManager:ReturnTemperature:ChilledWater".

I found it really useful because it lets the heat pump impulsion temperature float between a minimum and a maximum, and this is a "common" practice that makes the COP of the heat pump higher.

However, after changing the fluid of the plant loop to water+ethyleneglycol, I found in the .err file the following warning:

 ** Warning ** GetSpecificHeatGlycol: Temperature is out of range (too low) for fluid **[WATER]** specific heat supplied values **
   **   ~~~   ** ..Called From:ReturnWaterChWSetPointManager::calculate,Temperature=[-0.34], supplied data range=[0.00,125.00]
   **   ~~~   **  Environment=SITIO (01-01:31-12), at Simulation time=01/01 10:05 - 10:10

This error says that the returnWaterSetpoint manager thinks the fluid is water and therefore the problem is that the return water setpoint is using pure water for specific heat calculations, and because the fluid isn't pure water, the heat balance is never properly solved.

So I delved into the Source code as I have a modified version (for E+ 9.4) and found this on the Setpointmanager.cc, subroutine "DefineReturnWaterChWSetPointManager" lines 7606 to 7624:

   // we need to know the plant to get the fluid ID in case it is glycol
   // but we have to wait in case plant isn't initialized yet
   // if plant isn't initialized, assume index=1 (water)
   int fluidIndex = 1;
   if (this->plantLoopIndex == 0) {
       for (int plantIndex = 1; plantIndex <= DataPlant::TotNumLoops; plantIndex++) {
           if (this->supplyNodeIndex == DataPlant::PlantLoop(plantIndex).LoopSide(2).NodeNumOut) {
               this->plantLoopIndex = plantIndex;
               this->plantSetpointNodeIndex = DataPlant::PlantLoop(plantIndex).TempSetPointNodeNum;
               fluidIndex = DataPlant::PlantLoop(plantIndex).FluidIndex;
               // now that we've found the plant populated, let's verify that the nodes match
               if (!PlantUtilities::verifyTwoNodeNumsOnSamePlantLoop(this->supplyNodeIndex, this->returnNodeIndex)) {
                   ShowSevereError("Node problem for SetpointManager:ReturnTemperature:ChilledWater.");
                   ShowContinueError("Return and Supply nodes were not found on the same plant loop.  Verify node names.");
                   ShowFatalError("Simulation aborts due to setpoint node problem");
               }
           }
       }
   }

Some lines later it uses the variable "fluidIndex" to calculate the specific heat of the fluid:

// we don't need fluid names since we have a real index, so just pass in the temperature and get properties
Real64 avgTemp = (returnNode.Temp + supplyNode.Temp) / 2;
Real64 cp = FluidProperties::GetSpecificHeatGlycol("", avgTemp, fluidIndex, "ReturnWaterChWSetPointManager::calculate");

This block of code NEVER uses fluidIndex as called from the plantloop, it ALWAYS uses 1 (Water). And the reason I believe is that the "fluidIndex = DataPlant::PlantLoop(plantIndex).FluidIndex;" is used only once, when the plant is NOT initialised.

This is a simplified version of the logic: Fluid=Water Ifnotinitialised->{ initialise it Fluid=Fluid of the plant}

This subroutine is executed in EVERY timestep, so it only sets the fluid correctly once, at ... (more)

PmP's avatar
215
PmP
asked 2024-05-21 05:34:45 -0500, updated 2024-05-24 05:34:08 -0500
edit flag offensive 0 remove flag close merge delete

Comments

2

I suggest you post this bug report at https://github.com/NREL/EnergyPlus/is... so the EnergyPlus developers see it.

shorowit's avatar shorowit (2024-05-24 15:42:01 -0500) edit
2

Done! Thank you for the input, I was a bit scared because I thought I had to do the full pull request and I don't work with the current E+ version, but the Issue is easier to do.

I should have put the link here too, so here it is: https://github.com/NREL/EnergyPlus/is...

PmP's avatar PmP (2024-05-24 16:17:07 -0500) edit
add a comment see more comments

1 Answer

4

Corrected and properly solved on github:

Issue: https://github.com/NREL/EnergyPlus/issues/10524

Pull Request: https://github.com/NREL/EnergyPlus/pull/10535

PmP's avatar
215
PmP
answered 2024-06-13 03:58:18 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments