Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Output Variables to Ideal Air loads #8302

Merged
merged 39 commits into from
Feb 12, 2021
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
861cfef
Add two output variables to Ideal Air loads
jmythms Sep 24, 2020
908ab51
Moved SupplyTemp and SupplyHumRat from local into the PurchAir struct
jmythms Sep 29, 2020
6b7b538
Merge branch 'develop' into Add-New-Zone-Ideal-Loads-Output-Variables
jmythms Sep 29, 2020
5acf86f
Moved MixedAirTemp and MixedAirHumRat from local into the PurchAir st…
jmythms Sep 29, 2020
0bc4fdf
Merge branch 'develop' into Add-New-Zone-Ideal-Loads-Output-Variables
jmythms Oct 6, 2020
a5b0833
New Output Vars + Documentation + Removed old redundant vars
jmythms Oct 6, 2020
14dbd0d
Fixed labels
jmythms Oct 6, 2020
7bf3209
Unit fix
jmythms Oct 6, 2020
6b73be5
White spaces
jmythms Oct 6, 2020
a33d794
Modifying testfiles to add the new outputs.
jmythms Oct 7, 2020
e5f0e2a
Cleaning up degree symbols
jmythms Oct 7, 2020
89a70d3
Reorder members in the constructor
jmythms Oct 7, 2020
18e8fb9
Merge branch 'develop' into Add-New-Zone-Ideal-Loads-Output-Variables
jmythms Nov 5, 2020
279aa5c
Fixing output variables
jmythms Nov 5, 2020
747afea
Merge branch 'develop' into Add-New-Zone-Ideal-Loads-Output-Variables
jmythms Nov 6, 2020
3cd3110
minor cleanup, bump CI
mitchute Nov 10, 2020
bbe882a
Merge branch 'Add-New-Zone-Ideal-Loads-Output-Variables' of https://g…
jmythms Nov 12, 2020
2ef45da
Merge branch 'develop' into Add-New-Zone-Ideal-Loads-Output-Variables
jmythms Nov 12, 2020
754e98c
Missed "state"
jmythms Nov 12, 2020
cbdb675
Missed 'state'
jmythms Nov 12, 2020
e487697
Unnecessary statements?
jmythms Nov 12, 2020
4972b6f
Changed outputs to report hourly instead of detailed frequency
jmythms Nov 13, 2020
0fc065b
Merge branch 'develop' into Add-New-Zone-Ideal-Loads-Output-Variables
jmythms Nov 13, 2020
2461195
Missed this in the list of outputs
jmythms Nov 13, 2020
120fac1
Removed unnecessary space
jmythms Nov 13, 2020
2dac64b
Merge branch 'develop' into Add-New-Zone-Ideal-Loads-Output-Variables
jmythms Dec 14, 2020
56c86eb
merge conflic resolution
jmythms Dec 14, 2020
227bdd2
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into Add…
jmythms Dec 15, 2020
71755c5
Fix conflict after pulling develop
jmythms Feb 9, 2021
6d6654b
fixed reporting freq to hpurly
jmythms Feb 9, 2021
660dacb
changed MixedAirHumRat to PurchAir(PurchAirNum).MixedAirHumRat
jmythms Feb 9, 2021
fd33e3e
broken unit test
jmythms Feb 9, 2021
7fbaa76
Intermediate commit for Unit test question
jmythms Feb 9, 2021
f67fbc8
fixed unit test
jmythms Feb 10, 2021
ec0199d
Merge branch 'develop' into Add-New-Zone-Ideal-Loads-Output-Variables
jmythms Feb 10, 2021
bebe31c
Merge branch 'develop' into Add-New-Zone-Ideal-Loads-Output-Variables
jmythms Feb 11, 2021
863baf5
Unit change+ .hh file clang formatting
jmythms Feb 11, 2021
e4ade3a
Clang formatted PurchasedAirManager.cc
jmythms Feb 11, 2021
3cfe237
clang formatted PurchasedAirManager.hh
jmythms Feb 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

286 changes: 176 additions & 110 deletions src/EnergyPlus/PurchasedAirManager.cc

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions src/EnergyPlus/PurchasedAirManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,6 @@ namespace PurchasedAirManager {
Real64 SupplyAirMassFlowRate; // Supply air mass flow rate [kg/s]
Real64 SupplyAirVolFlowRateStdRho; // supply air volume flow using standard density [m3/s]
// Intermediate results
Real64 FinalMixedAirTemp; // Dry-bulb temperature of the mixed air, saved for system ventilation load reporting [C]
Real64 FinalMixedAirHumRat; // Humidity ratio of the mixed air, saved for system ventilation load reporting [kgWater/kgDryAir]
Real64 HtRecSenOutput; // Sensible heating/cooling rate from heat recovery (<0 means cooling) [W]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed them since I felt the new mixedairtemp and mixedairhumrat were doing the same thing?

Copy link
Contributor

Choose a reason for hiding this comment

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

And it appears that FinalMixedAirTemp and FinalMixedAirHumRat weren't being used anywhere, so find to replace them here.

Real64 HtRecLatOutput; // Latent heating/cooling rate from heat recovery (<0 means cooling or dehumidfying) [W]
Real64 OASenOutput; // Outdoor air sensible output relative to zone conditions [W], <0 means OA is cooler than zone air
Expand Down Expand Up @@ -262,6 +260,10 @@ namespace PurchasedAirManager {
Real64 TimeHtRecActive; // Time heat reocovery is active [hrs]
int ZonePtr; // pointer to a zone served by an Ideal load air system
int HVACSizingIndex; // index of a HVAC Sizing object for an Ideal load air system
Real64 SupplyTemp; // Supply inlet to zone dry bulb temperature [C]
Real64 SupplyHumRat; // Supply inlet to zone humidity ratio [kgWater/kgDryAir]
Real64 MixedAirTemp; // Mixed air dry bulb temperature [C]
Real64 MixedAirHumRat; // Mixed air humidity ratio [kgWater/kgDryAir]

// Default Constructor
ZonePurchasedAir()
Expand All @@ -274,8 +276,7 @@ namespace PurchasedAirManager {
EMSValueMassFlowRate(0.0), EMSOverrideOAMdotOn(false), EMSValueOAMassFlowRate(0.0),
EMSOverrideSupplyTempOn(false), EMSValueSupplyTemp(0.0), EMSOverrideSupplyHumRatOn(false),
EMSValueSupplyHumRat(0.0), MinOAMassFlowRate(0.0),
OutdoorAirMassFlowRate(0.0), OutdoorAirVolFlowRateStdRho(0.0), SupplyAirMassFlowRate(0.0), SupplyAirVolFlowRateStdRho(0.0),
FinalMixedAirTemp(0.0), FinalMixedAirHumRat(0.0), HtRecSenOutput(0.0), HtRecLatOutput(0.0), OASenOutput(0.0), OALatOutput(0.0),
OutdoorAirMassFlowRate(0.0), OutdoorAirVolFlowRateStdRho(0.0), SupplyAirMassFlowRate(0.0), SupplyAirVolFlowRateStdRho(0.0), HtRecSenOutput(0.0), HtRecLatOutput(0.0), OASenOutput(0.0), OALatOutput(0.0),
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why this line didn't wrap earlier. It's much longer than all the rest. Was Clang format used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rraustad I just checked this, it was disabled in my IDE. Shall I do one more commit after reformatting?

Copy link
Contributor

Choose a reason for hiding this comment

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

@Myoldmopar is it worth another commit for Clang formatting the hh file? I don't see any other changes needed, but I haven't tested the example file yet. Unit tests run clean locally.

SenOutputToZone(0.0), LatOutputToZone(0.0), SenCoilLoad(0.0), LatCoilLoad(0.0), OAFlowMaxCoolOutputError(0),
OAFlowMaxHeatOutputError(0), SaturationOutputError(0), OAFlowMaxCoolOutputIndex(0), OAFlowMaxHeatOutputIndex(0),
SaturationOutputIndex(0), AvailStatus(0), CoolErrIndex(0), HeatErrIndex(0), SenHeatEnergy(0.0), LatHeatEnergy(0.0), TotHeatEnergy(0.0),
Expand All @@ -286,8 +287,8 @@ namespace PurchasedAirManager {
SenHeatRate(0.0), LatHeatRate(0.0), TotHeatRate(0.0), SenCoolRate(0.0), LatCoolRate(0.0), TotCoolRate(0.0), ZoneSenHeatRate(0.0),
ZoneLatHeatRate(0.0), ZoneTotHeatRate(0.0), ZoneSenCoolRate(0.0), ZoneLatCoolRate(0.0), ZoneTotCoolRate(0.0), OASenHeatRate(0.0),
OALatHeatRate(0.0), OATotHeatRate(0.0), OASenCoolRate(0.0), OALatCoolRate(0.0), OATotCoolRate(0.0), HtRecSenHeatRate(0.0),
HtRecLatHeatRate(0.0), HtRecTotHeatRate(0.0), HtRecSenCoolRate(0.0), HtRecLatCoolRate(0.0), HtRecTotCoolRate(0.0), TimeEconoActive(0.0),
TimeHtRecActive(0.0), ZonePtr(0), HVACSizingIndex(0)
HtRecLatHeatRate(0.0), HtRecTotHeatRate(0.0), HtRecSenCoolRate(0.0), HtRecLatCoolRate(0.0), HtRecTotCoolRate(0.0), TimeEconoActive(0.0),
TimeHtRecActive(0.0), ZonePtr(0), HVACSizingIndex(0), SupplyTemp(0.0), SupplyHumRat(0.0), MixedAirTemp(0.0), MixedAirHumRat(0.0)
{
}
};
Expand Down
11 changes: 10 additions & 1 deletion testfiles/HVACTemplate-5ZonePurchAir.idf
Original file line number Diff line number Diff line change
Expand Up @@ -1930,6 +1930,16 @@

Output:Variable,*,Zone Ideal Loads Heat Recovery Active Time,hourly;

Output:Variable,*,Zone Ideal Loads Supply Air Temperature,hourly;

Output:Variable,*,Zone Ideal Loads Supply Air Humidity Ratio,hourly;

Output:Variable,*,Zone Ideal Loads Mixed Air Temperature,hourly;

Output:Variable,*,Zone Ideal Loads Mixed Air Humidity Ratio,hourly;

Output:Variable,*,System Node Mass Flow Rate,hourly;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now the results appear in the test file output. Should I change the reporting frequency to hourly? Also, the effects are better visible for an annual simulation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I would make the reporting frequency consistent - looks like everything else is hourly.

Output:Variable,SPACE2-1 Ideal Loads Outdoor Air Inlet,System Node Standard Density Volume Flow Rate,hourly;

Output:Variable,SPACE3-1 Ideal Loads Outdoor Air Inlet,System Node Standard Density Volume Flow Rate,hourly;
Expand Down Expand Up @@ -1969,4 +1979,3 @@

Output:Table:SummaryReports,
AllSummary; !- Report 1 Name

4 changes: 4 additions & 0 deletions testfiles/HVACTemplate-5ZonePurchAir.rvi
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@ Zone Ideal Loads Supply Air Latent Heating Rate
Zone Ideal Loads Supply Air Total Heating Rate
Zone Ideal Loads Economizer Active Time
Zone Ideal Loads Heat Recovery Active Time
Zone Ideal Loads Supply Air Temperature
Zone Ideal Loads Supply Air Humidity Ratio
Zone Ideal Loads Mixed Air Temperature
Zone Ideal Loads Mixed Air Humidity Ratio
System Node Standard Density Volume Flow Rate
0
169 changes: 169 additions & 0 deletions tst/EnergyPlus/unit/PurchasedAirManager.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@
#include <EnergyPlus/DataZoneEquipment.hh>
#include <EnergyPlus/EMSManager.hh>
#include <EnergyPlus/HeatBalanceManager.hh>
#include <EnergyPlus/Psychrometrics.hh>
#include <EnergyPlus/PurchasedAirManager.hh>
#include <EnergyPlus/RuntimeLanguageProcessor.hh>
#include <EnergyPlus/ScheduleManager.hh>
#include <EnergyPlus/ZoneEquipmentManager.hh>
#include <EnergyPlus/ZonePlenum.hh>
#include <EnergyPlus/SizingManager.hh>

using namespace EnergyPlus;
using namespace ObjexxFCL;
Expand Down Expand Up @@ -520,6 +522,173 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_ExhaustNodeTest)
EXPECT_EQ(PurchAir(1).SupplyAirMassFlowRate, Node(PurchAir(1).ZoneExhaustAirNodeNum).MassFlowRate);
}

TEST_F(ZoneIdealLoadsTest, IdealLoads_IntermediateOutputVarsTest)
{

std::string const idf_objects = delimited_string({

"Zone,",
" EAST ZONE, !- Name",
" 0, !- Direction of Relative North{ deg }",
" 0, !- X Origin{ m }",
" 0, !- Y Origin{ m }",
" 0, !- Z Origin{ m }",
" 1, !- Type",
" 1, !- Multiplier",
" autocalculate, !- Ceiling Height{ m }",
" autocalculate; !- Volume{ m3 }",

"ZoneHVAC:IdealLoadsAirSystem,",
" ZONE 1 IDEAL LOADS, !- Name",
" , !- Availability Schedule Name",
" Zone Inlet Node, !- Zone Supply Air Node Name",
" Zone Exhaust Node, !- Zone Exhaust Air Node Name",
" , !- System Inlet Air Node Name",
" 50, !- Maximum Heating Supply Air Temperature{ C }",
" 13, !- Minimum Cooling Supply Air Temperature{ C }",
" 0.015, !- Maximum Heating Supply Air Humidity Ratio{ kgWater / kgDryAir }",
" 0.009, !- Minimum Cooling Supply Air Humidity Ratio{ kgWater / kgDryAir }",
" NoLimit, !- Heating Limit",
" autosize, !- Maximum Heating Air Flow Rate{ m3 / s }",
" , !- Maximum Sensible Heating Capacity{ W }",
" NoLimit, !- Cooling Limit",
" autosize, !- Maximum Cooling Air Flow Rate{ m3 / s }",
" , !- Maximum Total Cooling Capacity{ W }",
" , !- Heating Availability Schedule Name",
" , !- Cooling Availability Schedule Name",
" ConstantSupplyHumidityRatio, !- Dehumidification Control Type",
" , !- Cooling Sensible Heat Ratio{ dimensionless }",
" ConstantSupplyHumidityRatio, !- Humidification Control Type",
" Office Outdoor Air Spec, !- Design Specification Outdoor Air Object Name",
" , !- Outdoor Air Inlet Node Name",
" , !- Demand Controlled Ventilation Type",
" NoEconomizer, !- Outdoor Air Economizer Type",
" Sensible, !- Heat Recovery Type",
" 0.7, !- Sensible Heat Recovery Effectiveness{ dimensionless }",
" 0.65; !- Latent Heat Recovery Effectiveness{ dimensionless }",

"DesignSpecification:OutdoorAir,",
" Office Outdoor Air Spec, !- Name",
" Flow/Zone, !- Outdoor Air Method",
" 0.0, !- Outdoor Air Flow per Person {m3/s-person}",
" 0.00305, !- Outdoor Air Flow per Zone Floor Area {m3/s-m2}",
" 0.0, !- Outdoor Air Flow per Zone {m3/s}",
" 0.0, !- Outdoor Air Flow Air Changes per Hour {1/hr}",
" Min OA Sched; !- Outdoor Air Schedule Name",

"Schedule:Compact,",
" Min OA Sched, !- Name",
" Fraction, !- Schedule Type Limits Name",
" Through: 12/31, !- Field 1",
" For: WeekDays CustomDay1 CustomDay2, !- Field 2",
" Until: 8:00,0.0, !- Field 3",
" Until: 21:00,1.0, !- Field 5",
" Until: 24:00,0.0, !- Field 7",
" For: Weekends Holiday, !- Field 9",
" Until: 24:00,0.0, !- Field 10",
" For: SummerDesignDay, !- Field 12",
" Until: 24:00,1.0, !- Field 13",
" For: WinterDesignDay, !- Field 15",
" Until: 24:00,1.0; !- Field 16",

"ZoneHVAC:EquipmentConnections,",
" EAST ZONE, !- Zone Name",
" ZoneEquipment, !- Zone Conditioning Equipment List Name",
" Zone Inlet Node, !- Zone Air Inlet Node or NodeList Name",
" Zone Exhaust Node, !- Zone Air Exhaust Node or NodeList Name",
" Zone Node, !- Zone Air Node Name",
" Zone Outlet Node; !- Zone Return Air Node Name",

"ZoneHVAC:EquipmentList,",
" ZoneEquipment, !- Name",
" SequentialLoad, !- Load Distribution Scheme",
" ZoneHVAC:IdealLoadsAirSystem, !- Zone Equipment 1 Object Type",
" ZONE 1 IDEAL LOADS, !- Zone Equipment 1 Name",
" 1, !- Zone Equipment 1 Cooling Sequence",
" 1; !- Zone Equipment 1 Heating or No - Load Sequence",

"AirLoopHVAC:ReturnPlenum,",
" DOAS Zone Return Plenum, !- Name",
" PLENUM ZONE, !- Zone Name",
" Plenum Node, !- Zone Node Name", // illegal use of non-unique zone node name
" Plenum Outlet Node, !- Outlet Node Name",
" , !- Induced Air Outlet Node or NodeList Name",
" Zone Exhaust Node; !- Inlet 1 Node Name",

});

ASSERT_TRUE(process_idf(idf_objects)); // read idf objects

state->dataGlobal->DoWeathSim = true;

bool ErrorsFound = false;
GetZoneData(*state, ErrorsFound);
Zone(1).SurfaceFirst = 1;
Zone(1).SurfaceLast = 1;
ScheduleManager::Schedule.allocate(1);
AllocateHeatBalArrays(*state);
EXPECT_FALSE(ErrorsFound); // expect no errors
auto & PurchAir(state->dataPurchasedAirMgr->PurchAir);


bool FirstHVACIteration(true);
bool SimZone(true);
bool SimAir(false);

EnergyPlus::SizingManager::GetOARequirements(*state);
ManageZoneEquipment(*state,
FirstHVACIteration,
SimZone,
SimAir); // read zone equipment configuration and list objects and simulate ideal loads air system


EXPECT_EQ(PurchAir(1).Name, "ZONE 1 IDEAL LOADS");
// Expecting SupplyTemp to be the same as Zone supply temp
EXPECT_EQ(PurchAir(1).SupplyTemp, Node(PurchAir(1).ZoneSupplyAirNodeNum).Temp);
EXPECT_EQ(PurchAir(1).SupplyHumRat, Node(PurchAir(1).ZoneSupplyAirNodeNum).HumRat);

// Test for intermediate variables, MixedAirTemp, MixedAirHumRat
Node(PurchAir(1).ZoneRecircAirNodeNum).Temp = 24;
Node(PurchAir(1).ZoneRecircAirNodeNum).HumRat = 0.00929;
Node(PurchAir(1).ZoneRecircAirNodeNum).Enthalpy = Psychrometrics::PsyHFnTdbW(
Node(PurchAir(1).ZoneRecircAirNodeNum).Temp,
Node(PurchAir(1).ZoneRecircAirNodeNum).HumRat
);
Node(PurchAir(1).OutdoorAirNodeNum).Temp = 3;
Node(PurchAir(1).OutdoorAirNodeNum).HumRat = 0.004586;
Node(PurchAir(1).OutdoorAirNodeNum).Enthalpy = Psychrometrics::PsyHFnTdbW(
Node(PurchAir(1).OutdoorAirNodeNum).Temp,
Node(PurchAir(1).OutdoorAirNodeNum).HumRat
);
PurchAir(1).MixedAirTemp = 0;
PurchAir(1).MixedAirHumRat = 0;
Real64 MixedAirEnthalpy = 0;
Real64 OAMassFlowRate = 10;
Real64 SupplyMassFlowRate = 11;
CalcPurchAirMixedAir(*state,
1, // index to ideal loads unit
OAMassFlowRate, // outside air mass flow rate [kg/s]
SupplyMassFlowRate, // supply air mass flow rate [kg/s]
PurchAir(1).MixedAirTemp, // Mixed air dry bulb temperature [C]
PurchAir(1).MixedAirHumRat, // Mixed air humidity ratio [kgWater/kgDryAir]
MixedAirEnthalpy, // Mixed air enthalpy [J/kg]
OpMode::Cool // current operating mode, Off, Heating, Cooling, or DeadBand
);
// Calculations:
// Stream 1: Recirc stream: T1: 24 C; W1: 0.00929 kg/kg; h1: 47764.36 J/kg; m_dot1: 11 kg/s
// Stream 2: Outdoor Air stream: T2: 3 C; W2:0.004586 kg/kg; h2: 14509.40 J/kg; m_dot2: 10 kg/s

// Mixed stream:
// When SupplyMassFlowRate > OAMassFlowRate
// RecircMassFlowRate = SupplyMassFlowRate - OAMassFlowRate = 1 kg/s
// h_mix_stream = (RecircMassFlowRate X h_Recirc + m_dotOA X h_OA)/SupplyFlowRate = 17532.58 J/kg
// W_mix_stream = (RecircMassFlowRate X W_Recirc + m_dotOA X W_OA)/SupplyFlowRate = 0.005013 kg/kg
// T_mix_stream = T as fn (h_mix_stream,W_mix_stream) = 4.924 C

EXPECT_EQ(PurchAir(1).MixedAirTemp,4.9240554165264818);
EXPECT_EQ(PurchAir(1).MixedAirHumRat,0.0050136363636363633);
}

TEST_F(ZoneIdealLoadsTest, IdealLoads_EMSOverrideTest)
{

Expand Down