mp.mm_element
- class mp.mm_element
Bases:
handle
mp.mm_element
- Abstract base class for MATPOWER mathematical model element objects.A math model element object typically does not contain any data, but only the methods that are used to build the math model and update the corresponding data model element once the math model has been solved.
All math model element classes inherit from
mp.mm_element
. Each element type typically implements its own subclasses, which are further subclassed where necessary per task and formulation, as with the container class.By convention, math model element variables are named
mme
and math model element class names begin withmp.mme
.- mp.mm_element Methods:
name()
- get name of element type, e.g.'bus'
,'gen'
data_model_element()
- get corresponding data model elementnetwork_model_element()
- get corresponding network model elementadd_vars()
- add math model variables for this elementadd_constraints()
- add math model constraints for this elementadd_costs()
- add math model costs for this elementdata_model_update()
- update the corresponding data model elementdata_model_update_off()
- update offline elements in corresponding data model elementdata_model_update_on()
- update online elements in corresponding data model element
See the Mathematical Model Elements section in the MATPOWER Developer’s Manual for more information.
See also
mp.math_model
.- Method Summary
- name()
Get name of element type, e.g.
'bus'
,'gen'
.name = mme.name()
- Output:
name (char array) – name of element type, must be a valid struct field name
Implementation provided by an element type specific subclass.
- data_model_element(dm, name)
Get corresponding data model element.
dme = mme.data_model_element(dm) dme = mme.data_model_element(dm, name)
- Inputs:
dm (
mp.data_model
) – data model objectname (char array) – (optional) name of element type (default is name of this object)
- Output:
dme (
mp.dm_element
) – data model element object
- network_model_element(nm, name)
Get corresponding network model element.
nme = mme.network_model_element(nm) nme = mme.network_model_element(nm, name)
- Inputs:
nm (
mp.net_model
) – network model objectname (char array) – (optional) name of element type (default is name of this object)
- Output:
nme (
mp.nm_element
) – network model element object
- add_vars(mm, nm, dm, mpopt)
Add math model variables for this element.
mme.add_vars(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
Implementation provided by a subclass.
- add_constraints(mm, nm, dm, mpopt)
Add math model constraints for this element.
mme.add_constraints(obj, 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
Implementation provided by a subclass.
- add_costs(mm, nm, dm, mpopt)
Add math model costs for this element.
mme.add_costs(obj, 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
Implementation provided by a subclass.
- data_model_update(mm, nm, dm, mpopt)
Update the corresponding data model element.
mme.data_model_update(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
Call
data_model_update_off()
thendata_model_update_on()
to update the data model for this element based on the math model solution.See also
data_model_update_off()
,data_model_update_on()
.
- data_model_update_off(mm, nm, dm, mpopt)
Update offline elements in the corresponding data model element.
mme.data_model_update_off(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
Set export variables for offline elements based on specs returned by
mp.dm_element.export_vars_offline_val()
.See also
data_model_update()
,data_model_update_on()
.
- data_model_update_on(mm, nm, dm, mpopt)
Update online elements in the corresponding data model element.
mme.data_model_update_on(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
Extract the math model solution relevant to this particular element and update the corresponding data model element for online elements accordingly.
Implementation provided by a subclass.
See also
data_model_update()
,data_model_update_off()
.