Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

Assignment_techno_eco_2022 about:srcdoc

EN-Methods for analyzing energy efficiency


and renewable energy technologies (2021)
Assignment 6-Renewable energy balance and techno-
economic analysis
Teachers
• David Parra, David.Parra@unige.ch
• Arven Syla, room B601, Arven.Syla@etu.unige.ch
• Arthur Rinaldi, room B601, arthur.rinaldi@unige.ch
• Mart van der Kam, room B601, marten.vanderkam@unige.ch

Write your students names and date in a cell below


Hombourger Caroline Zafra Carla Valentina

Subjects and objectives of this assignment


1. Understanding consumers interest in PV and batteries
2. Performing energy balances of renewable and storage technologies with different temporal
resolutions and power flow balances (work in Python Jupyter Notebook)
3. Perform a techno-economic analysis of a PV-coupled battery and determine key
performance indicators (work in Python Jupyter Notebook)

Final product
The Jupyter Notebook should be converted into a pdf document and submitted into Moodle,
with a total of (60 points)

Literature
For some background literature, please check the corresponding section in Moodle

Submission date
The report has to be submitted into Moodle on Wednesday, 13 April 2022 at 17:00 at latest.
Any submissions later than this date, without any prior notice, would not be reviewed. Only the
pdf generated from the Notebook file is needed.

Debriefing
The debriefing of the assignment will take place on Friday, 29 April 2021.

1 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

Python libraries
We first load the Python libraries that will be used during this assingment:

• Numpy: is a library for the Python programming language, adding support for large, multi-
dimensional arrays and matrices, along with a large collection of high-level mathematical
functions to operate on these arrays. It is similar to Matlab
• Pandas: pandas is a software library written for the Python programming language for data
manipulation and analysis. In particular, it offers data structures and operations for
manipulating numerical tables and time series. It is like Excel
• Matplotlib: it is a library to plot

In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

Exercise 1: System 1: PV system (without battery) for


single house (27 points)
The figure below is a schematic representation of the system 1. It corrresponds to a 4.8 kWp PV
array (index “p” stands for peak ) is installed in a house in Geneva with an annual electricity
demand of 3373 kWh, which corresponds to an “average” Swiss household.

Your will perform an energy balance and techno-economic analysis of such a system.

Input data (please mind the capital letter, used for absolute cost,
versus nomal letter, used for cost relative to power)
Throughout the Exercise 1, you will use the following input data:

• PV DC/AC inverter efficiency (eta_inv): 0,95

2 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

• Price of electricity exported/sold to the grid electricity ( P_ex): 0,06 CHF/kWh

• Price of electricity imported from the grid (retail price, P_i): 0,25 CHF/kWh

• PV lifetime (Lifetime_PV): 30 yr

• Discount rate (r): 4 %

• PV system capital cost/expenditure (capex_PV): 3000 CHF/kW

• Inverter cost for the replacement (capex_inv): 400 CHF/kW

• PV nominal capacity (Capacity_PV): 4.8 kW

• Inverter lifetime (Lifetime_inv): 15 yr

In [2]:
eta_inv=0.95
Lifetime_inv=15
P_ex=0.06
P_i=0.25
Lifetime_PV=30
r=0.04
capex_PV=3000
capex_inv=400
Capacity_PV=4.8

1. Please formulate an energy balance of the system 1 by writing


the equations which: (a) explain how PV electricity generation is
used (i.e. which demand loads it is supplied to, namely the demand
of the house and the grid); and (b) how the electricity demand is
satisfied (i.e. PV system and electricity grid import). Thereby, please
account for the efficiency of the DC/AC inverter, i.e. the relationship
between DC PV generations to AC PV generation. Please, make use
of the parameters defined in Figure 2. (2 point).
(a) The equation on how PV electricity generation is used :

EPVDC*eta_inv = epvgrid + Epvd

EPVD = (Epvd + EPVgrid) / eta_inv

(b) The equation on how the electricity demand is satisfied :

Ed = Epvd + Edgrid

2. Using the previous enerby balance, you will now perform energy
balances of the PV system (without a battery) in two different
temporal scales, namely 15 min and 1 year. To do so, we import the
following data: PV generation (in DC terms) and the electricity
demand (in AC terms) from the house throughout the year with 15

3 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

min resolution, using the Excel file called


"PV_Demand_Battery.xlsx". Also, determine (6 point):
• the (annual) capacity factor of the PV installation (using the annual PV generation in AC
terms) and compare it with other traditional technologies (e.g., hydro and nuclear). Please,
discus the differences.
• the percentage of PV which is self-consumed (SC) and exported to the grid on annual
basis
• the self-sufficiency percentage (SS) and the percentage of electricity imported from
the grid

Nomenclature
In terms of nomenclature, we propose the following:

• for a value with 15-min resolution, we use, for example, E_d


• for a value with annual resolution, we use, for example, E_d_a

Functions to be used
• Feel free to check the data using functions such as "df.head()", "df.tail()", "df.describe()".

• You can use the property "df.iloc[]" to select the 365244 data in each relevant column in
Excel.

• Using the fuction "df.assign", we can first define and initialise at 0 the new data with 15-min
temporal resolution (columns), nameley PV generation (in AC terms), PV self-consumption,
PV export and grid import.

• Now, we can resolve the electricity balance with temporal resolution of 15 min, i.e to
calculate E_PVd (equal to E_dPV), E_PVgrid and E_dgrid. To do so, you can use the property
"df.loc[]" since it allows the use of conditions to filter rows and/or columns

• To calculate the annual values, you can use the function "df.sum()"
In [3]:
df = pd.read_excel ('PV_Demand_Battery.xlsx')
print (df)
df.head()
df.tail()
df.describe()

df.E_PVDC.sum()

capacity_factor= (df.E_PVDC.sum()/(Capacity_PV*8760))*100
print(capacity_factor)

Unnamed: 0 E_d E_PVDC E_charDC E_disDC


0 2017-01-01 00:00:00+01:00 0.33 0.0 0.0 0.0
1 2017-01-01 00:15:00+01:00 0.31 0.0 0.0 0.0
2 2017-01-01 00:30:00+01:00 0.12 0.0 0.0 0.0
3 2017-01-01 00:45:00+01:00 0.05 0.0 0.0 0.0

4 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

4 2017-01-01 01:00:00+01:00 0.09 0.0 0.0 0.0


... ... ... ... ... ...
35035 2017-12-31 22:45:00+01:00 0.32 0.0 0.0 0.0
35036 2017-12-31 23:00:00+01:00 0.34 0.0 0.0 0.0
35037 2017-12-31 23:15:00+01:00 0.36 0.0 0.0 0.0
35038 2017-12-31 23:30:00+01:00 0.23 0.0 0.0 0.0
35039 2017-12-31 23:45:00+01:00 0.29 0.0 0.0 0.0

[35040 rows x 5 columns]


17.461501507352107
In [4]:
#Hydro has a capacity factor of 50% and Nuclear almost 90%, comparing our result of 17

In [5]:
df=df.assign(E_PVAC=0)

df.head()

df=df.assign(E_dPV=0)

df.head()

df=df.assign(E_PVgrid=0)

df.head()

df=df.assign(Ed_grid=0)

df.head()

df.loc[df.E_PVDC>df.E_d]

df.E_PVAC=df.E_PVDC*eta_inv

df.loc[df.E_PVAC>df.E_d,'E_dPV']=df.E_d
df.loc[df.E_PVAC<=df.E_d,'E_dPV']=df.E_PVAC
df.head()

df.describe()
#self consumption
sc=(df.E_dPV.sum()/df.E_PVAC.sum())*100
print('sc=',sc,'%')

df.loc[df.E_PVAC>df.E_dPV,'E_PVgrid']=df.E_PVAC-df.E_dPV

df.describe()
#self sufficiency
ss=(df.E_dPV.sum()/(df.E_d.sum()))*100
print('ss=',ss,'%')
df.describe()

df.Ed_grid = df.E_d-df.E_dPV
#imported from the grid
imported_grid= ((df.E_d.sum()-df.E_dPV.sum())/df.E_d.sum())*100
print('imported_grid=',imported_grid,'%')
df.describe()

sc= 21.92413973892474 %

5 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

ss= 45.32814247614432 %
Out[5]: E_d E_PVDC E_charDC E_disDC E_PVAC E_dPV E_PVgrid

count 35040.000000 35040.000000 3.504000e+04 35040.000000 35040.000000 35040.000000 35040.000000

mean 0.096281 0.209538 4.998752e-02 0.044489 0.199061 0.043642 0.155419

std 0.073320 0.309718 1.345633e-01 0.068979 0.294232 0.063434 0.257734

min 0.040000 0.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000

25% 0.050000 0.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000

50% 0.080000 0.000087 0.000000e+00 0.000000 0.000082 0.000082 0.000000

75% 0.110000 0.366426 2.013737e-08 0.063830 0.348105 0.080000 0.239208

max 0.490000 1.190872 7.000000e-01 0.478723 1.131328 0.440000 1.079133

Results: The annual capacity factor of the PV installation is 17.46%. To compare for example, the
annual capacity factor of a nuclear plant is around 82,5% in 2019 (World Nuclear Performance
Report). The difference may be explained by the fact that nuclear is a more closed system, with
less losses and it continiously works, night and day because turning off and on the nuclear plant
takes a lot of time and energy so they don't turn it off unless it's a maintenance necessity.

The percentage of PV which is self-consumed (sc) is 21,9% and so 78,1% is exported to the grid
on annual basis.

The self-sufficiency percentage (ss) is 45,3% and so the percentage of electricity imported from
the grid is 54,7%.

3. Now, we will focus on two representative days, namely a sunny


and cloudy day, and work with power instead of energy, assuming
that power is constant in the selected time scale (15 minute) and
represent (plot) these various power flows (kW) in one graph each
for a winter day and a summer day. To do so, randomly pick two
days in the calendar. What are the main differences among the two
days? What are the main factors which can affect PV generation,
electricity demand, and the resulting energy balance (i.e. PV
generation and electricity demand)? Please discuss them. (7 points)
Some tips:
• You can create a new dataframe per day, namely df_Winter_day_power and
df_Summer_day_power
• You can use the property "df.iloc[]" to select your days. Remember that as index of data,
Python starts with 0.
• Make sure that plots are labelled, with time (hr) in the horizontal axis and Power (kW) in the
vertical one
• Use a legend and different colours for the series to be plotted.

6 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

In [6]:
Winter_day=df.iloc[0:96]
Winter_day_power = Winter_day*4
Winter_day_power.head()
df=df.assign(time=0)

Winter_day_power.time = np.arange(0,24,0.25)
Winter_day_power.head()
plt.plot(Winter_day_power.time,Winter_day_power.E_d, label= 'P demand')
plt.plot(Winter_day_power.time,Winter_day_power.E_PVAC, label= 'P production')
plt.plot(Winter_day_power.time,Winter_day_power.E_dPV,label= 'PV demand')
plt.plot(Winter_day_power.time,Winter_day_power.Ed_grid, label='P from grid')
plt.plot(Winter_day_power.time,Winter_day_power.E_PVgrid, label='PV to grid')
plt.xlabel('time (h)')
plt.ylabel('power (kW)')
plt.legend()
plt.show()

<ipython-input-6-27567d008656>:6: UserWarning: Pandas doesn't allow columns to


be created via a new attribute name - see https://pandas.pydata.org/pandas-doc
s/stable/indexing.html#attribute-access
Winter_day_power.time = np.arange(0,24,0.25)

In [7]:
np.arange(0,24,1)

Out[7]: array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,


17, 18, 19, 20, 21, 22, 23])

7 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

In [8]:
Summer_day = df.iloc[17276:17372]
Summer_day_power = Summer_day*4
Summer_day_power.head()
df=df.assign(time=0)

Summer_day_power.time = np.arange(0,24,0.25)
Summer_day_power.head()
plt.plot(Summer_day_power.time,Summer_day_power.E_d, label= 'P demand')
plt.plot(Summer_day_power.time,Summer_day_power.E_PVAC, label= 'P production')
plt.plot(Summer_day_power.time,Summer_day_power.E_dPV,label= 'PV demand')
plt.plot(Summer_day_power.time,Summer_day_power.Ed_grid, label='P from grid')
plt.plot(Summer_day_power.time,Summer_day_power.E_PVgrid, label='PV to grid')
plt.xlabel('time (h)')
plt.ylabel('power (kW)')
plt.legend()
plt.show()

Discussion:The main differences between this two days are :

• In summer, the PV generation is higher (peak at 4 kW in summer and 2,5 kW in winter) and
longer too, because in summer the PV produces electricity from 6am to 7pm. In winter PV
system produces electricity from 9am to 4pm. This is explain by the sun that shines longer
and brighter during the summer days than during the winter days.

• The demand in electricity stays more or less the same, even if in winter it's more for the
heating system and in sumer for the cooling system.

4. Please propose equations to calculate the CAPEX of the PV


system (only initial investment without replacements), CAPEX_PV
(CHF) considering that the investment cost of the PV system
(including array, inverter, etc.) is given as a function of the power,
costPV (CHF/kWp, see input data above). Then calculate the cost
for the PV system (4.8 kWp) using the input data given above.
Calculate also the replacement cost for the inverter which will be
used after the lifetime of the inverter (15 yr) (2 points)

8 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

In [9]:
CAPEX_PV=capex_PV*Capacity_PV
print('CAPEX_PV=',CAPEX_PV,'CHF')

CAPEX_INV=capex_inv*Capacity_PV
print('CAPEX_INV=',CAPEX_INV,'CHF')

CAPEX_PV= 14400.0 CHF


CAPEX_INV= 1920.0 CHF

Results :

The equation to calculate the CAPEX of the PV system is : Capex_PV=capex_PV*Capacity_PV

The cost for a PV system is : 14 400 CHF.

The replacement cost for the inverter after 15 years is : 1920 CHF.

5. Please propose equations to calculate the revenue (in economic


terms including both electricity sold to the grid and avoided cost of
electricity purchased) of the PV system, Revenue_PV (CHF),
compared to the original situation in which the house only buys
electricity from the grid. Please, calculate the annual revenue for
the PV system (using the electricity prices given in the
introduction). What is the percentage of revenue due to PV self-
consumption and due to PV export to the grid? (2 point)
In [10]:
#reference (CHF)
Ref=df.E_d.sum()*P_i
print('Ref=',Ref,'CHF')

#electricity I dont pay (CHF)

elect_dp=df.E_dPV.sum()*P_i
print('elect_dp=',elect_dp,'CHF')

#Electricity I sell
elect_PV=df.E_PVgrid.sum()*P_ex
print('elect_PV=',elect_PV,'CHF')

#anual revenue
revenue=elect_dp+elect_PV
print('revenue=',revenue,'CHF')

#revenue PV self consumption


revenue_sc=(elect_dp/revenue)*100
print('revenue_sc=',revenue_sc,'%')

#revenue PV export to the grid


revenue_grid=(elect_PV/revenue)*100
print('revenue_grid=',revenue_grid,'%')

Ref= 843.4225 CHF


elect_dp= 382.30775247585836 CHF
elect_PV= 326.75223217304455 CHF
revenue= 709.0599846489029 CHF

9 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

revenue_sc= 53.91754728130108 %
revenue_grid= 46.08245271869893 %
Results: The equation to calculate the revenu of the PV system is : Revenue_PV (CHF) = electricity sold to the grid
+ avoided cost of electricity (that we didn't bought from the grid) --> PV_Revenue=[E_PVgrid*P_exp] We also
calculate the situation of a house that only buys electricity from the grid. They buy electricity from the grid 843,42
CHF per year. The annual revenue for the PV system is 709,06 CHF won by not spending money on electricity
from the grid plus electricity sold to the grid. The percentage of revenue due to PV self consuption is 53.9 and
the percentage of revenue due to PV exporter to the grid is 46.0.

6. Determine the levelised cost (LCOS), levelised value (LVOS) and


internal rate of return (IRR) of the PV system assuming that the PV
generation and revenue remain constant throughout the lifetime of
the PV system. Consider that the inverter has a lifetime of 15 yr and
a CAPEX of 400 CHF/kWp. Discuss the results and compare the
LCOS with the LVOS, and the link with the IRR.

- How does the LCOS of PV compare to other power generation


technologies?

- Which factors which are not considered in the calculation would


have the biggest impact on the results? What impact could these
factors have?

- Considering economic criteria, shall a consumer become


prosumer under these assumptions? Please, explain your answer

- Name 3 ecomic barriers for consumers to become prosumers (8


points)
Some tips:
• You can create a new dataframe for calculating the techno-economic indicators, e.g.,
df_TI_PV
• The first row can refer to the year zero (t=0), when investments occur
• Then, the second row would refer to the first year, and as such, include the cost expenditure
over the first year, the PV generation, and so on
• To calculate the internal rate of return, use a function from Numpy "np.irr()"

10 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

In [11]:
df_TI_PV=pd.DataFrame(index=np.arange(31),columns=['year','E_PVAC','E_PVAC_disc'

df_TI_PV.year= np.arange(0,31,1)

df_TI_PV.E_PVAC=df.E_PVAC.sum()
df_TI_PV.loc[df_TI_PV.year==0,'E_PVAC']=0

df_TI_PV.E_PVAC_disc=((df_TI_PV.E_PVAC/(1+r)**df_TI_PV.year))

df_TI_PV.Cost=0
df_TI_PV.loc[df_TI_PV.year==0,'Cost']=CAPEX_PV+CAPEX_INV
df_TI_PV.loc[df_TI_PV.year==15,'Cost']=CAPEX_INV

df_TI_PV.Cost_disc=((df_TI_PV.Cost/(1+r)**df_TI_PV.year))

df_TI_PV.Revenue=revenue
df_TI_PV.loc[df_TI_PV.year==0,'Revenue']=0
df_TI_PV.Revenue_disc=(df_TI_PV.Revenue/((1+r)**df_TI_PV.year))

df_TI_PV.CF_IRR=df_TI_PV.Revenue-df_TI_PV.Cost
print(df_TI_PV)

year E_PVAC E_PVAC_disc Cost Cost_disc Revenue \


0 0 0.000000 0.000000 16320.0 16320.000000 0.000000
1 1 6975.101546 6706.828410 0.0 0.000000 709.059985
2 2 6975.101546 6448.873471 0.0 0.000000 709.059985
3 3 6975.101546 6200.839876 0.0 0.000000 709.059985
4 4 6975.101546 5962.346034 0.0 0.000000 709.059985
5 5 6975.101546 5733.025033 0.0 0.000000 709.059985
6 6 6975.101546 5512.524070 0.0 0.000000 709.059985
7 7 6975.101546 5300.503914 0.0 0.000000 709.059985
8 8 6975.101546 5096.638379 0.0 0.000000 709.059985
9 9 6975.101546 4900.613826 0.0 0.000000 709.059985
10 10 6975.101546 4712.128678 0.0 0.000000 709.059985
11 11 6975.101546 4530.892960 0.0 0.000000 709.059985
12 12 6975.101546 4356.627846 0.0 0.000000 709.059985
13 13 6975.101546 4189.065237 0.0 0.000000 709.059985
14 14 6975.101546 4027.947343 0.0 0.000000 709.059985
15 15 6975.101546 3873.026291 1920.0 1066.107845 709.059985
16 16 6975.101546 3724.063742 0.0 0.000000 709.059985
17 17 6975.101546 3580.830521 0.0 0.000000 709.059985
18 18 6975.101546 3443.106270 0.0 0.000000 709.059985
19 19 6975.101546 3310.679106 0.0 0.000000 709.059985
20 20 6975.101546 3183.345294 0.0 0.000000 709.059985
21 21 6975.101546 3060.908937 0.0 0.000000 709.059985
22 22 6975.101546 2943.181670 0.0 0.000000 709.059985
23 23 6975.101546 2829.982375 0.0 0.000000 709.059985
24 24 6975.101546 2721.136899 0.0 0.000000 709.059985
25 25 6975.101546 2616.477787 0.0 0.000000 709.059985
26 26 6975.101546 2515.844026 0.0 0.000000 709.059985
27 27 6975.101546 2419.080795 0.0 0.000000 709.059985
28 28 6975.101546 2326.039226 0.0 0.000000 709.059985
29 29 6975.101546 2236.576178 0.0 0.000000 709.059985
30 30 6975.101546 2150.554018 0.0 0.000000 709.059985

Revenue_disc CF_IRR
0 0.000000 -16320.000000
1 681.788447 709.059985
2 655.565814 709.059985
3 630.351744 709.059985
4 606.107447 709.059985

11 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

5 582.795622 709.059985
6 560.380405 709.059985
7 538.827313 709.059985
8 518.103186 709.059985
9 498.176140 709.059985
10 479.015519 709.059985
11 460.591845 709.059985
12 442.876774 709.059985
13 425.843052 709.059985
14 409.464473 709.059985
15 393.715840 -1210.940015
16 378.572923 709.059985
17 364.012426 709.059985
18 350.011948 709.059985
19 336.549950 709.059985
20 323.605721 709.059985
21 311.159347 709.059985
22 299.191680 709.059985
23 287.684308 709.059985
24 276.619527 709.059985
25 265.980314 709.059985
26 255.750302 709.059985
27 245.913752 709.059985
28 236.455531 709.059985
29 227.361087 709.059985
30 218.616430 709.059985
In [12]:
IRR=np.irr(df_TI_PV.CF_IRR)
IRR

<ipython-input-12-22d8f4fe9297>:1: DeprecationWarning: numpy.irr is deprecated


and will be removed from NumPy 1.20. Use numpy_financial.irr instead (https://
pypi.org/project/numpy-financial/).
IRR=np.irr(df_TI_PV.CF_IRR)
Out[12]: 0.011359661388696152

In [13]:
df_TI_PV.loc[df_TI_PV.year==0,'Cost']

Out[13]: 0 16320.0
Name: Cost, dtype: float64

In [82]:
LVOESpv=df_TI_PV.Revenue_disc.sum()/df_TI_PV.E_PVAC_disc.sum()
print('LVOESpv=',LVOESpv,'CHF/kWh')

LCOESpv=df_TI_PV.Cost.sum()/df_TI_PV.E_PVAC_disc.sum()
print('LCOESpv=',LCOESpv,'CHF/kWh')

LVOESpv= 0.08734222875503841 CHF/kWh


LCOESpv= 0.15122661673429186 CHF/kWh

-----------------------------------------------------------
Exercise 2-System 2: PV-coupled battery system for
single house (33 point)
The figure below is a schematic representation of the System 2. It corrresponds to a PV-coupled

12 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

battery system to increase PV self-consumption. We assume a DC-coupled topologoy with a DC-


DC converter efficiency of 100% and DC/AC inverter efficiency as in the Exercise 1.
![PV-coupled%20battery%20system.jpg](attachment:PV-coupled%20battery%20system.jpg)

Input data
Throughout the Exercise 2, you will use the following input data:

• Battery capacity in energy terms (Capacity_E_bat): 7 kWh

• Battery power rating ( Capacity_P_bat): 2.8 kW

• Storage medium cost (retail price, capex_bat): 350 CHF/kWh

• Balance of the plant cost (capex_BoP): 2000 CHF/kW

• Other needed parameters, e.g., discount factor, are equal to exercise 1.

7. Expain the differences between an AC-coupled and DC-coupled


connection between the PV system and the battery. Please,
consider that in Exercise 2, we use a DC-coupled connection. (2
points)
The difference between AC-coupled

In [14]:
Lifetime_bat=15
Capacity_E_bat=7
Capacity_P_bat=2.8
capex_bat=350
capex_BoP=2200
eta_conv=1

### 8. Please formulate an energy balance of the System 2 by writing the equations which: (a) explain how PV
electricity generation is used (i.e. which demand loads it is supplied to, namely the demand of the house, the
battery and the grid) in DC terms; and (b) how the electricity demand is satisfied (i.e. PV system, battery and
electricity grid import) in AC terms. Since we are using a DC topology of the PV-coupled battery system, we
should solve the PV balance in DC terms and the demand balance in AC terms, using both the converter and
inverter efficiencies when needed. Also, include an equation for the round trip efficiency of the battery system.
Following the notation used in exercise 1, please refer to the electricity supplied from the PV to the battery as
E_PVbat (kWh) and so on (2 points).
a) Epvdc= E_pvbat*nconverter + ((E_PVd + EPVgrid)/ninv) #electricity generation in DC terms

b) Ed= Epvd + Edgrid + Edis*ninv #electricity demand in AC terms

c)eta_bat= E_disDC/E_charDC #round trip efficiency


### 9. Using the previous energy balance, please determine the values of the following parameters on a 15-
minute basis using the battery charge (kWh) and discharge (kWh) data of a 7 kWh battery together with the
energy balance of the System 1 (resolved for the exercise 1) (a) PV electricity sold to the grid, E_PVgrid (kWh); (b)
electricity purchased by the house E_dgrid, (kWh); and (c) annual round trip efficiency, eta_bat. The battery
charge (kWh) and discharge (kWh) data are in DC terms (at the battery level) in the Excel file . ### Then, perform
an energy balance on an annual basis (kWh per year) and calculate the new percentage of self-consumption, PV

13 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

export to the grid, self-sufficiency and grid import. Again, peform the PV balance (self-consumptin and grid
export) in DC terms and the demand balance (self-sufficiency and grid import in AC terms). Finally, determine the
total number of equivalent full cycles (EFC) achieved by the battery system, defined as the total discharge divide
by the total battery capacity (7 kWh). The lifetime of this battery system is 15 yr. Briefly discuss whether the
battery is fully charged and discharged on a daily basis, i.e. whether it makes use of its total capacity. ### Finally,
How are round trip efficiency, EFC, SS and SC interconnected? For example, does the battery efficiency affect the
amount of PV supplied to the battery and/or the self-consumption? What other relationships can you establish?
Can a house become fully independent from the main grid? (6 points) - #### Some tips: - You can create new
columns with the battery charge and discharge in AC terms, namely E_PVbat, E_disAC, using the function
"df.assign()" - We assume that inside the DC-coupled topology, the converter efficiency (DC to DC) is equal to 1.
In [15]:
#PV sold to the grid E_PVgrid
df=df.assign(E_PVbat=0)

df.head()

df=df.assign(E_disAC=0)
df.head()

eta_inv=0.95 #efficiency inverter


eta_conv=1 #efficiency converter

df.E_PVbat=df.E_charDC*eta_inv #Echarge battery in AC terms

df.E_disAC=df.E_disDC*eta_inv #Edischarge battery in AC terms

df.loc[(df.E_PVAC-df.E_PVbat)>df.E_dPV,'E_dPV']=df.E_d

df.loc[(df.E_PVAC-df.E_PVbat)<=df.E_dPV, 'E_dPV']=(df.E_PVAC-df.E_PVbat)

df.E_PVgrid=df.E_PVAC-df.E_PVbat-df.E_dPV

df.Ed_grid=df.E_d-df.E_dPV-df.E_disAC

df.describe()

Out[15]: E_d E_PVDC E_charDC E_disDC E_PVAC E_dPV E_PVgrid

count 35040.000000 35040.000000 3.504000e+04 35040.000000 35040.000000 35040.000000 35040.000000

mean 0.096281 0.209538 4.998752e-02 0.044489 0.199061 0.043642 0.107931

std 0.073320 0.309718 1.345633e-01 0.068979 0.294232 0.063434 0.239198

min 0.040000 0.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000

25% 0.050000 0.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000

50% 0.080000 0.000087 0.000000e+00 0.000000 0.000082 0.000082 0.000000

75% 0.110000 0.366426 2.013737e-08 0.063830 0.348105 0.080000 0.011699

max 0.490000 1.190872 7.000000e-01 0.478723 1.131328 0.440000 1.079133

14 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

In [16]:
#Battery efficiency
eta_bat=(df.E_disDC.sum()/df.E_charDC.sum())*100
print('eta_bat=',eta_bat,'%')
#The annual roundtrip efficiency equals to 88.99%

eta_bat= 88.99999999999997 %

In [17]:
E_d_a=df.E_d.sum()
E_PVAC_a=df.E_PVAC.sum()
E_dPV_a=df.E_dPV.sum()
E_PVbat_a=df.E_PVbat.sum()
E_PVgrid_a=df.E_PVgrid.sum()
Ed_grid_a=df.Ed_grid.sum()
E_disAC_a=df.E_disAC.sum()

print('E_d_a=',E_d_a,'kWh')
print('E_PVAC_a=',E_PVAC_a,'kWh')
print('E_dPV_a=',E_dPV_a,'kWh')
print('E_PVbat_a=',E_PVbat_a,'kWh')
print('E_PVgrid_a=',E_PVgrid_a,'kWh')
print('Ed_grid_a=',Ed_grid_a,'kWh')
print('E_disAC_a=',E_disAC_a,'kWh')

E_d_a= 3373.69 kWh


E_PVAC_a= 6975.101546120842 kWh
E_dPV_a= 1529.2310099034335 kWh
E_PVbat_a= 1663.9844969665673 kWh
E_PVgrid_a= 3781.8860392508423 kWh
Ed_grid_a= 363.5127877963223 kWh
E_disAC_a= 1480.946202300244 kWh

In [18]:
#Self consumption with E_disAC
self_consumption=((E_dPV_a+E_disAC_a)/E_PVAC_a)*100

print('self_consumption=',self_consumption,'%')

#Grid export with E_disAC


grid_export=(1-(E_dPV_a+E_disAC_a)/E_PVAC_a)*100

print('grid_export=',grid_export,'%')

#self-sufficiency: annual electricity self-consumption / total annual electricity dema

self_sufficiency=((E_dPV_a+E_disAC_a)/E_d_a)*100

print('self_sufficiency=',self_sufficiency,'%')

#Grid import with E_disAC

grid_import=(1-((E_dPV_a+E_disAC_a)/E_d_a))*100

print('grid_import=',grid_import,'%')

self_consumption= 43.15603424982061 %
grid_export= 56.84396575017939 %
self_sufficiency= 89.225068462238 %
grid_import= 10.774931537762 %

15 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

In [19]:
#EFC
EFC=df.E_disDC.sum()/Capacity_E_bat
print('EFC=',EFC)

#the total number of equivalent full cycles is 223

#Average daily battery charge in kWh


av_daily_charge=df.E_charDC.sum()/365
print('average daily charge=',av_daily_charge, 'kWh')

#Average daily battery discharge in kWh


av_daily_discharge=df.E_disDC.sum()/365
print('average daily discharge=',av_daily_discharge,'kWh')

EFC= 222.69867703763072
average daily charge= 4.798801721605097 kWh
average daily discharge= 4.2709335322285344 kWh

In [20]:
#Finally, How are round trip efficiency, EFC, SS and SC interconnected? For example,

10. Now, we will focus on the same two represenative days as in


the first exercise, namely a sunny and cloudy day, and work with
power instead of energy assuming that power is constant in the
selected time scale (15 minute) and represent these various power
flows (kW) in one graph each for the winder day and the summer
day. To do so, we randomly pick two days in the calendar using the
function iloc. What are the main differences among the two days?
Howe the battery performs in each day? Please discuss them. (6
points)
In [21]:
df_Winter_day=df.iloc[0:96]
df_Winter_day_power=df_Winter_day*4
df=df.assign(time=0)

df_Winter_day_power.time=np.arange(0,24,0.25)
df_Winter_day_power.head()

plt.plot(df_Winter_day_power.time,df_Winter_day_power.E_d,label= 'P demand')


plt.plot(df_Winter_day_power.time,df_Winter_day_power.E_PVAC, label= 'P production'
plt.plot(df_Winter_day_power.time,df_Winter_day_power.E_dPV,label= 'PV demand'
plt.plot(df_Winter_day_power.time,df_Winter_day_power.Ed_grid, label='P from grid'
plt.plot(df_Winter_day_power.time,df_Winter_day_power.E_PVgrid, label='PV to grid'
plt.plot(df_Winter_day_power.time,df_Winter_day_power.E_PVbat, label='PV to battery'
plt.plot(df_Winter_day_power.time,df_Winter_day_power.E_disAC, label='Discharge batter
plt.xlabel('time (h)')
plt.ylabel('power (kW)')
plt.legend()
plt.show()
df_Winter_day_power.describe()

16 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

Out[21]: E_d E_PVDC E_charDC E_disDC E_PVAC E_dPV E_PVgrid Ed_grid time

count 96.000000 96.000000 96.000000 96.000000 96.000000 96.000000 96.000000 96.000000 96.000000

mean 0.510417 0.557220 0.304775 0.271250 0.529359 0.119119 0.120704 0.133611 11.875000

std 0.399863 0.970836 0.718100 0.515382 0.922294 0.190181 0.368296 0.224029 6.964194

min 0.160000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -0.017447 0.000000

25% 0.240000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -0.002660 5.937500

50% 0.360000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 11.875000

75% 0.560000 0.789081 0.000002 0.236446 0.749627 0.260000 0.019567 0.200000 17.812500

max 1.640000 2.898316 2.394489 1.744681 2.753400 0.640000 1.573800 1.320000 23.750000

In [22]:
df_Summer_day=df.iloc[17276:17372]
df_Summer_day_power=df_Summer_day*4
df=df.assign(time=0)

df_Summer_day_power.time=np.arange(0,24,0.25)
df_Summer_day_power.head()

plt.plot(df_Summer_day_power.time,df_Summer_day_power.E_d,label= 'P demand')


plt.plot(df_Summer_day_power.time,df_Summer_day_power.E_PVAC, label= 'P production'
plt.plot(df_Summer_day_power.time,df_Summer_day_power.E_dPV,label= 'PV demand'
plt.plot(df_Summer_day_power.time,df_Summer_day_power.Ed_grid, label='P from grid'
plt.plot(df_Summer_day_power.time,df_Summer_day_power.E_PVgrid, label='PV to grid'
plt.plot(df_Summer_day_power.time,df_Summer_day_power.E_PVbat, label='PV to battery'
plt.plot(df_Summer_day_power.time,df_Summer_day_power.E_disAC, label='Discharge batter
plt.xlabel('time (h)')
plt.ylabel('power (kW)')
plt.legend()
plt.show()
df_Summer_day_power.describe()

17 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

Out[22]: E_d E_PVDC E_charDC E_disDC E_PVAC E_dPV E_PVgrid Ed_grid

count 96.000000 96.000000 9.600000e+01 96.000000 96.000000 96.000000 96.000000 96.000000 96.000000

mean 0.490833 1.529088 1.238459e-01 0.220751 1.452633 0.284388 1.050592 -0.003268 11.875000

std 0.444455 1.608670 3.819600e-01 0.418986 1.528236 0.347269 1.332440 0.006475 6.964194

min 0.160000 0.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 -0.027390 0.000000

25% 0.200000 0.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 -0.002234 5.937500

50% 0.280000 0.955075 0.000000e+00 0.000000 0.907321 0.200000 0.020459 0.000000 11.875000

75% 0.500000 3.068201 1.161133e-12 0.212766 2.914791 0.400000 2.531250 0.000000 17.812500

max 1.720000 4.285312 1.852120e+00 1.829070 4.071046 1.520000 3.669167 0.000000 23.750000

Discussion

11. Please propose equations to calculate the CAPEX of the battery


system including its energy component (storage medium, costsm
CHF/kWh) and power component (battery inverter balance-of-
plant (BoP), CHF/kWh). Then, calculate the total cost for the battery
system, CAPEX_bat (CHF), using the input data given below and
assuming that the battery system has a power rating of 2.8 kW . (2
points)
In [23]:
#Energy component
#a) capex_bat*Capacity_E_bat

#Power component
#b) Capacity_P_bat*capex_BoP

#Total cost of the battery system CAPEX_bat


CAPEX_bat=(capex_bat*Capacity_E_bat)+(Capacity_P_bat*capex_BoP)
print('Total cost of the battery system=',CAPEX_bat,'CHF')

Total cost of the battery system= 8610.0 CHF

18 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

12. Please propose equations to calculate the revenue (in economic


terms) of the battery system, Rev_bat (CHF/year), compared to the
case of having the PV system only. As electricity price
nomenclature, use Pep (CHF/kWh) and Pes (CHF/kWh) for the
purchase price of electricity and the selling price of electricity.
Please, formulate the economic revenue as a function of the
battery round trip efficiency and the ratio between the electricity
selling and purchase prices, Pes/Pep. Please discuss the main
parameters affecting the economic revenue drawn from the
battery. Finally, calculate the annual revenue of the battery system
(using the price data given in the introduction). (4 points)
In [26]:
#Purchased price of electricity: Pep : P_i=0.25
#Selling price of electricity: Pes: P_ex=0.06

Pep=P_i
Pes=P_ex

#revenue electricity exported to the grid without the battery


Reve_elect=df.E_PVgrid.sum()*Pes
print('Revenue elec. exported to the grid without Battery=',Reve_elect,'CHF')

#revenue electricity exported to the grid with the battery


Reve_electb=(df.E_PVgrid.sum()+df.E_disAC.sum())*Pes
print('Revenue elect. exported to the grid with Battery=',Reve_electb,'CHF')

#revenue lost
rev_lost=df.E_PVbat.sum()*Pes
print('Revenue lost=',rev_lost,'CHF')
#revenue lost is what could have been sold to the grid but it is used to charge the ba

#avoided cost of electricity importe from the grid, is the price of electricity that i
avoided_cost_dis=df.E_disAC.sum()*Pep
print('Avoided cost=',avoided_cost_dis,'CHF')

#Battery revenue
Rev_bat=avoided_cost_dis-rev_lost
print('Battery revenue=',Rev_bat,'CHF')

Revenue elec. exported to the grid without Battery= 226.91316235505053 CHF


Revenue elect. exported to the grid with Battery= 315.7699344930652 CHF
Revenue lost= 99.83906981799404 CHF
Avoided cost= 370.236550575061 CHF
Battery revenue= 270.397480757067 CHF

In [35]:
#Roundtrip efficiency= battery discharge/battery charge
#eta_bat=0.89
#Ratio prices=Pes/Pep
Ratio_P=Pes/Pep
print('Ratio Prices=',Ratio_P)

Rev_bat_a=df.E_disAC.sum()*Pep - df.E_PVbat.sum()*Pes
print('Annual Revenue Battery=',Rev_bat_a,'CHF')
#Pep*(df.E_disAC.sum()-df.E_PVbat.sum()*Ratio_P)

19 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

Ratio Prices= 0.24


Annual Revenue Battery= 270.397480757067 CHF

Battery revenue as a function of roundtrip


efficiency and price ratio

Rev_bat_p=Pepdf.E_PVbat.sum()(eta_bat-
Ratio_P)
The higher the battery efficiency the higher the revenue, since more costs can be avoided
because less electricity is imported.

The higher the ratio between selling and purchasing price, the lower the total revenue is, since
the lost revenue is higher. It means that for a high selling price there is a bigger price ratio, which
means that the revenue lost from not selling the electricity to the grid is higher (since this
electricity is used to charge the battery)

13. Determine the levelised cost (LCOES), levelised value (LVOES)


and internal rate of return (IRR) of the battery system assuming
that the battery discharge and the revenue remain constant
throughout the battery’s lifetime. Discuss the results and compare
the LCOES with the LVOES, and the link with the IRR. In your view,
what are the most important simplifications made for this battery
system? Considering economic criteria, shall a prosumer invest in a
battery under these assumptions? (5 points)

20 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

In [81]:
nrows=16
df_TI_Battery=pd.DataFrame(index=np.arange(nrows),columns=['year','E_disAC','E_disAC_d

r=0.04 #discount rate


df_TI_Battery.iloc[0,1]=0
df_TI_Battery.iloc[1:nrows,1]=df.E_disAC.sum()
df_TI_Battery.year= np.arange(0,nrows,1)

df_TI_Battery.E_disAC_disc=df_TI_Battery.E_disAC/(1+r)**(df_TI_Battery.year)

df_TI_Battery.iloc[0,3]=CAPEX_bat
df_TI_Battery.iloc[1:nrows,3]=0

df_TI_Battery.Cost_disc=df_TI_Battery.Cost/(1+r)**(df_TI_Battery.year)

df_TI_Battery.iloc[0,5]=0
df_TI_Battery.iloc[1:nrows,5]=Rev_bat

df_TI_Battery.Revenue_battery_year_disc=df_TI_Battery.Revenue_bat_year/(1+r)**

df_TI_Battery.CF_IRR=df_TI_Battery.Revenue_bat_year-df_TI_Battery.Cost
IRR=np.irr(df_TI_Battery.CF_IRR)
print('IRR=',IRR)
print(df_TI_Battery)

IRR= -0.08208356315027188
year E_disAC E_disAC_disc Cost Cost_disc Revenue_bat_year \
0 0 0 0 8610 8610 0
1 1 1480.95 1423.99 0 0 270.397
2 2 1480.95 1369.22 0 0 270.397
3 3 1480.95 1316.56 0 0 270.397
4 4 1480.95 1265.92 0 0 270.397
5 5 1480.95 1217.23 0 0 270.397
6 6 1480.95 1170.41 0 0 270.397
7 7 1480.95 1125.4 0 0 270.397
8 8 1480.95 1082.11 0 0 270.397
9 9 1480.95 1040.49 0 0 270.397
10 10 1480.95 1000.47 0 0 270.397
11 11 1480.95 961.994 0 0 270.397
12 12 1480.95 924.995 0 0 270.397
13 13 1480.95 889.418 0 0 270.397
14 14 1480.95 855.21 0 0 270.397
15 15 1480.95 822.317 0 0 270.397

Revenue_battery_year_disc CF_IRR
0 0 -8610
1 259.998 270.397
2 249.998 270.397
3 240.382 270.397
4 231.137 270.397
5 222.247 270.397
6 213.699 270.397
7 205.48 270.397
8 197.577 270.397
9 189.978 270.397
10 182.671 270.397
11 175.645 270.397
12 168.889 270.397
13 162.394 270.397
14 156.148 270.397

21 of 22 4/13/2022, 3:46 PM
Assignment_techno_eco_2022 about:srcdoc

15 150.142 270.397
<ipython-input-81-8adafc1c6de5>:23: DeprecationWarning: numpy.irr is deprecate
d and will be removed from NumPy 1.20. Use numpy_financial.irr instead (http
s://pypi.org/project/numpy-financial/).
IRR=np.irr(df_TI_Battery.CF_IRR)

In [79]:
LVOES=df_TI_Battery.Revenue_battery_year_disc.sum()/df_TI_Battery.E_disAC_disc
print('LVOES=',LVOES,'CHF/kWh')

LCOES=df_TI_Battery.Cost.sum()/df_TI_Battery.E_disAC_disc.sum()
print('LCOES=',LCOES,'CHF/kWh')

LVOES= 0.1825842696629213 CHF/kWh


LCOES= 0.5229041223720836 CHF/kWh

14. Please explain which parameters have the largest impact on the
economic performance of PV-coupled battery systems. What
evolution of these parameters do you expect for the next 10-15
years and how would this affect the business case of PV-coupled
battery systems in single houses? You can use the bibliography
given in Model to write your answer. (3 points)

15. In this exercise we have studied PV-coupled battery systems


performing PV self-consumption but this type of system is not yet
economically viable. Could you outline which other applications or
services PV-coupled battery systems could perform to improve
their economic viability? You can use the bibliography given in
Model to write your answer. (3 points)

To generate a pdf, use "file", "download as", "pdf via Latex"


In [ ]:

In [ ]:

In [ ]:

22 of 22 4/13/2022, 3:46 PM

You might also like