Exemplo n.º 1
0
    def plot_nodes(self, filename, **kwargs):
        """
        Plot a graph plot of the energy system and store it into a `.graphml`
        file. The kwargs are passed to the oemof.network function
        `create_nx_graph()
        <https://github.com/oemof/oemof.network/blob/dev/src/oemof/network/graph.py#L15>`_.

        Parameters
        ----------
        filename
        kwargs

        Returns
        -------

        """

        g = graph.create_nx_graph(self.es, filename=filename, **kwargs)

        return g
Exemplo n.º 2
0
def save_network_graph(energysystem, case_name):
    logging.debug("Generate networkx diagram")
    energysystem_graph = graph.create_nx_graph(energysystem)
    graph_file_name = case_name + SUFFIX_GRAPH
    graph_path = "./simulation_results/" + graph_file_name
    nx.readwrite.write_gpickle(G=energysystem_graph, path=graph_path)
    energysystem_graph = nx.readwrite.read_gpickle(graph_path)
    matplotlib.rcParams["figure.figsize"] = [20.0, 15.0]

    draw_graph(
        energysystem_graph,
        case_name,
        node_size=5500,
        node_color={
            "coal": "#0f2e2e",
            "gas": "#c76c56",
            "oil": "#494a19",
            "lignite": "#56201d",
            "bel": "#9a9da1",
            "bth": "#cd3333",
            "wind": "#4ca7c3",
            "pv": "#ffde32",
            "demand_el": "#9a9da1",
            "excess_el": "#9a9da1",
            "demand_th": "#cd3333",
            "pp_coal": "#0f2e2e",
            "pp_lig": "#56201d",
            "pp_gas": "#c76c56",
            "pp_oil": "#494a19",
            "pp_chp": "#eeac7e",
            "b_heat_source": "#cd3333",
            "heat_source": "#cd3333",
            "heat_pump": "#42c77a",
        },
        edge_color="#eeac7e",
    )
Exemplo n.º 3
0
        outputs={b_el1: Flow(nominal_value=100, variable_costs=25)},
    )
)

es.add(Sink(label="load", inputs={b_el2: Flow(nominal_value=100, fix=[1, 1])}))

m = Model(energysystem=es)

# m.write('lopf.lp', io_options={'symbolic_solver_labels': True})

m.solve(solver="cbc", solve_kwargs={"tee": True, "keepfiles": False})


m.results()

graph = create_nx_graph(es)

draw_graph(
    graph,
    plot=True,
    layout="neato",
    node_size=3000,
    node_color={"b_0": "#cd3333", "b_1": "#7EC0EE", "b_2": "#eeac7e"},
)


results = processing.results(m)

print(views.node(results, "gen_0"))
print(views.node(results, "gen_1"))
print(views.node(results, "line_1"))