commonpower.core.Bus

class Bus(name: str, config: dict = {})[source]

Bases: Node

Bus.

Parameters:
  • name (str) – Name of the Bus object.

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

Methods

add_data_provider

Adds a data provider to the entity.

add_node

Adds a subordinate node.

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

compute_cost

Computes the cost based on the specified cost_fcn and stores the result in the node's cost parameter.

cost_fcn

Returns the node's cost as pyomo expression at time t.

detach_controller

Remove the current controller from the entity

empty_copy

Creates a fresh copy of the node.

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

reset

Stores the current global model instance and initializes parameters according to their configuration.

set_as_stand_alone

Sets a flag indicating that the bus is stand-alone.

set_as_structure_member

Sets a flag indicating that the bus is a member of some structure (e.g., energy community, P2P market).

set_id

Generates and sets the node id.

set_value

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

unmodeled_update

System updates that are not modeled.

update

This reads data providers and executes the dynamics of self and all subordinate nodes.

update_data

Reads data providers for self and all subnodes.

validate_controller

Used to check whether all nodes which require a controller have one assigned.

validate_data_providers

Validates if data providers have compatible configurations.

Attributes

CLASS_INDEX

_get_additional_constraints() List[ModelElement][source]

Returns additional constraints on model variables. By default only internal power balance constraints.

Returns:

List[ModelElement] – List of additional constraint elements.

_get_internal_power_balance_constraints() List[ModelElement][source]

Returns the internal power balance constraints of the node.

Returns:

List[ModelElement] – Generated constraints.

classmethod _get_model_elements() List[ModelElement][source]

Returns primary model elements. Busses specify active power (p), reactive power (q), voltage magnitude (v), and voltage angle (d).

Returns:

List[ModelElement] – Model elements.

set_as_stand_alone() None[source]

Sets a flag indicating that the bus is stand-alone.

set_as_structure_member() None[source]

Sets a flag indicating that the bus is a member of some structure (e.g., energy community, P2P market).