Skip to content

Commit

Permalink
Photovoltaics iii
Browse files Browse the repository at this point in the history
  • Loading branch information
jmythms committed Mar 21, 2021
1 parent 8879c05 commit 5892010
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
26 changes: 12 additions & 14 deletions src/EnergyPlus/Photovoltaics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,7 @@ namespace Photovoltaics {
using namespace DataPhotovoltaics;
using DataHVACGlobals::TimeStepSys;



void clear_state() {

}

void SimPVGenerator(EnergyPlusData &state,
Expand Down Expand Up @@ -1122,20 +1119,20 @@ namespace Photovoltaics {
// perform the one time initializations
if (state.dataPhotovoltaicState->MyOneTimeFlag) {
// initialize the environment and sizing flags
state.dataPhotovoltaicState->MyEnvrnFlag.dimension(NumPVs, true);
state.dataPhotovoltaicState->MyOneTimeFlag = false;
state.dataPhotovoltaicState->CheckEquipName.dimension(NumPVs, true);
state.dataPhotovoltaicState->CheckEquipName = false;
}

// Do the Begin Environment initializations
if (state.dataGlobal->BeginEnvrnFlag && state.dataPhotovoltaicState->MyEnvrnFlag(PVnum)) {
if (state.dataGlobal->BeginEnvrnFlag && state.dataPhotovoltaicState->CheckEquipName(PVnum)) {

PVarray(PVnum).TRNSYSPVcalc.CellTempK = state.dataSurface->Surface(PVarray(PVnum).SurfacePtr).OutDryBulbTemp + DataGlobalConstants::KelvinConv;
PVarray(PVnum).TRNSYSPVcalc.LastCellTempK = state.dataSurface->Surface(PVarray(PVnum).SurfacePtr).OutDryBulbTemp + DataGlobalConstants::KelvinConv;
state.dataPhotovoltaicState->MyEnvrnFlag(PVnum) = false;
state.dataPhotovoltaicState->CheckEquipName(PVnum) = false;
}

if (!state.dataGlobal->BeginEnvrnFlag) {
state.dataPhotovoltaicState->MyEnvrnFlag(PVnum) = true;
state.dataPhotovoltaicState->CheckEquipName(PVnum) = true;
}

// Do the beginning of every time step initializations
Expand Down Expand Up @@ -1181,6 +1178,7 @@ namespace Photovoltaics {
int const KMAX(100);
Real64 const EtaIni(0.10); // initial value of eta

static Real64 PVTimeStep; // internal timestep (in seconds) for cell temperature mode 3
Real64 DummyErr;
Real64 ETA;
Real64 Tambient;
Expand Down Expand Up @@ -1214,7 +1212,7 @@ namespace Photovoltaics {

// if the cell temperature mode is 2, convert the timestep to seconds
if (state.dataPhotovoltaicState->firstTime && PVarray(PVnum).CellIntegrationMode == iDecoupledUllebergDynamicCellIntegration) {
state.dataPhotovoltaicState->PVTimeStep = double(state.dataGlobal->MinutesPerTimeStep) * 60.0; // Seconds per time step
PVTimeStep = double(state.dataGlobal->MinutesPerTimeStep) * 60.0; // Seconds per time step
}
state.dataPhotovoltaicState->firstTime = false;

Expand Down Expand Up @@ -1250,11 +1248,11 @@ namespace Photovoltaics {
CellTemp =
Tambient +
(PVarray(PVnum).TRNSYSPVcalc.LastCellTempK - Tambient) *
std::exp(-PVarray(PVnum).TRNSYSPVModule.HeatLossCoef / PVarray(PVnum).TRNSYSPVModule.HeatCapacity * state.dataPhotovoltaicState->PVTimeStep) +
std::exp(-PVarray(PVnum).TRNSYSPVModule.HeatLossCoef / PVarray(PVnum).TRNSYSPVModule.HeatCapacity * PVTimeStep) +
(PVarray(PVnum).TRNSYSPVModule.TauAlpha - ETA) * PVarray(PVnum).TRNSYSPVcalc.Insolation /
PVarray(PVnum).TRNSYSPVModule.HeatLossCoef *
(1.0 -
std::exp(-PVarray(PVnum).TRNSYSPVModule.HeatLossCoef / PVarray(PVnum).TRNSYSPVModule.HeatCapacity * state.dataPhotovoltaicState->PVTimeStep));
std::exp(-PVarray(PVnum).TRNSYSPVModule.HeatLossCoef / PVarray(PVnum).TRNSYSPVModule.HeatCapacity * PVTimeStep));
} else if (SELECT_CASE_var == iSurfaceOutsideFaceCellIntegration) {
CellTemp = state.dataHeatBalSurf->SurfTempOut(PVarray(PVnum).SurfacePtr) + DataGlobalConstants::KelvinConv;
} else if (SELECT_CASE_var == iTranspiredCollectorCellIntegration) {
Expand Down Expand Up @@ -1327,7 +1325,7 @@ namespace Photovoltaics {
} else if (SELECT_CASE_var == iDecoupledUllebergDynamicCellIntegration) {
CellTemp = Tambient +
(PVarray(PVnum).TRNSYSPVcalc.LastCellTempK - Tambient) *
std::exp(-PVarray(PVnum).TRNSYSPVModule.HeatLossCoef / PVarray(PVnum).TRNSYSPVModule.HeatCapacity * state.dataPhotovoltaicState->PVTimeStep);
std::exp(-PVarray(PVnum).TRNSYSPVModule.HeatLossCoef / PVarray(PVnum).TRNSYSPVModule.HeatCapacity * PVTimeStep);
} else if (SELECT_CASE_var == iSurfaceOutsideFaceCellIntegration) {
CellTemp = state.dataHeatBalSurf->SurfTempOut(PVarray(PVnum).SurfacePtr) + DataGlobalConstants::KelvinConv;
} else if (SELECT_CASE_var == iTranspiredCollectorCellIntegration) {
Expand Down Expand Up @@ -1472,8 +1470,8 @@ namespace Photovoltaics {
// SUBROUTINE PARAMETER DEFINITIONS:
Real64 const DELTA(1.e-3);
Real64 const EPSILON(1.e-3);
Real64 const RONE((std::sqrt(5.0) - 1.0) / 2.0);
constexpr Real64 const RTWO((5.0) - 1.0 / 2.0);
static Real64 const RONE((std::sqrt(5.0) - 1.0) / 2.0);
static Real64 const RTWO(RONE * RONE);

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
Real64 C;
Expand Down
6 changes: 3 additions & 3 deletions src/EnergyPlus/Photovoltaics.hh
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,16 @@ struct PhotovoltaicStateData : BaseGlobalStruct {
bool GetInputFlag = true; // one time get input flag
bool MyOneTimeFlag = true;
bool firstTime = true;
Real64 PVTimeStep; // internal timestep (in seconds) for cell temperature mode 3
Array1D_bool MyEnvrnFlag;
static Array1D_bool MyEnvrnFlag;

void clear_state() override
{

CheckEquipName.clear();
GetInputFlag = true;
MyOneTimeFlag = true;
firstTime = true;
MyEnvrnFlag.clear();

}
};

Expand Down

5 comments on commit 5892010

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

Global-Psychrometrics (jmythms) - x86_64-MacOS-10.15-clang-11.0.0: Tests Failed (2739 of 3065 tests passed, 395 test warnings)

Messages:\n

  • 721 tests had: AUD diffs.
  • 619 tests had: RDD diffs.
  • 326 tests had: Table big diffs.
  • 63 tests had: Table small diffs.
  • 1 test had: ESO small diffs.

Failures:\n

regression Test Summary

  • Passed: 396
  • Failed: 326

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.

Global-Psychrometrics (jmythms) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: Tests Failed (2778 of 3105 tests passed, 398 test warnings)

Messages:\n

  • 725 tests had: AUD diffs.
  • 622 tests had: RDD diffs.
  • 327 tests had: Table big diffs.
  • 62 tests had: Table small diffs.
  • 2 tests had: ESO small diffs.
  • 1 test had: EIO diffs.
  • 1 test had: MTR small diffs.

Failures:\n

regression Test Summary

  • Passed: 415
  • Failed: 327

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

Global-Psychrometrics (jmythms) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1619 of 1619 tests passed, 0 test warnings)

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

Global-Psychrometrics (jmythms) - Win64-Windows-10-VisualStudio-16: OK (2314 of 2314 tests passed, 0 test warnings)

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.

Global-Psychrometrics (jmythms) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (726 of 727 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 726
  • Timeout: 1

Build Badge Test Badge Coverage Badge

Please sign in to comment.