Skip to content

Commit

Permalink
More modules, only a few more to go
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir Roth committed Jan 7, 2025
1 parent 6eba628 commit 5710c25
Show file tree
Hide file tree
Showing 25 changed files with 315 additions and 518 deletions.
56 changes: 21 additions & 35 deletions src/EnergyPlus/PondGroundHeatExchanger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,9 @@ Real64 PondGroundHeatExchangerData::CalcTotalFLux(EnergyPlusData &state, Real64
Real64 FluxSolAbsorbed = CalcSolarFlux(state);

// specific heat from fluid prop routines
Real64 SpecHeat = FluidProperties::GetSpecificHeatGlycol(state,
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName,
max(this->InletTemp, 0.0),
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex,
RoutineName);
Real64 SpecHeat = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state,
max(this->InletTemp, 0.0),
RoutineName);
// heat transfer with fluid - heat exchanger analogy.

// convective flux
Expand Down Expand Up @@ -711,21 +709,15 @@ Real64 PondGroundHeatExchangerData::CalcEffectiveness(EnergyPlusData &state,

// evaluate properties at pipe fluid temperature for given pipe fluid

Real64 SpecificHeat = FluidProperties::GetSpecificHeatGlycol(state,
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName,
InsideTemperature,
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex,
CalledFrom);
Real64 Conductivity = FluidProperties::GetConductivityGlycol(state,
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName,
InsideTemperature,
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex,
CalledFrom);
Real64 Viscosity = FluidProperties::GetViscosityGlycol(state,
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName,
InsideTemperature,
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex,
CalledFrom);
Real64 SpecificHeat = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state,
InsideTemperature,
CalledFrom);
Real64 Conductivity = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getConductivity(state,
InsideTemperature,
CalledFrom);
Real64 Viscosity = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getViscosity(state,
InsideTemperature,
CalledFrom);

// Calculate the Reynold's number from RE=(4*Mdot)/(Pi*Mu*Diameter)
Real64 ReynoldsNum = 4.0 * massFlowRate / (Constant::Pi * Viscosity * this->TubeInDiameter * this->NumCircuits);
Expand Down Expand Up @@ -840,11 +832,9 @@ void PondGroundHeatExchangerData::UpdatePondGroundHeatExchanger(EnergyPlusData &

// Calculate the water side outlet conditions and set the
// appropriate conditions on the correct HVAC node.
Real64 CpFluid = FluidProperties::GetSpecificHeatGlycol(state,
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName,
this->InletTemp,
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex,
RoutineName);
Real64 CpFluid = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state,
this->InletTemp,
RoutineName);

PlantUtilities::SafeCopyPlantNode(state, InletNodeNum, OutletNodeNum);

Expand Down Expand Up @@ -896,16 +886,12 @@ void PondGroundHeatExchangerData::oneTimeInit(EnergyPlusData &state)
if (errFlag) {
ShowFatalError(state, "InitPondGroundHeatExchanger: Program terminated due to previous condition(s).");
}
Real64 rho = FluidProperties::GetDensityGlycol(state,
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName,
DataPrecisionGlobals::constant_zero,
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex,
RoutineName);
Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state,
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName,
DataPrecisionGlobals::constant_zero,
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex,
RoutineName);
Real64 rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state,
0.0,
RoutineName);
Real64 Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state,
0.0,
RoutineName);
this->DesignMassFlowRate = Constant::Pi / 4.0 * pow_2(this->TubeInDiameter) * DesignVelocity * rho * this->NumCircuits;
this->DesignCapacity = this->DesignMassFlowRate * Cp * 10.0; // assume 10C delta T?
PlantUtilities::InitComponentNodes(state, 0.0, this->DesignMassFlowRate, this->InletNodeNum, this->OutletNodeNum);
Expand Down
28 changes: 9 additions & 19 deletions src/EnergyPlus/PoweredInductionUnits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -720,11 +720,9 @@ void InitPIU(EnergyPlusData &state,
if (thisPIU.HotControlNode > 0) {
// plant upgrade note? why no separate handling of steam coil? add it ?
// local plant fluid density
Real64 const rho = FluidProperties::GetDensityGlycol(state,
state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum).FluidName,
Constant::HWInitConvTemp,
state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum).FluidIndex,
RoutineName);
Real64 const rho = state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum).glycol->getDensity(state,
Constant::HWInitConvTemp,
RoutineName);

thisPIU.MaxHotWaterFlow = rho * thisPIU.MaxVolHotWaterFlow;
thisPIU.MinHotWaterFlow = rho * thisPIU.MinVolHotWaterFlow;
Expand Down Expand Up @@ -850,8 +848,6 @@ void SizePIU(EnergyPlusData &state, int const PIUNum)

// Using/Aliasing
using namespace DataSizing;
using FluidProperties::GetDensityGlycol;
using FluidProperties::GetSpecificHeatGlycol;
using SteamCoils::GetCoilSteamInletNode;
using SteamCoils::GetCoilSteamOutletNode;
using WaterCoils::GetCoilWaterInletNode;
Expand Down Expand Up @@ -1207,16 +1203,12 @@ void SizePIU(EnergyPlusData &state, int const PIUNum)
Real64 const DesMassFlow = state.dataEnvrn->StdRhoAir * TermUnitSizing(CurTermUnitSizingNum).AirVolFlow;
DesCoilLoad = PsyCpAirFnW(CoilOutHumRat) * DesMassFlow * (CoilOutTemp - CoilInTemp);

Real64 const rho = GetDensityGlycol(state,
state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum).FluidName,
Constant::HWInitConvTemp,
state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum).FluidIndex,
RoutineName);
Real64 const Cp = GetSpecificHeatGlycol(state,
state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum).FluidName,
Constant::HWInitConvTemp,
state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum).FluidIndex,
RoutineName);
Real64 const rho = state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum).glycol->getDensity(state,
Constant::HWInitConvTemp,
RoutineName);
Real64 const Cp = state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum).glycol->getSpecificHeat(state,
Constant::HWInitConvTemp,
RoutineName);

MaxVolHotWaterFlowDes = DesCoilLoad / (state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * Cp * rho);
} else {
Expand Down Expand Up @@ -1408,8 +1400,6 @@ void CalcSeriesPIU(EnergyPlusData &state,

// Using/Aliasing
using namespace DataZoneEnergyDemands;
using FluidProperties::GetDensityGlycol;
using FluidProperties::GetSpecificHeatGlycol;
using HeatingCoils::SimulateHeatingCoilComponents;
using MixerComponent::SimAirMixer;
using PlantUtilities::SetComponentFlowRate;
Expand Down
18 changes: 3 additions & 15 deletions src/EnergyPlus/Pumps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ void GetPumpInput(EnergyPlusData &state)
using Curve::GetCurveIndex;
using Curve::GetCurveMinMaxValues;
using DataSizing::AutoSize;
using FluidProperties::GetDensityGlycol;
using NodeInputManager::GetOnlySingleNode;
using ScheduleManager::CheckScheduleValueMinMax;
using ScheduleManager::GetScheduleIndex;
Expand Down Expand Up @@ -1348,7 +1347,6 @@ void InitializePumps(EnergyPlusData &state, int const PumpNum)
// This subroutine does one-time and begin-envrn inits for the pump

// Using/Aliasing
using FluidProperties::GetDensityGlycol;

using PlantUtilities::InitComponentNodes;
using PlantUtilities::ScanPlantLoopsForObject;
Expand Down Expand Up @@ -1504,7 +1502,7 @@ void InitializePumps(EnergyPlusData &state, int const PumpNum)

} else {
auto &thisPumpPlant = state.dataPlnt->PlantLoop(thisPump.plantLoc.loopNum);
TempWaterDensity = GetDensityGlycol(state, thisPumpPlant.FluidName, Constant::InitConvTemp, thisPumpPlant.FluidIndex, RoutineName);
TempWaterDensity = thisPumpPlant.glycol->getDensity(state, Constant::InitConvTemp, RoutineName);
mdotMax = thisPump.NomVolFlowRate * TempWaterDensity;
// mdotMin = PumpEquip(PumpNum)%MinVolFlowRate * TempWaterDensity
// see note above
Expand Down Expand Up @@ -1564,7 +1562,6 @@ void SetupPumpMinMaxFlows(EnergyPlusData &state, int const LoopNum, int const Pu
// These values are also bounded by EMS overridable limit of max flow rate.

// Using/Aliasing
using FluidProperties::GetDensityGlycol;
using PlantPressureSystem::ResolveLoopFlowVsPressure;
using PlantUtilities::BoundValueToWithinTwoValues;
using ScheduleManager::GetCurrentScheduleValue;
Expand Down Expand Up @@ -1741,9 +1738,6 @@ void CalcPumps(EnergyPlusData &state, int const PumpNum, Real64 const FlowReques
// Energy Calculations, ASHRAE, 1993, pp2-10 to 2-15

// Using/Aliasing
using FluidProperties::GetDensityGlycol;
using FluidProperties::GetSpecificHeatGlycol;

using PlantUtilities::SetComponentFlowRate;
using ScheduleManager::GetCurrentScheduleValue;

Expand Down Expand Up @@ -1872,7 +1866,7 @@ void CalcPumps(EnergyPlusData &state, int const PumpNum, Real64 const FlowReques
}

// density used for volumetric flow calculations
LoopDensity = GetDensityGlycol(state, thisPumpPlant.FluidName, thisInNode.Temp, thisPumpPlant.FluidIndex, RoutineName);
LoopDensity = thisPumpPlant.glycol->getDensity(state, thisInNode.Temp, RoutineName);

//****************************!
//***** CALCULATE POWER (1) **!
Expand Down Expand Up @@ -2002,9 +1996,6 @@ void SizePump(EnergyPlusData &state, int const PumpNum)
// METHODOLOGY EMPLOYED:
// Obtains flow rates from the plant sizing array.

// Using/Aliasing
using FluidProperties::GetDensityGlycol;

// SUBROUTINE PARAMETER DEFINITIONS:
Real64 constexpr StartTemp(100.0); // Standard Temperature across code to calculated Steam density
static constexpr std::string_view RoutineName("PlantPumps::InitSimVars ");
Expand All @@ -2026,7 +2017,7 @@ void SizePump(EnergyPlusData &state, int const PumpNum)
// Calculate density at InitConvTemp once here, to remove RhoH2O calls littered throughout
if (thisPump.plantLoc.loopNum > 0) {
auto &thisPumpPlant = state.dataPlnt->PlantLoop(thisPump.plantLoc.loopNum);
TempWaterDensity = GetDensityGlycol(state, thisPumpPlant.FluidName, Constant::InitConvTemp, thisPumpPlant.FluidIndex, RoutineName);
TempWaterDensity = thisPumpPlant.glycol->getDensity(state, Constant::InitConvTemp, RoutineName);
} else {
TempWaterDensity = FluidProperties::GetWater(state)->getDensity(state, Constant::InitConvTemp, RoutineName);
}
Expand Down Expand Up @@ -2309,9 +2300,6 @@ void GetRequiredMassFlowRate(EnergyPlusData &state,
Real64 &PumpMaxMassFlowRateVFDRange)
{
// Using/Aliasing
using FluidProperties::GetDensityGlycol;
using FluidProperties::GetSpecificHeatGlycol;

using PlantPressureSystem::ResolveLoopFlowVsPressure;
using PlantUtilities::SetComponentFlowRate;
using ScheduleManager::GetCurrentScheduleValue;
Expand Down
Loading

3 comments on commit 5710c25

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

FluidAPI2 (Unknown) - x86_64-Linux-Ubuntu-24.04-gcc-13.3: OK (2917 of 2919 tests passed, 0 test warnings)

Failures:\n

AutoSizingFixture Test Summary

  • Passed: 31
  • SEGFAULT: 1

integration Test Summary

  • Passed: 800
  • Failed: 1

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

FluidAPI2 (Unknown) - x86_64-Linux-Ubuntu-24.04-gcc-13.3-UnitTestsCoverage-RelWithDebInfo: OK (2100 of 2101 tests passed, 0 test warnings)

Failures:\n

AutoSizingFixture Test Summary

  • Passed: 31
  • SEGFAULT: 1

Build Badge Test Badge Coverage Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

FluidAPI2 (Unknown) - x86_64-Linux-Ubuntu-24.04-gcc-13.3-IntegrationCoverage-RelWithDebInfo: OK (800 of 801 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 800
  • Failed: 1

Build Badge Test Badge Coverage Badge

Please sign in to comment.