Skip to content

Commit 7249504

Browse files
committed
Fix legacy FlowSystemLong
1 parent b192916 commit 7249504

1 file changed

Lines changed: 14 additions & 25 deletions

File tree

tests/conftest.py

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -511,51 +511,42 @@ def flow_system_long():
511511
p_el = data['Strompr.€/MWh'].values
512512
gas_price = data['Gaspr.€/MWh'].values
513513

514-
flow_system = fx.FlowSystem(pd.DatetimeIndex(data.index))
515-
516-
# Create special time series data for this system
517514
thermal_load_ts, electrical_load_ts = (
518-
fx.TimeSeriesData(thermal_load, coords={'time': flow_system.timesteps}),
519-
fx.TimeSeriesData(electrical_load, aggregation_weight=0.7, coords={'time': flow_system.timesteps}),
515+
fx.TimeSeriesData(thermal_load),
516+
fx.TimeSeriesData(electrical_load, aggregation_weight=0.7),
520517
)
521518
p_feed_in, p_sell = (
522-
fx.TimeSeriesData(-(p_el - 0.5), aggregation_group='p_el', coords={'time': flow_system.timesteps}),
523-
fx.TimeSeriesData(p_el + 0.5, aggregation_group='p_el', coords={'time': flow_system.timesteps}),
519+
fx.TimeSeriesData(-(p_el - 0.5), aggregation_group='p_el'),
520+
fx.TimeSeriesData(p_el + 0.5, aggregation_group='p_el'),
524521
)
525522

526-
# Add buses and effects using library
527-
flow_system.add_elements(*Buses.defaults(), Buses.coal())
528-
529-
flow_system.add_elements(Effects.costs(), Effects.co2(), Effects.primary_energy())
530-
531-
gas = Sources.gas_with_costs()
532-
gas.source.effects_per_flow_hour = {'costs': gas_price, 'CO2': 0.3}
533-
534-
# Add loads and sources - mix of library and special elements
523+
flow_system = fx.FlowSystem(pd.DatetimeIndex(data.index))
535524
flow_system.add_elements(
536-
# Special thermal load with time series
525+
*Buses.defaults(),
526+
Buses.coal(),
527+
Effects.costs(),
528+
Effects.co2(),
529+
Effects.primary_energy(),
537530
fx.Sink(
538531
'Wärmelast', sink=fx.Flow('Q_th_Last', bus='Fernwärme', size=1, fixed_relative_profile=thermal_load_ts)
539532
),
540-
# Special electrical load with time series
541533
fx.Sink('Stromlast', sink=fx.Flow('P_el_Last', bus='Strom', size=1, fixed_relative_profile=electrical_load_ts)),
542-
# Special coal tariff
543534
fx.Source(
544535
'Kohletarif',
545536
source=fx.Flow('Q_Kohle', bus='Kohle', size=1000, effects_per_flow_hour={'costs': 4.6, 'CO2': 0.3}),
546537
),
547-
# Special electricity feed-in with time series
538+
fx.Source(
539+
'Gastarif',
540+
source=fx.Flow('Q_Gas', bus='Gas', size=1000, effects_per_flow_hour={'costs': gas_price, 'CO2': 0.3}),
541+
),
548542
fx.Sink('Einspeisung', sink=fx.Flow('P_el', bus='Strom', size=1000, effects_per_flow_hour=p_feed_in)),
549-
# Special electricity purchase tariff
550543
fx.Source(
551544
'Stromtarif',
552545
source=fx.Flow('P_el', bus='Strom', size=1000, effects_per_flow_hour={'costs': p_sell, 'CO2': 0.3}),
553546
),
554547
)
555548

556-
# Add converters and storage - special components for this system
557549
flow_system.add_elements(
558-
# Special boiler for long system
559550
fx.linear_converters.Boiler(
560551
'Kessel',
561552
eta=0.85,
@@ -569,7 +560,6 @@ def flow_system_long():
569560
on_off_parameters=fx.OnOffParameters(effects_per_switch_on=1000),
570561
),
571562
),
572-
# Special coal-fired CHP
573563
fx.linear_converters.CHP(
574564
'BHKW2',
575565
eta_th=0.58,
@@ -579,7 +569,6 @@ def flow_system_long():
579569
Q_th=fx.Flow('Q_th', bus='Fernwärme'),
580570
Q_fu=fx.Flow('Q_fu', bus='Kohle', size=288, relative_minimum=87 / 288),
581571
),
582-
# Special storage with specific parameters
583572
fx.Storage(
584573
'Speicher',
585574
charging=fx.Flow('Q_th_load', size=137, bus='Fernwärme'),

0 commit comments

Comments
 (0)