<commit_before>:orphan:

How to Run Thermal & Electrical Grid Planning in CEA.
=====================================================
Independently from the CEA optimization for energy systems, this tool aims to provide the thermal network route that
yields the lowest total costs from both thermal network and electrical grid.

This tool explores the trade-offs between the costs of thermal networks and electricity grid. When buildings are connected
to the thermal network, the loads on electricity grid is decreased.

Assumptions
-----------
#. For buildings connected to the thermal networks, the electricity loads include: lighting, appliance, and hot water.
#. For buildings disconnected to the thermal networks, the electricity loads include: **cooling**, lighting, appliance, and hot water.


Prerequisites
-------------
1. Install the license of Gurobi on your computer. you can obtain one in `gurobi.com
<http://www.gurobi.com/registration/download-reg>`_ for free for academic purposes.

2. Add Gurobi package to the cea environment::
   
   *open anaconda
   *do ``conda env update``
   *do ``activate cea``
   *do ``grbgetkey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`` 
   (where xxxxxxxxxxxxxxxxxxxxxxxxxx is the key of your license.)
   
3. If you are having problems running from pycharm. get today's version 06.03.2019 or later one. This includes a fix to paths in conda.


Steps
-----
#. Assign optimization parameters in ``cea.config``
#. Run `cea\optimization\flexibility_model\electric_and_thermal_grid_planning\electrical_thermal_optimization_main.py`
#. Check results from optimization in ``...scenario\outputs\electrical_and_thermal_network\optimization``


Outputs
-------
In the evaluation of each individual, all the following aspects of thermal network and electricity grid design are saved.
The results can be found in ``...scenario\outputs\electrical_and_thermal_network\optimization``

Individuals
^^^^^^^^^^^
The individuals generated are saved in ``scenario\outputs\electrical_and_thermal_network\optimization\slave\geneneration_number``. The following information is included:

Thermal Network Design
""""""""""""""""""""""
* Buildings connected to thermal networks
* Route
* Pipe sizes
* Annualized Capital costs (CAPEX) and Operation costs (OPEX)

Electricity Grid Design<commit_msg>add description of config<commit_after>:orphan:

How to Run Thermal & Electrical Grid Planning in CEA.
=====================================================
Independently from the CEA optimization for energy systems, this tool aims to provide the thermal network route that
yields the lowest total costs from both thermal network and electrical grid.

This tool explores the trade-offs between the costs of thermal networks and electricity grid. When buildings are connected
to the thermal network, the loads on electricity grid is decreased.

Assumptions
-----------
#. For buildings connected to the thermal networks, the electricity loads include: lighting, appliance, and hot water.
#. For buildings disconnected to the thermal networks, the electricity loads include: **cooling**, lighting, appliance, and hot water.


Prerequisites
-------------
1. Install the license of Gurobi on your computer. you can obtain one in `gurobi.com
<http://www.gurobi.com/registration/download-reg>`_ for free for academic purposes.

2. Add Gurobi package to the cea environment::
   
   *open anaconda
   *do ``conda env update``
   *do ``activate cea``
   *do ``grbgetkey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`` 
   (where xxxxxxxxxxxxxxxxxxxxxxxxxx is the key of your license.)
   
3. If you are having problems running from pycharm. get today's version 06.03.2019 or later one. This includes a fix to paths in conda.


Steps
-----
#. Assign optimization parameters in ``cea.config``::
      
      [electrical-thermal-optimization]
      network-type = DH or DC
      initialind = number of individuals at the start of the optimization (parameter for genetic algorithm)
      halloffame = number of individuals to be stored in hall of fame
      ngen = number of generations in the optimization (parameter for genetic algorithm)
      fcheckpoint = frequency for the saving of checkpoints
      maxtime = maximum allowed time in seconds, 604800 is equivalent of 7 days
      recoverycheckpoint = in case the optimization stops, it can be resumed from this checkpoint
      random-seed = random seed to make it easy to replicate the results of the scenarios
      crossoverprobability = for optimization crossover
      mutationprobability = for optimization mutation

#. Run `cea\optimization\flexibility_model\electric_and_thermal_grid_planning\electrical_thermal_optimization_main.py`
#. Check results from optimization in ``...scenario\outputs\electrical_and_thermal_network\optimization``


Outputs
-------
In the evaluation of each individual, all the following aspects of thermal network and electricity grid design are saved.
The results can be found in ``...scenario\outputs\electrical_and_thermal_network\optimization``

Individuals
^^^^^^^^^^^
The individuals generated are saved in ``scenario\outputs\electrical_and_thermal_network\optimization\slave\geneneration_number``. The following information is included:

Thermal Network Design
""""""""""""""""""""""
* Buildings connected to thermal networks
* Route
* Pipe sizes
* Annualized Capital costs (CAPEX) and Operation costs (OPEX)

Electricity Grid Design
{'fraction_non_alphanumeric': 0.09975983742841307, 'fraction_numerical': 0.005357472750785147, 'mean_word_length': 4.5076297049847405, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5007068', 'n_tokens_mistral': 1460, 'n_tokens_neox': 1322, 'n_words': 603}