Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/#276 improve simple example #292

Open
wants to merge 94 commits into
base: dev
Choose a base branch
from

Conversation

maike93he
Copy link
Collaborator

@maike93he maike93he commented Aug 22, 2022

Description

  • Added plotly plot
  • Use smaller test grid 2095
  • Added description how configs can be changed and where they are stored
  • Explained saving to csv
  • Added Jupiter Notebooks to rtd

Fixes #276 (#274)

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • New and adjusted code is formatted using the pre-commit hooks
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

maike93he and others added 30 commits July 21, 2022 16:56
Added input parameter `freq` to the function and added wrapper function in `EDisGo` class
Updated tests for new test grid. Test still fails for following assertion: `assert len(self.edisgo.electromobility.integrated_charging_parks_df) == 14`
…nego/eDisGo into features/#276-improve-simple-example

# Conflicts:
#	examples/edisgo_simple_emob_example.ipynb
…ple.ipynb

Also replaced simBEV and tracBEV example_scenario data for testing by example_scenario_2 data (`conftest.py`).
Adjusted `test_import_electromobility` to match new data. Length of charging_processes_df, potential_charging_parks_gdf and integrated_charging_parks_df changed compared to test without kwagrs. Needs to be checked if that is correct.
…ty.py and test_generators_import.py

Moved the test for import_electromobility from `network.test_electromobility` to `io.test_electromobility_import`
Added doc for Electromobility
Added electromobility-integration-label
Added information on electromobility integration:
* allocation of charging processes to charging stations
* charging strategies
@birgits
Copy link
Collaborator

birgits commented Sep 11, 2022

Thank you @maike93he for your work! I have a few remarks:

  • I exchanged the plots in the simple example notebook by plotly plots. Could you please check why there are still overloaded lines shown in the plots after grid reinforcement? (Fixed with Bugfix relative loading scale and dashplot #302)
  • Could you please add a section in the simple example notebook that shows and shortly explains the EDisGo.save() function?
  • Including the example notebooks currently does not work on readthedocs, as edisgo is not installed on rtd and therefore the imports fail. Could you please try to fix this?
  • The electromobility example notebook can currently not be included in the documentation, as SimBEV and TracBEV data cannot be obtained. This should be fixed in PR Features/#261 emob tests #289 and can afterwards be added to the documentation.
  • The dash plot in the plot example does also not compile correctly. Maybe it needs to be excluded when the notebook is compiled by sphinx. You could e.g. try if "READTHEDOCS" not in os.environ .
  • When all example notebooks can be included in the rtd documentation I would prefer it if they replaced parts of the documentation so that information is not doubled and only needs to be maintained in one place. But this is not urgent and could be moved to a separate issue to be changed some other time.

@maike93he
Copy link
Collaborator Author

The dash plot in the plot example does also not compile correctly. Maybe it needs to be excluded when the notebook is compiled by sphinx. You could e.g. try if "READTHEDOCS" not in os.environ .

@birgits: The dash plot also doesn't compile correctly when the notebook is executed regularly. I get the following error message:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [14], in <cell line: 1>()
----> 1 plot_dash(edisgo_objects=edisgo_analyzed)
      2 time.sleep(2)

File ~/Documents/PythonProjects/eDisGo_orig/eDisGo/edisgo/tools/plots.py:2143, in plot_dash(edisgo_objects, mode, debug, port)
   2110 def plot_dash(
   2111     edisgo_objects: EDisGo | dict[str, EDisGo],
   2112     mode: str = "inline",
   2113     debug: bool = False,
   2114     port: int = 8050,
   2115 ):
   2116     """
   2117     Shows the generated jupyter dash app from given eDisGo object(s).
   2118 
   (...)
   2141 
   2142     """
-> 2143     app = plot_dash_app(edisgo_objects, debug=debug)
   2144     log = logging.getLogger("werkzeug")
   2145     log.setLevel(logging.ERROR)

File ~/Documents/PythonProjects/eDisGo_orig/eDisGo/edisgo/tools/plots.py:1982, in plot_dash_app(edisgo_objects, debug)
   1869         return fig_1, fig_2
   1871 else:
   1872     app.layout = html.Div(
   1873         [
   1874             html.Div(
   1875                 [
   1876                     html.Div(
   1877                         [
   1878                             html.Label("Grid"),
   1879                             dcc.Dropdown(
   1880                                 id="dropdown_grid",
   1881                                 options=[
   1882                                     {"label": i, "value": i} for i in grid_name_list
   1883                                 ],
   1884                                 value=grid_name_list[1],
   1885                             ),
   1886                         ],
   1887                         style={"padding": padding, "flex": 1},
   1888                     ),
   1889                     html.Div(
   1890                         [
   1891                             html.Label("Line plot mode"),
   1892                             dcc.Dropdown(
   1893                                 id="dropdown_line_plot_mode",
   1894                                 options=[
   1895                                     {"label": i, "value": i}
   1896                                     for i in line_plot_modes
   1897                                 ],
   1898                                 value=line_plot_modes[0],
   1899                             ),
   1900                         ],
   1901                         style={"padding": padding, "flex": 1},
   1902                     ),
   1903                     html.Div(
   1904                         [
   1905                             html.Label("Line result selection"),
   1906                             dcc.Dropdown(
   1907                                 id="line_result_selection",
   1908                                 options=[
   1909                                     {"label": "Min", "value": "min"},
   1910                                     {"label": "Max", "value": "max"},
   1911                                 ],
   1912                                 value="max",
   1913                             ),
   1914                         ],
   1915                         style={"padding": padding, "flex": 1},
   1916                     ),
   1917                 ],
   1918                 style={
   1919                     "display": "flex",
   1920                     "flex-direction": "row",
   1921                     "padding": 0,
   1922                     "flex": 1,
   1923                 },
   1924             ),
   1925             html.Div(
   1926                 [
   1927                     html.Div(
   1928                         [
   1929                             html.Label("Pseudo coordinates"),
   1930                             dcc.RadioItems(
   1931                                 id="radioitems_pseudo_coordinates",
   1932                                 options=[
   1933                                     {"label": "False", "value": False},
   1934                                     {"label": "True", "value": True},
   1935                                 ],
   1936                                 value=False,
   1937                             ),
   1938                         ],
   1939                         style={"padding": padding, "flex": 1},
   1940                     ),
   1941                     html.Div(
   1942                         [
   1943                             html.Label("Node plot mode"),
   1944                             dcc.Dropdown(
   1945                                 id="dropdown_node_plot_mode",
   1946                                 options=[
   1947                                     {"label": i, "value": i}
   1948                                     for i in node_plot_modes
   1949                                 ],
   1950                                 value=node_plot_modes[0],
   1951                             ),
   1952                         ],
   1953                         style={"padding": padding, "flex": 1},
   1954                     ),
   1955                     html.Div(
   1956                         [
   1957                             html.Label("Node result selection"),
   1958                             dcc.Dropdown(
   1959                                 id="node_result_selection",
   1960                                 options=[
   1961                                     {"label": "Min", "value": "min"},
   1962                                     {"label": "Max", "value": "max"},
   1963                                 ],
   1964                                 value="max",
   1965                             ),
   1966                         ],
   1967                         style={"padding": padding, "flex": 1},
   1968                     ),
   1969                 ],
   1970                 style={
   1971                     "display": "flex",
   1972                     "flex-direction": "row",
   1973                     "padding": 0,
   1974                     "flex": 1,
   1975                 },
   1976             ),
   1977             html.Div(
   1978                 [
   1979                     html.Div(
   1980                         [
   1981                             html.Label("Time step mode"),
-> 1982                             dcc.RadioItems(
   1983                                 ["Single", "Range", "All"],
   1984                                 "All",
   1985                                 inline=True,
   1986                                 id="timestep_mode_radio",
   1987                             ),
   1988                         ],
   1989                         style={"padding": padding, "flex": 1},
   1990                     ),
   1991                     html.Div(
   1992                         [
   1993                             html.Label("Time step start"),
   1994                             dcc.Dropdown(
   1995                                 id="timestep_dropdown_start",
   1996                                 options=timestep_option,
   1997                                 value=timestep_option[0]["value"],
   1998                             ),
   1999                         ],
   2000                         style={"padding": padding, "flex": 1},
   2001                     ),
   2002                     html.Div(
   2003                         [
   2004                             html.Label("Time step end"),
   2005                             dcc.Dropdown(
   2006                                 id="timestep_dropdown_end",
   2007                                 options=timestep_option,
   2008                                 value=timestep_option[-1]["value"],
   2009                             ),
   2010                         ],
   2011                         style={"padding": padding, "flex": 1},
   2012                     ),
   2013                 ],
   2014                 style={
   2015                     "display": "flex",
   2016                     "flex-direction": "row",
   2017                     "padding": 0,
   2018                     "flex": 1,
   2019                 },
   2020             ),
   2021             html.Div(
   2022                 [html.Div([dcc.Graph(id="fig")], style={"flex": "auto"})],
   2023                 style={"display": "flex", "flex-direction": "row"},
   2024             ),
   2025         ],
   2026         style={"display": "flex", "flex-direction": "column"},
   2027     )
   2029     @app.callback(
   2030         Output("timestep_dropdown_start", "disabled"),
   2031         Output("timestep_dropdown_end", "disabled"),
   2032         Input("timestep_mode_radio", "value"),
   2033     )
   2034     def update_timestep_components_single(timestep_mode_radio):
   2035         if timestep_mode_radio == "Single":

File ~/Documents/PythonProjects/eDisGo_orig/d_py38_edisgo/lib/python3.8/site-packages/dash/development/base_component.py:388, in _explicitize_args.<locals>.wrapper(*args, **kwargs)
    386 if "self" in kwargs["_explicit_args"]:
    387     kwargs["_explicit_args"].remove("self")
--> 388 return func(*args, **kwargs)

TypeError: __init__() got multiple values for argument 'id'

@birgits
Copy link
Collaborator

birgits commented Sep 22, 2022

@mltja can you have a look at the error @maike93he posted?

@mltja
Copy link
Member

mltja commented Sep 22, 2022

Hey @birgits and @maike93he , I got the same Error with an existing env yesterday, but with a new conda env everything worked fine. But I will try it again with this branch.

https://community.plotly.com/t/typeerror-init-got-multiple-values-for-argument-marks/61367/3

Base automatically changed from features/#261-emob-tests to dev September 26, 2022 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Improve simple example
4 participants