Skip to content

Commit

Permalink
Merge pull request #8349 from NREL/global_SteamCoils
Browse files Browse the repository at this point in the history
Global SteamCoils and Others
  • Loading branch information
mitchute authored Oct 19, 2020
2 parents 6c1e5e5 + 9d0c42f commit ddc0f77
Show file tree
Hide file tree
Showing 33 changed files with 2,451 additions and 3,639 deletions.
6 changes: 6 additions & 0 deletions src/EnergyPlus/Data/CommonIncludes.hh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@
#include <EnergyPlus/Fans.hh>
#include <EnergyPlus/Pipes.hh>
#include <EnergyPlus/PlantChillers.hh>
#include <EnergyPlus/SolarCollectors.hh>
#include <EnergyPlus/SolarReflectionManager.hh>
#include <EnergyPlus/SolarShading.hh>
#include <EnergyPlus/SplitterComponent.hh>
#include <EnergyPlus/SteamBaseboardRadiator.hh>
#include <EnergyPlus/SteamCoils.hh>
#include <EnergyPlus/SurfaceGroundHeatExchanger.hh>
#include <EnergyPlus/SwimmingPool.hh>
#include <EnergyPlus/SystemAvailabilityManager.hh>
Expand Down
11 changes: 11 additions & 0 deletions src/EnergyPlus/Data/EnergyPlusData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ namespace EnergyPlus {
this->dataGlobal = std::unique_ptr<DataGlobal>(new DataGlobal);
this->dataPipes = std::unique_ptr<PipesData>(new PipesData);
this->dataPlantChillers = std::unique_ptr<PlantChillersData>(new PlantChillersData);
this->dataSolarCollectors = std::unique_ptr<SolarCollectorsData>(new SolarCollectorsData);
this->dataSolarReflectionManager = std::unique_ptr<SolarReflectionManagerData>(new SolarReflectionManagerData);
this->dataSolarShading = std::unique_ptr<SolarShadingData>(new SolarShadingData);
this->dataSplitterComponent = std::unique_ptr<SplitterComponentData>(new SplitterComponentData);
this->dataSteamBaseboardRadiator = std::unique_ptr<SteamBaseboardRadiatorData>(new SteamBaseboardRadiatorData);
this->dataSteamCoils = std::unique_ptr<SteamCoilsData>(new SteamCoilsData);
this->dataSurfaceGroundHeatExchangers = std::unique_ptr<SurfaceGroundHeatExchangersData>(new SurfaceGroundHeatExchangersData);
this->dataSwimmingPools = std::unique_ptr<SwimmingPoolsData>(new SwimmingPoolsData);
this->dataSystemAvailabilityManager = std::unique_ptr<SystemAvailabilityManagerData>(new SystemAvailabilityManagerData);
Expand Down Expand Up @@ -146,6 +152,11 @@ namespace EnergyPlus {
this->dataGlobal->clear_state();
this->dataPipes->clear_state();
this->dataPlantChillers->clear_state();
this->dataSolarCollectors->clear_state();
this->dataSolarShading->clear_state();
this->dataSplitterComponent->clear_state();
this->dataSteamBaseboardRadiator->clear_state();
this->dataSteamCoils->clear_state();
this->dataSurfaceGroundHeatExchangers->clear_state();
this->dataSwimmingPools->clear_state();
this->dataSystemAvailabilityManager->clear_state();
Expand Down
12 changes: 12 additions & 0 deletions src/EnergyPlus/Data/EnergyPlusData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ struct ExteriorEnergyUseData;
struct FansData;
struct PipesData;
struct PlantChillersData;
struct SolarCollectorsData;
struct SolarReflectionManagerData;
struct SolarShadingData;
struct SplitterComponentData;
struct SteamBaseboardRadiatorData;
struct SteamCoilsData;
struct SurfaceGroundHeatExchangersData;
struct SwimmingPoolsData;
struct SystemAvailabilityManagerData;
Expand Down Expand Up @@ -158,6 +164,12 @@ struct EnergyPlusData : BaseGlobalStruct {
std::unique_ptr<FansData> dataFans;
std::unique_ptr<PipesData> dataPipes;
std::unique_ptr<PlantChillersData> dataPlantChillers;
std::unique_ptr<SolarCollectorsData> dataSolarCollectors;
std::unique_ptr<SolarReflectionManagerData> dataSolarReflectionManager;
std::unique_ptr<SolarShadingData> dataSolarShading;
std::unique_ptr<SplitterComponentData> dataSplitterComponent;
std::unique_ptr<SteamBaseboardRadiatorData> dataSteamBaseboardRadiator;
std::unique_ptr<SteamCoilsData> dataSteamCoils;
std::unique_ptr<SurfaceGroundHeatExchangersData> dataSurfaceGroundHeatExchangers;
std::unique_ptr<SwimmingPoolsData> dataSwimmingPools;
std::unique_ptr<SystemAvailabilityManagerData> dataSystemAvailabilityManager;
Expand Down
31 changes: 7 additions & 24 deletions src/EnergyPlus/DaylightingManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3400,26 +3400,9 @@ namespace DaylightingManager {
// METHODOLOGY EMPLOYED:
// switch as need to serve both reference points and map points based on calledFrom

// REFERENCES:
// na

// Using/Aliasing
using DataSystemVariables::DetailedSkyDiffuseAlgorithm;
using General::BlindBeamBeamTrans;
using General::POLYF;
using SolarReflectionManager::SolReflRecSurf;

// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:

// SUBROUTINE PARAMETER DEFINITIONS:
// na

// INTERFACE BLOCK SPECIFICATIONS:
// na

// DERIVED TYPE DEFINITIONS:
// na

if (SUNCOSHR(iHour, 3) < SunIsUpValue) return;

Expand Down Expand Up @@ -3892,10 +3875,10 @@ namespace DaylightingManager {
// Receiving surface number corresponding this window
RecSurfNum = Surface(IWin2).ShadowSurfRecSurfNum;
if (RecSurfNum > 0) { // interior windows do not apply
if (SolReflRecSurf(RecSurfNum).NumPossibleObs > 0) {
if (state.dataSolarReflectionManager->SolReflRecSurf(RecSurfNum).NumPossibleObs > 0) {
// This window has associated obstructions that could reflect beam onto the window
for (int loop = 1, loop_end = SolReflRecSurf(RecSurfNum).NumPossibleObs; loop <= loop_end; ++loop) {
ReflSurfNum = SolReflRecSurf(RecSurfNum).PossibleObsSurfNums(loop);
for (int loop = 1, loop_end = state.dataSolarReflectionManager->SolReflRecSurf(RecSurfNum).NumPossibleObs; loop <= loop_end; ++loop) {
ReflSurfNum = state.dataSolarReflectionManager->SolReflRecSurf(RecSurfNum).PossibleObsSurfNums(loop);
ReflSurfNumX = ReflSurfNum;
// Each shadowing surface has a "mirror" duplicate surface facing in the opposite direction.
// The following gets the correct side of a shadowing surface for reflection.
Expand Down Expand Up @@ -3928,8 +3911,8 @@ namespace DaylightingManager {
ReflDistance = std::sqrt(ReflDistanceSq);
// Is ray from ref. pt. to reflection point (HitPtRefl) obstructed?
hitObsRefl = false;
for (int loop2 = 1, loop2_end = SolReflRecSurf(RecSurfNum).NumPossibleObs; loop2 <= loop2_end; ++loop2) {
int const ObsSurfNum = SolReflRecSurf(RecSurfNum).PossibleObsSurfNums(loop2);
for (int loop2 = 1, loop2_end = state.dataSolarReflectionManager->SolReflRecSurf(RecSurfNum).NumPossibleObs; loop2 <= loop2_end; ++loop2) {
int const ObsSurfNum = state.dataSolarReflectionManager->SolReflRecSurf(RecSurfNum).PossibleObsSurfNums(loop2);
if (ObsSurfNum == ReflSurfNum || ObsSurfNum == Surface(ReflSurfNum).BaseSurf) continue;
PierceSurface(ObsSurfNum, RREF2, SunVecMir, ReflDistance, HitPtObs, hitObs); // ReflDistance cutoff added
if (hitObs) { // => Could skip distance check (unless < vs <= ReflDistance really matters)
Expand All @@ -3949,8 +3932,8 @@ namespace DaylightingManager {
ReflSurfRecNum = Surface(ReflSurfNum).ShadowSurfRecSurfNum;
if (ReflSurfRecNum > 0) {
// Loop over possible obstructions for this reflecting window
for (int loop2 = 1, loop2_end = SolReflRecSurf(ReflSurfRecNum).NumPossibleObs; loop2 <= loop2_end; ++loop2) {
int const ObsSurfNum = SolReflRecSurf(ReflSurfRecNum).PossibleObsSurfNums(loop2);
for (int loop2 = 1, loop2_end = state.dataSolarReflectionManager->SolReflRecSurf(ReflSurfRecNum).NumPossibleObs; loop2 <= loop2_end; ++loop2) {
int const ObsSurfNum = state.dataSolarReflectionManager->SolReflRecSurf(ReflSurfRecNum).PossibleObsSurfNums(loop2);
PierceSurface(ObsSurfNum, HitPtRefl, RAYCOS, HitPtObs, hitObs);
if (hitObs) break;
}
Expand Down
12 changes: 6 additions & 6 deletions src/EnergyPlus/FaultsManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -883,28 +883,28 @@ namespace FaultsManager {
} else if (UtilityRoutines::SameString(SELECT_CASE_VAR, "Coil:Heating:Steam")) {

// Read in coil input if not done yet
if (SteamCoils::GetSteamCoilsInputFlag) {
if (state.dataSteamCoils->GetSteamCoilsInputFlag) {
SteamCoils::GetSteamCoilInput(state);
SteamCoils::GetSteamCoilsInputFlag = false;
state.dataSteamCoils->GetSteamCoilsInputFlag = false;
}
// Check the coil name and coil type
int CoilNum = UtilityRoutines::FindItemInList(FaultsCoilSATSensor(jFault_CoilSAT).CoilName, SteamCoils::SteamCoil);
int CoilNum = UtilityRoutines::FindItemInList(FaultsCoilSATSensor(jFault_CoilSAT).CoilName, state.dataSteamCoils->SteamCoil);
if (CoilNum <= 0) {
ShowSevereError(cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" +
cAlphaArgs(5) + "\" not found.");
ErrorsFound = true;
} else {

if (SteamCoils::SteamCoil(CoilNum).TypeOfCoil != SteamCoils::TemperatureSetPointControl) {
if (state.dataSteamCoils->SteamCoil(CoilNum).TypeOfCoil != state.dataSteamCoils->TemperatureSetPointControl) {
// The fault model is only applicable to the coils controlled on leaving air temperature
ShowWarningError(cFaultCurrentObject + " = \"" + cAlphaArgs(1) + "\" invalid " + cAlphaFieldNames(5) + " = \"" +
cAlphaArgs(5) +
"\". The specified coil is not controlled on leaving air temperature. The coil SAT sensor fault model "
"will not be applied.");
} else {
// Link the fault model with the coil that is controlled on leaving air temperature
SteamCoils::SteamCoil(CoilNum).FaultyCoilSATFlag = true;
SteamCoils::SteamCoil(CoilNum).FaultyCoilSATIndex = jFault_CoilSAT;
state.dataSteamCoils->SteamCoil(CoilNum).FaultyCoilSATFlag = true;
state.dataSteamCoils->SteamCoil(CoilNum).FaultyCoilSATIndex = jFault_CoilSAT;
}
}

Expand Down
43 changes: 20 additions & 23 deletions src/EnergyPlus/GeneralRoutines.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,6 @@ void CalcPassiveExteriorBaffleGap(EnergyPlusData &state,
using Psychrometrics::PsyCpAirFnW;
using Psychrometrics::PsyRhoAirFnPbTdbW;
using Psychrometrics::PsyWFnTdbTwbPb;
using SolarCollectors::Collector;

// Argument array dimensioning

Expand Down Expand Up @@ -1173,12 +1172,12 @@ void CalcPassiveExteriorBaffleGap(EnergyPlusData &state,
ICSULossbottom = 0.40;
ICSWaterTemp = 20.0;
} else {
if (!Collector.allocated()) {
if (!state.dataSolarCollectors->Collector.allocated()) {
ICSULossbottom = 0.40;
ICSWaterTemp = 20.0;
} else {
ICSULossbottom = Collector(CollectorNum).UbLoss;
ICSWaterTemp = Collector(CollectorNum).TempOfWater;
ICSULossbottom = state.dataSolarCollectors->Collector(CollectorNum).UbLoss;
ICSWaterTemp = state.dataSolarCollectors->Collector(CollectorNum).TempOfWater;
MyICSEnvrnFlag = false;
}
}
Expand Down Expand Up @@ -1535,8 +1534,6 @@ void TestSupplyAirPathIntegrity(EnergyPlusData &state, bool &ErrFound)

// Using/Aliasing
using namespace DataLoopNode;
using SplitterComponent::NumSplitters;
using SplitterComponent::SplitterCond;
auto &GetZoneSplitterInput(SplitterComponent::GetSplitterInput);
using namespace DataZoneEquipment;
using DataHVACGlobals::NumPrimaryAirSys;
Expand Down Expand Up @@ -1630,25 +1627,25 @@ void TestSupplyAirPathIntegrity(EnergyPlusData &state, bool &ErrFound)
}

} else if (SELECT_CASE_var == "AIRLOOPHVAC:ZONESPLITTER") {
for (Count2 = 1; Count2 <= NumSplitters; ++Count2) {
if (SplitterCond(Count2).SplitterName != SupplyAirPath(BCount).ComponentName(Count)) continue;
if (Count == 1 && AirPathNodeName != NodeID(SplitterCond(Count2).InletNode)) {
for (Count2 = 1; Count2 <= state.dataSplitterComponent->NumSplitters; ++Count2) {
if (state.dataSplitterComponent->SplitterCond(Count2).SplitterName != SupplyAirPath(BCount).ComponentName(Count)) continue;
if (Count == 1 && AirPathNodeName != NodeID(state.dataSplitterComponent->SplitterCond(Count2).InletNode)) {
ShowSevereError("Error in AirLoopHVAC:SupplyPath=" + SupplyAirPath(BCount).Name);
ShowContinueError("For AirLoopHVAC:ZoneSplitter=" + SplitterCond(Count2).SplitterName);
ShowContinueError("For AirLoopHVAC:ZoneSplitter=" + state.dataSplitterComponent->SplitterCond(Count2).SplitterName);
ShowContinueError("Expected inlet node (supply air path)=" + AirPathNodeName);
ShowContinueError("Encountered node name (zone splitter)=" + NodeID(SplitterCond(Count2).InletNode));
ShowContinueError("Encountered node name (zone splitter)=" + NodeID(state.dataSplitterComponent->SplitterCond(Count2).InletNode));
ErrFound = true;
++NumErr;
}
print(state.files.bnd, " #Outlet Nodes on Supply Air Path Component,{}\n", SplitterCond(Count2).NumOutletNodes);
for (Count1 = 1; Count1 <= SplitterCond(Count2).NumOutletNodes; ++Count1) {
print(state.files.bnd, " #Outlet Nodes on Supply Air Path Component,{}\n", state.dataSplitterComponent->SplitterCond(Count2).NumOutletNodes);
for (Count1 = 1; Count1 <= state.dataSplitterComponent->SplitterCond(Count2).NumOutletNodes; ++Count1) {
print(state.files.bnd,
" Supply Air Path Component Nodes,{},{},{},{},{},{}\n",
Count1,
SupplyAirPath(BCount).ComponentType(Count),
SupplyAirPath(BCount).ComponentName(Count),
NodeID(SplitterCond(Count2).InletNode),
NodeID(SplitterCond(Count2).OutletNode(Count1)),
NodeID(state.dataSplitterComponent->SplitterCond(Count2).InletNode),
NodeID(state.dataSplitterComponent->SplitterCond(Count2).OutletNode(Count1)),
PrimaryAirLoopName);
}
}
Expand Down Expand Up @@ -1691,7 +1688,7 @@ void TestSupplyAirPathIntegrity(EnergyPlusData &state, bool &ErrFound)
}
}

if (NumSplitters == 0) {
if (state.dataSplitterComponent->NumSplitters == 0) {
if (inputProcessor->getNumObjectsFound("AirLoopHVAC:ZoneSplitter") > 0) {
GetZoneSplitterInput(state);
}
Expand All @@ -1704,7 +1701,7 @@ void TestSupplyAirPathIntegrity(EnergyPlusData &state, bool &ErrFound)

// now the reverse. is every zone splitter and supply plenum on supply air path
FoundSupplyPlenum.dimension(state.dataZonePlenum->NumZoneSupplyPlenums, false);
FoundZoneSplitter.dimension(NumSplitters, false);
FoundZoneSplitter.dimension(state.dataSplitterComponent->NumSplitters, false);
FoundNames.allocate(state.dataZonePlenum->NumZoneSupplyPlenums);
for (Count1 = 1; Count1 <= state.dataZonePlenum->NumZoneSupplyPlenums; ++Count1) {
for (BCount = 1; BCount <= NumSupplyAirPaths; ++BCount) {
Expand All @@ -1725,15 +1722,15 @@ void TestSupplyAirPathIntegrity(EnergyPlusData &state, bool &ErrFound)
}
}
FoundNames.deallocate();
FoundNames.allocate(NumSplitters);
for (Count1 = 1; Count1 <= NumSplitters; ++Count1) {
FoundNames.allocate(state.dataSplitterComponent->NumSplitters);
for (Count1 = 1; Count1 <= state.dataSplitterComponent->NumSplitters; ++Count1) {
for (BCount = 1; BCount <= NumSupplyAirPaths; ++BCount) {
for (Count = 1; Count <= SupplyAirPath(BCount).NumOfComponents; ++Count) {
if (SplitterCond(Count1).SplitterName != SupplyAirPath(BCount).ComponentName(Count) ||
if (state.dataSplitterComponent->SplitterCond(Count1).SplitterName != SupplyAirPath(BCount).ComponentName(Count) ||
SupplyAirPath(BCount).ComponentType(Count) != "AIRLOOPHVAC:ZONESPLITTER")
continue;
if (FoundZoneSplitter(Count1)) {
ShowSevereError("AirLoopHVAC:ZoneSplitter=\"" + SplitterCond(Count1).SplitterName + "\", duplicate entry.");
ShowSevereError("AirLoopHVAC:ZoneSplitter=\"" + state.dataSplitterComponent->SplitterCond(Count1).SplitterName + "\", duplicate entry.");
ShowContinueError("already exists on AirLoopHVAC:SupplyPath=\"" + FoundNames(Count1) + "\".");
ErrFound = true;
} else {
Expand All @@ -1755,9 +1752,9 @@ void TestSupplyAirPathIntegrity(EnergyPlusData &state, bool &ErrFound)
}

if (!all(FoundZoneSplitter)) {
for (Count1 = 1; Count1 <= NumSplitters; ++Count1) {
for (Count1 = 1; Count1 <= state.dataSplitterComponent->NumSplitters; ++Count1) {
if (FoundZoneSplitter(Count1)) continue;
ShowSevereError("AirLoopHVAC:ZoneSplitter=\"" + SplitterCond(Count1).SplitterName + "\", not found on any AirLoopHVAC:SupplyPath.");
ShowSevereError("AirLoopHVAC:ZoneSplitter=\"" + state.dataSplitterComponent->SplitterCond(Count1).SplitterName + "\", not found on any AirLoopHVAC:SupplyPath.");
// ErrFound=.TRUE.
}
}
Expand Down
Loading

5 comments on commit ddc0f77

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

develop (mitchute) - x86_64-MacOS-10.15-clang-11.0.0: OK (2267 of 2267 tests passed, 0 test warnings)

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.

develop (mitchute) - Win64-Windows-10-VisualStudio-16: OK (2240 of 2240 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

develop (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (2287 of 2287 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

develop (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1548 of 1548 tests passed, 0 test warnings)

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

develop (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (722 of 722 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.