Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into Fix8228_MacFixups
Browse files Browse the repository at this point in the history
  • Loading branch information
Myoldmopar committed Aug 27, 2020
2 parents a90fa99 + 77bde52 commit 406cf3c
Show file tree
Hide file tree
Showing 5 changed files with 507 additions and 148 deletions.
16 changes: 12 additions & 4 deletions src/EnergyPlus/WaterThermalTanks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3345,19 +3345,27 @@ namespace WaterThermalTanks {
}

Tank.Nodes = DataIPShortCuts::rNumericArgs(32);
int specifiedNodes = 0;
Tank.AdditionalCond = DataIPShortCuts::rNumericArgs(33);

Tank.AdditionalLossCoeff.allocate(Tank.Nodes);
Tank.AdditionalLossCoeff = 0.0;
for (int NodeNum = 1; NodeNum <= Tank.Nodes; ++NodeNum) {
if (NumNums > 32 + NodeNum) {
Tank.AdditionalLossCoeff(NodeNum) = DataIPShortCuts::rNumericArgs(33 + NodeNum);
for (int NodeNum = 1; NodeNum <= 12; ++NodeNum) {
int index = 33 + NodeNum;
if (NumNums >= index) {
if (NodeNum <= Tank.Nodes) {
++specifiedNodes;
Tank.AdditionalLossCoeff(NodeNum) = DataIPShortCuts::rNumericArgs(index);
} else if (!DataIPShortCuts::lNumericFieldBlanks(index) && (DataIPShortCuts::rNumericArgs(index) != 0)) {
// If either blank, or zero (default), then do not warn
++specifiedNodes;
}
} else {
break;
}
}

if (NumNums > 33 + Tank.Nodes) {
if (specifiedNodes > Tank.Nodes) {
ShowWarningError(DataIPShortCuts::cCurrentModuleObject + " = " + DataIPShortCuts::cAlphaArgs(1) +
": More Additional Loss Coefficients were entered than the number of nodes; extra coefficients will not be used");
}
Expand Down
136 changes: 69 additions & 67 deletions src/EnergyPlus/ZoneTempPredictorCorrector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3563,7 +3563,7 @@ namespace ZoneTempPredictorCorrector {
// Calculate the various heat balance sums

// NOTE: SumSysMCp and SumSysMCpT are not used in the predict step
CalcZoneSums(state.dataZonePlenum, ZoneNum, SumIntGain, SumHA, SumHATsurf, SumHATref, SumMCp, SumMCpT, SumSysMCp, SumSysMCpT);
CalcZoneSums(state.dataZonePlenum, ZoneNum, SumIntGain, SumHA, SumHATsurf, SumHATref, SumMCp, SumMCpT, SumSysMCp, SumSysMCpT, false);

// Sum all convective internal gains except for people: SumIntGainExceptPeople
if (HybridModel::FlagHybridModel_PC) {
Expand Down Expand Up @@ -6076,7 +6076,8 @@ namespace ZoneTempPredictorCorrector {
Real64 &SumMCp, // Zone sum of MassFlowRate*Cp
Real64 &SumMCpT, // Zone sum of MassFlowRate*Cp*T
Real64 &SumSysMCp, // Zone sum of air system MassFlowRate*Cp
Real64 &SumSysMCpT // Zone sum of air system MassFlowRate*Cp*T
Real64 &SumSysMCpT, // Zone sum of air system MassFlowRate*Cp*T
bool const CorrectorFlag
)
{

Expand Down Expand Up @@ -6172,84 +6173,85 @@ namespace ZoneTempPredictorCorrector {
// Sum all system air flow: SumSysMCp, SumSysMCpT
// Check to see if this is a controlled zone
ControlledZoneAirFlag = Zone(ZoneNum).IsControlled;
if (CorrectorFlag) {
// Check to see if this is a plenum zone
ZoneRetPlenumAirFlag = Zone(ZoneNum).IsReturnPlenum;
ZoneSupPlenumAirFlag = Zone(ZoneNum).IsSupplyPlenum;

// Plenum and controlled zones have a different set of inlet nodes which must be calculated.
if (ControlledZoneAirFlag) {
ZoneEquipConfigNum = Zone(ZoneNum).ZoneEqNum;
auto const &zec(ZoneEquipConfig(ZoneEquipConfigNum));
for (int NodeNum = 1, NodeNum_end = zec.NumInletNodes; NodeNum <= NodeNum_end; ++NodeNum) {
// Get node conditions
// this next block is of interest to irratic system loads... maybe nodes are not accurate at time of call?
// how can we tell? predict step must be lagged ? correct step, systems have run.
auto const &node(Node(zec.InletNode(NodeNum)));
NodeTemp = node.Temp;
MassFlowRate = node.MassFlowRate;
CpAir = PsyCpAirFnW(ZoneAirHumRat(ZoneNum));

// Check to see if this is a plenum zone
ZoneRetPlenumAirFlag = Zone(ZoneNum).IsReturnPlenum;
ZoneSupPlenumAirFlag = Zone(ZoneNum).IsSupplyPlenum;

// Plenum and controlled zones have a different set of inlet nodes which must be calculated.
if (ControlledZoneAirFlag) {
ZoneEquipConfigNum = Zone(ZoneNum).ZoneEqNum;
auto const &zec(ZoneEquipConfig(ZoneEquipConfigNum));
for (int NodeNum = 1, NodeNum_end = zec.NumInletNodes; NodeNum <= NodeNum_end; ++NodeNum) {
// Get node conditions
// this next block is of interest to irratic system loads... maybe nodes are not accurate at time of call?
// how can we tell? predict step must be lagged ? correct step, systems have run.
auto const &node(Node(zec.InletNode(NodeNum)));
NodeTemp = node.Temp;
MassFlowRate = node.MassFlowRate;
CpAir = PsyCpAirFnW(ZoneAirHumRat(ZoneNum));

Real64 const MassFlowRate_CpAir(MassFlowRate * CpAir);
SumSysMCp += MassFlowRate_CpAir;
SumSysMCpT += MassFlowRate_CpAir * NodeTemp;
} // NodeNum

} else if (ZoneRetPlenumAirFlag) {
ZoneRetPlenumNum = Zone(ZoneNum).PlenumCondNum;
auto const &zrpc(dataZonePlenum.ZoneRetPlenCond(ZoneRetPlenumNum));
Real64 const air_hum_rat(ZoneAirHumRat(ZoneNum));
for (int NodeNum = 1, NodeNum_end = zrpc.NumInletNodes; NodeNum <= NodeNum_end; ++NodeNum) {
// Get node conditions
auto const &node(Node(zrpc.InletNode(NodeNum)));
NodeTemp = node.Temp;
MassFlowRate = node.MassFlowRate;
CpAir = PsyCpAirFnW(air_hum_rat);

Real64 const MassFlowRate_CpAir(MassFlowRate * CpAir);
SumSysMCp += MassFlowRate_CpAir;
SumSysMCpT += MassFlowRate_CpAir * NodeTemp;
} // NodeNum
// add in the leaks
for (int ADUListIndex = 1, ADUListIndex_end = dataZonePlenum.ZoneRetPlenCond(ZoneRetPlenumNum).NumADUs; ADUListIndex <= ADUListIndex_end;
++ADUListIndex) {
ADUNum = dataZonePlenum.ZoneRetPlenCond(ZoneRetPlenumNum).ADUIndex(ADUListIndex);
if (AirDistUnit(ADUNum).UpStreamLeak) {
ADUInNode = AirDistUnit(ADUNum).InletNodeNum;
NodeTemp = Node(ADUInNode).Temp;
MassFlowRate = AirDistUnit(ADUNum).MassFlowRateUpStrLk;
CpAir = PsyCpAirFnW(air_hum_rat);
Real64 const MassFlowRate_CpAir(MassFlowRate * CpAir);
SumSysMCp += MassFlowRate_CpAir;
SumSysMCpT += MassFlowRate_CpAir * NodeTemp;
}
if (AirDistUnit(ADUNum).DownStreamLeak) {
ADUOutNode = AirDistUnit(ADUNum).OutletNodeNum;
NodeTemp = Node(ADUOutNode).Temp;
MassFlowRate = AirDistUnit(ADUNum).MassFlowRateDnStrLk;
} // NodeNum

} else if (ZoneRetPlenumAirFlag) {
ZoneRetPlenumNum = Zone(ZoneNum).PlenumCondNum;
auto const &zrpc(dataZonePlenum.ZoneRetPlenCond(ZoneRetPlenumNum));
Real64 const air_hum_rat(ZoneAirHumRat(ZoneNum));
for (int NodeNum = 1, NodeNum_end = zrpc.NumInletNodes; NodeNum <= NodeNum_end; ++NodeNum) {
// Get node conditions
auto const &node(Node(zrpc.InletNode(NodeNum)));
NodeTemp = node.Temp;
MassFlowRate = node.MassFlowRate;
CpAir = PsyCpAirFnW(air_hum_rat);

Real64 const MassFlowRate_CpAir(MassFlowRate * CpAir);
SumSysMCp += MassFlowRate_CpAir;
SumSysMCpT += MassFlowRate_CpAir * NodeTemp;
} // NodeNum
// add in the leaks
for (int ADUListIndex = 1, ADUListIndex_end = dataZonePlenum.ZoneRetPlenCond(ZoneRetPlenumNum).NumADUs;
ADUListIndex <= ADUListIndex_end;
++ADUListIndex) {
ADUNum = dataZonePlenum.ZoneRetPlenCond(ZoneRetPlenumNum).ADUIndex(ADUListIndex);
if (AirDistUnit(ADUNum).UpStreamLeak) {
ADUInNode = AirDistUnit(ADUNum).InletNodeNum;
NodeTemp = Node(ADUInNode).Temp;
MassFlowRate = AirDistUnit(ADUNum).MassFlowRateUpStrLk;
CpAir = PsyCpAirFnW(air_hum_rat);
Real64 const MassFlowRate_CpAir(MassFlowRate * CpAir);
SumSysMCp += MassFlowRate_CpAir;
SumSysMCpT += MassFlowRate_CpAir * NodeTemp;
}
if (AirDistUnit(ADUNum).DownStreamLeak) {
ADUOutNode = AirDistUnit(ADUNum).OutletNodeNum;
NodeTemp = Node(ADUOutNode).Temp;
MassFlowRate = AirDistUnit(ADUNum).MassFlowRateDnStrLk;
CpAir = PsyCpAirFnW(air_hum_rat);
Real64 const MassFlowRate_CpAir(MassFlowRate * CpAir);
SumSysMCp += MassFlowRate_CpAir;
SumSysMCpT += MassFlowRate_CpAir * NodeTemp;
}
}
}

} else if (ZoneSupPlenumAirFlag) {
ZoneSupPlenumNum = Zone(ZoneNum).PlenumCondNum;
// Get node conditions
NodeTemp = Node(dataZonePlenum.ZoneSupPlenCond(ZoneSupPlenumNum).InletNode).Temp;
MassFlowRate = Node(dataZonePlenum.ZoneSupPlenCond(ZoneSupPlenumNum).InletNode).MassFlowRate;
CpAir = PsyCpAirFnW(ZoneAirHumRat(ZoneNum));

SumSysMCp += MassFlowRate * CpAir;
SumSysMCpT += MassFlowRate * CpAir * NodeTemp;
}
} else if (ZoneSupPlenumAirFlag) {
ZoneSupPlenumNum = Zone(ZoneNum).PlenumCondNum;
// Get node conditions
NodeTemp = Node(dataZonePlenum.ZoneSupPlenCond(ZoneSupPlenumNum).InletNode).Temp;
MassFlowRate = Node(dataZonePlenum.ZoneSupPlenCond(ZoneSupPlenumNum).InletNode).MassFlowRate;
CpAir = PsyCpAirFnW(ZoneAirHumRat(ZoneNum));

ZoneMult = Zone(ZoneNum).Multiplier * Zone(ZoneNum).ListMultiplier;
SumSysMCp += MassFlowRate * CpAir;
SumSysMCpT += MassFlowRate * CpAir * NodeTemp;
}

SumSysMCp /= ZoneMult;
SumSysMCpT /= ZoneMult;
ZoneMult = Zone(ZoneNum).Multiplier * Zone(ZoneNum).ListMultiplier;

SumSysMCp /= ZoneMult;
SumSysMCpT /= ZoneMult;
}
// Sum all surface convection: SumHA, SumHATsurf, SumHATref (and additional contributions to SumIntGain)
for (SurfNum = Zone(ZoneNum).SurfaceFirst; SurfNum <= Zone(ZoneNum).SurfaceLast; ++SurfNum) {

Expand Down
3 changes: 2 additions & 1 deletion src/EnergyPlus/ZoneTempPredictorCorrector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ namespace ZoneTempPredictorCorrector {
Real64 &SumMCp, // Zone sum of MassFlowRate*Cp
Real64 &SumMCpT, // Zone sum of MassFlowRate*Cp*T
Real64 &SumSysMCp, // Zone sum of air system MassFlowRate*Cp
Real64 &SumSysMCpT // Zone sum of air system MassFlowRate*Cp*T
Real64 &SumSysMCpT, // Zone sum of air system MassFlowRate*Cp*T
bool const CorrectorFlag = true // Corrector call flag
);

void CalcZoneComponentLoadSums(ZonePlenumData &dataZonePlenum, int const ZoneNum, // Zone number
Expand Down
Loading

7 comments on commit 406cf3c

@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.

Fix8228_MacFixups (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-cppcheck: OK (0 of 0 tests passed, 0 test warnings)

Build 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.

Fix8228_MacFixups (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-custom_check: OK (13 of 13 tests passed, 0 test warnings)

Build Badge

@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.

Fix8228_MacFixups (Myoldmopar) - x86_64-MacOS-10.15-clang-11.0.0: OK (2924 of 2924 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

Fix8228_MacFixups (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (2964 of 2964 tests passed, 0 test warnings)

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.

Fix8228_MacFixups (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1490 of 1490 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

Fix8228_MacFixups (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2183 of 2183 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

Fix8228_MacFixups (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (721 of 721 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please # to comment.