Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
040216c
added pvwattsv8 compute module, currently copy of pvwattsv7
May 7, 2021
62ad380
added variable comments pvwattsv8
May 7, 2021
2ebb8ad
Merge branch 'develop' into pvwattsv8
May 28, 2021
4e7022f
add outputs to pvwattsv8 and frame out additions
May 28, 2021
d4a8c9d
Merge branch 'develop' into pvwattsv8
Jun 4, 2021
bf0388c
first crack at inverter model updates
Jul 30, 2021
c13c9ad
Merge branch 'develop' into pvwattsv8
Aug 13, 2021
8bd1ba5
Merge branch 'develop' into pvwattsv8
Aug 20, 2021
5c5e121
began tearing pvwattsv8 apart to insert the cec module model instead …
Aug 20, 2021
2111317
updated module coefficient assumptions for pvwattsv8 and started to t…
Sep 7, 2021
763971f
Merge branch 'develop' into pvwattsv8
Sep 10, 2021
3634e32
updated module, thermal, and inverter model in pvwattsv8, no testing yet
Sep 10, 2021
4cd404c
added pvwattsv8 tests
Sep 16, 2021
a93e0dd
updated pvwatts tests to all use one input_cases file and modified sa…
Sep 17, 2021
f41c254
merge develop and fix licenses
Sep 23, 2021
87a9c60
fix licenses and fix to pvwattsv8 dc side calculations
Sep 24, 2021
5e83c96
update default pvwattsv8 test answers, half a percent decrease in def…
Sep 24, 2021
2e1a0a0
updated pvwattsv8 test results
Sep 24, 2021
fb60226
Merge branch 'develop' into pvwattsv8
Sep 29, 2021
e08fe3e
pvwattsv8 test answer updates
Oct 5, 2021
0394129
Merge branch 'develop' into pvwattsv8
Oct 5, 2021
49d8c3a
further updates to pvwatts tests and fix transmitted poa in pvwattsv8
Oct 8, 2021
164e6e2
Merge branch 'develop' into pvwattsv8
Oct 8, 2021
58c564a
removed pvwattsv8 tests that weren't doing what I wanted them to
Oct 12, 2021
1cb65b6
updated pvwatts tests
Oct 13, 2021
81b698c
Merge branch 'develop' into pvwattsv8
Oct 26, 2021
ea4c07c
Merge branch 'develop' into pvwattsv8
Oct 27, 2021
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
51 changes: 32 additions & 19 deletions shared/lib_sandia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,17 @@ bool sandia_inverter_t::acpower(
double *Pntloss /* Power loss due to night time tare loss (Wac) */
)
{
//initialize values
*Pac = 0;
*Ppar = 0.0;
*Psoloss = 0.0; // Power consumption during operation
*Pntloss = 0.0;
*Pcliploss = 0.0;
double Pdc_total = 0;
//initialize output values, use a local variable so that not all outputs need to be retrieved in the function call (i.e. the function call can use a nullptr in place of an actual pointer value)
double Pac_ = 0.0;
double Ppar_ = 0.0;
double Plr_ = 0.0;
double Eff_ = 0.0;
double Pcliploss_ = 0.0;
double Psoloss_ = 0.0; // Power consumption during operation
double Pntloss_ = 0.0;

//initialize interim variables
double Pdc_total = 0.0;
std::vector<double> Pac_each;
std::vector<double> PacNoPso_each;

Expand Down Expand Up @@ -425,29 +429,38 @@ bool sandia_inverter_t::acpower(
// night time: power is equal to nighttime power loss (note that if PacNoPso > Pso and Pac < Pso then the night time loss could be considered an operating power loss)
if (Pdc_total <= Pso)
{
*Pac = -Pntare;
*Ppar = Pntare;
*Pntloss = Pntare;
Pac_ = -Pntare;
Ppar_ = Pntare;
Pntloss_ = Pntare;
}
// day time: calculate total Pac; power loss is the Pso loss, use values calculated above
else
for (size_t m = 0; m < Vdc.size(); m++)
{
*Psoloss += PacNoPso_each[m] - Pac_each[m];
*Pac += Pac_each[m];
Psoloss_ += PacNoPso_each[m] - Pac_each[m];
Pac_ += Pac_each[m];
}

// clipping loss Wac (note that the Pso=0 may have no clipping)
double PacNoClip = *Pac;
if ( *Pac > Paco )
double PacNoClip = Pac_;
if ( Pac_ > Paco )
{
*Pac = Paco;
*Pcliploss = PacNoClip - *Pac;
Pac_ = Paco;
Pcliploss_ = PacNoClip - Pac_;
}

*Plr = Pdc_total / Pdco;
*Eff = *Pac / Pdc_total;
if ( *Eff < 0.0 ) *Eff = 0.0;
Plr_ = Pdc_total / Pdco;
Eff_ = Pac_ / Pdc_total;
if ( Eff_ < 0.0 ) Eff_ = 0.0;

//check for existence of output pointers before assigning outputs
if (Pac) *Pac = Pac_;
if (Ppar) *Ppar = Ppar_;
if (Plr) *Plr = Plr_;
if (Eff) *Eff = Eff_;
if (Pcliploss) *Pcliploss = Pcliploss_;
if (Psoloss) *Psoloss = Psoloss_; // Power consumption during operation
if (Pntloss) *Pntloss = Pntloss_;

return true;
}
Expand Down
1 change: 1 addition & 0 deletions ssc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ set(SSC_SRC
cmod_pvwattsv1_poa.cpp
cmod_pvwattsv5.cpp
cmod_pvwattsv7.cpp
cmod_pvwattsv8.cpp
cmod_saleleaseback.cpp
cmod_sco2_air_cooler.cpp
cmod_sco2_csp_system.cpp
Expand Down
24 changes: 18 additions & 6 deletions ssc/cmod_pvwattsv7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ static var_info _cm_vtab_pvwattsv7[] = {
{ SSC_OUTPUT, SSC_ARRAY, "snow", "Weather file snow depth", "cm", "", "Time Series", "", "", "" },

{ SSC_OUTPUT, SSC_ARRAY, "sunup", "Sun up over horizon", "0/1", "", "Time Series", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "shad_beam_factor", "Shading factor for beam radiation", "", "", "Time Series", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "shad_beam_factor", "External shading factor for beam radiation", "", "", "Time Series", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "ss_beam_factor", "Calculated self-shading factor for beam radiation", "", "1=no shading", "Time Series", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "ss_sky_diffuse_factor", "Calculated self-shading factor for sky diffuse radiation", "", "1=no shading", "Time Series", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "ss_gnd_diffuse_factor", "Calculated self-shading factor for ground-reflected diffuse radiation", "", "1=no shading", "Time Series", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "aoi", "Angle of incidence", "deg", "", "Time Series", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "poa", "Plane of array irradiance", "W/m2", "", "Time Series", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "tpoa", "Transmitted plane of array irradiance", "W/m2", "", "Time Series", "*", "", "" },
Expand All @@ -174,7 +177,7 @@ static var_info _cm_vtab_pvwattsv7[] = {
{ SSC_OUTPUT, SSC_ARRAY, "dc_monthly", "DC output", "kWh", "", "Monthly", "", "LENGTH=12", "" },
{ SSC_OUTPUT, SSC_ARRAY, "ac_monthly", "AC output", "kWh", "", "Monthly", "", "LENGTH=12", "" },
{ SSC_OUTPUT, SSC_ARRAY, "monthly_energy", "Monthly energy", "kWh", "", "Monthly", "", "LENGTH=12", "" },
{ SSC_OUTPUT, SSC_MATRIX, "annual_energy_distribution_time", "Annual energy production as function of Time", "", "", "Heatmaps", "", "", "" },
{ SSC_OUTPUT, SSC_MATRIX, "annual_energy_distribution_time","Annual energy production as function of Time", "", "", "Heatmaps", "", "", "" },

{ SSC_OUTPUT, SSC_NUMBER, "solrad_annual", "Daily average solar irradiance", "kWh/m2/day","", "Annual", "", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "ac_annual", "Annual AC output", "kWh", "", "Annual", "", "", "" },
Expand All @@ -191,7 +194,6 @@ static var_info _cm_vtab_pvwattsv7[] = {
{ SSC_OUTPUT, SSC_NUMBER, "elev", "Site elevation", "m", "", "Location", "*", "", "" },

{ SSC_OUTPUT, SSC_NUMBER, "inverter_efficiency", "Inverter efficiency at rated power", "%", "", "PVWatts", "", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "estimated_rows", "Estimated number of rows in the system", "", "", "PVWatts", "", "", "" },

{ SSC_OUTPUT, SSC_NUMBER, "ts_shift_hours", "Time offset for interpreting time series outputs", "hours","", "Miscellaneous", "*", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "percent_complete", "Estimated percent of total completed simulation", "%", "", "Miscellaneous", "", "", "" },
Expand Down Expand Up @@ -546,7 +548,6 @@ class cm_pvwattsv7 : public compute_module
// fails for pv.modules < 1 that is id dc_nameplate < stc_watts
if (pv.nmodules < 1) pv.nmodules = 1;
pv.nrows = (int)ceil(sqrt(pv.nmodules)); // estimate of # rows, assuming 1 module in each row
assign("estimated_rows", var_data((ssc_number_t)pv.nrows));

// see note farther down in code about self-shading for small systems
// assume at least some reasonable number of rows.
Expand All @@ -556,7 +557,7 @@ class cm_pvwattsv7 : public compute_module
log(util::format("system size is too small to accurately estimate regular row-row self shading impacts. (estimates: #modules=%d, #rows=%d). disabling self-shading calculations.",
(int)pv.nmodules, (int)pv.nrows), SSC_WARNING);*/

if (pv.type == ONE_AXIS)
if (pv.type == ONE_AXIS || pv.type == ONE_AXIS_BACKTRACKING)
pv.nmody = 1; // e.g. Nextracker or ArrayTechnologies single portrait
else
pv.nmody = 2; // typical fixed 2 up portrait
Expand Down Expand Up @@ -709,7 +710,10 @@ class cm_pvwattsv7 : public compute_module
ssc_number_t* p_sunup = allocate("sunup", nrec);
ssc_number_t* p_aoi = allocate("aoi", nrec);
ssc_number_t* p_shad_beam = allocate("shad_beam_factor", nrec); // just for reporting output
ssc_number_t* p_stow = allocate("tracker_stowing", nrec); // just for reporting output
ssc_number_t* p_ss_beam = allocate("ss_beam_factor", nrec);
ssc_number_t* p_ss_sky_diffuse = allocate("ss_sky_diffuse_factor", nrec);
ssc_number_t* p_ss_gnd_diffuse = allocate("ss_gnd_diffuse_factor", nrec);
ssc_number_t* p_stow = allocate("tracker_stowing", nrec);

ssc_number_t* p_tmod = allocate("tcell", nrec);
ssc_number_t* p_dcshadederate = allocate("dcshadederate", nrec);
Expand Down Expand Up @@ -850,7 +854,11 @@ class cm_pvwattsv7 : public compute_module
if (shad.fbeam(hour_of_year, wf.minute, solalt, solazi))
shad_beam = shad.beam_shade_factor();

// initialize shading outputs
p_shad_beam[idx] = (ssc_number_t)shad_beam;
p_ss_beam[idx] = (ssc_number_t)1.0;
p_ss_sky_diffuse[idx] = (ssc_number_t)1.0;
p_ss_gnd_diffuse[idx] = (ssc_number_t)1.0;

if (sunup > 0)
{
Expand Down Expand Up @@ -996,6 +1004,7 @@ class cm_pvwattsv7 : public compute_module
{
if (y == 0 && wdprov->annualSimulation()) ld("poa_loss_self_beam_shade") += ibeam * ssout.m_shade_frac_fixed * wm2_to_wh;
ibeam *= (1 - ssout.m_shade_frac_fixed);
p_ss_beam[idx] = (ssc_number_t)(1 - ssout.m_shade_frac_fixed);
}

// one-axis true tracking system with linear self-shading: beam is derated by linear shade fraction for 1-axis trackers
Expand All @@ -1007,6 +1016,7 @@ class cm_pvwattsv7 : public compute_module
{
if (y == 0 && wdprov->annualSimulation()) ld("poa_loss_self_beam_shade") += ibeam * shad1xf * wm2_to_wh;
ibeam *= (1 - shad1xf);
p_ss_beam[idx] = (ssc_number_t)(1 - shad1xf);
}

// for non-linear self-shading (fixed and one-axis, but not backtracking)
Expand Down Expand Up @@ -1034,13 +1044,15 @@ class cm_pvwattsv7 : public compute_module
if (y == 0 && wdprov->annualSimulation()) ld("poa_loss_self_diff_shade") += (1.0 - Fskydiff) * (iskydiff + irear) * wm2_to_wh; //irear is zero if not bifacial
iskydiff *= Fskydiff;
irear *= Fskydiff;
p_ss_sky_diffuse[idx] = (ssc_number_t)Fskydiff;
}
else log(util::format("Sky diffuse reduction factor invalid at time %lg: fskydiff=%lg, stilt=%lg.", idx, Fskydiff, stilt), SSC_NOTICE, (float)idx);

if (Fgnddiff >= -0.00001 && Fgnddiff <= 1.00001) //include tolerances due to double representation
{
if (y == 0 && wdprov->annualSimulation()) ld("poa_loss_self_diff_shade") += (1.0 - Fgnddiff) * ignddiff * wm2_to_wh;
ignddiff *= Fgnddiff;
p_ss_gnd_diffuse[idx] = (ssc_number_t)Fgnddiff;
}
else log(util::format("Ground diffuse reduction factor invalid at time %lg: fgnddiff=%lg, stilt=%lg.", idx, Fgnddiff, stilt), SSC_NOTICE, (float)idx);

Expand Down
Loading