Skip to content

Commit

Permalink
(#90) protect against zero panel temperature
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonlharvey committed Jun 21, 2024
1 parent aad3c18 commit cddabf9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
4 changes: 3 additions & 1 deletion aspects/electrical/SolarArray/GunnsElectPvString2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,9 @@ void GunnsElectPvString2::update()
mSeriesVoltageDrop = mConfig->mBlockingDiodeVoltageDrop
+ mNumBypassedGroups * mConfig->mBypassDiodeVoltageDrop;

if (mNumActiveCells > 0) {
/// - Skip updating the model, and instead zero the string outputs, if there are no active
/// cells or if temperature is near zero.
if (mNumActiveCells > 0 and mInput->mTemperature > 1.0) {
if (mMalfDegradeFlag) {
mEqProps->update(mRefCell, mInput->mTemperature, mInput->mPhotoFlux, MsMath::limitRange(0.0, mMalfDegradeValue, 1.0));
} else {
Expand Down
34 changes: 34 additions & 0 deletions aspects/electrical/SolarArray/test/UtGunnsElectPvString2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,31 @@ void UtGunnsElectPvString2::testStep()
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mMpp.mCurrent, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mMpp.mPower, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mMpp.mConductance, 0.0);
} {
/// @test Update outputs zero panel temperature so the string makes no power.
tArticle->mMalfCellGroupValue = 0;
tInputData->mTemperature = 0.0;
CPPUNIT_ASSERT_NO_THROW(tArticle->update());
CPPUNIT_ASSERT_EQUAL(tNumCells, static_cast<int>(tArticle->mNumActiveCells));
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mEqProps->mTemperature, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mEqProps->mPhotoFlux, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mEqProps->mVoc, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mEqProps->mIsc, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mEqProps->mVmp, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mEqProps->mImp, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mEqProps->mNVt, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mEqProps->mRs, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mEqProps->mRsh, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mEqProps->mI0, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mEqProps->mIL, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mEqProps->mEfficiency, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mEqProps->mFillFactor, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mShortCircuitCurrent, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mOpenCircuitVoltage, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mMpp.mVoltage, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mMpp.mCurrent, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mMpp.mPower, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mMpp.mConductance, 0.0);
} {
/// @test Update outputs with MPP voltage = 0, for coverage. We force this by manipulating
/// the blocking diode voltage to be higher than the entire output of all the cells.
Expand All @@ -908,6 +933,15 @@ void UtGunnsElectPvString2::testStep()
tConfigData->mBlockingDiodeVoltageDrop = 10.0;
CPPUNIT_ASSERT_NO_THROW(tArticle->update());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mMpp.mConductance, 0.0);
} {
/// @test updateMpp in the zero voltage case for code coverage.
tArticle->mEqProps->mVmp = 0.0;
tArticle->mEqProps->mImp = 1.0;
tArticle->updateMpp();
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mMpp.mVoltage, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, tArticle->mMpp.mCurrent, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mMpp.mPower, 0.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, tArticle->mMpp.mConductance, 0.0);
}

UT_PASS;
Expand Down

0 comments on commit cddabf9

Please sign in to comment.