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

Global HVACController, RootFinder, and others #8615

Merged
merged 22 commits into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
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
2 changes: 1 addition & 1 deletion src/EnergyPlus/AirLoopHVACDOAS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ namespace AirLoopHVACDOAS {
bool errorsFound = false;
if (this->m_FanIndex > 0 && this->m_FanTypeNum == SimAirServingZones::Fan_ComponentModel) {
Fans::SetFanData(state, this->m_FanIndex, errorsFound, Name, sizingMassFlow / state.dataEnvrn->StdRhoAir, 0);
Fans::Fan(this->m_FanIndex).MaxAirMassFlowRate = sizingMassFlow;
state.dataFans->Fan(this->m_FanIndex).MaxAirMassFlowRate = sizingMassFlow;
state.dataLoopNodes->Node(this->m_FanInletNodeNum).MassFlowRateMaxAvail = sizingMassFlow;
state.dataLoopNodes->Node(this->m_FanOutletNodeNum).MassFlowRateMaxAvail = sizingMassFlow;
state.dataLoopNodes->Node(this->m_FanOutletNodeNum).MassFlowRateMax = sizingMassFlow;
Expand Down
8 changes: 4 additions & 4 deletions src/EnergyPlus/AirflowNetworkBalanceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ namespace AirflowNetworkBalanceManager {
}
Real64 flowRate;

GetFanVolFlow(fanIndex, flowRate);
GetFanVolFlow(state, fanIndex, flowRate);
flowRate *= state.dataEnvrn->StdRhoAir;
bool nodeErrorsFound{false};
int inletNode = GetFanInletNode(state, "Fan:ZoneExhaust", thisObjectName, nodeErrorsFound);
Expand Down Expand Up @@ -1268,7 +1268,7 @@ namespace AirflowNetworkBalanceManager {
success = false;
}

GetFanVolFlow(fanIndex, flowRate);
GetFanVolFlow(state, fanIndex, flowRate);
flowRate *= state.dataEnvrn->StdRhoAir;

GetFanType(state, fan_name, fanType_Num, FanErrorFound);
Expand Down Expand Up @@ -9786,7 +9786,7 @@ namespace AirflowNetworkBalanceManager {
HVACFan::fanObjs[DisSysCompCVFData(AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).TypeNum).FanIndex]->AirLoopNum =
AirflowNetworkLinkageData(i).AirLoopNum;
} else {
SetFanAirLoopNumber(n, AirflowNetworkLinkageData(i).AirLoopNum);
SetFanAirLoopNumber(state, n, AirflowNetworkLinkageData(i).AirLoopNum);
}
}
if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).EPlusTypeNum == EPlusTypeNum_COI) {
Expand Down Expand Up @@ -10324,7 +10324,7 @@ namespace AirflowNetworkBalanceManager {
HVACFan::fanObjs[DisSysCompCVFData(typeNum).FanIndex]->designAirVolFlowRate * state.dataEnvrn->StdRhoAir;
} else {
Real64 FanFlow; // Return type
GetFanVolFlow(DisSysCompCVFData(typeNum).FanIndex, FanFlow);
GetFanVolFlow(state, DisSysCompCVFData(typeNum).FanIndex, FanFlow);
DisSysCompCVFData(typeNum).MaxAirMassFlowRate = FanFlow * state.dataEnvrn->StdRhoAir;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void BaseSizerWithScalableInputs::initializeWithinEP(EnergyPlusData &state,
coilSelectionReportObj->setCoilSupplyFanInfo(state,
this->compName,
this->compType,
Fans::Fan(SupFanNum).FanName,
state.dataFans->Fan(SupFanNum).FanName,
DataAirSystems::structArrayLegacyFanModels,
this->primaryAirSystem(this->curSysNum).SupFanNum);
}
Expand Down
4 changes: 0 additions & 4 deletions src/EnergyPlus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,15 @@ set(SRC
DataLoopNode.hh
DataMoistureBalance.cc
DataMoistureBalance.hh
DataMoistureBalanceEMPD.cc
DataMoistureBalanceEMPD.hh
DataOutputs.cc
DataOutputs.hh
DataPhotovoltaics.cc
DataPhotovoltaics.hh
DataPrecisionGlobals.cc
DataPrecisionGlobals.hh
DataReportingFlags.cc
DataReportingFlags.hh
DataRoomAirModel.cc
DataRoomAirModel.hh
DataRootFinder.cc
DataRootFinder.hh
DataRuntimeLanguage.cc
DataRuntimeLanguage.hh
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ void CoilCoolingDXCurveFitPerformance::calcStandardRatings(EnergyPlus::EnergyPlu
fanPowerCorrection = HVACFan::fanObjs[supplyFanIndex]->fanPower();
} else {
Fans::SimulateFanComponents(state, supplyFanName, true, supplyFanIndex, _, true, false, FanStaticPressureRise);
fanPowerCorrection = Fans::GetFanPower(supplyFanIndex);
fanPowerCorrection = Fans::GetFanPower(state, supplyFanIndex);
}

fanHeatCorrection = state.dataLoopNodes->Node(fanOutletNode).Enthalpy - state.dataLoopNodes->Node(fanInletNode).Enthalpy;
Expand Down Expand Up @@ -600,7 +600,7 @@ void CoilCoolingDXCurveFitPerformance::calcStandardRatings(EnergyPlus::EnergyPlu
fanPowerCorrection = HVACFan::fanObjs[supplyFanIndex]->fanPower();
} else {
Fans::SimulateFanComponents(state, supplyFanName, true, supplyFanIndex, _, true, false, FanStaticPressureRise);
fanPowerCorrection = Fans::GetFanPower(supplyFanIndex);
fanPowerCorrection = Fans::GetFanPower(state, supplyFanIndex);
}

fanHeatCorrection = state.dataLoopNodes->Node(fanOutletNode).Enthalpy - state.dataLoopNodes->Node(fanInletNode).Enthalpy;
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/CondenserLoopTowers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5440,7 +5440,7 @@ namespace CondenserLoopTowers {

// PURPOSE OF THIS SUBROUTINE:
// To verify that the empirical model's independent variables are within the limits used during the
// developement of the empirical model.
// development of the empirical model.

// METHODOLOGY EMPLOYED:
// The empirical models used for simulating a variable speed cooling tower are based on a limited data set.
Expand Down
14 changes: 7 additions & 7 deletions src/EnergyPlus/Construction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,24 +113,24 @@ namespace EnergyPlus::Construction {
// Urbana-Champaign, 1995.

// SUBROUTINE PARAMETER DEFINITIONS:
Real64 const PhysPropLimit(1.0e-6); // Physical properties limit.
constexpr Real64 PhysPropLimit(1.0e-6); // Physical properties limit.
// This is more or less the traditional value from BLAST.

Real64 const RValueLowLimit(1.0e-3); // Physical properties limit for R-value only layers
constexpr Real64 RValueLowLimit(1.0e-3); // Physical properties limit for R-value only layers
// This value was based on trial and error related to CR 7791 where a
// user had entered a "no insulation" layer with an R-value of 1.0E-05.
// Some trial and error established this as a potential value though
// there is no guarantee that this is a good value.

int const MinNodes(6); // Minimum number of state space nodes
constexpr int MinNodes(6); // Minimum number of state space nodes
// per layer. This value was chosen based on experience with IBLAST.

Real64 const MaxAllowedCTFSumError(0.01); // Allow a 1 percent
constexpr Real64 MaxAllowedCTFSumError(0.01); // Allow a 1 percent
// difference between the CTF series summations. If the difference is
// greater than this, then the coefficients will not yield a valid steady
// state solution.

Real64 const MaxAllowedTimeStep(4.0); // Sets the maximum allowed time step
constexpr Real64 MaxAllowedTimeStep(4.0); // Sets the maximum allowed time step
// for CTF calculations to be 4 hours. This is done in response to some
// rare situations where odd or faulty input will cause the routine to
// go off and get some huge time step (in excess of 20 hours). This value
Expand Down Expand Up @@ -1100,7 +1100,7 @@ namespace EnergyPlus::Construction {
// Calculation Code in BEST", BSO internal document,
// May/June 1996.

Real64 const DPLimit(1.0e-20);
constexpr Real64 DPLimit(1.0e-20);
// This argument is nice, but not sure it's accurate -- LKL Nov 1999.
// Parameter set to the significant figures limit of double
// precision variables plus a safety factor.- The argument for setting this parameter to 1E-20 involves the
Expand Down Expand Up @@ -1576,7 +1576,7 @@ namespace EnergyPlus::Construction {
// dissertation.

// SUBROUTINE PARAMETER DEFINITIONS:
Real64 const ConvrgLim(1.0e-13); // Convergence limit (ratio) for cutting off the calculation of further
constexpr Real64 ConvrgLim(1.0e-13); // Convergence limit (ratio) for cutting off the calculation of further
// CTFs. This value was found to give suitable accuracy in IBLAST.

Real64 avg; // Intermediate calculation variable (average)
Expand Down
8 changes: 4 additions & 4 deletions src/EnergyPlus/DXCoils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8255,7 +8255,7 @@ namespace EnergyPlus::DXCoils {
if (Coil.SupplyFan_TypeNum == DataHVACGlobals::FanType_SystemModelObject) {
locFanElecPower = HVACFan::fanObjs[Coil.SupplyFanIndex]->fanPower();
} else {
locFanElecPower = Fans::GetFanPower(Coil.SupplyFanIndex);
locFanElecPower = Fans::GetFanPower(state, Coil.SupplyFanIndex);
}

// calculate evaporator total cooling capacity
Expand Down Expand Up @@ -13644,7 +13644,7 @@ namespace EnergyPlus::DXCoils {
} else {
Fans::SimulateFanComponents(
state, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanName, true, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex, _, true, false, FanStaticPressureRise);
FanPowerCorrection = Fans::GetFanPower(state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex);
FanPowerCorrection = Fans::GetFanPower(state, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex);
}

FanHeatCorrection = state.dataLoopNodes->Node(FanOutletNode).Enthalpy - state.dataLoopNodes->Node(FanInletNode).Enthalpy;
Expand Down Expand Up @@ -13786,7 +13786,7 @@ namespace EnergyPlus::DXCoils {
} else {
Fans::SimulateFanComponents(
state, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanName, true, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex, _, true, false, FanStaticPressureRise);
FanPowerCorrection = Fans::GetFanPower(state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex);
FanPowerCorrection = Fans::GetFanPower(state, state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex);
}

FanHeatCorrection = state.dataLoopNodes->Node(FanOutletNode).Enthalpy - state.dataLoopNodes->Node(FanInletNode).Enthalpy;
Expand Down Expand Up @@ -15175,7 +15175,7 @@ namespace EnergyPlus::DXCoils {
coilSelectionReportObj->setCoilSupplyFanInfo(state,
state.dataDXCoils->DXCoil(DXCoilNum).Name,
state.dataDXCoils->DXCoil(DXCoilNum).DXCoilType,
Fans::Fan(state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex).FanName,
state.dataFans->Fan(state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex).FanName,
DataAirSystems::structArrayLegacyFanModels,
state.dataDXCoils->DXCoil(DXCoilNum).SupplyFanIndex);
}
Expand Down
87 changes: 0 additions & 87 deletions src/EnergyPlus/DataMoistureBalanceEMPD.cc

This file was deleted.

36 changes: 20 additions & 16 deletions src/EnergyPlus/DataMoistureBalanceEMPD.hh
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,31 @@ namespace DataMoistureBalanceEMPD {

constexpr Real64 Lam(2500000.0); // heat of adsorption for building materials

// MODULE VARIABLE DECLARATIONS:
// Variables that are used in both the Surface Heat Balance and the Moisture Balance
extern Array1D<Real64> RVSurfaceOld; // Moisture level at interior surfaces at previous time step
extern Array1D<Real64> RVSurface; // Moisture level at interior surfaces at current interation
// and current time step
extern Array1D<Real64> HeatFluxLatent; // Moisture flux at interior surfaces [W]
extern Array1D<Real64> RVSurfLayerOld;
extern Array1D<Real64> RVdeepOld;
extern Array1D<Real64> RVSurfLayer;
extern Array1D<Real64> RVDeepLayer;
extern Array1D<Real64> RVwall;

void clear_state();

} // namespace DataMoistureBalanceEMPD

struct MoistureBalanceEMPDData : BaseGlobalStruct {
struct MoistureBalanceEMPDData : BaseGlobalStruct
{

// Variables that are used in both the Surface Heat Balance and the Moisture Balance
Array1D<Real64> RVSurfaceOld; // Moisture level at interior surfaces at previous time step
Array1D<Real64> RVSurface; // Moisture level at interior surfaces at current iteration and current time step
Array1D<Real64> HeatFluxLatent; // Moisture flux at interior surfaces [W]
Array1D<Real64> RVSurfLayerOld;
Array1D<Real64> RVdeepOld;
Array1D<Real64> RVSurfLayer;
Array1D<Real64> RVDeepLayer;
Array1D<Real64> RVwall;

void clear_state() override
{

this->RVSurfaceOld.deallocate();
this->RVSurface.deallocate();
this->HeatFluxLatent.deallocate();
this->RVSurfLayerOld.deallocate();
this->RVdeepOld.deallocate();
this->RVSurfLayer.deallocate();
this->RVDeepLayer.deallocate();
this->RVwall.deallocate();
}
};

Expand Down
Loading