commonpower.models.components.ConventionalGen
- class ConventionalGen(name: str, config: dict = {})[source]
Bases:
ComponentConventional generator which is fully controlled.
>>> from commonpower.models.components import ConventionalGen >>> ConventionalGen.info() ---- INFO: ConventionalGen ---- +---------+----------+------------------+------------------+--------+------------------------------+---------------+ | Element | Type | Description | Domain | Bounds | Required config | Data provider | +---------+----------+------------------+------------------+--------+------------------------------+---------------+ | p | INPUT | active power | NonPositiveReals | None | (lb, ub) | | | a | CONSTANT | cost parameter a | Reals | None | constant or ParamInitializer | | | b | CONSTANT | cost parameter b | Reals | None | constant or ParamInitializer | | | c | CONSTANT | cost parameter c | NonNegativeReals | None | constant or ParamInitializer | | | cost | COST | dispatch cost | Reals | None | | | +---------+----------+------------------+------------------+--------+------------------------------+---------------+ CONFIG TEMPLATE { "p": "(lb, ub) (NonPositiveReals)", "a": "constant or ParamInitializer (Reals)", "b": "constant or ParamInitializer (Reals)", "c": "constant or ParamInitializer (NonNegativeReals)" } ---- INFO END ----
Generic power system device. We use this to model generators, loads, storage systems, etc.
- Parameters:
name (str) – Name of the Component object.
config (dict, optional) – Configuration for defined model elements. Defaults to {}.
Methods
add_data_providerAdds a data provider to the entity.
add_nodeComponents cannot have subordinate nodes.
add_to_modelThis 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_providerscompute_costComputes the cost based on the specified cost_fcn and stores the result in the node's cost parameter.
The cost function represents:
detach_controllerRemove the current controller from the entity
empty_copyCreates a fresh copy of the node.
fix_inputsSet the variables corresponding to inputs to fixed
get_childrenget_input_idsGet identifiers of input elements of a given model instance or self :param model_instance: model to get the input element identifiers for
get_inputsExtracts 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_elementGets a pyomo element referenced by name from the given model.
get_pyomo_element_idConstructs the global element name from the local name.
get_self_as_pyomo_blockRetrieves the pyomo block of the calling entity from a global model (based on the entity's global id).
get_valueGets the value of the specified model element.
has_pyomo_elementThis 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).
infoPrints some information about this entity.
input_spaceDetermines 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_inputsTotal number of model elements with type INPUT within the entire tree of this entity
observation_spaceDetermines the observation space of an entity based on the observation mask by retrieving the bounds of the model elements listed in the mask
observeGet observations for one node within the system based on the model items within the observation mask.
register_controllerRegister a controller with this node :param controller: controller to be registered :type controller: BaseController
resetStores the current global model instance and initializes parameters according to their configuration.
set_idGenerates and sets the node id.
set_valueSets the value of the specified model element to the specified value.
unmodeled_updateSystem updates that are not modeled.
updateThis reads data providers and executes the dynamics of self and all subordinate nodes.
update_dataReads data providers for self and all subnodes.
validate_controllerUsed to check whether all nodes which require a controller have one assigned.
validate_data_providersValidates if data providers have compatible configurations.
Attributes
CLASS_INDEX- classmethod _get_model_elements() List[ModelElement][source]
Returns primary model elements.
- Returns:
List[ModelElement] – Model elements.
- cost_fcn(scenario: CostScenario, model: ConcreteModel, t: int = 0) Expression[source]
The cost function represents:
\[cost = a * p^2 + b * p + c.\]Note that p <= 0 for generators.