-
Notifications
You must be signed in to change notification settings - Fork 396
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
Photovoltaic Thermal Collector Plant Component Refactor #7652
Changes from all commits
859516d
47a61af
d4671e8
e913827
893237d
ca75cac
609022f
1e80ed0
def2a77
af63c80
13ba04f
221885a
983daf0
2db4b85
41ffe35
1f29ab9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,7 @@ | |
#include <EnergyPlus/OutAirNodeManager.hh> | ||
#include <EnergyPlus/OutputProcessor.hh> | ||
#include <EnergyPlus/OutputReportPredefined.hh> | ||
#include <EnergyPlus/Plant/PlantLocation.hh> | ||
#include <EnergyPlus/PhotovoltaicThermalCollectors.hh> | ||
#include <EnergyPlus/Psychrometrics.hh> | ||
#include <EnergyPlus/ReportSizingManager.hh> | ||
|
@@ -458,7 +459,7 @@ namespace MixedAir { | |
OACoolCoil, | ||
OAHX); | ||
} | ||
// now simulate again propogate current temps back through OA system | ||
// now simulate again propigate current temps back through OA system | ||
for (CompNum = 1; CompNum <= OutsideAirSys(OASysNum).NumComponents; ++CompNum) { | ||
CompType = OutsideAirSys(OASysNum).ComponentType(CompNum); | ||
CompName = OutsideAirSys(OASysNum).ComponentName(CompNum); | ||
|
@@ -599,8 +600,6 @@ namespace MixedAir { | |
using HVACDXSystem::SimDXCoolingSystem; | ||
using HVACHXAssistedCoolingCoil::HXAssistedCoil; | ||
using HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil; | ||
using PhotovoltaicThermalCollectors::CalledFromOutsideAirSystem; | ||
using PhotovoltaicThermalCollectors::SimPVTcollectors; | ||
using SimAirServingZones::SolveWaterCoilController; | ||
using SteamCoils::SimulateSteamCoilComponents; | ||
using TranspiredCollector::SimTranspiredCollector; | ||
|
@@ -831,7 +830,10 @@ namespace MixedAir { | |
// Air-based Photovoltaic-thermal flat plate collector | ||
} else if (SELECT_CASE_var == PVT_AirBased) { // 'SolarCollector:FlatPlate:PhotovoltaicThermal' | ||
if (Sim) { | ||
SimPVTcollectors(CompIndex, FirstHVACIteration, CalledFromOutsideAirSystem, CompName); | ||
if (CompIndex == 0) { | ||
CompIndex = PhotovoltaicThermalCollectors::getPVTindexFromName(CompName); | ||
} | ||
PhotovoltaicThermalCollectors::simPVTfromOASys(CompIndex, FirstHVACIteration); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Much better, thanks! |
||
} | ||
|
||
// Evaporative Cooler Types | ||
|
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,67 +50,42 @@ | |
|
||
// ObjexxFCL Headers | ||
#include <ObjexxFCL/Array1D.hh> | ||
#include <ObjexxFCL/Optional.hh> | ||
|
||
// EnergyPlus Headers | ||
#include <EnergyPlus/DataGlobals.hh> | ||
#include <EnergyPlus/EnergyPlus.hh> | ||
#include <EnergyPlus/PlantComponent.hh> | ||
|
||
namespace EnergyPlus { | ||
|
||
namespace PhotovoltaicThermalCollectors { | ||
|
||
// Using/Aliasing | ||
|
||
// Data | ||
// MODULE PARAMETER DEFINITIONS: | ||
extern int const SimplePVTmodel; | ||
extern int const LayerByLayerPVTmodel; | ||
|
||
extern int const ScheduledThermEffic; // mode for thermal efficiency is to use schedule | ||
extern int const FixedThermEffic; // mode for thermal efficiency is to use fixed value | ||
|
||
extern int const LiquidWorkingFluid; | ||
extern int const AirWorkingFluid; | ||
|
||
extern int const CalledFromPlantLoopEquipMgr; | ||
extern int const CalledFromOutsideAirSystem; | ||
|
||
extern Real64 const SimplePVTWaterSizeFactor; // [ m3/s/m2 ] average of collectors in SolarCollectors.idf | ||
|
||
// DERIVED TYPE DEFINITIONS: | ||
|
||
// MODULE VARIABLE DECLARATIONS: | ||
extern Array1D_bool CheckEquipName; | ||
extern int NumPVT; // count of all types of PVT in input file | ||
extern int NumSimplePVTPerform; // count of simple PVT performance objects in input file | ||
|
||
// SUBROUTINE SPECIFICATIONS FOR MODULE: | ||
// Driver/Manager Routines | ||
|
||
// Utility routines for module | ||
// these would be public such as: | ||
// PUBLIC GetPVTIncidentSolarForInternalPVLayer | ||
// PUBLIC GetPVTCellTemp | ||
enum struct WorkingFluidEnum | ||
{ | ||
LIQUID, | ||
AIR | ||
}; | ||
|
||
// Types | ||
enum struct ThermEfficEnum | ||
{ | ||
SCHEDULED, | ||
FIXED | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
struct SimplePVTModelStruct | ||
{ | ||
// Members | ||
std::string Name; | ||
Real64 ThermalActiveFract; // fraction of surface area with active thermal collection | ||
int ThermEfficMode; // setting for how therm effic is determined | ||
Real64 ThermEffic; // fixed or current Therm efficiency | ||
int ThermEffSchedNum; // pointer to schedule for therm effic (if any) | ||
Real64 SurfEmissivity; // surface emittance in long wave IR | ||
Real64 LastCollectorTemp; // store previous temperature | ||
Real64 CollectorTemp; // average solar collector temp. | ||
Real64 ThermalActiveFract; // fraction of surface area with active thermal collection | ||
ThermEfficEnum ThermEfficMode; // setting for how therm effic is determined | ||
Real64 ThermEffic; // fixed or current Therm efficiency | ||
int ThermEffSchedNum; // pointer to schedule for therm effic (if any) | ||
Real64 SurfEmissivity; // surface emittance in long wave IR | ||
Real64 LastCollectorTemp; // store previous temperature | ||
Real64 CollectorTemp; // average solar collector temp. | ||
|
||
// Default Constructor | ||
SimplePVTModelStruct() | ||
: ThermalActiveFract(0.0), ThermEfficMode(0), ThermEffic(0.0), ThermEffSchedNum(0), SurfEmissivity(0.0), LastCollectorTemp(0.0), | ||
CollectorTemp(0.0) | ||
: ThermalActiveFract(0.0), ThermEfficMode(ThermEfficEnum::FIXED), ThermEffic(0.0), ThermEffSchedNum(0), SurfEmissivity(0.0), | ||
LastCollectorTemp(0.0), CollectorTemp(0.0) | ||
{ | ||
} | ||
}; | ||
|
@@ -136,88 +111,86 @@ namespace PhotovoltaicThermalCollectors { | |
} | ||
}; | ||
|
||
struct PVTCollectorStruct | ||
struct PVTCollectorStruct : PlantComponent | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
{ | ||
// Members | ||
// input | ||
std::string Name; // Name of PVT collector | ||
int TypeNum; // Plant Side Connection: 'TypeOf_Num' assigned in DataPlant !DSU | ||
int WLoopNum; // Water plant loop index number !DSU | ||
int WLoopSideNum; // Water plant loop side index !DSU | ||
int WLoopBranchNum; // Water plant loop branch index !DSU | ||
int WLoopCompNum; // Water plant loop component index !DSU | ||
bool EnvrnInit; // manage begin environmen inits | ||
bool SizingInit; // manage when sizing is complete | ||
std::string PVTModelName; // Name of PVT performance object | ||
int PVTModelType; // model type indicator, only simple avail now | ||
int SurfNum; // surface index | ||
std::string PVname; // named Generator:Photovoltaic object | ||
int PVnum; // PV index | ||
bool PVfound; // init, need to delay get input until PV gotten | ||
// INTEGER :: PlantLoopNum = 0 ! needed for sizing and control | ||
// INTEGER :: PlantLoopSide = 0 ! needed for sizing, demand vs. supply sided | ||
std::string Name; // Name of PVT collector | ||
int TypeNum; // Plant Side Connection: 'TypeOf_Num' assigned in DataPlant | ||
int WLoopNum; // Water plant loop index number | ||
int WLoopSideNum; // Water plant loop side index | ||
int WLoopBranchNum; // Water plant loop branch index | ||
int WLoopCompNum; // Water plant loop component index | ||
bool EnvrnInit; // manage begin environment inits | ||
bool SizingInit; // manage when sizing is complete | ||
std::string PVTModelName; // Name of PVT performance object | ||
int PVTModelType; // model type indicator, only simple avail now | ||
int SurfNum; // surface index | ||
std::string PVname; // named Generator:Photovoltaic object | ||
int PVnum; // PV index | ||
bool PVfound; // init, need to delay get input until PV gotten | ||
SimplePVTModelStruct Simple; // performance data structure. | ||
int WorkingFluidType; | ||
WorkingFluidEnum WorkingFluidType; | ||
int PlantInletNodeNum; | ||
int PlantOutletNodeNum; | ||
int HVACInletNodeNum; | ||
int HVACOutletNodeNum; | ||
Real64 DesignVolFlowRate; | ||
bool DesignVolFlowRateWasAutoSized; // true if design volume flow rate was autosize on input | ||
Real64 MaxMassFlowRate; | ||
Real64 MassFlowRate; // DSU | ||
Real64 MassFlowRate; | ||
Real64 AreaCol; | ||
bool BypassDamperOff; | ||
bool CoolingUseful; | ||
bool HeatingUseful; | ||
PVTReportStruct Report; | ||
bool MySetPointCheckFlag; | ||
bool MyOneTimeFlag; | ||
bool SetLoopIndexFlag; | ||
|
||
// Default Constructor | ||
PVTCollectorStruct() | ||
: WLoopNum(0), WLoopSideNum(0), WLoopBranchNum(0), WLoopCompNum(0), EnvrnInit(true), SizingInit(true), PVTModelType(0), SurfNum(0), | ||
PVnum(0), PVfound(false), WorkingFluidType(0), PlantInletNodeNum(0), PlantOutletNodeNum(0), HVACInletNodeNum(0), HVACOutletNodeNum(0), | ||
DesignVolFlowRate(0.0), DesignVolFlowRateWasAutoSized(false), MaxMassFlowRate(0.0), MassFlowRate(0.0), AreaCol(0.0), | ||
BypassDamperOff(true), CoolingUseful(false), HeatingUseful(false) | ||
: TypeNum(0), WLoopNum(0), WLoopSideNum(0), WLoopBranchNum(0), WLoopCompNum(0), EnvrnInit(true), SizingInit(true), PVTModelType(0), | ||
SurfNum(0), PVnum(0), PVfound(false), WorkingFluidType(WorkingFluidEnum::LIQUID), PlantInletNodeNum(0), PlantOutletNodeNum(0), | ||
HVACInletNodeNum(0), HVACOutletNodeNum(0), DesignVolFlowRate(0.0), DesignVolFlowRateWasAutoSized(false), MaxMassFlowRate(0.0), | ||
MassFlowRate(0.0), AreaCol(0.0), BypassDamperOff(true), CoolingUseful(false), HeatingUseful(false), MySetPointCheckFlag(true), | ||
MyOneTimeFlag(true), SetLoopIndexFlag(true) | ||
{ | ||
} | ||
}; | ||
|
||
// Object Data | ||
extern Array1D<PVTCollectorStruct> PVT; | ||
static PlantComponent *factory(std::string const &objectName); | ||
|
||
// Functions | ||
void onInitLoopEquip(const PlantLocation &calledFromLocation) override; | ||
|
||
void SimPVTcollectors(int &PVTnum, // index to PVT array. | ||
bool const FirstHVACIteration, | ||
int const CalledFrom, | ||
Optional_string_const PVTName = _, | ||
Optional_bool_const InitLoopEquip = _); | ||
void simulate(const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, bool RunFlag) override; | ||
|
||
void GetPVTcollectorsInput(); | ||
void setupReportVars(); | ||
|
||
void initialize(bool FirstHVACIteration); | ||
|
||
void size(); | ||
|
||
void InitPVTcollectors(int const PVTnum, bool const FirstHVACIteration); | ||
void control(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, great naming! |
||
|
||
void SizePVT(int const PVTnum); | ||
void calculate(); | ||
|
||
void ControlPVTcollector(int const PVTnum); | ||
void update(); | ||
}; | ||
|
||
extern Array1D<PVTCollectorStruct> PVT; | ||
|
||
void clear_state(); | ||
|
||
void GetPVTcollectorsInput(); | ||
|
||
void CalcPVTcollectors(int const PVTnum); | ||
void simPVTfromOASys(int index, bool FirstHVACIteration); | ||
|
||
void UpdatePVTcollectors(int const PVTnum); | ||
int getPVTindexFromName(std::string const &name); | ||
|
||
void GetPVTThermalPowerProduction(int const PVindex, // index of PV generator (not PVT collector) | ||
Real64 &ThermalPower, | ||
Real64 &ThermalEnergy); | ||
int GetAirInletNodeNum(std::string const &PVTName, | ||
bool &ErrorsFound | ||
); | ||
void GetPVTThermalPowerProduction(int PVindex, Real64 &ThermalPower, Real64 &ThermalEnergy); | ||
|
||
int GetAirOutletNodeNum(std::string const &PVTName, | ||
bool &ErrorsFound | ||
); | ||
int GetAirInletNodeNum(std::string const &PVTName, bool &ErrorsFound); | ||
|
||
//===================== Utility/Other routines for module. | ||
// Insert as appropriate | ||
int GetAirOutletNodeNum(std::string const &PVTName, bool &ErrorsFound); | ||
|
||
} // namespace PhotovoltaicThermalCollectors | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"propagate" 😄