mp.task_opf_legacy
- class mp.task_opf_legacy
Bases:
mp.task_opf
,mp.task_shared_legacy
mp.task_opf
- MATPOWER task for legacy optimal power flow (OPF).Adds functionality needed by the legacy MATPOWER framework to the task implementation for the optimal power flow problem. This consists of pre-processing some input data and exporting and packaging result data, as well as using some legacy specific model sub-classes.
- mp.task_pf Methods:
run_pre()
- pre-process inputs that are for legacy framework onlyrun_post()
- export results back to data model sourcedm_converter_class_mpc2_default()
- set tomp.dm_converter_mpc2_legacy
data_model_build_post()
- get data model converter to do more input pre-processingmath_model_class_default()
- use legacy math model subclasseslegacy_post_run()
- post-process legacy framework outputs
See also
mp.task_opf
,mp.task
,mp.task_shared_legacy
.- Method Summary
- run_pre(d, mpopt)
Pre-process inputs that are for legacy framework only.
[d, mpopt] = task.run_pre(d, mpopt)
- Inputs:
d – data source specification, currently assumed to be a MATPOWER case name or case struct (
mpc
)mpopt (struct) – MATPOWER options struct
- Outputs:
d – updated value of corresponding input
mpopt (struct) – updated value of corresponding input
Call
run_pre_legacy()
method before calling parent.
- run_post(mm, nm, dm, mpopt)
Export results back to data model source.
task.run_post(mm, nm, dm, mpopt)
- Inputs:
mm (
mp.math_model
) – mathmatical model objectnm (
mp.net_model
) – network model objectdm (
mp.data_model
) – data model objectmpopt (struct) – MATPOWER options struct
- Output:
task (
mp.task
) – task object
Calls
mp.dm_converter.export()
and saves the result in the data modelsource
property.
- dm_converter_class_mpc2_default()
Set to
mp.dm_converter_mpc2_legacy
.dmc_class = task.dm_converter_class_mpc2_default()
- data_model_build_post(dm, dmc, mpopt)
Get data model converter to do more input pre-processing after calling superclass
data_model_build_post()
.
- math_model_class_default(nm, dm, mpopt)
Use legacy math model subclasses to support legacy costs and callbacks.
Uses math model variations that inherit from
mp.mm_shared_opf_legacy
(compatible with the legacyopf_model
), in order to support legacy cost functions and callback functions that expect to find the MATPOWER case struct inmm.mpc
.
- legacy_post_run(mpopt)
Post-process legacy framework outputs.
[results, success, raw] = task.legacy_post_run(mpopt)
- Input:
mpopt (struct) – MATPOWER options struct
- Outputs:
results (struct) – results struct for legacy MATPOWER framework, see Table 6.1 in legacy MATPOWER User's Manual.
success (integer) – 1 - succeeded, 0 - failed
raw (struct) – see
raw
field in Table 6.1 in legacy MATPOWER User's Manual.
Extract
results
andsuccess
and save the task object inresults.task
before returning. This method also creates and populates numerous other fields expected in the legacy OPFresults
struct, such asf
,x
,om
,mu
,g
,dg
,raw
,var
,nle
,nli
,lin
, andcost
. Based on code from the legacy functionsopf_execute()
,dcopf_solver()
, andnlpopf_solver()
.