OpenDSS Backend APIs

This section presents the functions used for interacting the OpenDSS simulation.

Classes and Functions

Created on Tue Jun 07 19:42:05 2022

@author: abhijeetsahu

generate_scenario.cause_line_fault(dss, line_number)

This function causes the line outage.

Parameters
  • dss (object) – openDss com object

  • line_number (str) – The transmission line that encounters outage

Returns

List of voltage status of all the buses in the distribution feeder

Return type

list

generate_scenario.cb_outage(dss, cb_name)

This function implements the capacitor bank outage and run the power flow

Parameters

cb_name – the name of the capacitor bank selected

generate_scenario.cb_restore(dss, cb_name)

This function restores the capacitor banks and re-run the power flow

Parameters

cb_name – the name of the capacitor bank selected

generate_scenario.close_one_switch(dss, circuit, sw_to_close, critical_load_buses)

This function closes one switch

Parameters
  • dss (object) – openDss com object

  • circuit (dss.Circuit) – The circuit of the dss object.

  • sw_to_close (str) – switch to close

  • critical_load_buses (list) – List of critical load buses

Returns

List of voltage status of critical load bus

Return type

list

generate_scenario.close_switch(dss, circuit, switches_to_close, rest_switch, critical_load_buses)

This function closes the set of sectionalizing switches and returns the voltage statuses of the critical loads

Parameters
  • dss (object) – openDss com object

  • circuit (dss.Circuit) – The circuit of the dss object.

  • switches_to_close (list) – List of switches to close

  • rest_switch (list) – complete list of switches

  • critical_load_buses (list) – List of critical load buses

Returns

List of voltage status of critical load bus

Return type

list

generate_scenario.close_switch_sequentially(dss, circuit, switches_to_close, rest_switch, critical_load_buses)

This function sequentially closes the switch

Parameters
  • dss (object) – openDss com object

  • circuit (dss.Circuit) – The circuit of the dss object.

  • switches_to_close (list) – List of switches to close

  • rest_switch (list) – complete list of switches

  • critical_load_buses (list) – List of critical load buses

Returns

List of voltage status of critical load bus

Return type

list

generate_scenario.der_outage(dss, der_bus_number)

This function implements the DER outages and run the power flow

Parameters

der_bus_number – the bus name of the DER which will encounter outage

generate_scenario.disable_switches(dss, circuit, switches_to_open)

This function disable the switches and run the power flow

generate_scenario.enable_switches(dss, circuit, switches_to_close)

This function enable the switches and run the power flow

generate_scenario.getPowers(circuit, dss, type, names)

This function gets the power consumed by a list of load buses

Parameters
  • dss (object) – openDss com object

  • circuit (dss.Circuit) – The circuit of the dss object.

  • type (str) – circuit element type

  • names (list) – list of load buses

Returns

List of power consumed at the critical load buses

Return type

list

generate_scenario.get_Vbus(dss, circuit, busname)

This function gets the absolute voltage magnitude of the specified bus

Parameters
  • dss (object) – openDss com object

  • circuit (dss.Circuit) – The circuit of the dss object.

  • busname (str) – bus name

Returns

voltage magnitude of the bus

Return type

float

generate_scenario.get_lines(dss)
generate_scenario.get_loads(dss, circuit, loadshape_flag=0, loadshape_folder=None)

This function gets the list of load

generate_scenario.get_transformer(dss, circuit)
generate_scenario.open_switch_all(dss, circuit, switches_to_open)

This function opens all the sectionalizing switches before the start of the episode

Parameters
  • dss (object) – openDss com object

  • circuit (dss.Circuit) – The circuit of the dss object.

  • switches_to_open (list) – List of switches to open

generate_scenario.process_solution(dss, circuit, switch_names, critical_loads_bus, line_faults)

This function prints the best solution based on various resilience metric. This function was written based on identifying expert demonstrations based on a defined resilience metric

Parameters
  • dss (object) – openDss com object

  • switch_names (list) – List of sectionalizing switches in the feeder

  • critical_loads_bus (list) – List of critical load bus names

  • line_faults (list) – The list of line under outage

Returns

Nothing

:type : None

generate_scenario.randomize_load(dss, load_names, min_load=0.9, max_load=1.1)

This function randomise the load profile.

Parameters

load_names (list) – List of load bus names

generate_scenario.read_dss_result(power_file, voltage_file, bus_number=130)

This function reads the dss results mainly V and P, obtained after running the power flow

Parameters
  • power_file (str) – file path to the power output

  • voltage_file (str) – file path to the voltage output

generate_scenario.scale_down(dss, randScale, load_names)

This function scales down the load profile

Parameters
  • dss (object) – openDss com object

  • randScale (float) – scaling factor

  • load_names (list) – List of load bus names

Returns

Nothing

:type : None

generate_scenario.scale_up(dss, randScale, load_names)

This function scales up the load profile

Parameters
  • dss (object) – openDss com object

  • randScale (float) – scaling factor

  • load_names (list) – List of load bus names

Returns

Nothing

:type : None

generate_scenario.voltage_satisfiability(volt_mag_list)

Checks if the voltage are in limits

Parameters

volt_mag_list (list) – List of p.u. voltage at the buses

Returns

True or Falsse depending on voltage satisfiability

:type : bool

generate_scenario.voltage_satisfiability_easy(volt_mag_list)
generate_scenario.voltage_satisfiability_old(volt_mag_list)