<commit_before>"""
Energy Mix (yearly total) based on technologies used

This file generates the file with the yearly total of the energy supplied by each system.
This is further used to generate Pie Chart
"""
from __future__ import division
from __future__ import print_function

import os
import pandas as pd
import cea.config
import cea.inputlocator
from cea.analysis.multicriteria.optimization_post_processing.electricity_imports_exports_script import electricity_import_and_exports
from cea.analysis.multicriteria.optimization_post_processing.natural_gas_imports_script import natural_gas_imports

__author__ = "<NAME>"
__copyright__ = "Copyright 2018, Architecture and Building Systems - ETH Zurich"
__credits__ = ["<NAME>"]
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Production"

def energy_mix_based_on_technologies_script(generation, individual, locator, config):
    category = "optimization-detailed"

    if config.multi_criteria.network_type == 'DH':
        print ('Need to do this in future')

    elif config.multi_criteria.network_type == 'DC':
        data_cooling = pd.read_csv(
            os.path.join(locator.get_optimization_slave_cooling_activation_pattern(individual, generation)))

        Q_VCC_total_W = data_cooling['Q_from_VCC_W'].sum()
        Q_Lake_total_W = data_cooling['Q_from_Lake_W'].sum()
        Q_ACH_total_W = data_cooling['Q_from_ACH_W'].sum()
        Q_VCC_backup_total_W = data_cooling['Q_from_VCC_backup_W'].sum()
        Q_thermal_storage_total_W = data_cooling['Q_from_storage_tank_W'].sum()
        Q_cooling_total_W = data_cooling['Q_total_cooling_W'].sum()

        if not os.path.exists(locator.get_optimization_slave_electricity_activation_pattern_processed(individual, generation)):
            data_electricity = electricity_import_and_exports(generation, individual, locator, config)
        else:
            data_electricity = pd.read_csv(
                locator.get_optimization_slave_electricity_activation_pattern_processed(individual, generation))

        E_ACH_total_W = data_electricity['E_ACH_W'].sum()
        E_CHP_to_directload_total_W = data_electricity['E_CHP_to_directload_W'].sum()
        E_CHP_to_grid_total_W =  data_electricity['E_CHP_to_grid_W'].sum()<commit_msg>fix to network type flag<commit_after>"""
Energy Mix (yearly total) based on technologies used

This file generates the file with the yearly total of the energy supplied by each system.
This is further used to generate Pie Chart
"""
from __future__ import division
from __future__ import print_function

import os
import pandas as pd
import cea.config
import cea.inputlocator
from cea.analysis.multicriteria.optimization_post_processing.electricity_imports_exports_script import electricity_import_and_exports
from cea.analysis.multicriteria.optimization_post_processing.natural_gas_imports_script import natural_gas_imports

__author__ = "<NAME>"
__copyright__ = "Copyright 2018, Architecture and Building Systems - ETH Zurich"
__credits__ = ["<NAME>"]
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Production"


def energy_mix_based_on_technologies_script(generation, individual, locator, config):
    category = "optimization-detailed"

    config.restricted_to = None
    if config.multi_criteria.network_type == 'DH':
        print ('Need to do this in future')

    elif config.multi_criteria.network_type == 'DC':
        data_cooling = pd.read_csv(
            os.path.join(locator.get_optimization_slave_cooling_activation_pattern(individual, generation)))

        Q_VCC_total_W = data_cooling['Q_from_VCC_W'].sum()
        Q_Lake_total_W = data_cooling['Q_from_Lake_W'].sum()
        Q_ACH_total_W = data_cooling['Q_from_ACH_W'].sum()
        Q_VCC_backup_total_W = data_cooling['Q_from_VCC_backup_W'].sum()
        Q_thermal_storage_total_W = data_cooling['Q_from_storage_tank_W'].sum()
        Q_cooling_total_W = data_cooling['Q_total_cooling_W'].sum()

        if not os.path.exists(locator.get_optimization_slave_electricity_activation_pattern_processed(individual, generation)):
            data_electricity = electricity_import_and_exports(generation, individual, locator, config)
        else:
            data_electricity = pd.read_csv(
                locator.get_optimization_slave_electricity_activation_pattern_processed(individual, generation))

        E_ACH_total_W = data_electricity['E_ACH_W'].sum()
        E_CHP_to_directload_total_W = data_electricity['E_CHP_to_directload_W'].sum()
        E_CHP_to_grid_total_W =  data_electricity['E_CHP_to_grid_W'].sum()
{'fraction_non_alphanumeric': 0.08437365475678002, 'fraction_numerical': 0.002582866982350409, 'mean_word_length': 5.066579634464752, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3756455', 'n_tokens_mistral': 1561, 'n_tokens_neox': 1459, 'n_words': 281}