energia.modeling.variables.aspect#

Variable

Functions

dataclass([cls, init, repr, eq, order, ...])

Add dunder methods based on the fields defined in the class.

merge_tree_levels(d)

Convert nested dict to level-wise compact structure, merging repeated keys at all levels.

Classes

Aspect(primary_type[, nn, ispos, neg, ...])

A particular facet of the system under consideration.

BalCons

alias of Balance

Commodity([basis, label, citations])

A commodity, can be a material, chemical, energy, etc.

Domain(indicator, commodity, process, ...)

Point represented by a tuple of indices

Indicator([label, citations])

Impact Indicator

Interact()

Interaction between Players

Lag([of, periods])

A number of temporal Periods.

Linkage(source, sink[, dist, bi, auto, ...])

Linkage between two Locations.

Location(*has[, label, citations])

A discretization of Space.

MapCons

alias of Map

Modes([size, sample, parent, n])

Represents a discrete choice to be taken within a spatiotemporal disposition.

Periods([size, of, n, label, citations])

A discretization of Time.

Player([label, citations])

Player or Actor, the one taking the decisions based on information provided

Process(*args[, label, citations])

Process converts one Resource to another Resource at some Location

Sample(aspect, domain[, timed, spaced, report])

Sets a bound on a variable (V) within a particular domain.

Space(model)

Spatial representation of the system.

Storage(*args[, label, citations])

Storage is a container for three main elements: 1.

Time(model)

Temporal representation of a system.

Transport(*args[, label, citations])

Exports Resource through Link basically, moves Resources between Locations

cached_property(func)

class Aspect(primary_type: Type[_Component] | tuple[Type[_Component], ...], nn: bool = True, ispos: bool = True, neg: str = '', latex: str = '', bound: str = '', label: str = '', use_multiplier: bool = False)[source]#

Bases: object

A particular facet of the system under consideration. A sample of an aspect at a specific disposition is represented by a variable (\(\overset{\*}{v} \in \overset{\*}{\mathcal{V}}\)). The range of values which the \(\overset{\*}{v}\) is bounded such that:

\[\overset{\*}{v} \in [\underline{\theta}, \overline{\theta}]\]

Aspects can be decision-variables (\(\dot{v}\)) that prescribe a control action or a set point for the state, or derived (calculated) variables (\(\hat{v}\)) that represent the state of the system. States can be operation capacity, production levels, purchase levels, emissions, consumption levels, etc.

Parameters:
  • primary_types (Type[_Component] | tuple[Type[_Component], ...]) – associated components type(s). Defaults to None.

  • nn (bool) – If True, the decision is a non-negative decision. Defaults to True.

  • ispos (bool) – If True, the decision is positive (non-negative). Defaults to True.

  • neg (str) – Negative form or representation of the decision, if any. Defaults to “”.

  • latex (str) – LaTeX string. Defaults to “”.

  • bound (str) – if the aspect is bounded by another. Defaults to “”.

  • label (str) – Label for the decision. Defaults to “”.

  • use_multiplier (bool) – Use a scaler (such as distance) for calculations

Variables:
  • model (Model) – Model to which the Aspect belongs.

  • name (str) – Name of the Aspect.

  • indices (list[Location | Linkage, Periods]) – List of indices (Location, Periods) associated with the Aspect.

  • bound_spaces (dict[Commodity | Process | Storage | Transport, list[Location | Linkage]]) – Spaces where the Aspect has been already bound.

  • domains (list[Domain]) – List of domains associated with the Aspect.

Raises:

ValueError – If primary_type is not defined.

primary_type: Type[_Component] | tuple[Type[_Component], ...]#
nn: bool = True#
ispos: bool = True#
neg: str = ''#
latex: str = ''#
bound: str = ''#
label: str = ''#
use_multiplier: bool = False#
property maps: dict[str, dict[Domain, list[Domain]]][source]#

Maps of the decision

property maps_report: dict[str, dict[Domain, list[Domain]]][source]#

Maps of the decision

property isneg: bool[source]#

Does this remove from the domain?

property sign: float[source]#

Gives the multiplier in balances

property space: Space[source]#

Space

property program: Prg[source]#

Mathematical Program

property problem: Problem[source]#

Tree

property time: Time[source]#

Time

property I: Idx#

gana index set (I)

property V: Var#

Variable

property cons: list[C]#

Constraints

property network: Location#

Circumscribing Location (Spatial Scale)

property horizon: Periods#

Circumscribing Periods (Temporal Scale)

property dispositions: dict[Self, dict[Commodity | Process | Storage | Transport, dict[Periods | Location | Linkage, dict[Location | Periods | Linkage, bool]]]]#

Dispositions dict

property sizes#

dict of domain sizes

property box#

Box of domain indices

crumple_domains()[source]#
alias(*names: str)[source]#

Create aliases for the decision

Parameters:

names (str) – Names of the aliases

update(domain: Domain, reporting: bool = False)[source]#

Each inherited object has their own

show(descriptive=False)[source]#

Pretty print the component

output(n_sol: int = 0, aslist: bool = False, asdict: bool = False, compare: bool = False) list[float] | dict[tuple[Idx, ...], float] | None[source]#

Solution

Parameters:
  • n_sol (int, optional) – Solution number. Defaults to 0.

  • compare (bool, optional) – Compares the solution with the previous one. Defaults to False.

  • optional) (aslist (bool,) – Returns values taken as dict. Defaults to False.

  • optional) – Returns values taken as list. Defaults to False.

Returns:

List of values taken by the decision.

Return type:

list[float] | None

gettime(*index) list[Periods][source]#

Finds the sparsest time scale in the domains

Map(domain: Domain, reporting: bool = False)[source]#

Map the aspect to the domain

Balance(domain: Domain)[source]#

Add a general resource balance for the aspect over the domain