Constraints
EnConstraints
¶
Bases: EnBaseModel
Represents constraint definitions used for various optimization models.
The EnConstraints
class is used for defining constraints within an optimization
framework. It allows the user to configure various parameters of the constraint, such as
the variables involved, proportional factors, limits, and weights. Additionally, the
class provides functionality to parse its data into a format suited for downstream
usage.
Attributes:
Name | Type | Description |
---|---|---|
typ |
Constraints | None
|
Type of the Constraints, all possible types are given in the Enum types.Constraints |
var1 |
object | None
|
First variable, to be set to equal with Var2 and multiplied with factor1. |
var2 |
object | None
|
Second variable, to be set equal to (Var1 * factor1). |
factor1 |
float | None
|
Factor to define the proportion between the variables. |
name |
str | None
|
Optional name for the equation e.g. in the LP file. By default the name is: equate + string representation of var1 and var2. |
keyword |
str | None
|
Keyword to consider (searches all NonConvexFlows). |
quantity |
object | None
|
Shared Pyomo variable for all components of a type. |
limit_name |
str | None
|
Name of the constraint to create. |
components |
list | None
|
List of components from the same type. |
weights |
list[float] | None
|
It has to have the same length as the list of components |
limit |
float | None
|
Absolute limit of keyword attribute for the energy system. |
flows |
list | dict | None
|
List or dictionary that describes flows relevant to the constraint. |
constraint_name |
str | None
|
Name assigned to the constraint. |
upper_limit |
int | None
|
Maximum number of active flows in the list |
lower_limit |
int | None
|
Minimum number of active flows in the list |
Source code in backend/app/ensys/components/constraints.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
to_oemof()
¶
Converts the attributes of the current instance into a dictionary format.
This method iterates through all the attributes of the instance, excluding the
attribute named "typ". If an attribute is not None
, it is added to the resulting
dictionary. The resulting dictionary represents the instance in a format compatible
for further usage or processing.
Returns:
Type | Description |
---|---|
dict[str, dict]
|
A dictionary representation of the instance where keys are attribute names and values are their corresponding data, excluding attributes that are |