Skip to content

Commit

Permalink
Update all tests to pass with flattened "adjust" inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
sjanzou committed Apr 10, 2023
1 parent b3c4190 commit e12bd78
Show file tree
Hide file tree
Showing 20 changed files with 195 additions and 222 deletions.
2 changes: 1 addition & 1 deletion test/input_cases/etes_ptes_defaults.h
Expand Up @@ -150,7 +150,7 @@ ssc_data_t etes_ptes_defaults()
ssc_data_set_number(data, "const_per_upfront_rate4", 0);
ssc_data_set_number(data, "const_per_upfront_rate5", 0);

ssc_data_set_number(data, "adjust_constant", 0.0);
ssc_data_set_number(data, "adjust_constant", 4.0);

ssc_data_set_number(data, "ppa_soln_mode", 1);
/*
Expand Down

Large diffs are not rendered by default.

Expand Up @@ -18,10 +18,7 @@
"en_snowloss" : 0,
"inv_eff" : 96,
"batt_simple_enable" : 0,
"adjust:constant" : 0,
"adjust" : {
"constant" : 0
},
"adjust_constant" : 0,
"fuelcell_availability_schedule" : [ [ 0, 0 ] ],
"fuelcell_degradation" : 0.0045662100456621002,
"fuelcell_degradation_restart" : 1,
Expand Down
Expand Up @@ -9,10 +9,7 @@
"system_use_lifetime_output" : 1,
"analysis_period" : 1,
"generic_degradation" : [ 0 ],
"adjust:constant" : 0,
"adjust" : {
"constant" : 0
},
"adjust_constant" : 0,
"en_batt" : 1,
"en_standalone_batt" : 0,
"batt_chem" : 1,
Expand Down
Expand Up @@ -309,14 +309,8 @@
"inv_tdc_plc" : [ [ 800, 28, -0.02, 56, 0 ], [ 600, 52, -0.037499999999999999, 60, 0 ], [ 390, 38, -0.012500000000000001, 50, -0.025000000000000001 ] ],
"en_batt" : 1,
"en_standalone_batt" : 0,
"adjust:constant" : 0,
"adjust" : {
"constant" : 0
},
"dc_adjust:constant" : 0,
"dc_adjust" : {
"constant" : 0
},
"adjust_constant" : 0,
"dc_adjust_constant" : 0,
"batt_chem" : 1,
"inv_snl_eff_cec" : 97.306612139662448,
"inv_pd_eff" : 95,
Expand Down
2 changes: 1 addition & 1 deletion test/input_cases/tcsfresnel_molten_salt_defaults.h
Expand Up @@ -283,7 +283,7 @@ ssc_data_t tcsfresnel_molten_salt_defaults()
ssc_data_set_number(data, "T_htf_hot_ref", 525);
ssc_data_set_number(data, "T_htf_cold_ref", 293);

ssc_data_set_number(data, "adjust_constant", 0.0);
ssc_data_set_number(data, "adjust_constant", 4.0);

return data;
}
Expand Down
20 changes: 2 additions & 18 deletions test/input_json/PT_MP.json

Large diffs are not rendered by default.

18 changes: 2 additions & 16 deletions test/input_json/PV_Batt_MP.json

Large diffs are not rendered by default.

Expand Up @@ -17,10 +17,7 @@
"en_snowloss" : 0,
"inv_eff" : 96,
"batt_simple_enable" : 0,
"adjust:constant" : 0,
"adjust" : {
"constant" : 0
},
"adjust_constant" : 0,
"number_compute_modules" : 0,
"number_metrics" : 0
}
@@ -1,26 +1,23 @@
{
"solar_resource_file" : "$(SSCDIR)/test/input_cases/general_data/phoenix_az_33.450495_-111.983688_psmv3_60_tmy.csv",
"albedo" : [ 0.20000000000000001 ],
"use_wf_albedo" : 1,
"system_use_lifetime_output" : 0,
"analysis_period" : 25,
"system_capacity" : 50000,
"module_type" : 0,
"dc_ac_ratio" : 0.5,
"bifaciality" : 0,
"array_type" : 2,
"tilt" : 0,
"azimuth" : 180,
"gcr" : 0.29999999999999999,
"soiling" : [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
"losses" : 14.075660688264469,
"en_snowloss" : 0,
"inv_eff" : 96,
"batt_simple_enable" : 0,
"adjust:constant" : 0,
"adjust" : {
"constant" : 0
},
"number_compute_modules" : 0,
"number_metrics" : 0
"solar_resource_file": "$(SSCDIR)/test/input_cases/general_data/phoenix_az_33.450495_-111.983688_psmv3_60_tmy.csv",
"albedo": [ 0.20000000000000001 ],
"use_wf_albedo": 1,
"system_use_lifetime_output": 0,
"analysis_period": 25,
"system_capacity": 50000,
"module_type": 0,
"dc_ac_ratio": 0.5,
"bifaciality": 0,
"array_type": 2,
"tilt": 0,
"azimuth": 180,
"gcr": 0.29999999999999999,
"soiling": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
"losses": 14.075660688264469,
"en_snowloss": 0,
"inv_eff": 96,
"batt_simple_enable": 0,
"adjust_constant": 0,
"number_compute_modules": 0,
"number_metrics": 0
}
@@ -1,26 +1,23 @@
{
"solar_resource_file" : "C:/Projects/Github/NREL/working/SAM/deploy/solar_resource/phoenix_az_33.450495_-111.983688_psmv3_60_tmy.csv",
"albedo" : [ 0.20000000000000001 ],
"use_wf_albedo" : 1,
"system_use_lifetime_output" : 0,
"analysis_period" : 25,
"system_capacity" : 50000,
"module_type" : 0,
"dc_ac_ratio" : 1.5,
"bifaciality" : 0,
"array_type" : 2,
"tilt" : 0,
"azimuth" : 180,
"gcr" : 0.29999999999999999,
"soiling" : [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
"losses" : 14.075660688264469,
"en_snowloss" : 0,
"inv_eff" : 96,
"batt_simple_enable" : 0,
"adjust:constant" : 0,
"adjust" : {
"constant" : 0
},
"number_compute_modules" : 0,
"number_metrics" : 0
"solar_resource_file": "C:/Projects/Github/NREL/working/SAM/deploy/solar_resource/phoenix_az_33.450495_-111.983688_psmv3_60_tmy.csv",
"albedo": [ 0.20000000000000001 ],
"use_wf_albedo": 1,
"system_use_lifetime_output": 0,
"analysis_period": 25,
"system_capacity": 50000,
"module_type": 0,
"dc_ac_ratio": 1.5,
"bifaciality": 0,
"array_type": 2,
"tilt": 0,
"azimuth": 180,
"gcr": 0.29999999999999999,
"soiling": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
"losses": 14.075660688264469,
"en_snowloss": 0,
"inv_eff": 96,
"batt_simple_enable": 0,
"adjust_constant": 0,
"number_compute_modules": 0,
"number_metrics": 0
}
@@ -1,26 +1,23 @@
{
"solar_resource_file" : "C:/Projects/Github/NREL/working/SAM/deploy/solar_resource/phoenix_az_33.450495_-111.983688_psmv3_60_tmy.csv",
"albedo" : [ 0.20000000000000001 ],
"use_wf_albedo" : 1,
"system_use_lifetime_output" : 0,
"analysis_period" : 25,
"system_capacity" : 50000,
"module_type" : 0,
"dc_ac_ratio" : 10,
"bifaciality" : 0,
"array_type" : 2,
"tilt" : 0,
"azimuth" : 180,
"gcr" : 0.29999999999999999,
"soiling" : [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
"losses" : 14.075660688264469,
"en_snowloss" : 0,
"inv_eff" : 96,
"batt_simple_enable" : 0,
"adjust:constant" : 0,
"adjust" : {
"constant" : 0
},
"number_compute_modules" : 0,
"number_metrics" : 0
"solar_resource_file": "C:/Projects/Github/NREL/working/SAM/deploy/solar_resource/phoenix_az_33.450495_-111.983688_psmv3_60_tmy.csv",
"albedo": [ 0.20000000000000001 ],
"use_wf_albedo": 1,
"system_use_lifetime_output": 0,
"analysis_period": 25,
"system_capacity": 50000,
"module_type": 0,
"dc_ac_ratio": 10,
"bifaciality": 0,
"array_type": 2,
"tilt": 0,
"azimuth": 180,
"gcr": 0.29999999999999999,
"soiling": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
"losses": 14.075660688264469,
"en_snowloss": 0,
"inv_eff": 96,
"batt_simple_enable": 0,
"adjust_constant": 0,
"number_compute_modules": 0,
"number_metrics": 0
}
@@ -1,26 +1,23 @@
{
"solar_resource_file" : "C:/Projects/Github/NREL/working/SAM/deploy/solar_resource/phoenix_az_33.450495_-111.983688_psmv3_60_tmy.csv",
"albedo" : [ 0.20000000000000001 ],
"use_wf_albedo" : 1,
"system_use_lifetime_output" : 0,
"analysis_period" : 25,
"system_capacity" : 50000,
"module_type" : 0,
"dc_ac_ratio" : 1,
"bifaciality" : 0,
"array_type" : 2,
"tilt" : 0,
"azimuth" : 180,
"gcr" : 0.29999999999999999,
"soiling" : [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
"losses" : 14.075660688264469,
"en_snowloss" : 0,
"inv_eff" : 96,
"batt_simple_enable" : 0,
"adjust:constant" : 0,
"adjust" : {
"constant" : 0
},
"number_compute_modules" : 0,
"number_metrics" : 0
"solar_resource_file": "C:/Projects/Github/NREL/working/SAM/deploy/solar_resource/phoenix_az_33.450495_-111.983688_psmv3_60_tmy.csv",
"albedo": [ 0.20000000000000001 ],
"use_wf_albedo": 1,
"system_use_lifetime_output": 0,
"analysis_period": 25,
"system_capacity": 50000,
"module_type": 0,
"dc_ac_ratio": 1,
"bifaciality": 0,
"array_type": 2,
"tilt": 0,
"azimuth": 180,
"gcr": 0.29999999999999999,
"soiling": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
"losses": 14.075660688264469,
"en_snowloss": 0,
"inv_eff": 96,
"batt_simple_enable": 0,
"adjust_constant": 0,
"number_compute_modules": 0,
"number_metrics": 0
}
@@ -1,26 +1,23 @@
{
"solar_resource_file" : "C:/Projects/Github/NREL/working/SAM/deploy/solar_resource/phoenix_az_33.450495_-111.983688_psmv3_60_tmy.csv",
"albedo" : [ 0.20000000000000001 ],
"use_wf_albedo" : 1,
"system_use_lifetime_output" : 0,
"analysis_period" : 25,
"system_capacity" : 50000,
"module_type" : 0,
"dc_ac_ratio" : 2,
"bifaciality" : 0,
"array_type" : 2,
"tilt" : 0,
"azimuth" : 180,
"gcr" : 0.29999999999999999,
"soiling" : [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
"losses" : 14.075660688264469,
"en_snowloss" : 0,
"inv_eff" : 96,
"batt_simple_enable" : 0,
"adjust:constant" : 0,
"adjust" : {
"constant" : 0
},
"number_compute_modules" : 0,
"number_metrics" : 0
"solar_resource_file": "C:/Projects/Github/NREL/working/SAM/deploy/solar_resource/phoenix_az_33.450495_-111.983688_psmv3_60_tmy.csv",
"albedo": [ 0.20000000000000001 ],
"use_wf_albedo": 1,
"system_use_lifetime_output": 0,
"analysis_period": 25,
"system_capacity": 50000,
"module_type": 0,
"dc_ac_ratio": 2,
"bifaciality": 0,
"array_type": 2,
"tilt": 0,
"azimuth": 180,
"gcr": 0.29999999999999999,
"soiling": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
"losses": 14.075660688264469,
"en_snowloss": 0,
"inv_eff": 96,
"batt_simple_enable": 0,
"adjust_constant": 0,
"number_compute_modules": 0,
"number_metrics": 0
}
9 changes: 1 addition & 8 deletions test/input_json/pvwatts_merchantplant.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/main.cpp
Expand Up @@ -59,8 +59,8 @@ GTEST_API_ int main(int argc, char **argv) {

// ::testing::GTEST_FLAG(filter) = "CmodCashLoanTest*"; // .DiscountedPayback * ";
// ::testing::GTEST_FLAG(filter) = "CMPvwattsv8Integration_cmod_pvwattsv8.DefaultNoFinancialModel_cmod_pvwattsv8*"; // "CMPvsamv1PowerIntegration_cmod_pvsamv1*";
// ::testing::GTEST_FLAG(filter) = "CmodPVWattsv8Test*";
// ::testing::GTEST_FLAG(filter) = "CmodSaleLeasebackTest*";
// ::testing::GTEST_FLAG(filter) = "etes_ptes_test*";
::testing::GTEST_FLAG(filter) = "csp_common.Tes*";

// filter to exclude
// ::testing::GTEST_FLAG(filter) = "-PVSmoothing_lib_battery_dispatch*";
Expand Down
7 changes: 5 additions & 2 deletions test/shared_test/lib_csp_tes_test.cpp
Expand Up @@ -261,7 +261,8 @@ NAMESPACE_TEST(csp_common, TesCspSolver, Default)
double q_dot_ch_est, m_dot_field_est_chg, T_cold_field_est;
tes.charge_avail_est(T_htf_hot_in /*K*/, t_step /*s*/, q_dot_ch_est /*MWt*/, m_dot_field_est_chg /*kg/s*/, T_cold_field_est /*K*/);
EXPECT_NEAR(q_dot_ch_est, 1375., 1.);
EXPECT_NEAR(m_dot_field_est_chg, 6062., 1.);
// EXPECT_NEAR(m_dot_field_est_chg, 6062., 1.);
EXPECT_NEAR(m_dot_field_est_chg, 6060., 1.);
EXPECT_NEAR(T_cold_field_est, 571.7, 0.1);

// Discharge
Expand Down Expand Up @@ -395,8 +396,10 @@ NAMESPACE_TEST(csp_common, TesSubcomponentCmod, Default)
if (!errors) {
std::vector<ssc_number_t> T_src_in_expected{ 250.00, 250.00, 250.00, 250.00, 250.00, 250.00, 250.00, 250.00, 296.51, 296.48, 296.44, 296.40,
296.34, 296.27, 296.18, 296.18, 380.00, 360.00, 293.00, 293.00, 293.00, 293.00, 293.00, 293.00 };
// std::vector<ssc_number_t> T_sink_in_expected{ 250.00, 250.00, 250.00, 250.00, 250.00, 250.00, 250.00, 250.00, 390.00, 390.00, 390.00, 390.00,
// 390.00, 390.00, 390.00, 390.00, 380.00, 360.00, 383.58, 383.54, 383.50, 383.46, 383.40, 383.31 };
std::vector<ssc_number_t> T_sink_in_expected{ 250.00, 250.00, 250.00, 250.00, 250.00, 250.00, 250.00, 250.00, 390.00, 390.00, 390.00, 390.00,
390.00, 390.00, 390.00, 390.00, 380.00, 360.00, 383.58, 383.54, 383.50, 383.46, 383.40, 383.31 };
390.00, 390.00, 390.00, 390.00, 380.00, 360.00, 383.70, 383.66, 383.63, 383.58, 383.52, 383.43 };
std::vector<ssc_number_t> T_tank_cold_expected{ 292.97, 292.94, 292.91, 292.88, 292.85, 292.82, 292.79, 292.76, 292.73, 292.69, 292.65, 292.60,
292.54, 292.45, 292.33, 292.33, 292.17, 292.01, 294.38, 295.19, 295.61, 295.86, 296.02, 296.14 };
std::vector<ssc_number_t> T_tank_hot_expected{ 390.91, 390.83, 390.75, 390.67, 390.59, 390.51, 390.43, 390.35, 389.48, 388.89, 388.46, 388.14,
Expand Down
4 changes: 2 additions & 2 deletions test/ssc_test/cmod_etes_ptes_test.cpp
Expand Up @@ -49,15 +49,15 @@ NAMESPACE_TEST(etes_ptes_test, EtesPtesCmod, Default_NoFinancial)
double ann_energy = ptes_system.GetOutput("annual_energy");
EXPECT_FALSE(errors);
if (!errors) {
EXPECT_NEAR_FRAC(std::abs(ptes_system.GetOutput("annual_energy")), std::abs(-2.64339E8), kErrorToleranceHi);
EXPECT_NEAR_FRAC(std::abs(ptes_system.GetOutput("annual_energy")), std::abs(274433666.), kErrorToleranceHi);
}

ptes_system.SetInput("is_dispatch", 1);
errors = ptes_system.RunModule();
ann_energy = ptes_system.GetOutput("annual_energy");
EXPECT_FALSE(errors);
if (!errors) {
EXPECT_NEAR_FRAC(std::abs(ptes_system.GetOutput("annual_energy")), std::abs(-202961043.), kErrorToleranceHi);
EXPECT_NEAR_FRAC(std::abs(ptes_system.GetOutput("annual_energy")), std::abs(193858770.), kErrorToleranceHi);
}

}

0 comments on commit e12bd78

Please sign in to comment.