Skip to content

Commit

Permalink
Merge pull request #8275 from NREL/sam_pvwatts
Browse files Browse the repository at this point in the history
Update PVWatts using SAM Simulation Core library
  • Loading branch information
Myoldmopar authored Jan 29, 2021
2 parents 44de053 + db5d14b commit ce50183
Show file tree
Hide file tree
Showing 1,729 changed files with 3,903,917 additions and 2,758 deletions.
32 changes: 32 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/third_party/Windows-CalcEngine/src/Si
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/third_party/Windows-CalcEngine/src/SpectralAveraging/include)
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/third_party/Windows-CalcEngine/src/Tarcog/include)
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/third_party/Windows-CalcEngine/src/Viewer/include)
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/third_party/ssc )
if( OPENGL_FOUND )
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/third_party/penumbra/include )
endif()
Expand Down Expand Up @@ -249,6 +250,37 @@ ENDIF()
ADD_SUBDIRECTORY(third_party/Windows-CalcEngine)
set_target_properties(Windows-CalcEngine PROPERTIES FOLDER ThirdParty/Windows-CalcEngine)

# SAM Simulation Core (SSC)
mark_as_advanced(FORCE JSONCPP_USE_SECURE_MEMORY)
mark_as_advanced(FORCE JSONCPP_WITH_CMAKE_PACKAGE)
mark_as_advanced(FORCE JSONCPP_WITH_EXAMPLE)
mark_as_advanced(FORCE JSONCPP_WITH_PKGCONFIG_SUPPORT)
mark_as_advanced(FORCE JSONCPP_WITH_STRICT_ISO)
mark_as_advanced(FORCE JSONCPP_WITH_TESTS)
set(JSONCPP_WITH_TESTS OFF CACHE BOOL "Compile and (for jsoncpp_check) run JsonCpp test executables" FORCE)
mark_as_advanced(FORCE JSONCPP_WITH_WARNING_AS_ERROR)
mark_as_advanced(FORCE DEBUG_LIBNAME_SUFFIX)
mark_as_advanced(FORCE JSONCPP_WITH_POST_BUILD_UNITTEST)
set(JSONCPP_WITH_POST_BUILD_UNITTEST OFF CACHE BOOL "Automatically run unit-tests as a post build step" FORCE)
mark_as_advanced(FORCE CCACHE_FOUND)
set(SAM_SKIP_TOOLS ON CACHE BOOL "Skips the sdktool and tcsconsole builds" FORCE)
mark_as_advanced(FORCE SAM_SKIP_TOOLS)
set(SAM_SKIP_TESTS ON CACHE BOOL "Skips building tests" FORCE)
mark_as_advanced(FORCE SAM_SKIP_TESTS)
set(SAMAPI_EXPORT OFF CACHE BOOL "Export of ssc binaries to the SAM_api directory; for Unix, compile ssc libraries for SAM_api" FORCE)
mark_as_advanced(FORCE SAMAPI_EXPORT)
ADD_SUBDIRECTORY(third_party/ssc)
set_target_properties(ssc PROPERTIES FOLDER ThirdParty/ssc)
IF ( CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" ) # g++/Clang
target_compile_options(splinter PUBLIC -Wno-error -w)
target_compile_options(shared PUBLIC -Wno-error -w)
target_compile_options(ssc PUBLIC -Wno-error -w)
ELSEIF( MSVC ) # VisualStudio
target_compile_options(splinter PUBLIC /W0)
target_compile_options(shared PUBLIC /W0)
target_compile_options(ssc PUBLIC /W0)
ENDIF()

# Btwxt
INCLUDE_DIRECTORIES( ${gtest_SOURCE_DIR}/include/ SYSTEM )
set(BUILD_BTWXT_TESTING ${BUILD_TESTING} CACHE BOOL "" FORCE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4762,7 +4762,7 @@ \subsubsection{Inputs}\label{inputs-22}

\subsection{Generator:PVWatts}\label{generatorpvwatts}

PVWatts is a web application and module in NREL's System Advisor Model (SAM) software that estimates the electricity production of a grid-connected photovoltaic system based on a few simple inputs. This object brings the same calculations from PVWatts into an EnergyPlus whole building simulation without the need to call the web application API or SAM SDK. It provides a good alternative to the \hyperref[generatorphotovoltaic-000]{Generator:Photovoltaic} object when detailed information about the PV array is not available such as in a first pass analysis or when the desire is to achieve comparable results to PVWatts outside of EnergyPlus. To get comparable results to PVWatts, it should be used with the \hyperref[electricloadcenterinverterpvwatts]{ElectricLoadCenter:Inverter:PVWatts}.
PVWatts is a web application and module in NREL's System Advisor Model (SAM) software that estimates the electricity production of a grid-connected photovoltaic system based on a few simple inputs. This object brings the same calculations from PVWatts into an EnergyPlus whole building simulation without the need to call the web application API or SAM SDK. It provides a good alternative to the \hyperref[generatorphotovoltaic-000]{Generator:Photovoltaic} object when detailed information about the PV array is not available such as in a first pass analysis or when the desire is to achieve comparable results to PVWatts outside of EnergyPlus. To get comparable results to PVWatts, it should be used with the \hyperref[electricloadcenterinverterpvwatts]{ElectricLoadCenter:Inverter:PVWatts}. The PVWatts:Generator uses SAM 2020.11.29 Revision 0, SSC Revision 250.

\subsubsection{Inputs}\label{input-description}

Expand Down Expand Up @@ -4908,6 +4908,8 @@ \subsubsection{Outputs Description}\label{outputs-description}
HVAC,Average,Plane of Array Irradiance $\left [\frac{\text{W}}{\text{m}^2} \right ]$
\item
HVAC,Average,Generator PV Cell Temperature {[}C{]}
\item
HVAC,Average,Shaded Percent {[}\%{]}
\end{itemize}


Expand Down
4 changes: 1 addition & 3 deletions src/EnergyPlus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,6 @@ SET( SRC
OutsideEnergySources.hh
PVWatts.cc
PVWatts.hh
PVWattsSSC.cc
PVWattsSSC.hh
PackagedTerminalHeatPump.cc
PackagedTerminalHeatPump.hh
PackagedThermalStorageCoil.cc
Expand Down Expand Up @@ -778,7 +776,7 @@ endif()
# first we will create a static library of EnergyPlus
# this will be linked statically to create the DLL and also the unit tests
add_library( energypluslib STATIC ${SRC} )
target_link_libraries( energypluslib fmt::fmt objexx sqlite bcvtb epexpat epfmiimport re2 DElight libkiva btwxt Windows-CalcEngine airflownetworklib )
target_link_libraries( energypluslib fmt::fmt objexx sqlite bcvtb epexpat epfmiimport re2 DElight libkiva btwxt Windows-CalcEngine airflownetworklib ssc )
if (OPENGL_FOUND)
target_link_libraries( energypluslib penumbra )
endif()
Expand Down
19 changes: 19 additions & 0 deletions src/EnergyPlus/ElectricPowerServiceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,10 @@ ElectPowerLoadCenter::ElectPowerLoadCenter(EnergyPlusData &state, int const obje
} else {
PVWatts::PVWattsGenerator &pvwGen = PVWatts::GetOrCreatePVWattsGenerator(state, generatorController->name);
totalDCCapacity += pvwGen.getDCSystemCapacity();

// Pass the inverter properties to the PVWatts generator class
pvwGen.setDCtoACRatio(inverterObj->pvWattsDCtoACSizeRatio());
pvwGen.setInverterEfficiency(inverterObj->pvWattsInverterEfficiency());
}
}
if (!errorsFound) {
Expand Down Expand Up @@ -2503,6 +2507,16 @@ Real64 DCtoACInverter::pvWattsDCCapacity()
return ratedPower_ * pvWattsDCtoACSizeRatio_;
}

Real64 DCtoACInverter::pvWattsInverterEfficiency()
{
return pvWattsInverterEfficiency_;
}

Real64 DCtoACInverter::pvWattsDCtoACSizeRatio()
{
return pvWattsDCtoACSizeRatio_;
}

Real64 DCtoACInverter::thermLossRate() const
{
return thermLossRate_;
Expand Down Expand Up @@ -2601,6 +2615,9 @@ void DCtoACInverter::calcEfficiency(EnergyPlusData &state)
break;
}
case InverterModelType::pvWatts: {
// This code is lifted from ssc cmod_pvwatts5.cpp:powerout() method.
// It was easier to do this calculation here because we have a many to one relationship between inverter
// and generator whereas theirs is one to one.
Real64 const etaref = 0.9637;
Real64 const A = -0.0162;
Real64 const B = -0.0059;
Expand All @@ -2617,6 +2634,8 @@ void DCtoACInverter::calcEfficiency(EnergyPlusData &state)
// clipping
ac = ratedPower_;
}
// make sure no negative AC values (no parasitic nighttime losses calculated)
if (ac < 0) ac = 0;
efficiency_ = ac / dCPowerIn_;
} else {
efficiency_ = 0.0;
Expand Down
4 changes: 4 additions & 0 deletions src/EnergyPlus/ElectricPowerServiceManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ public: // Methods

Real64 pvWattsDCCapacity();

Real64 pvWattsInverterEfficiency();

Real64 pvWattsDCtoACSizeRatio();

Real64 thermLossRate() const;

Real64 getLossRateForOutputPower(EnergyPlusData &state, Real64 const powerOutOfInverter);
Expand Down
Loading

10 comments on commit ce50183

@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 (Myoldmopar) - x86_64-MacOS-10.15-clang-11.0.0: OK (2275 of 2275 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 (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2248 of 2248 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.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (2295 of 2295 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 (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1556 of 1556 tests passed, 0 test warnings)

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

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

Failures:\n

integration Test Summary

  • Passed: 721
  • Failed: 1

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

176742533_Issue8497 (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3031 of 3032 tests passed, 0 test warnings)

Messages:\n

  • 1 test had: ESO big diffs.

Failures:\n

regression Test Summary

  • Passed: 736
  • Failed: 1

Build Badge Test Badge

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

176742533_Issue8497 (Myoldmopar) - x86_64-MacOS-10.15-clang-11.0.0: OK (2991 of 2992 tests passed, 0 test warnings)

Messages:\n

  • 1 test had: ESO big diffs.

Failures:\n

regression Test Summary

  • Passed: 716
  • Failed: 1

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.

176742533_Issue8497 (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1556 of 1556 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.

176742533_Issue8497 (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2248 of 2248 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.

176742533_Issue8497 (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (721 of 722 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 721
  • Failed: 1

Build Badge Test Badge Coverage Badge

Please sign in to comment.