Skip to content

Commit

Permalink
including testing flag for repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ebalogun01 committed Dec 13, 2023
1 parent 47d7559 commit a4c6e74
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def make_scenarios():
voltage_idx += 1
return scenarios_list

def run(scenario):
def run(scenario, testing=False):
"""
Runs a scenario and updates the scenario JSON to reflect main properties of that scenario.
Expand All @@ -234,13 +234,16 @@ def run(scenario):
os.mkdir(save_folder_prefix)
EV_charging_sim.setup(dcfc_dicts_list + l2_dicts_list, scenario=scenario)
print('multistep')
if testing:
print("Basic testing passed!")
return True
EV_charging_sim.multistep()
print('multistep done')
EV_charging_sim.load_results_summary(save_folder_prefix)
with open(f'{save_folder_prefix}scenario.json', "w") as outfile:
json.dump(scenario, outfile, indent=1)

def run_scenarios_sequential():
def run_scenarios_sequential(testing=False):
"""
Creates scenarios based on the energy and c-rate lists/vectors and runs each of the scenarios,
which is a combination of all the capacities and c-rates.
Expand All @@ -261,11 +264,12 @@ def run_scenarios_sequential():
scenario["dcfc_caps"] = [station["DCFC"] for station in dcfc_dicts_list]
if l2_dicts_list:
scenario["l2_caps"] = [station["L2"] for station in l2_dicts_list]
run(scenario)
run(scenario, testing=testing)

if sequential_run:
test = True # toggle
print("Running scenarios sequentially...")
run_scenarios_sequential()
run_scenarios_sequential(testing=test)
print("Simulation complete!")

return
Expand Down

0 comments on commit a4c6e74

Please sign in to comment.