示例#1
0
    if goodIO == 1:
        cur.execute(
            '''SELECT Area, GD2016, ED2016, Age FROM Stores Where id= {vn1}'''.format(
                vn1=id_store))
        Index = cur.fetchall()
        if not Index:
            pass
        else:
            SurfaceArea = np.array([elt[0] for elt in Index])
            Gas = np.array([elt[1] for elt in Index])
            Ele = np.array([elt[2] for elt in Index])
            Store_age = np.array([elt[3] for elt in Index])
            

            solution = pb.CHPproblem(id_store).SimpleOpti5NPV(mod = [1.195,1,1,1], ECA_value = 0.26, table_string = 'Utility_Prices_Aitor _NoGasCCL')
            payback.append(solution[4][1])
            carbon_savings.append(solution[5][2])
            Capex.append(solution[4][5])
            cum_disc_cashflow.append(solution[4][4])
            CHP_size.extend(list(map(int, re.findall('\d+', solution[1]))))
            financial_savings.append(solution[4][0])
            h2p.append(Gas[0]/Ele[0])
            Area.append(SurfaceArea[0])
            Ele_demand.append(Ele[0])
            Gas_demand.append(Gas[0])
            Age.append(Store_age[0])
            
MAC = -1*np.array(cum_disc_cashflow)/abs(np.array(carbon_savings))

#Inputs =======================================================================
示例#2
0
    PV_pb.gas_price = p_gas_mod * init_p_gas

    #calculate solution, extract opex savings, carbon savings and electricity production
    PV_solution = PV_pb.SimulatePVonAllRoof(1, n_panels)
    PV_opex = PV_solution[1]
    PV_Carbon = PV_solution[4]
    PV_prod = PV_solution[6]

    CHP_capex_array = []
    CHP_size_array = []
    for tech_id in range(1, 21):
        cur.execute('''SELECT * FROM Technologies WHERE id=?''', (tech_id, ))
        dummy = cur.fetchall()
        CHP_tech_size = (list(map(int, re.findall('\d+', dummy[0][1]))))
        CHP_tech_price = (dummy[0][2])
        CHP_pb = BBC.CHPproblem(id_store)

        CHP_pb.store.d_ele = abs(init_d_ele - PV_prod)

        CHP_solution = CHP_pb.SimpleOpti5NPV(tech_range=[tech_id],
                                             mod=[p_elec_mod, p_gas_mod, 1, 1],
                                             ECA_value=0.26)

        CHP_opex = CHP_solution[4][0]
        CHP_Carbon = CHP_solution[5][2]

        PV_array.append(n_panels)
        CHP_array.extend(CHP_tech_size)
        Capex_array.append(CHP_tech_price + PV_capex)
        OPEX_array.append(CHP_opex + PV_opex)
        Carbon_array.append((PV_Carbon + CHP_Carbon))
示例#3
0
Cum_disc_cash_flow_CHP = []
Carbon_PV =[]
Carbon_CHP =[]
Cum_disc_cash_flow_south=[]
Carbon_PV_south=[]
Cum_disc_cash_flow_central=[]
Carbon_PV_central=[]
Cum_disc_cash_flow_north=[]
Carbon_PV_north=[]

for store_id in Store_id_range: 
    a = pb.PVproblem(store_id)
    a.elec_price = a.store.p_ele*11.9/9.87
    [best_tech, opti_savings, opti_capex,opti_ele_prod,opti_panel,opti_carbon,Cum_disc_cash_flow] = a.OptiPVpanels()
    
    b=BBC.CHPproblem(store_id)
    b.store.p_ele =b.store.p_ele*11.9/9.87
    [opti_tech, opti_tech_name, opti_CHPQI, opti_part_load, financials, carbon, year_BAU_cost] =b.SimpleOpti5NPV(ECA_value = 0.26)
    Area = a.store.area

    Cum_disc_cash_flow_PV.append(Cum_disc_cash_flow)
    Cum_disc_cash_flow_CHP.append(financials[-2])
    Carbon_PV.append(opti_carbon)
    Carbon_CHP.append(carbon[2])
    
    if Area <25000:
        Cum_disc_cash_flow_PV_cat_1.append(Cum_disc_cash_flow)
        Carbon_PV_1.append(opti_carbon)
        Cum_disc_cash_flow_CHP_cat_1.append(financials[-2])
        Carbon_CHP_1.append(carbon[2])
        
示例#4
0
    PV_mod = np.power(1+capex_reduction_PV, np.linspace(year_start,year_stop, time_window+1)[0:-1] - year_start)
    cf_mod = np.power(1+cf_decrease, np.linspace(year_start,year_stop, time_window+1)[0:-1] - year_start)

    BAU_op_cost = []    
    BAU_carbon = []
    time = []
    store_range = []
    for n in range(0,time_window):
        print('Time window:%d' %year[n])
        
        for store_id in Store_id_range[:stores]:
            print('store:%d' %store_id)
            
            time.append(year[n])
            store_range.append(store_id)
            solution = BBC.CHPproblem(store_id).SimpleOpti5NPV(tech_range=[1],mod=[p_elec_mod[n],p_gas_mod[n],1,1],ECA_value = 0.26)
            BAU_op_cost.append(solution[6])
            BAU_carbon.append(solution[5][0]*cf_mod[n])



    workbook=xlsxwriter.Workbook(scenario_names[scen]+' BAU.xlsx')
    worksheet=workbook.add_worksheet()
    
    headers = ['time','store','BAU Cost','BAU carbon']
    row = 0
    col = 0
    for h in headers:
        worksheet.write(row,col,h)
        col +=1
    
示例#5
0
import re
import matplotlib.pyplot as plt

biometh_CF= 0.00039546
gas_CF = 0.18416
ele_CF = 0.35156 

database_path = "Sainsburys.sqlite"
conn = sqlite3.connect(database_path)
cur = conn.cursor()
conn.commit()
cur.execute('''SELECT * FROM Technologies''')
dummy_CHP = cur.fetchall()


sol=BBC.CHPproblem(51)
BAU_gas = []
BAU_ele =[]
biomethane_usage = []
BAU_carbon = []
savings_range =[]
CHP_tech_size_range =[]
for tech in range(1,21):
    if tech ==20:
        CHP_tech_size = [0]
        savings = 0
    else:
        
        CHP_tech_size =(list(map(int, re.findall('\d+', dummy_CHP[tech][1]))))
        savings = sol.SimpleOpti5NPV(tech_range=[tech])[5][0]-(sol.SimpleOpti5NPV(tech_range=[tech])[5][3]*gas_CF/1000+sol.SimpleOpti5NPV(tech_range=[tech])[5][4]*ele_CF/1000)
    CHP_tech_size_range.append(CHP_tech_size)
示例#6
0
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 30 13:04:55 2018

@author: nl211
"""

import sqlite3
import Common.classStore as st
import Common.classTech as tc
import Solvers.classCHPProblemnew as pb
import numpy as np
import matplotlib.pyplot as plt
import datetime
import pandas as pd

store_index = 507  #Leicester North
p_id = pb.CHPproblem(store_index)

#default_initial_time = datetime.datetime(2016,1,1)
#default_final_time = datetime.datetime(2017,1,1)
#time_start= int((default_initial_time-datetime.datetime(1970,1,1)).total_seconds()/60/30)
#time_stop= int((default_final_time-datetime.datetime(1970,1,1)).total_seconds()/60/30)

p_id.store.getWeatherData(p_id.time_start, p_id.time_stop)
plt.plot(p_id.store.irr)