pwrs.power_models.dispatch#

Formulation registry and build/extend/solve lifecycle.

class pwrs.power_models.dispatch.FormulationSpec(name, builder, solver, classifier)[source]#

Bases: object

Lazy entry points for one public PowerModels formulation.

Parameters:
  • name (str)

  • builder (str)

  • solver (str)

  • classifier (str)

pwrs.power_models.dispatch.build_power_model(mpc, formulation)[source]#

Build one registered formulation without applying extensions.

Parameters:
  • mpc (Any)

  • formulation (str)

Return type:

Any

pwrs.power_models.dispatch.formulation_spec(formulation)[source]#

Return a registered formulation or raise a stable public error.

Parameters:

formulation (str)

Return type:

FormulationSpec

pwrs.power_models.dispatch.solve_built_power_model(problem, mpopt, nargout=1, *, expected_formulation=None)[source]#

Apply configured extensions and solve a previously built model.

Parameters:
  • problem (Any)

  • mpopt (Any)

  • nargout (int)

  • expected_formulation (str | None)

pwrs.power_models.dispatch.solve_formulation_opf(mpc, mpopt, formulation, nargout=1)[source]#

Build, extend, and solve one explicitly selected formulation.

Parameters:
  • mpc (Any)

  • mpopt (Any)

  • formulation (str)

  • nargout (int)

pwrs.power_models.dispatch.solve_power_models_opf(mpc, mpopt, nargout=1)[source]#

Build, extend, and solve the formulation selected in mpopt.

Parameters:
  • mpc (Any)

  • mpopt (Any)

  • nargout (int)