Skip to content

Commit

Permalink
Merge branch 'develop' into 7174-AddSETOutput
Browse files Browse the repository at this point in the history
  • Loading branch information
RKStrand committed Aug 30, 2019
2 parents 93f8d20 + 349e5a8 commit 8a5217b
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 42 deletions.
57 changes: 25 additions & 32 deletions src/EnergyPlus/AirflowNetworkBalanceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8209,6 +8209,7 @@ namespace AirflowNetworkBalanceManager {
Real64 AirDensity;
Real64 CpAir;
Real64 Tamb;
Real64 hfg; // latent heat of vaporization
Real64 ReportingConstant;
Real64 ReportingFraction;
int AirLoopNum;
Expand Down Expand Up @@ -8294,6 +8295,8 @@ namespace AirflowNetworkBalanceManager {
Tamb = Zone(ZN1).OutDryBulbTemp;
CpAir = PsyCpAirFnWTdb(OutHumRat, Tamb);
}
hfg = Psychrometrics::PsyHfgAirFnWTdb(ZoneAirHumRat(ZN1), (MAT(ZN1) + Tamb) / 2.0);

if (Tamb > MAT(ZN1)) {
AirflowNetworkReportData(ZN1).MultiZoneInfiSenGainW += (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (Tamb - MAT(ZN1)));
AirflowNetworkReportData(ZN1).MultiZoneInfiSenGainJ +=
Expand All @@ -8304,13 +8307,14 @@ namespace AirflowNetworkBalanceManager {
(AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN1) - Tamb)) * ReportingConstant;
}
if (OutHumRat > ZoneAirHumRat(ZN1)) {
AirflowNetworkReportData(ZN1).MultiZoneInfiLatGainW += (AirflowNetworkLinkSimu(i).FLOW2 * (OutHumRat - ZoneAirHumRat(ZN1)));
AirflowNetworkReportData(ZN1).MultiZoneInfiLatGainW += (AirflowNetworkLinkSimu(i).FLOW2 * (OutHumRat - ZoneAirHumRat(ZN1))) * hfg;
AirflowNetworkReportData(ZN1).MultiZoneInfiLatGainJ +=
(AirflowNetworkLinkSimu(i).FLOW2 * (OutHumRat - ZoneAirHumRat(ZN1))) * ReportingConstant;
(AirflowNetworkLinkSimu(i).FLOW2 * (OutHumRat - ZoneAirHumRat(ZN1))) * hfg * ReportingConstant;
} else {
AirflowNetworkReportData(ZN1).MultiZoneInfiLatLossW += (AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - OutHumRat));
AirflowNetworkReportData(ZN1).MultiZoneInfiLatLossW +=
(AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - OutHumRat)) * hfg;
AirflowNetworkReportData(ZN1).MultiZoneInfiLatLossJ +=
(AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - OutHumRat)) * ReportingConstant;
(AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - OutHumRat)) * hfg * ReportingConstant;
}
}
if (ZN1 == 0 && ZN2 > 0) {
Expand All @@ -8322,6 +8326,8 @@ namespace AirflowNetworkBalanceManager {
Tamb = Zone(ZN2).OutDryBulbTemp;
CpAir = PsyCpAirFnWTdb(OutHumRat, Tamb);
}
hfg = Psychrometrics::PsyHfgAirFnWTdb(ZoneAirHumRat(ZN2), (MAT(ZN2) + Tamb) / 2.0);

if (Tamb > MAT(ZN2)) {
AirflowNetworkReportData(ZN2).MultiZoneInfiSenGainW += (AirflowNetworkLinkSimu(i).FLOW * CpAir * (Tamb - MAT(ZN2)));
AirflowNetworkReportData(ZN2).MultiZoneInfiSenGainJ +=
Expand All @@ -8332,18 +8338,21 @@ namespace AirflowNetworkBalanceManager {
(AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN2) - Tamb)) * ReportingConstant;
}
if (OutHumRat > ZoneAirHumRat(ZN2)) {
AirflowNetworkReportData(ZN2).MultiZoneInfiLatGainW += (AirflowNetworkLinkSimu(i).FLOW * (OutHumRat - ZoneAirHumRat(ZN2)));
AirflowNetworkReportData(ZN2).MultiZoneInfiLatGainW +=
(AirflowNetworkLinkSimu(i).FLOW * (OutHumRat - ZoneAirHumRat(ZN2))) * hfg;
AirflowNetworkReportData(ZN2).MultiZoneInfiLatGainJ +=
(AirflowNetworkLinkSimu(i).FLOW * (OutHumRat - ZoneAirHumRat(ZN2))) * ReportingConstant;
(AirflowNetworkLinkSimu(i).FLOW * (OutHumRat - ZoneAirHumRat(ZN2))) * hfg * ReportingConstant;
} else {
AirflowNetworkReportData(ZN2).MultiZoneInfiLatLossW += (AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - OutHumRat));
AirflowNetworkReportData(ZN2).MultiZoneInfiLatLossW +=
(AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - OutHumRat)) * hfg;
AirflowNetworkReportData(ZN2).MultiZoneInfiLatLossJ +=
(AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - OutHumRat)) * ReportingConstant;
(AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - OutHumRat)) * hfg * ReportingConstant;
}
}

if (ZN1 > 0 && ZN2 > 0) {
CpAir = PsyCpAirFnWTdb(ZoneAirHumRat(ZN1), MAT(ZN1));
hfg = Psychrometrics::PsyHfgAirFnWTdb((ZoneAirHumRat(ZN1) + ZoneAirHumRat(ZN2)) / 2.0, (MAT(ZN1) + MAT(ZN2)) / 2.0);
if (MAT(ZN1) > MAT(ZN2)) {
AirflowNetworkReportData(ZN2).MultiZoneMixSenGainW += (AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN1) - MAT(ZN2)));
AirflowNetworkReportData(ZN2).MultiZoneMixSenGainJ +=
Expand All @@ -8355,14 +8364,14 @@ namespace AirflowNetworkBalanceManager {
}
if (ZoneAirHumRat(ZN1) > ZoneAirHumRat(ZN2)) {
AirflowNetworkReportData(ZN2).MultiZoneMixLatGainW +=
(AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN1) - ZoneAirHumRat(ZN2)));
(AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN1) - ZoneAirHumRat(ZN2))) * hfg;
AirflowNetworkReportData(ZN2).MultiZoneMixLatGainJ +=
(AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN1) - ZoneAirHumRat(ZN2))) * ReportingConstant;
(AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN1) - ZoneAirHumRat(ZN2))) * hfg * ReportingConstant;
} else {
AirflowNetworkReportData(ZN2).MultiZoneMixLatLossW +=
(AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - ZoneAirHumRat(ZN1)));
(AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - ZoneAirHumRat(ZN1))) * hfg;
AirflowNetworkReportData(ZN2).MultiZoneMixLatLossJ +=
(AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - ZoneAirHumRat(ZN1))) * ReportingConstant;
(AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - ZoneAirHumRat(ZN1))) * hfg * ReportingConstant;
}
CpAir = PsyCpAirFnWTdb(ZoneAirHumRat(ZN2), MAT(ZN2));
if (MAT(ZN2) > MAT(ZN1)) {
Expand All @@ -8376,14 +8385,14 @@ namespace AirflowNetworkBalanceManager {
}
if (ZoneAirHumRat(ZN2) > ZoneAirHumRat(ZN1)) {
AirflowNetworkReportData(ZN1).MultiZoneMixLatGainW +=
(AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN2) - ZoneAirHumRat(ZN1)));
(AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN2) - ZoneAirHumRat(ZN1))) * hfg;
AirflowNetworkReportData(ZN1).MultiZoneMixLatGainJ +=
(AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN2) - ZoneAirHumRat(ZN1))) * ReportingConstant;
(AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN2) - ZoneAirHumRat(ZN1))) * hfg * ReportingConstant;
} else {
AirflowNetworkReportData(ZN1).MultiZoneMixLatLossW +=
std::abs(AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - ZoneAirHumRat(ZN2)));
std::abs(AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - ZoneAirHumRat(ZN2))) * hfg;
AirflowNetworkReportData(ZN1).MultiZoneMixLatLossJ +=
(AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - ZoneAirHumRat(ZN2))) * ReportingConstant;
(AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - ZoneAirHumRat(ZN2))) * hfg * ReportingConstant;
}
}
}
Expand Down Expand Up @@ -8447,10 +8456,6 @@ namespace AirflowNetworkBalanceManager {
// Zone report

for (auto &e : AirflowNetworkZnRpt) {
e.MeanAirTemp = 0.0;
e.OperativeTemp = 0.0;
e.InfilHeatGain = 0.0;
e.InfilHeatLoss = 0.0;
e.InfilVolume = 0.0;
e.InfilMass = 0.0;
e.InfilAirChangeRate = 0.0;
Expand Down Expand Up @@ -8642,23 +8647,11 @@ namespace AirflowNetworkBalanceManager {

if (!(SimulateAirflowNetwork == AirflowNetworkControlMultizone || SimulateAirflowNetwork == AirflowNetworkControlMultiADS)) return;

for (i = 1; i <= NumOfZones; ++i) {
AirflowNetworkZnRpt(i).MeanAirTemp = MAT(i);
AirflowNetworkZnRpt(i).OperativeTemp = 0.5 * (MAT(i) + MRT(i));
}

for (i = 1; i <= NumOfZones; ++i) { // Start of zone loads report variable update loop ...
Tamb = Zone(i).OutDryBulbTemp;
CpAir = PsyCpAirFnWTdb(ZoneAirHumRatAvg(i), MAT(i));
AirDensity = PsyRhoAirFnPbTdbW(OutBaroPress, MAT(i), ZoneAirHumRatAvg(i));

if (MAT(i) > Tamb) {
AirflowNetworkZnRpt(i).InfilHeatLoss = AirflowNetworkExchangeData(i).SumMCp * (MAT(i) - Tamb) * ReportingConstant;
AirflowNetworkZnRpt(i).InfilHeatGain = 0.0;
} else if (MAT(i) <= Tamb) {
AirflowNetworkZnRpt(i).InfilHeatGain = AirflowNetworkExchangeData(i).SumMCp * (Tamb - MAT(i)) * ReportingConstant;
AirflowNetworkZnRpt(i).InfilHeatLoss = 0.0;
}
AirflowNetworkZnRpt(i).InfilVolume = (AirflowNetworkExchangeData(i).SumMCp / CpAir / AirDensity) * ReportingConstant;
AirflowNetworkZnRpt(i).InfilAirChangeRate = AirflowNetworkZnRpt(i).InfilVolume / (TimeStepSys * Zone(i).Volume);
AirflowNetworkZnRpt(i).InfilMass = (AirflowNetworkExchangeData(i).SumMCp / CpAir) * ReportingConstant;
Expand Down
6 changes: 1 addition & 5 deletions src/EnergyPlus/AirflowNetworkBalanceManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ namespace AirflowNetworkBalanceManager {
struct AirflowNetworkReportVars
{
// Members
Real64 MeanAirTemp; // Mean Air Temperature {C}
Real64 OperativeTemp; // Average of Mean Air Temperature {C} and Mean Radiant Temperature {C}
Real64 InfilHeatGain; // Heat Gain {W} due to infiltration
Real64 InfilHeatLoss; // Heat Loss {W} due to infiltration
Real64 InfilVolume; // Volume of Air {m3} due to infiltration
Real64 InfilMass; // Mass of Air {kg} due to infiltration
Real64 InfilAirChangeRate; // Infiltration air change rate {ach}
Expand All @@ -154,7 +150,7 @@ namespace AirflowNetworkBalanceManager {

// Default Constructor
AirflowNetworkReportVars()
: MeanAirTemp(0.0), OperativeTemp(0.0), InfilHeatGain(0.0), InfilHeatLoss(0.0), InfilVolume(0.0), InfilMass(0.0), InfilAirChangeRate(0.0),
: InfilVolume(0.0), InfilMass(0.0), InfilAirChangeRate(0.0),
VentilHeatLoss(0.0), VentilHeatGain(0.0), VentilVolume(0.0), VentilMass(0.0), VentilFanElec(0.0), VentilAirTemp(0.0), MixVolume(0.0),
MixMass(0.0), ExfilSensiLoss(0.0), ExfilLatentLoss(0.0), ExfilTotalLoss(0.0), ExfilMass(0.0), InletMass(0.0), OutletMass(0.0)
{
Expand Down
38 changes: 33 additions & 5 deletions tst/EnergyPlus/unit/AirflowNetworkBalanceManager.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
#include <gtest/gtest.h>

// EnergyPlus Headers
#include <AirflowNetworkBalanceManager.hh>
#include <AirflowNetwork/Solver.hpp>
#include <AirflowNetwork/Elements.hpp>
#include <AirflowNetwork/Solver.hpp>
#include <AirflowNetworkBalanceManager.hh>
#include <DataSurfaces.hh>
#include <EnergyPlus/BranchNodeConnections.hh>
#include <EnergyPlus/CurveManager.hh>
Expand Down Expand Up @@ -2333,8 +2333,6 @@ TEST_F(EnergyPlusFixture, TestAFNPressureStat)
EXPECT_NEAR(0.0, AirflowNetwork::AirflowNetworkLinkReport(20).FLOW, 0.0001);
EXPECT_NEAR(0.0, AirflowNetwork::AirflowNetworkLinkReport(50).FLOW, 0.0001);

AirflowNetwork::AirflowNetworkExchangeData.deallocate();

// Start a test for #6005
AirflowNetwork::ANZT = 26.0;
AirflowNetwork::MultizoneSurfaceData(2).HybridVentClose = true;
Expand All @@ -2348,7 +2346,37 @@ TEST_F(EnergyPlusFixture, TestAFNPressureStat)
EXPECT_EQ(0.0, SurfaceWindow(5).VentingOpenFactorMultRep);
EXPECT_EQ(0.0, SurfaceWindow(14).VentingOpenFactorMultRep);

Node.deallocate();
// Test for #7162
DataHeatBalFanSys::ZoneAirHumRat.allocate(4);
DataHeatBalFanSys::MAT.allocate(4);
DataHeatBalFanSys::ZoneAirHumRatAvg.allocate(NumOfZones);

DataHeatBalFanSys::MAT(1) = 23.0;
DataHeatBalFanSys::MAT(2) = 23.0;
DataHeatBalFanSys::MAT(3) = 23.0;
DataHeatBalFanSys::MAT(4) = 5.0;
DataHeatBalFanSys::ZoneAirHumRat(1) = 0.0007;
DataHeatBalFanSys::ZoneAirHumRat(2) = 0.0011;
DataHeatBalFanSys::ZoneAirHumRat(3) = 0.0012;
DataHeatBalFanSys::ZoneAirHumRat(4) = 0.0008;
DataHeatBalFanSys::ZoneAirHumRatAvg = DataHeatBalFanSys::ZoneAirHumRat;
DataZoneEquipment::ZoneEquipConfig.allocate(4);
DataZoneEquipment::ZoneEquipConfig(1).IsControlled = false;
DataZoneEquipment::ZoneEquipConfig(2).IsControlled = false;
DataZoneEquipment::ZoneEquipConfig(3).IsControlled = false;
DataZoneEquipment::ZoneEquipConfig(4).IsControlled = false;
DataHVACGlobals::TimeStepSys = 0.1;

AirflowNetwork::AirflowNetworkLinkSimu(1).FLOW2 = 0.1;
AirflowNetwork::AirflowNetworkLinkSimu(10).FLOW2 = 0.15;
AirflowNetwork::AirflowNetworkLinkSimu(13).FLOW2 = 0.1;

ReportAirflowNetwork();

EXPECT_NEAR(34.3673036, AirflowNetwork::AirflowNetworkReportData(1).MultiZoneInfiLatGainW, 0.0001);
EXPECT_NEAR(36.7133377, AirflowNetwork::AirflowNetworkReportData(2).MultiZoneMixLatGainW, 0.0001);
EXPECT_NEAR(89.3450925, AirflowNetwork::AirflowNetworkReportData(3).MultiZoneInfiLatLossW, 0.0001);

}
TEST_F(EnergyPlusFixture, TestZoneVentingSchWithAdaptiveCtrl)
{
Expand Down

7 comments on commit 8a5217b

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

7174-AddSETOutput (RKStrand) - x86_64-MacOS-10.13-clang: OK (2550 of 2550 tests passed, 3 test warnings)

Messages:\n

  • 3 tests had: AUD diffs.
  • 3 tests had: RDD diffs.
  • 1 test had: MTD diffs.

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.

7174-AddSETOutput (RKStrand) - x86_64-Linux-Ubuntu-18.04-cppcheck: OK (0 of 0 tests passed, 0 test warnings)

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

7174-AddSETOutput (RKStrand) - x86_64-Linux-Ubuntu-18.04-custom_check: OK (9 of 9 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.

7174-AddSETOutput (RKStrand) - x86_64-Linux-Ubuntu-18.04-gcc-7.4: OK (2590 of 2590 tests passed, 3 test warnings)

Messages:\n

  • 3 tests had: AUD diffs.
  • 3 tests had: RDD diffs.
  • 1 test had: MTD diffs.

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.

7174-AddSETOutput (RKStrand) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-UnitTestsCoverage-Debug: OK (1214 of 1214 tests passed, 0 test warnings)

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.

7174-AddSETOutput (RKStrand) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-IntegrationCoverage-Debug: OK (672 of 672 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.

7174-AddSETOutput (RKStrand) - Win64-Windows-10-VisualStudio-16: OK (2550 of 2550 tests passed, 3 test warnings)

Messages:\n

  • 3 tests had: AUD diffs.
  • 3 tests had: RDD diffs.
  • 1 test had: MTD diffs.

Build Badge Test Badge

Please sign in to comment.