Skip to content

Commit

Permalink
convert VariableSpeedCoils
Browse files Browse the repository at this point in the history
  • Loading branch information
brianlball committed Oct 6, 2020
1 parent 30e8671 commit 7c50488
Show file tree
Hide file tree
Showing 27 changed files with 2,721 additions and 2,863 deletions.
1 change: 1 addition & 0 deletions src/EnergyPlus/Data/CommonIncludes.hh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
#include <EnergyPlus/Fans.hh>
#include <EnergyPlus/Pipes.hh>
#include <EnergyPlus/PlantChillers.hh>
#include <EnergyPlus/VariableSpeedCoils.hh>
#include <EnergyPlus/VentilatedSlab.hh>
#include <EnergyPlus/WaterCoils.hh>
#include <EnergyPlus/WaterManager.hh>
Expand Down
2 changes: 2 additions & 0 deletions src/EnergyPlus/Data/EnergyPlusData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ namespace EnergyPlus {
this->dataGlobal = std::unique_ptr<DataGlobal>(new DataGlobal);
this->dataPipes = std::unique_ptr<PipesData>(new PipesData);
this->dataPlantChillers = std::unique_ptr<PlantChillersData>(new PlantChillersData);
this->dataVariableSpeedCoils = std::unique_ptr<VariableSpeedCoilsData>(new VariableSpeedCoilsData);
this->dataVentilatedSlab = std::unique_ptr<VentilatedSlabData>(new VentilatedSlabData);
this->dataWaterCoils = std::unique_ptr<WaterCoilsData>(new WaterCoilsData);
this->dataWaterManager = std::unique_ptr<WaterManagerData>(new WaterManagerData);
Expand Down Expand Up @@ -132,6 +133,7 @@ namespace EnergyPlus {
this->dataGlobal->clear_state();
this->dataPipes->clear_state();
this->dataPlantChillers->clear_state();
this->dataVariableSpeedCoils->clear_state();
this->dataVentilatedSlab->clear_state();
this->dataWaterCoils->clear_state();
this->dataWaterManager->clear_state();
Expand Down
2 changes: 2 additions & 0 deletions src/EnergyPlus/Data/EnergyPlusData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ struct ExteriorEnergyUseData;
struct FansData;
struct PipesData;
struct PlantChillersData;
struct VariableSpeedCoilsData;
struct VentilatedSlabData;
struct WaterCoilsData;
struct WaterManagerData;
Expand Down Expand Up @@ -144,6 +145,7 @@ struct EnergyPlusData : BaseGlobalStruct {
std::unique_ptr<FansData> dataFans;
std::unique_ptr<PipesData> dataPipes;
std::unique_ptr<PlantChillersData> dataPlantChillers;
std::unique_ptr<VariableSpeedCoilsData> dataVariableSpeedCoils;
std::unique_ptr<VentilatedSlabData> dataVentilatedSlab;
std::unique_ptr<WaterCoilsData> dataWaterCoils;
std::unique_ptr<WaterManagerData> dataWaterManager;
Expand Down
59 changes: 28 additions & 31 deletions src/EnergyPlus/Furnaces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ namespace Furnaces {
using namespace ScheduleManager;
using DXCoils::SimDXCoil;
using Fans::SimulateFanComponents;
using VariableSpeedCoils::MaxSpedLevels;

// Data
// MODULE PARAMETER DEFINITIONS
Expand Down Expand Up @@ -6067,7 +6066,6 @@ namespace Furnaces {
using IntegratedHeatPump::IntegratedHeatPumps;
using IntegratedHeatPump::SizeIHP;
using VariableSpeedCoils::SimVariableSpeedCoils;
using VariableSpeedCoils::VarSpeedCoil;
using WaterToAirHeatPumpSimple::SimWatertoAirHPSimple;

// Locals
Expand Down Expand Up @@ -6135,9 +6133,9 @@ namespace Furnaces {
if (Furnace(FurnaceNum).bIsIHP) {
SizeIHP(state, Furnace(FurnaceNum).CoolingCoilIndex);
IHPCoilIndex = IntegratedHeatPumps(Furnace(FurnaceNum).CoolingCoilIndex).SCCoilIndex;
Furnace(FurnaceNum).NumOfSpeedCooling = VarSpeedCoil(IHPCoilIndex).NumOfSpeeds;
MulSpeedFlowScale = VarSpeedCoil(IHPCoilIndex).RatedAirVolFlowRate /
VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(VarSpeedCoil(IHPCoilIndex).NormSpedLevel);
Furnace(FurnaceNum).NumOfSpeedCooling = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).NumOfSpeeds;
MulSpeedFlowScale = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).RatedAirVolFlowRate /
state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).NormSpedLevel);
IntegratedHeatPumps(Furnace(FurnaceNum).CoolingCoilIndex).CoolVolFlowScale = MulSpeedFlowScale;
} else {
SimVariableSpeedCoils(state,
Expand All @@ -6154,19 +6152,19 @@ namespace Furnaces {
0.0,
0.0,
0.0); // conduct the sizing operation in the VS WSHP
Furnace(FurnaceNum).NumOfSpeedCooling = VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).NumOfSpeeds;
MulSpeedFlowScale = VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).RatedAirVolFlowRate /
VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex)
.MSRatedAirVolFlowRate(VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).NormSpedLevel);
Furnace(FurnaceNum).NumOfSpeedCooling = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).NumOfSpeeds;
MulSpeedFlowScale = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).RatedAirVolFlowRate /
state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex)
.MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).NormSpedLevel);
IHPCoilIndex = Furnace(FurnaceNum).CoolingCoilIndex;
}

for (Iter = 1; Iter <= Furnace(FurnaceNum).NumOfSpeedCooling; ++Iter) {
Furnace(FurnaceNum).CoolVolumeFlowRate(Iter) = VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) * MulSpeedFlowScale;
Furnace(FurnaceNum).CoolMassFlowRate(Iter) = VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(Iter) * MulSpeedFlowScale;
Furnace(FurnaceNum).CoolVolumeFlowRate(Iter) = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) * MulSpeedFlowScale;
Furnace(FurnaceNum).CoolMassFlowRate(Iter) = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(Iter) * MulSpeedFlowScale;
Furnace(FurnaceNum).MSCoolingSpeedRatio(Iter) =
VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) /
VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Furnace(FurnaceNum).NumOfSpeedCooling);
state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) /
state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Furnace(FurnaceNum).NumOfSpeedCooling);
}

if (Furnace(FurnaceNum).HeatingCoilType_Num == Coil_HeatingWaterToAirHPVSEquationFit ||
Expand All @@ -6175,9 +6173,9 @@ namespace Furnaces {
if (Furnace(FurnaceNum).bIsIHP) {
SizeIHP(state, Furnace(FurnaceNum).CoolingCoilIndex);
IHPCoilIndex = IntegratedHeatPumps(Furnace(FurnaceNum).CoolingCoilIndex).SHCoilIndex;
Furnace(FurnaceNum).NumOfSpeedHeating = VarSpeedCoil(IHPCoilIndex).NumOfSpeeds;
MulSpeedFlowScale = VarSpeedCoil(IHPCoilIndex).RatedAirVolFlowRate /
VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(VarSpeedCoil(IHPCoilIndex).NormSpedLevel);
Furnace(FurnaceNum).NumOfSpeedHeating = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).NumOfSpeeds;
MulSpeedFlowScale = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).RatedAirVolFlowRate /
state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).NormSpedLevel);
IntegratedHeatPumps(Furnace(FurnaceNum).CoolingCoilIndex).HeatVolFlowScale = MulSpeedFlowScale;
} else {
SimVariableSpeedCoils(state,
Expand All @@ -6194,19 +6192,19 @@ namespace Furnaces {
0.0,
0.0,
0.0); // conduct the sizing operation in the VS WSHP
Furnace(FurnaceNum).NumOfSpeedHeating = VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).NumOfSpeeds;
MulSpeedFlowScale = VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).RatedAirVolFlowRate /
VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex)
.MSRatedAirVolFlowRate(VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).NormSpedLevel);
Furnace(FurnaceNum).NumOfSpeedHeating = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).NumOfSpeeds;
MulSpeedFlowScale = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).RatedAirVolFlowRate /
state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex)
.MSRatedAirVolFlowRate(state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).NormSpedLevel);
IHPCoilIndex = Furnace(FurnaceNum).HeatingCoilIndex;
}

for (Iter = 1; Iter <= Furnace(FurnaceNum).NumOfSpeedHeating; ++Iter) {
Furnace(FurnaceNum).HeatVolumeFlowRate(Iter) = VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) * MulSpeedFlowScale;
Furnace(FurnaceNum).HeatMassFlowRate(Iter) = VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(Iter) * MulSpeedFlowScale;
Furnace(FurnaceNum).HeatVolumeFlowRate(Iter) = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) * MulSpeedFlowScale;
Furnace(FurnaceNum).HeatMassFlowRate(Iter) = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(Iter) * MulSpeedFlowScale;
Furnace(FurnaceNum).MSHeatingSpeedRatio(Iter) =
VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) /
VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Furnace(FurnaceNum).NumOfSpeedHeating);
state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Iter) /
state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(Furnace(FurnaceNum).NumOfSpeedHeating);
}
}

Expand Down Expand Up @@ -10690,7 +10688,6 @@ namespace Furnaces {
using Fans::SimulateFanComponents;
using IntegratedHeatPump::SimIHP;
using VariableSpeedCoils::SimVariableSpeedCoils;
using VariableSpeedCoils::VarSpeedCoil;

// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:
Expand Down Expand Up @@ -10793,7 +10790,7 @@ namespace Furnaces {
SavePartloadRatio = PartLoadFrac;
SaveSpeedRatio = SpeedRatio;

SaveCompressorPLR = VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).PartLoadRatio;
SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).PartLoadRatio;
} else {
if (Furnace(FurnaceNum).bIsIHP) {
SimIHP(state,
Expand Down Expand Up @@ -10869,7 +10866,7 @@ namespace Furnaces {
SavePartloadRatio = PartLoadFrac;
SaveSpeedRatio = SpeedRatio;

SaveCompressorPLR = VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).PartLoadRatio;
SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).PartLoadRatio;
} else {
if (Furnace(FurnaceNum).bIsIHP) {
SimIHP(state,
Expand Down Expand Up @@ -10960,7 +10957,7 @@ namespace Furnaces {

SavePartloadRatio = PartLoadFrac;
SaveSpeedRatio = SpeedRatio;
SaveCompressorPLR = VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).PartLoadRatio;
SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).PartLoadRatio;
} else {

if (Furnace(FurnaceNum).bIsIHP) {
Expand Down Expand Up @@ -11036,7 +11033,7 @@ namespace Furnaces {

SavePartloadRatio = PartLoadFrac;
SaveSpeedRatio = SpeedRatio;
SaveCompressorPLR = VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).PartLoadRatio;
SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).PartLoadRatio;
} else {
if (Furnace(FurnaceNum).bIsIHP) {
SimIHP(state,
Expand Down Expand Up @@ -11133,7 +11130,7 @@ namespace Furnaces {
SavePartloadRatio = PartLoadFrac;
SaveSpeedRatio = SpeedRatio;

SaveCompressorPLR = VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).PartLoadRatio;
SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).CoolingCoilIndex).PartLoadRatio;
} else {
if (Furnace(FurnaceNum).bIsIHP) {
SimIHP(state,
Expand Down Expand Up @@ -11209,7 +11206,7 @@ namespace Furnaces {

SavePartloadRatio = PartLoadFrac;
SaveSpeedRatio = SpeedRatio;
SaveCompressorPLR = VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).PartLoadRatio;
SaveCompressorPLR = state.dataVariableSpeedCoils->VarSpeedCoil(Furnace(FurnaceNum).HeatingCoilIndex).PartLoadRatio;
} else {
if (Furnace(FurnaceNum).bIsIHP) {
SimIHP(state,
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/Furnaces.hh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ struct EnergyPlusData;
namespace Furnaces {

// Using/Aliasing
using VariableSpeedCoils::MaxSpedLevels;

// Data
// MODULE PARAMETER DEFINITIONS
Expand Down Expand Up @@ -131,7 +130,8 @@ namespace Furnaces {
// Types

struct FurnaceEquipConditions
{
{
int MaxSpedLevels = 10;
// Members
std::string Name; // Name of the Furnace
int FurnaceType_Num; // Numeric Equivalent for Furnace Type
Expand Down
15 changes: 6 additions & 9 deletions src/EnergyPlus/HVACDXHeatPumpSystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,6 @@ namespace HVACDXHeatPumpSystem {
using Psychrometrics::PsyHFnTdbW;
using Psychrometrics::PsyTdpFnWPb;
using VariableSpeedCoils::SimVariableSpeedCoils;
using VariableSpeedCoils::VarSpeedCoil;

// SUBROUTINE PARAMETER DEFINITIONS:
int const MaxIte(500); // Maximum number of iterations for solver
Expand Down Expand Up @@ -815,7 +814,7 @@ namespace HVACDXHeatPumpSystem {
OnOffAirFlowRatio);

VSCoilIndex = DXHeatPumpSystem(DXSystemNum).HeatPumpCoilIndex;
NumOfSpeeds = VarSpeedCoil(VSCoilIndex).NumOfSpeeds;
NumOfSpeeds = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).NumOfSpeeds;

NoOutput = Node(InletNode).MassFlowRate * (PsyHFnTdbW(Node(OutletNode).Temp, Node(OutletNode).HumRat) -
PsyHFnTdbW(Node(InletNode).Temp, Node(OutletNode).HumRat));
Expand Down Expand Up @@ -861,7 +860,7 @@ namespace HVACDXHeatPumpSystem {
// OutletTempDXCoil is the full capacity outlet temperature at PartLoadFrac = 1 from the CALL above. If this
// temp is greater than the desired outlet temp, then run the compressor at PartLoadFrac = 1, otherwise find the
// operating PLR.
OutletTempDXCoil = VarSpeedCoil(VSCoilIndex).OutletAirDBTemp;
OutletTempDXCoil = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).OutletAirDBTemp;
if (OutletTempDXCoil < DesOutTemp) {
PartLoadFrac = 1.0;
SpeedNum = NumOfSpeeds;
Expand All @@ -885,7 +884,7 @@ namespace HVACDXHeatPumpSystem {
QLatReq,
OnOffAirFlowRatio);

TempSpeedOut = VarSpeedCoil(VSCoilIndex).OutletAirDBTemp;
TempSpeedOut = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).OutletAirDBTemp;

if ((TempSpeedOut - DesOutTemp) < Acc) {
// Check to see which speed to meet the load
Expand All @@ -908,7 +907,7 @@ namespace HVACDXHeatPumpSystem {
QLatReq,
OnOffAirFlowRatio);

TempSpeedOut = VarSpeedCoil(VSCoilIndex).OutletAirDBTemp;
TempSpeedOut = state.dataVariableSpeedCoils->VarSpeedCoil(VSCoilIndex).OutletAirDBTemp;

if ((TempSpeedOut - DesOutTemp) > Acc) {
SpeedNum = I;
Expand Down Expand Up @@ -1156,7 +1155,6 @@ namespace HVACDXHeatPumpSystem {
// na
// Using/Aliasing
using VariableSpeedCoils::SimVariableSpeedCoils;
using VariableSpeedCoils::VarSpeedCoil;

// Return value
Real64 Residuum; // residual to be minimized to zero
Expand Down Expand Up @@ -1207,7 +1205,7 @@ namespace HVACDXHeatPumpSystem {
QLatReq,
OnOffAirFlowRatio);

OutletAirTemp = VarSpeedCoil(CoilIndex).OutletAirDBTemp;
OutletAirTemp = state.dataVariableSpeedCoils->VarSpeedCoil(CoilIndex).OutletAirDBTemp;
Residuum = Par(2) - OutletAirTemp;

return Residuum;
Expand Down Expand Up @@ -1235,7 +1233,6 @@ namespace HVACDXHeatPumpSystem {
// na
// Using/Aliasing
using VariableSpeedCoils::SimVariableSpeedCoils;
using VariableSpeedCoils::VarSpeedCoil;

// Return value
Real64 Residuum; // residual to be minimized to zero
Expand Down Expand Up @@ -1287,7 +1284,7 @@ namespace HVACDXHeatPumpSystem {
QLatReq,
OnOffAirFlowRatio);

OutletAirTemp = VarSpeedCoil(CoilIndex).OutletAirDBTemp;
OutletAirTemp = state.dataVariableSpeedCoils->VarSpeedCoil(CoilIndex).OutletAirDBTemp;
Residuum = Par(2) - OutletAirTemp;

return Residuum;
Expand Down
Loading

4 comments on commit 7c50488

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

global_variable_speed_coils (brianlball) - x86_64-MacOS-10.15-clang-11.0.0: Build Failed

Failures:\n

API Test Summary

  • Failed: 6
  • notrun: 3

integration Test Summary

  • Passed: 2
  • Failed: 717

regression Test Summary

  • Passed: 715
  • Failed: 2

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

global_variable_speed_coils (brianlball) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: Build Failed

Failures:\n

API Test Summary

  • Failed: 6
  • notrun: 3

integration Test Summary

  • Passed: 2
  • Failed: 720

regression Test Summary

  • Passed: 735
  • Failed: 2

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

global_variable_speed_coils (brianlball) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: Build Failed

Failures:\n

API Test Summary

  • Failed: 6
  • notrun: 3

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

global_variable_speed_coils (brianlball) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: Build Failed

Failures:\n

integration Test Summary

  • Passed: 2
  • Failed: 720

Build Badge Test Badge Coverage Badge

Please sign in to comment.