Skip to content

Commit

Permalink
Merge branch 'main' into upgrade-timeseries
Browse files Browse the repository at this point in the history
  • Loading branch information
ann-sherin committed Nov 3, 2023
2 parents a245734 + b4a9136 commit ca59d35
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 68 deletions.
4 changes: 4 additions & 0 deletions disco/cli/disco.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from disco.cli.create_pipeline import create_pipeline
from disco.cli.ingest_tables import ingest_tables
from disco.cli.make_summary_tables import make_summary_tables
from disco.cli.compute_hosting_capacity import compute_hosting_capacity
from disco.cli.plots import plot
from disco.cli.select_time_points import select_time_points
from disco.cli.summarize_hosting_capacity import summarize_hosting_capacity
from disco.cli.config_generic_models import config_generic_models
Expand Down Expand Up @@ -57,3 +59,5 @@ def cli():
cli.add_command(summarize_hosting_capacity)
cli.add_command(upgrade_cost_analysis)
cli.add_command(hosting_capacity_by_timestep)
cli.add_command(compute_hosting_capacity)
cli.add_command(plot)
4 changes: 0 additions & 4 deletions disco/cli/disco_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
from disco.cli.compute_time_series_impact_analysis import compute_time_series_impact_analysis
from disco.cli.make_cba_tables import make_cba_tables
from disco.cli.make_upgrade_tables import make_upgrade_tables
from disco.cli.compute_hosting_capacity import compute_hosting_capacity
from disco.cli.cba_post_process import cba_post_process
from disco.cli.compute_cba import compute_cba
from disco.cli.plots import plot


logger = logging.getLogger(__name__)
Expand All @@ -30,7 +28,5 @@ def cli():
cli.add_command(compute_time_series_impact_analysis)
cli.add_command(make_cba_tables)
cli.add_command(make_upgrade_tables)
cli.add_command(compute_hosting_capacity)
cli.add_command(cba_post_process)
cli.add_command(compute_cba)
cli.add_command(plot)
36 changes: 31 additions & 5 deletions disco/cli/pv_deployments.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def create_pv_deployments(input_path: str, hierarchy: str, config: dict):
print(json.dumps(summary, indent=2))


def create_pv_configs(input_path: str, hierarchy: str, config: dict):
def create_pv_configs(input_path: str, hierarchy: str, config: dict, control_name: str, limit: int):
"""A method for generating pv config JSON files """
hierarchy = DeploymentHierarchy(hierarchy)
config = SimpleNamespace(**config)
Expand All @@ -46,7 +46,7 @@ def create_pv_configs(input_path: str, hierarchy: str, config: dict):
print(f"'-p' or '--placement' option is ignored for this action.")

manager = PVConfigManager(input_path, hierarchy, config)
config_files = manager.generate_pv_configs()
config_files = manager.generate_pv_configs(control_name=control_name, limit=limit)
print(f"PV configs created! Total: {len(config_files)}")


Expand Down Expand Up @@ -112,8 +112,12 @@ def redirect_pv_shapes(input_path: str, hierarchy: str, config: dict):
hierarchy = DeploymentHierarchy(hierarchy)
config = SimpleNamespace(**config)
manager = PVDataManager(input_path, hierarchy, config)
manager.redirect_substation_pv_shapes()
manager.redirect_feeder_pv_shapes()
if hierarchy == DeploymentHierarchy.SUBSTATION:
manager.redirect_substation_pv_shapes()
elif hierarchy == DeploymentHierarchy.FEEDER:
manager.redirect_feeder_pv_shapes()
else:
raise NotImplementedError(f"{hierarchy=}")


def generate_pv_deployment_jobs(input_path: str, hierarchy: str, config: dict):
Expand Down Expand Up @@ -170,12 +174,28 @@ def pv_deployments():
required=True,
help="Choose the action related to pv deployments"
)
@click.option(
"-c", "--control-name",
type=click.STRING,
default="volt_var_ieee_1547_2018_catB",
show_default=True,
help="Choose the control name to assign to pv configs in the action create-configs."
)
@click.option(
"-h", "--hierarchy",
type=click.Choice(HIERARCHY_CHOICE, case_sensitive=False),
required=True,
help="Choose the deployment hierarchy."
)
@click.option(
"-l", "--kw-limit",
type=click.FLOAT,
default=5,
show_default=True,
help="Capacity threshold to use for assigning the value of --control-name. The action "
"create-configs will only assign a control if a PV's capacity is greater than this value in "
"kW.",
)
@click.option(
"-p", "--placement",
type=click.Choice(PLACEMENT_CHOICE, case_sensitive=False),
Expand Down Expand Up @@ -280,7 +300,9 @@ def pv_deployments():
def source_tree_1(
input_path,
action,
control_name,
hierarchy,
kw_limit,
placement,
category,
master_filename,
Expand Down Expand Up @@ -322,7 +344,11 @@ def source_tree_1(
"random_seed": random_seed
}
action_function = ACTION_MAPPING[action]
action_function(input_path, hierarchy, config)
args = [input_path, hierarchy, config]
if action == "create-configs":
args.append(control_name)
args.append(kw_limit)
action_function(*args)


pv_deployments.add_command(source_tree_1)
8 changes: 4 additions & 4 deletions disco/pipelines/creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def make_postprocess_command(self):
with_loadshape = config_params["with_loadshape"]
auto_select_time_points = config_params["auto_select_time_points"]
pf1 = config_params["pf1"]
base_cmd = f"disco-internal compute-hosting-capacity {inputs}"
plot_cmd = f"disco-internal plot {inputs}"
base_cmd = f"disco compute-hosting-capacity {inputs}"
plot_cmd = f"disco plot {inputs}"
scenarios = [CONTROL_MODE_SCENARIO]
if pf1:
scenarios.append(PF1_SCENARIO)
Expand Down Expand Up @@ -192,10 +192,10 @@ def make_postprocess_command(self):
commands.append(f"disco make-summary-tables {inputs}")
if hosting_capacity:
for scenario in TIME_SERIES_SCENARIOS:
commands.append(f"disco-internal compute-hosting-capacity {inputs} --scenario={scenario}")
commands.append(f"disco compute-hosting-capacity {inputs} --scenario={scenario}")

for scenario in TIME_SERIES_SCENARIOS:
commands.append(f"disco-internal plot {inputs} --scenario={scenario}")
commands.append(f"disco plot {inputs} --scenario={scenario}")

# Postprocess to ingest results into sqlite database
task_name = self.template.data["task_name"]
Expand Down
Loading

0 comments on commit ca59d35

Please sign in to comment.