Skip to content

Commit

Permalink
modified code for fastapi-0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Lubojanski committed Jul 24, 2023
1 parent 31c7c52 commit 2fe7421
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 135 deletions.
25 changes: 5 additions & 20 deletions src/InRetEnsys/components/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ class InRetEnsysConstraints(InRetEnsysConfigContainer):
title='factor1',
description='Factor to define the proportion between the variables.',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

name: str = Field(
Expand Down Expand Up @@ -103,21 +100,15 @@ class InRetEnsysConstraints(InRetEnsysConfigContainer):
title='Weights',
description='',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

limit: float = Field(
None,
title='Limit',
description='',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0,
step=1e-3
lvl_edit=42
)

flows: Union[List, dict] = Field(
Expand All @@ -141,21 +132,15 @@ class InRetEnsysConstraints(InRetEnsysConfigContainer):
title='Upper Limit',
description='',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0,
step=1e-3
lvl_edit=42
)

lower_limit: int = Field(
None,
title='Lower Limit',
description='',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0,
step=1e-3
lvl_edit=42
)

## Returns a dictionary of the given args of this object.
Expand Down
4 changes: 1 addition & 3 deletions src/InRetEnsys/components/energysystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ class InRetEnsysEnergysystem(InRetEnsysConfigContainer):
title='Time Steps',
description='Number of timesteps from Startdate',
lvl_visible=21,
lvl_edit=42,
ge=0,
le=float("+inf")
lvl_edit=42
)

def add(self, elem: Union[InRetEnsysSink, InRetEnsysSource, InRetEnsysBus, InRetEnsysStorage, InRetEnsysTransformer, InRetEnsysConstraints]):
Expand Down
35 changes: 7 additions & 28 deletions src/InRetEnsys/components/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ class InRetEnsysFlow(InRetEnsysConfigContainer):
description='The nominal value of the flow. If this value is set the corresponding optimization variable of '
'the flow object will be bounded by this value multiplied with min(lower bound)/max(upper bound).',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

# numeric or sequence or None
Expand All @@ -41,10 +38,7 @@ class InRetEnsysFlow(InRetEnsysConfigContainer):
description='Normed fixed value for the flow variable. '
'Will be multiplied with the nominal_value to get the absolute value',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-5
lvl_edit=42
)

# numeric or sequence
Expand All @@ -53,10 +47,7 @@ class InRetEnsysFlow(InRetEnsysConfigContainer):
title='Minimum',
description='',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

# numeric or sequence
Expand All @@ -65,10 +56,7 @@ class InRetEnsysFlow(InRetEnsysConfigContainer):
title='Maximum',
description='',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

positive_gradient: Dict = Field(
Expand All @@ -92,10 +80,7 @@ class InRetEnsysFlow(InRetEnsysConfigContainer):
description='Specific maximum value summed over all timesteps. '
'Will be multiplied with the nominal_value to get the absolute limit.',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

summed_min: float = Field(
Expand All @@ -104,21 +89,15 @@ class InRetEnsysFlow(InRetEnsysConfigContainer):
description='Specific minimum value summed over all timesteps. '
'Will be multiplied with the nominal_value to get the absolute limit.',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

variable_costs: Union[float, Sequence[float]] = Field(
None,
title='Variable Costs',
description='The costs associated with one unit of the flow.',
lvl_visible=21,
lvl_edit=42,
#le=float("+inf"),
#ge=0.0,
#step=1e-3
lvl_edit=42
)

investment: InRetEnsysInvestment = Field(
Expand Down
40 changes: 8 additions & 32 deletions src/InRetEnsys/components/genericstorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,54 +55,39 @@ class InRetEnsysStorage(InRetEnsysConfigContainer):
title='nominal storage capacity',
description='',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

invest_relation_input_capacity: float = Field(
None,
title='invest relation input capacity',
description='',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

invest_relation_output_capacity: float = Field(
None,
title='invest relation output capacity',
description='',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

invest_relation_input_output: float = Field(
None,
title='invest relation input output',
description='',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

initial_storage_level: float = Field(
None,
title='initial storage level',
description='',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

balanced: bool = Field(
Expand All @@ -118,32 +103,23 @@ class InRetEnsysStorage(InRetEnsysConfigContainer):
title='loss rate',
description='',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

fixed_losses_relative: float = Field(
None,
title='fixed losses relative',
description='',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

fixed_losses_absolute: float = Field(
None,
title='Fixed losses absolute',
description='',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

inflow_conversion_factor: float = Field(
Expand Down
25 changes: 5 additions & 20 deletions src/InRetEnsys/components/investment.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,31 @@ class InRetEnsysInvestment(InRetEnsysConfigContainer):
title='Maximum',
description='Maximum of the Investment.',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

minimum: float = Field(
0.0,
title='Minimum',
description='Minimum of the Investment.',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

ep_costs: float = Field(
0.0,
title='EP Costs',
description='ep_costs',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

existing: float = Field(
0.0,
title='Existing',
description='Value of existing investment',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

nonconvex: bool = Field(
Expand All @@ -72,10 +60,7 @@ class InRetEnsysInvestment(InRetEnsysConfigContainer):
title='Offset',
description='Offset',
lvl_visible=21,
lvl_edit=42,
le=float("+inf"),
ge=0.0,
step=1e-3
lvl_edit=42
)

custom_attributes: dict = Field(
Expand Down
Loading

0 comments on commit 2fe7421

Please sign in to comment.