Coder Social home page Coder Social logo

fleema's People

Contributors

alexkens avatar j-brendel avatar justinhodura avatar marcusschober avatar mosc5 avatar rsgitdata avatar yplatow avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

fleema's Issues

Implement decision making algorithm

The decision making for buses is based on a master's thesis. The proposed algorithms need to be analyzed and converted into code

  • Read master thesis
  • Flow chart (miro)
  • implement

Check new simbev version for reusable code

As we want to simulate vehicles per time step, there is likely crossover between the two tools.

  • Get simbev and checkout the remote branch feature-41-restructure-simbev or look it up in github
  • Look at the Car and CarType classes to check for useful code
  • Check other classes for useful functions
  • Implement found code in the advantage tool

Set up class structure

The planned class structure from the meeting on April 27th 2022 needs to be implemented so that we can start working on the functions. This includes the classes Simulation, Vehicle, and Location and their respective init functions.

Add code documentation

Tasks:

  • Research docstring conventions
  • Decide on convention that fits our needs (typing, readthedocs, ...)
  • Write docstrings for existing classes and functions

Pytest creates result files

Currently result files are always created. There should be a run option to create no vehicle outputs, which can improve calculation speed and doesn't clog up the project folder when running pytest

Improve choice of charging points

Current charging point choice method doesn't check if the charging event actually contributes to goals in a meaningful way (end of day soc, minimum soc, ...)

Config option to set start and end location

Instead of putting the first and last drive to a location in the schedule set a start/end location that the vehicle has to reach by the end of the day. This allows for more flexible charging. It should be an optional parameter.

Location testing

Write tests that cover all properties and functions of the Location class.

  • Define all properties of the class via Miro
  • Implement tests that define the functionality of the class
  • Implement the class itself

Use mypy in testing and fix found errors

mypy is used to check the code for type hints and enforces good typing practices. To not break the automated tests (again), this will be implemented on it's own branch first until all current mypy issues are resolved

Use cost timeseries

Currently cost is being calculated with a fixed price of 30 ct/kWh. The max cost for charging evaluation is set at 1€. These should be changed to use the actual cost time series and the highest price in the series for the charging evaluation.

  • Read cost time series
  • Get max values of series for evaluation
  • Calculate power cost from time series

Include better charging information in scenario

The current charging_points.json in each scenario contains plug types and charging points using those types. They information for actual plug type (Schuke, Type2, etc) is missing here, and makes it difficult to match vehicles to the proper charging power that's available for them.

Update scenarios

This issue should only be tackled once #35 is completed. All scenarios that are not public_transport_base need to be restructured and updated according to changes made in #35, #21 and #22. This includes new input files, changes of the scenario.cfg and structural changes of the directories

Redo scenario file structure

Having to copy every single file for a new scenario is not efficient. I suggest a split between data and settings. An example tree could look as follows

  • advantage-tool
    • scenario_data
      • bad_birnbach
        • charging_points.json
        • schedule.csv
        • ...
      • bad_birnbach_future
        • ...
    • scenario_settings
      • base_scenario
        • scenario.cfg
        • weights.csv

The name of the scenario_data folder will be set in the scenario.cfg and all data files will be pulled from there. This means that there needs to be a standardized name for every input file.
Optionally we could allow the override of specific file paths. Example:

scenario_data = bad_birnbach
charging_points = bad_birnbach_future

OR

charging_points = scenario_data/bad_birnbach_future/charging_points.json

So either it points to another scenario and takes the specific file from there, or set the path directly. One of those options should be chosen and implemented.

Make plotly requirement optional

Plotly is a big package that slows down automatic tests due to installation time.

  • Define different levels of installation (refer to "dev" installation option in setup.cfg)
  • Implement new installation levels
  • Plotly should be an optional requirement

ReadTheDocs setup

ReadTheDocs integration should only be set up once the project goes public, but the docs can already be built. We use .rst files instead of .md, which can easily be used for docs creation. See other projects like TracBEV and SMOOTH for inspiration.

Create script to create distance and incline matrices from schedule

If given a schedule, we can interpolate distances between all points (assuming a straight line grid with only one possible way to get between stations). Distances that can't be calculated could either be left empty or get a high or negative number (up for discussion). This could be a good start to make inputting your own data easier. The incline matrix could be left empty (all 0), but creating the rows and columns can be automated.

Create plots as outputs

possible plots we could have as outputs:

  • SoC of vehicles over a day
  • grid timeseries
  • energy from grid vs from pv
  • create flag in config
  • docstrings

These could be done with matplotlib or using plotly (html output)

Create driving simulation

In case we don't get access to the API license for missions, for use in our own projects and as a necessary component of the open source version of this tool, a driving simulation is needed.

The driving tool gets initialized with all relevant Locations, distances, maximum average speeds and other parameters. It will take a current location, destination, consumption, max speed, consumption, ... as inputs and return the time taken and the necessary energy for the trip

  • read consumption data into simulation (from_config)
  • find consumption value through inputs (driving simulation)
  • interpolate average speed in config
  • create data format for Locations and read it in from_config
  • find all values from matrix for drive from location A to B and output consumption

Parametrize spiceev interface

spiceev is currently being called with dummy data. To change this, data in spiceev_interface.py and scenario_info (for relevant classes) needs to be updated. Additional tests to check for correct formatting and successful execution of the Scenario should also be implemented

  • change data in spiceev_interface.py, get_spice_ev_scenario_dict()
  • update scenario_info property of each relevant class
  • create additional tests

Log outputs and improve event csv

Event csv should get the following new columns:

  • distance
  • energy from PV
  • energy from grid
  • energy cost in €
  • co2 emissions in g

Log file (JSON) should contain:

  • rejected ride requests
  • total emissions
  • total cost
  • total distance
  • total charged energy
  • self-sufficiency (pv energy / total energy)

When no vehicle is being charged the simulation crashes

When no vehicle is being charged the simulation crashes when calculaing self_sufficiency:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.3\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_umd.py", line 211, in runfile
    runpy._run_module_as_main(module_name)
  File "...\.conda\envs\Advantage_Tool_env\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "...\.conda\envs\Advantage_Tool_env\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "...\PythonProjects\advantage-tool\src\advantage\__main__.py", line 26, in <module>
    main()
  File "...\PythonProjects\advantage-tool\src\advantage\__main__.py", line 21, in main
    simulation.run()
  File "...\PythonProjects\advantage-tool\src\advantage\simulation.py", line 271, in run
    sim.run()
  File "...\PythonProjects\advantage-tool\src\advantage\simulation_types\schedule.py", line 259, in run
    self.simulation.observer.export_log(self.simulation.save_directory)
  File "...\PythonProjects\advantage-tool\src\advantage\simulation_state.py", line 74, in export_log
    self.calculate_key_log_parameters()
  File "...\PythonProjects\advantage-tool\src\advantage\simulation_state.py", line 64, in calculate_key_log_parameters
    self.accumulated_results["energy_from_feed_in"]
KeyError: 'energy_from_feed_in'

Example: \319_szenario_data\Sz_1\01_depot_paper\configs\ohne_prio.cfg

Implement level of load tracking

Level of load is a factor from 0-1. Max level of load depends on vehicle type (set when calculating demand table).

  • Level of load in schedule?
  • check level of load when getting demand (track in drive event?)
  • check if interpolation works
  • testing

Integrate new SpiceEV naming

SpiceEV names were changed in rl-institut/spice_ev#160

feedInPower is now localGenerationPower
extLoads are fixedLoads

  • replace old names with new ones
  • check if functionality is unchanged
  • get current users to update SpiceEV in their environments

Add hard coded parameters to config

Multiple parameters are currently hard coded and should be added to the config. This includes the simulation type and the desired end of day soc

Implementation of Vehicle and Location classes

Vehicle and Location are currently set up as dataclasses, which only make sense for static objects. If the Simulation class tracks locations and vehicle SoC, this could be kept. Otherwise these should be changed. Dataclasses could be useful for a VehicleType or Charger class

Improve reproducibility

It would be important to be able to see what input was used to generate output. The easiest solution would be to copy the input files to the output folder in a subdirectory called "input". Files that should be included are at least:

  • config
  • charging_points.json
  • vehicle_types.json
    I think bigger files tht are not supposed to change frequently are not as relevant and can be left out to minimize size of each output folder created.

Charger testing

Charger should be a data class. The constructor and additional properties need to be tested and implemented.

  • Define all properties of the class via Miro
  • Implement tests that define the functionality of the class
  • Implement the class itself

Status and task names should be enums

Create an enum to replace the currently used status strings of "parking", "driving", and "charging".

  • Create enum
  • Replace usage of strings in the code with the enum

Create tests for test driven development

Writing test before implementing the actual code allows for simple and clean development of functions. Tests have to be created based on planned functionality of the software.

Simulation testing

Develop tests that define functions and behaviors of the Simulation class.

  • Define all properties of the class via Miro
  • Implement tests that define the functionality of the class
  • Implement the class itself

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.