Skip to content

Commit

Permalink
fix EMS and minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
yzhou601 committed Jul 21, 2021
1 parent 6e00bb5 commit 4808014
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 26 deletions.
5 changes: 3 additions & 2 deletions src/EnergyPlus/DataHeatBalance.hh
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,7 @@ namespace DataHeatBalance {
Real64 InfilVolumeStdDensity; // Volume of Air {m3} due to infiltration at standard density (adjusted for elevation)
Real64 InfilVdotCurDensity; // Volume flow rate of Air {m3/s} due to infiltration at current zone air density
Real64 InfilVdotStdDensity; // Volume flow rate of Air {m3/s} due to infiltration standard density (adjusted elevation)
Real64 InfilMdot; // Mass flow rate {kg/s} due to infiltration for reporting
Real64 InfilMass; // Mass of Air {kg} due to infiltration
Real64 InfilAirChangeRate; // Infiltration air change rate {ach}

Expand All @@ -926,8 +927,8 @@ namespace DataHeatBalance {
AIM2StackCoefficient(0.0), AIM2WindCoefficient(0.0), PressureExponent(0.0), ShelterFactor(0.0), EMSOverrideOn(false),
EMSAirFlowRateValue(0.0), QuadratureSum(false), OABalancePtr(0), VolumeFlowRate(0.0), MassFlowRate(0.0), MCpI_temp(0.0),
InfilHeatGain(0.0), InfilHeatLoss(0.0), InfilLatentGain(0.0), InfilLatentLoss(0.0), InfilTotalGain(0.0), InfilTotalLoss(0.0),
InfilVolumeCurDensity(0.0), InfilVolumeStdDensity(0.0), InfilVdotCurDensity(0.0), InfilVdotStdDensity(0.0), InfilMass(0.0),
InfilAirChangeRate(0.0)
InfilVolumeCurDensity(0.0), InfilVolumeStdDensity(0.0), InfilVdotCurDensity(0.0), InfilVdotStdDensity(0.0), InfilMdot(0.0),
InfilMass(0.0), InfilAirChangeRate(0.0)
{
}
};
Expand Down
26 changes: 10 additions & 16 deletions src/EnergyPlus/HVACManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2481,36 +2481,30 @@ void ReportAirHeatBalance(EnergyPlusData &state)
}

// first calculate mass flows using outside air heat capacity for consistency with input to heat balance
ZnAirRpt(ZoneLoop).InfilMass =
(state.dataHeatBalFanSys->MCPI(ZoneLoop) / CpAir) * TimeStepSys * DataGlobalConstants::SecInHour * ADSCorrectionFactor;
ZnAirRpt(ZoneLoop).InfilMdot = (state.dataHeatBalFanSys->MCPI(ZoneLoop) / CpAir) * ADSCorrectionFactor;
ZnAirRpt(ZoneLoop).VentilMass =
(state.dataHeatBalFanSys->MCPV(ZoneLoop) / CpAir) * TimeStepSys * DataGlobalConstants::SecInHour * ADSCorrectionFactor;
ZnAirRpt(ZoneLoop).InfilMass = ZnAirRpt(ZoneLoop).InfilMdot * TimeStepSys * DataGlobalConstants::SecInHour;
ZnAirRpt(ZoneLoop).VentilMdot = (state.dataHeatBalFanSys->MCPV(ZoneLoop) / CpAir) * ADSCorrectionFactor;
ZnAirRpt(ZoneLoop).VentilMass = ZnAirRpt(ZoneLoop).VentilMdot * TimeStepSys * DataGlobalConstants::SecInHour;

// CR7751 second, calculate using indoor conditions for density property
AirDensity = PsyRhoAirFnPbTdbW(state,
state.dataEnvrn->OutBaroPress,
state.dataHeatBalFanSys->MAT(ZoneLoop),
state.dataHeatBalFanSys->ZoneAirHumRatAvg(ZoneLoop),
RoutineName3);
ZnAirRpt(ZoneLoop).InfilVolumeCurDensity =
(state.dataHeatBalFanSys->MCPI(ZoneLoop) / CpAir / AirDensity) * TimeStepSys * DataGlobalConstants::SecInHour * ADSCorrectionFactor;
ZnAirRpt(ZoneLoop).InfilVdotCurDensity = ZnAirRpt(ZoneLoop).InfilMdot / AirDensity;
ZnAirRpt(ZoneLoop).InfilVolumeCurDensity = ZnAirRpt(ZoneLoop).InfilVdotCurDensity * TimeStepSys * DataGlobalConstants::SecInHour;
ZnAirRpt(ZoneLoop).InfilAirChangeRate = ZnAirRpt(ZoneLoop).InfilVolumeCurDensity / (TimeStepSys * Zone(ZoneLoop).Volume);
ZnAirRpt(ZoneLoop).InfilVdotCurDensity = (state.dataHeatBalFanSys->MCPI(ZoneLoop) / CpAir / AirDensity) * ADSCorrectionFactor;
ZnAirRpt(ZoneLoop).VentilVolumeCurDensity =
(state.dataHeatBalFanSys->MCPV(ZoneLoop) / CpAir / AirDensity) * TimeStepSys * DataGlobalConstants::SecInHour * ADSCorrectionFactor;
ZnAirRpt(ZoneLoop).VentilVdotCurDensity = ZnAirRpt(ZoneLoop).VentilMdot / AirDensity;
ZnAirRpt(ZoneLoop).VentilVolumeCurDensity = ZnAirRpt(ZoneLoop).VentilVdotCurDensity * TimeStepSys * DataGlobalConstants::SecInHour;
ZnAirRpt(ZoneLoop).VentilAirChangeRate = ZnAirRpt(ZoneLoop).VentilVolumeCurDensity / (TimeStepSys * Zone(ZoneLoop).Volume);
ZnAirRpt(ZoneLoop).VentilVdotCurDensity = (state.dataHeatBalFanSys->MCPV(ZoneLoop) / CpAir / AirDensity) * ADSCorrectionFactor;

// CR7751 third, calculate using standard dry air at nominal elevation
AirDensity = state.dataEnvrn->StdRhoAir;
ZnAirRpt(ZoneLoop).InfilVolumeStdDensity =
(state.dataHeatBalFanSys->MCPI(ZoneLoop) / CpAir / AirDensity) * TimeStepSys * DataGlobalConstants::SecInHour * ADSCorrectionFactor;
ZnAirRpt(ZoneLoop).InfilVdotStdDensity = (state.dataHeatBalFanSys->MCPI(ZoneLoop) / CpAir / AirDensity) * ADSCorrectionFactor;
ZnAirRpt(ZoneLoop).VentilVolumeStdDensity =
(state.dataHeatBalFanSys->MCPV(ZoneLoop) / CpAir / AirDensity) * TimeStepSys * DataGlobalConstants::SecInHour * ADSCorrectionFactor;
ZnAirRpt(ZoneLoop).VentilVdotStdDensity = (state.dataHeatBalFanSys->MCPV(ZoneLoop) / CpAir / AirDensity) * ADSCorrectionFactor;
ZnAirRpt(ZoneLoop).InfilVdotStdDensity = ZnAirRpt(ZoneLoop).InfilMdot / AirDensity;
ZnAirRpt(ZoneLoop).InfilVolumeStdDensity = ZnAirRpt(ZoneLoop).InfilVdotStdDensity * TimeStepSys * DataGlobalConstants::SecInHour;
ZnAirRpt(ZoneLoop).VentilVdotStdDensity = ZnAirRpt(ZoneLoop).VentilMdot / AirDensity;
ZnAirRpt(ZoneLoop).VentilVolumeStdDensity = ZnAirRpt(ZoneLoop).VentilVdotStdDensity * TimeStepSys * DataGlobalConstants::SecInHour;

// ZnAirRpt(ZoneLoop)%VentilFanElec = 0.0
ZnAirRpt(ZoneLoop).VentilAirTemp = 0.0;
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/HeatBalanceAirManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err
SetupOutputVariable(state,
"Infiltration Mass Flow Rate",
OutputProcessor::Unit::kg_s,
state.dataHeatBal->Infiltration(Loop).MassFlowRate,
state.dataHeatBal->Infiltration(Loop).InfilMdot,
"Zone",
"Average",
state.dataHeatBal->Infiltration(Loop).Name);
Expand Down
7 changes: 4 additions & 3 deletions src/EnergyPlus/ZoneEquipmentManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6416,17 +6416,18 @@ void ReportInfiltrations(EnergyPlusData &state)
Infiltration(j).InfilTotalGain = 0.0;
Infiltration(j).InfilTotalLoss = -TotalLoad;
}
Infiltration(j).InfilMass = Infiltration(j).MassFlowRate * TimeStepZoneSec;
Infiltration(j).InfilMdot = Infiltration(j).MCpI_temp / CpAir;
Infiltration(j).InfilMass = Infiltration(j).InfilMdot * TimeStepZoneSec;
// CR7751 second, calculate using indoor conditions for density property
AirDensity = PsyRhoAirFnPbTdbW(
state, state.dataEnvrn->OutBaroPress, state.dataHeatBalFanSys->MAT(NZ), state.dataHeatBalFanSys->ZoneAirHumRatAvg(NZ), RoutineName);
Infiltration(j).InfilVdotCurDensity = Infiltration(j).MassFlowRate / AirDensity;
Infiltration(j).InfilVdotCurDensity = Infiltration(j).InfilMdot / AirDensity;
Infiltration(j).InfilVolumeCurDensity = Infiltration(j).InfilVdotCurDensity * TimeStepZoneSec;
Infiltration(j).InfilAirChangeRate = Infiltration(j).InfilVolumeCurDensity / (TimeStepZone * Zone(NZ).Volume);

// CR7751 third, calculate using standard dry air at nominal elevation
AirDensity = state.dataEnvrn->StdRhoAir;
Infiltration(j).InfilVdotStdDensity = Infiltration(j).MassFlowRate / AirDensity;
Infiltration(j).InfilVdotStdDensity = Infiltration(j).InfilMdot / AirDensity;
Infiltration(j).InfilVolumeStdDensity = Infiltration(j).InfilVdotStdDensity * TimeStepZoneSec;
}
}
Expand Down
8 changes: 4 additions & 4 deletions tst/EnergyPlus/unit/ZoneEquipmentManager.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2322,10 +2322,10 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_InfiltrationReport)
EXPECT_NEAR(ZnAirRpt(3).InfilMass, state->dataHeatBal->Infiltration(3).InfilMass, 0.000001); // zone level reporting matches object level
EXPECT_NEAR(ZnAirRpt(4).InfilMass, state->dataHeatBal->Infiltration(4).InfilMass, 0.000001); // zone level reporting matches object level

EXPECT_NEAR(ZnAirRpt(1).InfilMdot, state->dataHeatBal->Infiltration(1).MassFlowRate, 0.000001); // zone level reporting matches object level
EXPECT_NEAR(ZnAirRpt(2).InfilMdot, state->dataHeatBal->Infiltration(2).MassFlowRate, 0.000001); // zone level reporting matches object level
EXPECT_NEAR(ZnAirRpt(3).InfilMdot, state->dataHeatBal->Infiltration(3).MassFlowRate, 0.000001); // zone level reporting matches object level
EXPECT_NEAR(ZnAirRpt(4).InfilMdot, state->dataHeatBal->Infiltration(4).MassFlowRate, 0.000001); // zone level reporting matches object level
EXPECT_NEAR(ZnAirRpt(1).InfilMdot, state->dataHeatBal->Infiltration(1).InfilMdot, 0.000001); // zone level reporting matches object level
EXPECT_NEAR(ZnAirRpt(2).InfilMdot, state->dataHeatBal->Infiltration(2).InfilMdot, 0.000001); // zone level reporting matches object level
EXPECT_NEAR(ZnAirRpt(3).InfilMdot, state->dataHeatBal->Infiltration(3).InfilMdot, 0.000001); // zone level reporting matches object level
EXPECT_NEAR(ZnAirRpt(4).InfilMdot, state->dataHeatBal->Infiltration(4).InfilMdot, 0.000001); // zone level reporting matches object level

EXPECT_NEAR(ZnAirRpt(1).InfilVolumeCurDensity,
state->dataHeatBal->Infiltration(1).InfilVolumeCurDensity,
Expand Down

5 comments on commit 4808014

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

infiltration-reporting (yzhou601) - x86_64-MacOS-10.15-clang-11.0.0: OK (3106 of 3106 tests passed, 380 test warnings)

Messages:\n

  • 380 tests had: AUD diffs.
  • 372 tests had: RDD diffs.

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

infiltration-reporting (yzhou601) - Win64-Windows-10-VisualStudio-16: OK (2356 of 2356 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.

infiltration-reporting (yzhou601) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3147 of 3147 tests passed, 381 test warnings)

Messages:\n

  • 381 tests had: AUD diffs.
  • 373 tests had: RDD diffs.

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.

infiltration-reporting (yzhou601) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1661 of 1661 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.

infiltration-reporting (yzhou601) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (726 of 726 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.