commonpower.core.Line

class Line(src: Node, dst: Node, config: dict = {}, name: str = 'line')[source]

Bases: ControllableModelEntity

Power transmission line. Sublasses have to implement specific variables and parameters. We consider lines to be undirected in principle, however, the sign of current flow would be based on the src-dst convention.

Parameters:
  • src (Node) – Source node.

  • dst (Node) – Target node.

  • config (dict, optional) – Configuration for defined model elements. Defaults to {}.

  • name (str, optional) – Name of the line object. Defaults to “line”.

Methods

add_data_provider

Adds a data provider to the entity.

add_to_model

This method adds the calling entity to the given (global) pyomo model. To this end, we - declare and add a new pyomo block named by self.id (the entity's global id). - call _get_model_elements() to retrieve the entity's model elements (variables and parameters). - call _augment_model_elements() to add additional model elements (constraints etc.). - check the configuration dict for completeness based on the defined model elements. - add all model elements to the previously declared pyomo block.

clear_data_providers

cost_fcn

Returns the pyomo expression of the entity's cost function.

detach_controller

Remove the current controller from the entity

empty_copy

Creates a fresh copy of the line.

fix_inputs

Set the variables corresponding to inputs to fixed

get_children

get_input_ids

Get identifiers of input elements of a given model instance or self :param model_instance: model to get the input element identifiers for

get_inputs

Extracts model elements of type INPUT from a given model instance or self :param model_instance: model to get the input elements for :type model_instance: ConcreteModel, Optional

get_pyomo_element

Gets a pyomo element referenced by name from the given model.

get_pyomo_element_id

Constructs the global element name from the local name.

get_self_as_pyomo_block

Retrieves the pyomo block of the calling entity from a global model (based on the entity's global id).

get_value

Gets the value of the specified model element.

has_pyomo_element

This is essentially an indicator wrapper around get_pyomo_element() which returns False if no corresponding model element could be found (instead of raising an error).

info

Prints some information about this entity.

input_space

Determines the input space of an entity from the bounds of all model elements with type INPUT within the tree :param normalize: Whether or not to normalize the input space to [-1,1] :type normalize: bool

n_inputs

Total number of model elements with type INPUT within the entire tree of this entity

observation_space

Determines the observation space of an entity based on the observation mask by retrieving the bounds of the model elements listed in the mask

observe

Get observations for one node within the system based on the model items within the observation mask.

register_controller

Register a controller with this node :param controller: controller to be registered :type controller: BaseController

set_value

Sets the value of the specified model element to the specified value.

Attributes

CLASS_INDEX

empty_copy() Line[source]

Creates a fresh copy of the line.

Returns:

Line – Cloned line instance.