Commit e9ea5469 authored by Etienne Cuisinier's avatar Etienne Cuisinier
Browse files

Ajout de la possibilité de rentrer une valeur constante (int ou float) à la...

Ajout de la possibilité de rentrer une valeur constante (int ou float) à la place d'une série temporelle pour l'attribut p (power) d'une FixedEnergyUnit 
parent 31e03b03
......@@ -1038,7 +1038,7 @@ class FixedEnergyUnit(EnergyUnit):
"""
def __init__(self, time, name: str, p: list or dict or pd.DataFrame,
def __init__(self, time, name: str, p: list or dict or pd.DataFrame or int or float,
flow_direction='in',
starting_cost=None, operating_cost=None, co2_out=None,
energy_type=None, verbose=True):
......@@ -1048,12 +1048,18 @@ class FixedEnergyUnit(EnergyUnit):
"You have to define the power profile (p) for the "
"FixedEnergyUnit !")
# p may be a list, a dict or a dataframe (1 column only)
# p may be a list, a dict, a dataframe (1 column only), or an int/float. The latter corresponding to a constant value.
if isinstance(p, list):
e_tot = sum(p) * time.DT
p_min = min(p)
p_max = max(p)
elif isinstance(p, int) or isinstance(p, float):
p_min = p
p_max = p
p = [p for i in range(len(time.DATES))]
e_tot = sum(p) * time.DT
elif isinstance(p, dict):
# Checking the length of the dictionary corresponds to the length
# of the time unit
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment