Git Product home page Git Product logo

alefunxo / basopra Goto Github PK

View Code? Open in Web Editor NEW
30.0 0.0 8.0 9.06 MB

BASOPRA - BAttery Schedule OPtimizer for Residential Applications. Daily battery schedule optimizer (i.e. 24 h optimization framework), assuming perfect day-ahead forecast of the electricity demand load and solar PV generation in order to determine the maximum economic potential regardless of the forecast strategy used. Include the use of different applications which residential batteries can perform from a consumer perspective. Applications such as avoidance of PV curtailment, demand load-shifting and demand peak shaving are considered along with the base application, PV self-consumption. Different battery technologies and sizes can be analyzed as well as different tariff structures. Aging is treated as an exogenous parameter, calculated on daily basis and is not subject of optimization. Data with 15-minute temporal resolution are used for simulations. The model objective function have two components, the energy-based and the power-based component, as the tariff structure depends on the applications considered, a boolean parameter activate the power-based factor of the bill when is necessary.

License: GNU General Public License v3.0

Python 100.00%
battery optimization pv-systems applications lithium-ion

basopra's Introduction

Description
Daily battery schedule optimizer (i.e. 24 h optimization framework), assuming perfect day-ahead forecast of the electricity demand load and solar PV generation in order to determine the maximum economic potential regardless of the forecast strategy used. Include the use of different applications which residential batteries can perform from a consumer perspective. Applications such as avoidance of PV curtailment, demand load-shifting and demand peak shaving are considered along with the base application, PV self-consumption. Different battery technologies and sizes can be analyzed as well as different tariff structures.
Aging is treated as an exogenous parameter, calculated on daily basis and is not subject of optimization. Data with 15-minute, 30-minute and 1-hour temporal resolution may be used for simulations. The model objective function have two components, the energy-based and the power-based component, as the tariff structure depends on the applications considered, a boolean parameter activate the power-based factor of the bill when is necessary.


Citation
If you make use of this software for your work we would appreciate if you would cite this paper from the journal "Renewable & Sustainable Energy Reviews":
@article{pena-bello2019,
  title={Optimized PV-coupled battery systems for combining applications: Impact of battery technology and geography},
  author={Pena-Bello, Alejandro and Barbour, Edward and Gonzalez, Marta C. and Patel, Martin K. and Parra, David},
  journal={Renewable & Sustainable Energy Reviews},
  volume={ 112},
  pages={ 978-990},
  year={2019},
  doi={https://doi.org/10.1016/j.rser.2019.06.003}
}


In order to run the program you will need to clone it, type in your console:

git clone https://github.com/alefunxo/Basopra.git

then go to the repertory BASOPRA and run the setup:

cd Basopra
conda env create -f environment_droplet.yml
conda activate basopra_1

pyomo 5.5.1 proved to work fine with python 3.6, 3.7 and 3.9, please use this version.

Once the setup has been succesfully run, you can run the Main script, for this, change the repertory to the subdirectory BASOPRA and run python3 Main.py:

cd BASOPRA
python3 Main.py

Please have in mind that you will need CPLEX (or gurobi, glpk...) to run the optimization. If you have problems with CPLEX or other optimization software but you are sure you have it, go to Core_LP.py and be sure that the executable path is the correct one for your system, it is in the line opt = SolverFactory('PATH_TO_YOUR_OPTIMIZATION_SOFTWARE') (i.e., lines 181 and 184 of Core_LP.py).

---------------------------HOW TO USE---------------------
If you have clone BASOPRA from github.com you will see three folders inside Basopra (BASOPRA, Input and Doc). BASOPRA contains the code, Doc the documentation. Finally, Input contains 5 files, df_1h.csv (example of dataframe with one-hour resolution), df_30m.csv (example of dataframe with 30-minute resolution), df_15m.csv (example of dataframe with 15-minute resolution), df_US_Batt.csv (US data used for the optimization in Pena-Bello et al. (2019) and Input_data.csv. Input_data.csv contains the parameters by default of the optimization, such as inverter load ratio, inverter and converter efficiency, number of days to be simulated, etc. Please modify this file to customize your optimization. 

Time_resolution in Input_data.csv will determine the input file for the optimization, if Time_resolution is 1 then df_1h.csv will be used, if Time_resolution is 0.5 then df_30m.csv will be the input data. Please modify the input data in these files using your own data (we are working on a nice interface, but for the moment this is the only way to do it).

In order to run BASOPRA go to the BASOPRA directory (where the code is) and from the console run python3 Main.py (or python Main.py depending on how your system is configured). The results will be in csv format in a Output folder (which will be created automatically).

In case of doubts, bugs or problems please contact us by e-mail: [email protected] or using github.com

basopra's People

Contributors

alefunxo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

basopra's Issues

Strange behavior of P_max_year_batt when changed timezone

While I was testing different timezones in the script I realized that when I used US/Central timezone there was a significant change in the result of P_max_year_batt as you can see in the last two rows of the picture below. Those results were reproduced with the default input data, just by changing the timezone from US/Central to a different one. I tested with many other timezones and the only one that shows a different result is US/Central. I was not able to find the root cause for that. If you have any theories on what may be happening I would be happy to test.

pasted image 0 (2)

Column order of input files does not match script

The 'df' input files' columns aren't matching the import columns order of the script. As far as I could tell 'export_price' has to be the last column in the file for the orders to match. Please see the pictures below taken from the original files.

After I dragged export_price as the last column the simulation results seemed more reasonable.

pasted image 0

pasted image 0 (1)

Power calculation in post_proc.py

The calculation of power in 'post_proc.py' is multiplying energy by 4 to reach the result in lines 43 - 48 and 115. This makes sense if the input data is using a timestep of 15 minutes but will provide wrong results in other situations.

My suggestion is to divide the expression by param['delta_t'] instead of multiplying by four, then the script will be generic to any timestep, as in the pictures below.

Captura de Tela 2020-11-04 às 08 19 28

Captura de Tela 2020-11-04 às 08 19 48

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.