The goal of the MCOR tool is to provide several viable microgrid configurations that can meet the resilience goals of a site and maximize economic benefits. This means meeting a set of critical loads for a specified period of time, without any power supply from the electrical grid. The tool simulates power dispatch for many different system configurations, and ranks the systems according to the goals of the site.
- Python 3.10
- pvlib: https://github.com/pvlib/pvlib-python.git
- numba (optional) - Install numba to speed up solar power calculation: http://numba.pydata.org/#installing
To install required packages:
pip install -r requirements.txt
You will need to create your own credentials file with an NREL API key in order to download historical solar data from the NSRDB. To do so:
- Sign up for an API key here: https://developer.nrel.gov/signup/
- Create a file called creds.yaml in the root directory and then add your email address and API key to the file. The file should have the following format:
nrel_api_key: <your key>
nrel_api_email: <your email>
To run MCOR, update the parameter values in the first half of main_example.py (or your site-specific copy of main_example.py) under the section titled "Define simulation parameters here". Then run main_example.py in either a terminal or your IDE of choice.
Includes input data such as component costs, generator specs, and validation requirements.
Script for running MCOR from the command line. This file must be copied and modified to include site parameters.
Script for running MCOR from the command line, and varying one parameter across a set of values. This file must be copied and modified to include site parameters.
Output data from an MCOR run is saved here (Excel, json, and pkl files).
Includes downloaded NREL solar data and generated solar profile files that are created when running MCOR.
Unit and integration tests.
Includes downloaded data (must be user supplied) and generated tidal profile files that are created when running MCOR with a tidal energy resource.
Alternative Solar Profiles (ASP) algorithm used for solar forecasting: Original author in MATLAB: James Follum and Trevor Hardy
Classes:
- AlternativeSolarProfiles
Standalone functions:
- date_parser
Includes repository paths.
Tool-wide constants used for displaying simulation results.
Includes credentials for NREL api key. Needs to be created upon MCOR installation/set-up.
Calls the ASP code and calculates AC power production.
Solar power calculations carried out with pvlib-python: https://github.com/pvlib/pvlib-python
For an explanation of the pvlib power calculation: http://nbviewer.jupyter.org/github/pvlib/pvlib-python/blob/master/docs/tutorials/pvsystem.ipynb
Classes:
- SolarProfileGenerator
Standalone functions:
- download_solar_data
- calc_pv_prod
- calc_night_duration
- parse_himawari_tmy
Generates tidal generation profiles using one-year of modeled hindcast data.
Tidal epoch extrapolation carried out using utide: https://pypi.org/project/UTide/
Classes:
- TidalProfileGenerator
Standalone functions:
- calc_tidal_prod
Optimization class for simulating, filtering and ranking microgrid systems.
Classes:
- Optimizer
- GridSearchOptimizer (inherits from Optimizer)
Standalone functions:
- get_electricity_rate
Microgrid simulator class. Includes the core of the system dispatch algorithm.
Classes:
- Simulator
- PVBattGenSimulator (inherits from Simulator)
Standalone functions:
- calculate_load_duration
Class structure for microgrid system and its components.
Classes:
- Component
- PV (inherits from Component)
- MRE (inherits from Component)
- Tidal (inherits from MRE)
- Wave (inherits from MRE)
- Battery (inherits from Component)
- SimpleLiIonBattery (inherits from Battery)
- Generator (inherits from Component)
- FuelTank (inherits from Component)
- MicrogridSystem
- SimpleMicrogridSystem (inherits from MicrogridSystem)
Classes:
- Error
- ParamValidationError (inherits from Error)
Standalone functions:
- log_error
- validate_all_parameters
- validate_parameter
- ...various custom validation functions
For questions, please reach out to [email protected]
For analyses performed using MCOR, please cite the following paper:
Newman, S., Shiozawa, K., Follum, J., Barrett, E., Douville, T., Hardy, T., and Solana, A., 2020. “A comparison of PV resource modeling for sizing microgrid components”, Renewable Energy, vol. 162, pp 831-843.
This material was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government nor the United States Department of Energy, nor Battelle, nor any of their employees, nor any jurisdiction or organization that has cooperated in the development of these materials, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness or any information, apparatus, product, software, or process disclosed, or represents that its use would not infringe privately owned rights. Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or any agency thereof, or Battelle Memorial Institute. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof.
PACIFIC NORTHWEST NATIONAL LABORATORY operated by BATTELLE for the UNITED STATES DEPARTMENT OF ENERGY under Contract DE-AC05-76RL01830