From 9c1f8924fbb3fe4cefa4acead580d87312925d52 Mon Sep 17 00:00:00 2001 From: Malcolm Moncheur Date: Wed, 15 Nov 2023 10:11:46 -0800 Subject: [PATCH] added rtol and atol to integration_test.py --- main_files/main.py | 6 +++--- tests/system_tests/integration_test.py | 12 +++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/main_files/main.py b/main_files/main.py index 3c06d2a..b664fe3 100644 --- a/main_files/main.py +++ b/main_files/main.py @@ -144,8 +144,8 @@ def run_mcor(input_dict): input_dict["pv_inputs"]["solar_data_source"] = 'nsrdb' input_dict["pv_inputs"]["solar_data_start_year"] = 1998 input_dict["pv_inputs"]["solar_data_end_year"] = 2021 - input_dict["pv_inputs"]["get_solar_data"] = False - input_dict["pv_inputs"]["get_solar_profiles"] = False + input_dict["pv_inputs"]["get_solar_data"] = True + input_dict["pv_inputs"]["get_solar_profiles"] = True # Battery dictionary input_dict["battery_inputs"] = {} @@ -223,7 +223,7 @@ def run_mcor(input_dict): # Output / Inputs dictionary input_dict["output_inputs"] = {} - input_dict["output_inputs"]["save_timeseries_json"] = True + input_dict["output_inputs"]["save_timeseries_json"] = False input_dict["output_inputs"]["save_filename"] = 'project_name' # Settings for dispatch plots diff --git a/tests/system_tests/integration_test.py b/tests/system_tests/integration_test.py index ede203c..389ec78 100644 --- a/tests/system_tests/integration_test.py +++ b/tests/system_tests/integration_test.py @@ -18,6 +18,8 @@ SYS_DATA_DIR = os.path.join(SYS_TESTS_DIR, 'data') TEST_SOLAR_DATA_DIR = os.path.join(SYS_DATA_DIR, 'solar_data') +rtol = 1e-2 +atol = 1e-4 class TestSimulation(unittest.TestCase): @@ -127,7 +129,7 @@ def test_longest_night_battery(self): ground_truth_df = pd.read_csv(os.path.join(SYS_DATA_DIR, 'ground_truth', 'longest_night_ground_truth.csv'), header=0, index_col=0) - pd.testing.assert_frame_equal(ground_truth_df, optim.results_grid, check_exact=False) + pd.testing.assert_frame_equal(ground_truth_df, optim.results_grid, check_exact=False,rtol=rtol, atol=atol) def test_no_pv_export_battery(self): self.tc['batt_sizing_method'] = 'no_pv_export' @@ -139,7 +141,7 @@ def test_no_pv_export_battery(self): ground_truth_df = pd.read_csv(os.path.join(SYS_DATA_DIR, 'ground_truth', 'no_pv_export_ground_truth.csv'), header=0, index_col=0) - pd.testing.assert_frame_equal(ground_truth_df, optim.results_grid, check_exact=False) + pd.testing.assert_frame_equal(ground_truth_df, optim.results_grid, check_exact=False,rtol=rtol, atol=atol) def test_net_metering_limits(self): self.tc['net_metering_limits'] = {'type': 'percent_of_load', 'value': 100} @@ -151,7 +153,7 @@ def test_net_metering_limits(self): ground_truth_df = pd.read_csv(os.path.join(SYS_DATA_DIR, 'ground_truth', 'nm_limit_ground_truth.csv'), header=0, index_col=0) - pd.testing.assert_frame_equal(ground_truth_df, optim.results_grid, check_exact=False) + pd.testing.assert_frame_equal(ground_truth_df, optim.results_grid, check_exact=False,rtol=rtol, atol=atol) def test_existing_equipment(self): pv = PV(existing=True, pv_capacity=300, tilt=self.tc['tilt'], @@ -166,7 +168,7 @@ def test_existing_equipment(self): ground_truth_df = pd.read_csv(os.path.join(SYS_DATA_DIR, 'ground_truth', 'existing_pv_ground_truth.csv'), header=0, index_col=0) - pd.testing.assert_frame_equal(ground_truth_df, optim.results_grid, check_exact=False) + pd.testing.assert_frame_equal(ground_truth_df, optim.results_grid, check_exact=False,rtol=rtol, atol=atol) def test_off_grid_load_profile(self): self.tc['off_grid_load_profile'] = 'sample_off_grid_load_profile.csv' @@ -178,4 +180,4 @@ def test_off_grid_load_profile(self): ground_truth_df = pd.read_csv(os.path.join(SYS_DATA_DIR, 'ground_truth', 'off_grid_load_ground_truth.csv'), header=0, index_col=0) - pd.testing.assert_frame_equal(ground_truth_df, optim.results_grid, check_exact=False) + pd.testing.assert_frame_equal(ground_truth_df, optim.results_grid, check_exact=False,rtol=rtol, atol=atol)