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 with mp.mme.

mp.mm_element Methods:

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 object

  • name (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 object

  • name (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:

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:

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:

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:

Call data_model_update_off() then data_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:

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:

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().