Skip to content

Commit

Permalink
Move mass balance check.
Browse files Browse the repository at this point in the history
  • Loading branch information
nealkruis committed May 26, 2016
1 parent 3eae46a commit 3d49396
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
4 changes: 0 additions & 4 deletions src/EnergyPlus/Fans.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2504,10 +2504,6 @@ namespace Fans {
Node( OutletNode ).GenContam = Node( InletNode ).GenContam;
}

assert(Node( InletNode ).MassFlowRate == Fan( FanNum ).InletAirMassFlowRate);
assert(Node( OutletNode ).MassFlowRate == Fan( FanNum ).OutletAirMassFlowRate);
assert(Node( InletNode ).MassFlowRate == Node( OutletNode ).MassFlowRate);

}

// End of Update subroutines for the Fan Module
Expand Down
26 changes: 25 additions & 1 deletion src/EnergyPlus/HVACManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
#include <DisplayRoutines.hh>
//#include <EarthTube.hh>
#include <EMSManager.hh>
#include <Fans.hh>
#include <General.hh>
#include <HVACStandAloneERV.hh>
#include <IceThermalStorage.hh>
Expand All @@ -106,6 +107,7 @@
#include <PlantUtilities.hh>
#include <PollutionModule.hh>
#include <Psychrometrics.hh>
#include <Pumps.hh>
#include <RefrigeratedCase.hh>
#include <ScheduleManager.hh>
#include <SetPointManager.hh>
Expand Down Expand Up @@ -515,6 +517,8 @@ namespace HVACManager {

ManageEMS( emsCallFromEndSystemTimestepBeforeHVACReporting, anyEMSRan ); // EMS calling point

CheckMassBalances();

// This is where output processor data is updated for System Timestep reporting
if ( ! WarmupFlag ) {
if ( DoOutputReporting ) {
Expand Down Expand Up @@ -855,7 +859,7 @@ namespace HVACManager {
++HVACManageIteration; // Increment the iteration counter

if ( anyEMSRan && HVACManageIteration <= 2 ) {
// the calling point emsCallFromHVACIterationLoop is only effective for air loops if this while loop runs at least twice
// the calling point emsCallFromHVACIterationLoop is only effective for air loops if this while loop runs at least twice
SimAirLoopsFlag = true;
}

Expand Down Expand Up @@ -2725,6 +2729,26 @@ namespace HVACManager {

}

void
CheckMassBalances()
{
using namespace Fans;
using namespace Pumps;

for (int FanNum = 1; FanNum <= NumFans; ++FanNum) {
assert(Node( Fan( FanNum ).InletNodeNum ).MassFlowRate == Fan( FanNum ).InletAirMassFlowRate);
assert(Node( Fan( FanNum ).OutletNodeNum ).MassFlowRate == Fan( FanNum ).OutletAirMassFlowRate);
assert(Node( Fan( FanNum ).InletNodeNum ).MassFlowRate == Node( Fan( FanNum ).OutletNodeNum ).MassFlowRate);
}

for (int PumpNum = 1; PumpNum <= NumPumps; ++PumpNum) {
assert(Node( PumpEquip( PumpNum ).OutletNodeNum ).MassFlowRate == Node( PumpEquip( PumpNum ).InletNodeNum ).MassFlowRate);
}


}


} // HVACManager

} // EnergyPlus
3 changes: 3 additions & 0 deletions src/EnergyPlus/HVACManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ namespace HVACManager {
void
SimHVAC();

void
CheckMassBalances();

void
SimSelectedEquipment(
bool & SimAirLoops, // True when the air loops need to be (re)simulated
Expand Down
1 change: 0 additions & 1 deletion src/EnergyPlus/Pumps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,6 @@ namespace Pumps {
Node( OutletNode ).Press = Node( InletNode ).Press;
Node( OutletNode ).Quality = Node( InletNode ).Quality;

assert(Node( OutletNode ).MassFlowRate == Node( InletNode ).MassFlowRate);
}

//*************************************************************************!
Expand Down
7 changes: 1 addition & 6 deletions src/EnergyPlus/SimAirServingZones.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2077,12 +2077,7 @@ namespace SimAirServingZones {
// [DC/LBNL] Save previous mass flow rate
MassFlowSaved = Node( NodeNumIn ).MassFlowRate;

if (TurnFansOn && !TurnFansOff) {
Node( NodeNumIn ).MassFlowRate = AirLoopFlow( AirLoopNum ).DesSupply;
}
else {
Node( NodeNumIn ).MassFlowRate = 0.0;
}
Node( NodeNumIn ).MassFlowRate = AirLoopFlow( AirLoopNum ).DesSupply;

// [DC/LBNL] Detect if air mass flow rate has changed since last air loop simulation
if ( Node( NodeNumIn ).MassFlowRate != MassFlowSaved ) {
Expand Down

9 comments on commit 3d49396

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

conservation-tests (nealkruis) - x86_64-MacOS-10.9-clang: OK (2189 of 2194 tests passed, 1 test warnings)

  • 3 tests had: AUD diffs.
  • 2 tests had: MDD diffs.
  • 3 tests had: MTD diffs.
  • 5 tests had: MTR big diffs.
  • 2 tests had: RDD diffs.
  • 3 tests had: EIO diffs.
  • 3 tests had: ESO big diffs.
  • 3 tests had: Table big diffs.
  • 1 test had: ERR 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.

conservation-tests (nealkruis) - x86_64-Linux-Ubuntu-14.04-gcc-4.8: OK (2227 of 2232 tests passed, 1 test warnings)

  • 3 tests had: AUD diffs.
  • 2 tests had: MDD diffs.
  • 3 tests had: MTD diffs.
  • 5 tests had: MTR big diffs.
  • 2 tests had: RDD diffs.
  • 3 tests had: EIO diffs.
  • 3 tests had: ESO big diffs.
  • 3 tests had: Table big diffs.
  • 1 test had: ERR 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.

conservation-tests (nealkruis) - i386-Windows-7-VisualStudio-12: OK (2195 of 2200 tests passed, 1 test warnings)

  • 3 tests had: AUD diffs.
  • 2 tests had: MDD diffs.
  • 3 tests had: MTD diffs.
  • 5 tests had: MTR big diffs.
  • 2 tests had: RDD diffs.
  • 3 tests had: EIO diffs.
  • 3 tests had: ESO big diffs.
  • 3 tests had: Table big diffs.
  • 1 test had: ERR 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.

conservation-tests (nealkruis) - x86_64-Linux-Ubuntu-14.04-cppcheck-1.61: 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.

conservation-tests (nealkruis) - x86_64-Linux-Ubuntu-14.04-gcc-4.8-UnitTestsCoverage-Debug: OK (1085 of 1086 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.

conservation-tests (nealkruis) - x86_64-Linux-Ubuntu-14.04-gcc-4.8-IntegrationCoverage-Debug: Tests Failed (1457 of 1644 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.

conservation-tests (nealkruis) - x86_64-Linux-Ubuntu-14.04-custom_check: OK (0 of 0 tests passed, 0 test warnings)

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

conservation-tests (nealkruis) - Win64-Windows-7-VisualStudio-12: OK (2195 of 2200 tests passed, 1 test warnings)

  • 3 tests had: AUD diffs.
  • 2 tests had: MDD diffs.
  • 3 tests had: MTD diffs.
  • 5 tests had: MTR big diffs.
  • 2 tests had: RDD diffs.
  • 3 tests had: EIO diffs.
  • 3 tests had: ESO big diffs.
  • 3 tests had: Table big diffs.
  • 1 test had: ERR diffs.

Build Badge Test Badge

@rraustad
Copy link
Contributor

Choose a reason for hiding this comment

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

We just need to remember where this is.

Please sign in to comment.