Skip to content

Commit

Permalink
Correcting ThermalCLuster arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdiwahada committed Oct 29, 2024
1 parent 27c7758 commit 9fffa9a
Showing 1 changed file with 52 additions and 10 deletions.
62 changes: 52 additions & 10 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,24 @@ def test_distribute_outages(available_units, po_candidates, fo_candidates, expec
def test_forced_outages(rng):
days = 365
# modifier valid_outage_params de facon à le paramétrer
outage_gen_params = valid_outage_params()
outage_gen_params = OutageGenerationParameters(
unit_count=10,
fo_law=ProbabilityLaw.UNIFORM,
fo_volatility=0,
po_law=ProbabilityLaw.UNIFORM,
po_volatility=0,
fo_duration=10 * np.ones(dtype=int, shape=days),
fo_rate=0.2 * np.ones(dtype=float, shape=days),
po_duration=10 * np.ones(dtype=int, shape=days),
po_rate=np.zeros(dtype=float, shape=days),
npo_min=np.zeros(dtype=int, shape=days),
npo_max=10 * np.ones(dtype=int, shape=days),
)
cluster = ThermalCluster(
outage_gen_params,
nominal_power=100,
modulation=np.ones(dtype=float, shape=8760),
)
link_capacity = LinkCapacity(
outage_gen_params,
nominal_capacity=100,
modulation_direct=np.ones(dtype=float, shape=8760),
modulation_indirect=np.ones(dtype=float, shape=8760),
)
cluster.modulation[12] = 0.5

generator = ThermalDataGenerator(rng=rng, days=days)
Expand Down Expand Up @@ -255,7 +261,19 @@ def test_planned_outages(rng):
def test_planned_outages_limitation(rng):
days = 365
# Maximum 1 planned outage at a time.
outage_gen_params = valid_outage_params()
outage_gen_params = OutageGenerationParameters(
unit_count=10,
fo_law=ProbabilityLaw.UNIFORM,
fo_volatility=0,
po_law=ProbabilityLaw.UNIFORM,
po_volatility=0,
fo_duration=10 * np.ones(dtype=int, shape=days),
fo_rate=np.zeros(dtype=float, shape=days),
po_duration=2 * np.ones(dtype=int, shape=days),
po_rate=0.2 * np.ones(dtype=float, shape=days),
npo_min=np.zeros(dtype=int, shape=days),
npo_max=1 * np.ones(dtype=int, shape=days),
)
cluster = ThermalCluster(
outage_gen_params,
nominal_power=100,
Expand Down Expand Up @@ -285,7 +303,19 @@ def test_planned_outages_limitation(rng):
def test_planned_outages_min_limitation(rng):
days = 365
# Minimum 2 planned outages at a time
outage_gen_params = valid_outage_params()
outage_gen_params = OutageGenerationParameters(
unit_count=10,
fo_law=ProbabilityLaw.UNIFORM,
fo_volatility=0,
po_law=ProbabilityLaw.UNIFORM,
po_volatility=0,
fo_duration=10 * np.ones(dtype=int, shape=days),
fo_rate=np.zeros(dtype=float, shape=days),
po_duration=10 * np.ones(dtype=int, shape=days),
po_rate=0.2 * np.ones(dtype=float, shape=days),
npo_min=2 * np.ones(dtype=int, shape=days),
npo_max=5 * np.ones(dtype=int, shape=days),
)
cluster = ThermalCluster(
outage_gen_params,
nominal_power=100,
Expand Down Expand Up @@ -325,7 +355,19 @@ def test_with_long_fo_and_po_duration(data_directory):
po_duration[:31] = 3
fo_rate[:31] = 0.1
po_rate[:31] = 0.02
outage_gen_params = valid_outage_params()
outage_gen_params = OutageGenerationParameters(
unit_count=10,
fo_law=ProbabilityLaw.UNIFORM,
fo_volatility=0.5,
po_law=ProbabilityLaw.GEOMETRIC,
po_volatility=0.5,
fo_duration=fo_duration,
fo_rate=fo_rate,
po_duration=po_duration,
po_rate=po_rate,
npo_min=0 * np.ones(dtype=int, shape=days),
npo_max=3 * np.ones(dtype=int, shape=days),
)
cluster = ThermalCluster(
outage_gen_params,
nominal_power=500,
Expand Down

0 comments on commit 9fffa9a

Please sign in to comment.