pwrs.core.toggle_dcline#

pwrs.core.toggle_dcline.toggle_dcline(mpc, on_off)[source]#

Enable, disable or query DC line modeling callbacks.

Parameters:
  • mpc (dict) – MATPOWER case dict. When enabling the extension, it must contain a "dcline" field whose columns follow idx_dcline.

  • on_off ({"on", "off", "status"}) – Requested mode. "on" registers the userfcn callbacks, "off" removes them, and "status" returns the current state.

Returns:

Returns the updated case dict for "on" and "off". Returns a status flag for "status".

Return type:

dict or int

Notes

The DC line extension models each in-service DC line as a linked pair of generators. Although implemented via the OPF userfcn extension mechanism, it is used by both simple power flow and OPF workflows.

See also

idx_dcline, add_userfcn, remove_userfcn, run_userfcn