Skip to content

Commit

Permalink
added rtol and atol to integration_test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
malcolmmoncheur committed Nov 15, 2023
1 parent 74b0830 commit 9c1f892
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions main_files/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = {}
Expand Down Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions tests/system_tests/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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'
Expand All @@ -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}
Expand All @@ -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'],
Expand All @@ -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'
Expand All @@ -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)

0 comments on commit 9c1f892

Please sign in to comment.