test/ssc_test/cmod_battery_test.cpp
/// Test standalone battery compute modeule with a input lifetime generation and commercial load
Test standalone battery compute modeule with a input lifetime generation and commercial load
Test standalone battery compute modeule with a input lifetime generation and commercial load
TEST_F(CMBattery_cmod_battery, CommercialLifetimePeakShaving) {
	ssc_number_t n_years;
	ssc_data_get_number(data, "analysis_period", &n_years);
	size_t n_lifetime = (size_t)(n_years) * 8760;
	int errors = run_module(data, "battery");
	EXPECT_FALSE(errors);
	if (!errors)
	{
		ssc_number_t roundtripEfficiency;
		ssc_data_get_number(data, "average_battery_roundtrip_efficiency", &roundtripEfficiency);
		EXPECT_NEAR(roundtripEfficiency, 94.42, 2);
		int n;
		calculated_array = ssc_data_get_array(data, "gen", &n);
		EXPECT_EQ(n_lifetime, (size_t)n);
		calculated_array = ssc_data_get_array(data, "batt_bank_replacement", &n);
		int replacements = std::accumulate(calculated_array, calculated_array + n, 0);
		EXPECT_GT(replacements, 0);
	}
}
TEST_F ( CMBattery_cmod_battery , CommercialLifetimePeakShaving ) { ssc_number_t n_years ; ssc_data_get_number ( data , " " , & n_years ) ; size_t n_lifetime = ( size_t ) ( n_years ) * 8760 ; int errors = run_module ( data , " " ) ; EXPECT_FALSE ( errors ) ; if ( ! errors ) { ssc_number_t roundtripEfficiency ; ssc_data_get_number ( data , " " , & roundtripEfficiency ) ; EXPECT_NEAR ( roundtripEfficiency , 94.42 , 2 ) ; int n ; calculated_array = ssc_data_get_array ( data , " " , & n ) ; EXPECT_EQ ( n_lifetime , ( size_t ) n ) ; calculated_array = ssc_data_get_array ( data , " " , & n ) ; int replacements = std :: accumulate ( calculated_array , calculated_array + n , 0 ) ; EXPECT_GT ( replacements , 0 ) ; } }
Test standalone battery compute modeule with a input lifetime generation and commercial load
Test standalone battery compute modeule with a input lifetime generation and commercial load
// Run with fixed output // roundtrip efficiency test will ensure that the battery cycled // test that lifetime output is achieved // test that battery was replaced at some point