Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions shared/lib_battery_voltage.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ struct voltage_params {
}; // voltage model (0), voltage table (1)

MODE voltage_choice;
int num_cells_series; // number of cells in series
int num_strings; // addition number in parallel
// int overflow erroeous results
// int num_cells_series; // number of cells in series
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove commented out code (leaving the bit about the int causing an overflow is fine)

// int num_strings; // addition number in parallel
double num_cells_series; // number of cells in series
double num_strings; // addition number in parallel
double Vnom_default; // nominal cell voltage [V]
double resistance; // internal cell resistance (Ohm)
double dt_hr;
Expand Down
15 changes: 10 additions & 5 deletions shared/lib_pv_io_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ Subarray_IO::Subarray_IO(compute_module* cm, const std::string& cmName, size_t s

if (enable)
{
int n = cm->as_integer(prefix + "nstrings");
// int n = cm->as_integer(prefix + "nstrings");
double n = cm->as_double(prefix + "nstrings");
if (n < 0) {
throw exec_error(cmName, "invalid string allocation between subarrays. all subarrays must have zero or positive number of strings.");
}
Expand All @@ -301,7 +302,8 @@ Subarray_IO::Subarray_IO(compute_module* cm, const std::string& cmName, size_t s
return;
}

nModulesPerString = cm->as_integer(prefix + "modules_per_string");
// nModulesPerString = cm->as_integer(prefix + "modules_per_string");
nModulesPerString = cm->as_double(prefix + "modules_per_string");
mpptInput = cm->as_integer(prefix + "mppt_input");
trackMode = cm->as_integer(prefix + "track_mode");
tiltEqualLatitude = 0;
Expand Down Expand Up @@ -372,8 +374,10 @@ Subarray_IO::Subarray_IO(compute_module* cm, const std::string& cmName, size_t s

shadeMode = cm->as_integer(prefix + "shade_mode");
selfShadingInputs.mod_orient = cm->as_integer(prefix + "mod_orient"); //although these inputs are stored in self-shading structure, they are also used for snow model and bifacial model, so required for all enabled subarrays
selfShadingInputs.nmody = cm->as_integer(prefix + "nmody"); //same as above
selfShadingInputs.nmodx = cm->as_integer(prefix + "nmodx"); //same as above
// selfShadingInputs.nmody = cm->as_integer(prefix + "nmody"); //same as above
// selfShadingInputs.nmodx = cm->as_integer(prefix + "nmodx"); //same as above
selfShadingInputs.nmody = cm->as_double(prefix + "nmody"); //same as above
selfShadingInputs.nmodx = cm->as_double(prefix + "nmodx"); //same as above
selfShadingInputs.nstrx = selfShadingInputs.nmodx / nModulesPerString;
poa.nonlinearDCShadingDerate = 1;
selfShadingSkyDiffTable.init(tiltDegrees, groundCoverageRatio);
Expand Down Expand Up @@ -612,7 +616,8 @@ PVSystem_IO::PVSystem_IO(compute_module* cm, std::string cmName, Simulation_IO*
stringsInParallel += static_cast<int>(Subarrays[s]->nStrings);
}

numberOfInverters = cm->as_integer("inverter_count");
// numberOfInverters = cm->as_integer("inverter_count");
numberOfInverters = cm->as_double("inverter_count");
ratedACOutput = Inverter->ratedACOutput * numberOfInverters;
acDerate = 1 - cm->as_double("acwiring_loss") / 100;
acLossPercent = (1 - acDerate) * 100;
Expand Down
14 changes: 9 additions & 5 deletions shared/lib_pv_io_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ struct PVSystem_IO
void SetupPOAInput();

size_t numberOfSubarrays;
size_t numberOfInverters;
// size_t numberOfInverters;
double numberOfInverters;

Irradiance_IO * Irradiance;
Simulation_IO * Simulation;
Expand Down Expand Up @@ -392,9 +393,11 @@ struct Subarray_IO
flag enable; // Whether or not the subarray is enabled

// Electrical characteristics
size_t nStrings; // Number of strings in the subarray
int nModulesPerString; // The number of modules per string
int mpptInput; // Which inverter MPPT input this subarray is connected to
//size_t nStrings; // Number of strings in the subarray
//int nModulesPerString; // The number of modules per string
double nStrings; // Number of strings in the subarray
double nModulesPerString; // The number of modules per string
int mpptInput; // Which inverter MPPT input this subarray is connected to

// Physical characteristics
double groundCoverageRatio; // The ground coverage ratio [0 - 1]
Expand All @@ -406,7 +409,8 @@ struct Subarray_IO
std::vector<double> monthlyTiltDegrees; // The seasonal tilt [degrees]
flag backtrackingEnabled; // Backtracking enabled or not
double moduleAspectRatio; // The aspect ratio of the models used in the subarray
int nStringsBottom; // Number of strings along bottom from self-shading
// int nStringsBottom; // Number of strings along bottom from self-shading
double nStringsBottom; // Number of strings along bottom from self-shading

// Subarray-specific losses
std::vector<double> monthlySoiling; // The soiling loss by month [%]
Expand Down
3 changes: 2 additions & 1 deletion shared/lib_pvshade.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// static self-shading inputs- these do not change with timestep. dynamic inputs are inputs to the ss_exec function
struct ssinputs
{
int nstrx, nmodx, nmody, nrows;
// int nstrx, nmodx, nmody, nrows;
double nstrx, nmodx, nmody, nrows;
double length, width;
int mod_orient, str_orient;
double row_space;
Expand Down
3 changes: 2 additions & 1 deletion shared/lib_snowmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ pvsnowmodel::pvsnowmodel()

}

bool pvsnowmodel::setup(int nmody_in, float baseTilt_in, bool limitTilt){
bool pvsnowmodel::setup(double nmody_in, float baseTilt_in, bool limitTilt) {
// bool pvsnowmodel::setup(int nmody_in, float baseTilt_in, bool limitTilt) {

nmody = nmody_in;
baseTilt = baseTilt_in;
Expand Down
9 changes: 5 additions & 4 deletions shared/lib_snowmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class pvsnowmodel
pvsnowmodel();

// limitTilt requires tilt to be between 10 and 45 degrees
bool setup(int, float, bool limitTilt = true);
// bool setup(int, float, bool limitTilt = true);
bool setup(double, float, bool limitTilt = true);

bool getLoss(float poa, float tilt, float wspd, float tdry, float snowDepth, int sunup, float dt, float &returnLoss);

Expand All @@ -44,13 +45,13 @@ class pvsnowmodel
coverage, // Snow coverage ( 0...1 )
pCvg; // Snow coverage from previous iteration ( 0...1 )

int nmody, // number of modules in a row
badValues, // keeps track of the number of detected bad snow depth values
double nmody; // number of modules in a row
int badValues, // keeps track of the number of detected bad snow depth values
maxBadValues; // The number of maximum bad snow depth values that is acceptable

std::string msg; // This is a string used to return error messages
bool good; // This an error flag that will be set to false
// if an error has occured
};

#endif
#endif
11 changes: 8 additions & 3 deletions ssc/cmod_battery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,12 @@ battstor::battstor(var_table& vt, bool setup_model, size_t nrec, double dt_hr, c
}

// Battery bank sizing
batt_vars->batt_computed_series = vt.as_integer("batt_computed_series");
batt_vars->batt_computed_strings = vt.as_integer("batt_computed_strings");
// batt_vars->batt_computed_series = vt.as_integer("batt_computed_series");
// batt_vars->batt_computed_strings = vt.as_integer("batt_computed_strings");
// batt_vars->batt_computed_series = vt.as_unsigned_long("batt_computed_series");
// batt_vars->batt_computed_strings = vt.as_unsigned_long("batt_computed_strings");
batt_vars->batt_computed_series = vt.as_double("batt_computed_series");
batt_vars->batt_computed_strings = vt.as_double("batt_computed_strings");
batt_vars->batt_kwh = vt.as_double("batt_computed_bank_capacity");
batt_vars->batt_kw = vt.as_double("batt_power_discharge_max_kwdc");

Expand Down Expand Up @@ -590,7 +594,8 @@ battstor::battstor(var_table& vt, bool setup_model, size_t nrec, double dt_hr, c
batt_vars->inverter_model = vt.as_integer("inverter_model");
if (batt_vars->inverter_model < 4) //user has assigned an actual inverter model
{
batt_vars->inverter_count = vt.as_integer("inverter_count");
// batt_vars->inverter_count = vt.as_integer("inverter_count");
batt_vars->inverter_count = vt.as_double("inverter_count");
batt_vars->batt_inverter_efficiency_cutoff = vt.as_double("batt_inverter_efficiency_cutoff");

if (batt_vars->inverter_model == SharedInverter::SANDIA_INVERTER)
Expand Down
11 changes: 7 additions & 4 deletions ssc/cmod_battery.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ struct batt_variables
std::vector<double> batt_losses_idle;
std::vector<double> batt_losses;

int batt_computed_series;
int batt_computed_strings;
// int batt_computed_series;
// int batt_computed_strings;
double batt_computed_series;
double batt_computed_strings;

double batt_kw;
double batt_kwh;
Expand Down Expand Up @@ -171,8 +173,9 @@ struct batt_variables
size_t inverter_model;
double inverter_efficiency;
double inverter_paco;
size_t inverter_count;
double batt_inverter_efficiency_cutoff;
//size_t inverter_count;
double inverter_count;
double batt_inverter_efficiency_cutoff;

double batt_calendar_q0;
double batt_calendar_a;
Expand Down
Loading