Completed
Push — dev ( 68ddc7...49e927 )
by Patrik
58s queued 48s
created

tests.test_flows.shared._run_flow_model()   A

Complexity

Conditions 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 15
rs 9.85
c 0
b 0
f 0
cc 1
nop 1
1
# -*- coding: utf-8 -*-
2
3
"""Tests for Flows with NonConvex attribute
4
5
SPDX-FileCopyrightText: Deutsches Zentrum für Luft- und Raumfahrt e.V.
6
SPDX-FileCopyrightText: Patrik Schönfeldt
7
8
SPDX-License-Identifier: MIT
9
"""
10
11
import pandas as pd
12
13
from oemof import solph
14
15
16
def _run_flow_model(flow):
17
    date_time_index = pd.date_range("1/1/2012", periods=10, freq="h")
18
    energysystem = solph.EnergySystem(
19
        timeindex=date_time_index,
20
        infer_last_interval=True,
21
    )
22
    bus = solph.buses.Bus(label="bus", balanced=False)
23
    energysystem.add(bus)
24
25
    bus.inputs[bus] = flow
26
27
    model = solph.Model(energysystem)
28
    model.solve()
29
30
    return solph.processing.results(model)[(bus, bus)]["sequences"]
31