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

Micro-Grids Documentation

Release 1.0.0

Sergio Balderrama, Sylvain Quoilin

Nov 27, 2017


Contents

1 Contents 3
1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Model Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 API Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.4 Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2 Indices and tables 15

3 License 17
3.1 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

i
ii
Micro-Grids Documentation, Release 1.0.0

Organization 1 University Of Liege, Energy Systems Research unit


Organization 2 University Mayor of San Simon, Energy Center
Version 1.0
Date Nov 27, 2017
The world is currently undergoing a drastic change of the energy matrix from conventional sources of energy to
renewable and alternative ones. This trend is particularly relevant in the challenge of rural electrification in developing
countries because in some cases the levelized cost of electricity (LCOE) of hybrid or renewable systems can be
competitive with the extension of the main grid in order to supply the energy demand of isolated communities [1].
However, exploiting solar energy for off-grid rural electrification faces some major challenges, especially due to the
stochastic nature of the solar resource and eventual electricity demand (viz.load profile). These can have a serious
impact on the sizing of the micro-grid, and the stability and reliability of the energy supply. In addition, as analysed
in [2-3], an insightful analysis on how the electrification process impacts the electricity-user’s behaviour is generally
lacking when planning a micro-grid, as well as a generalized underestimation of the social aspect during the design
phase.To this aim, optimization techniques fulfill a key role in differents aspects of micro-grid planning and operating
procedure in order to reduce the LCOE for a determined micro-grid [4].
The Micro-Grid library main objective is to provide an open source alternative to the problem of sizing and dispatch of
energy in micro-grids in isolated places. It’s written in python(pyomo) and use excel and text files as input and output
data handling and visualization.
Main features:
• Robust optimization
• Optimal sizing of Lion-Ion batteries, diesel generators and PV panels in order to supply a demand with the
lowest cost possible.
• Optimal dispatch from different energy sources.
• Calculation of the net present cost of the system for the project lifetime.
• Determination of the LCOE for the optimal system1.

Contents 1
Micro-Grids Documentation, Release 1.0.0

2 Contents
CHAPTER 1

Contents

1.1 Overview

The main objective of the Micro-grid library is to determine the combination of install capacities of PV, Lion-Ion
Batteries and diesel generators that makes the lowest Net Present Cost for the life time of the project and accomplish
the constraints of the system. For this objective the problem is express as a linear programming problem.

Fig. 1. The considered micro-grid typology: adapted from[1].


The main optimization variables are the size of the PV array, battery bank and diesel generator that minimize the
objective function and satisfy the physical, technical and economical constraints of the different elements in the micro-
grid. The optimal dispatch of energy is also a result of the optimization process. The time step of the demand load and
the irradiation is 1 hour and the optimization horizon is 1 year.

3
Micro-Grids Documentation, Release 1.0.0

After the optimization process finish and the results are found, a post-processing tool is used in order to present the
results and the most important parameters in an excel sheet, finally a Figure with the energy flow from the choose days
is created.

Fig. 2. Example of a figure created by the micro-grids library.

1.1.1 Reference

[1] Agarwal N., Kumar A., Varun., Optimization of grid independent hybrid PV-diesel-battery system for power
generation in remote villages of uttar Pradesh, india. Energy for Sustainable Development 2013; 17:210-219

1.2 Model Description

1.2.1 Sets

Name Symbol Description


Years n Year of the project
Periods t Period that are divided the years
Scenarios s Scenarios analalized

1.2.2 Parameters

Data analysis parameters

Name Unit Description


Startdate Day Start date of the analysis
PlotTime Days Number of days for the plot of energy dispatch
PlotDay Day Start date for the dispatch plot
PlotScenario Scenario to be plot

4 Chapter 1. Contents
Micro-Grids Documentation, Release 1.0.0

PV parameters

Name Unit Description


PVNominalCapacity W/unit Nominal capacity of one PV unit
InverterEfficiency % efficiency of the inverter to transform DC energy to AC
PVinvesmentCost USD/W Investment Cost to install PV panels
PVEnergyProduction Wh The yield of energy of one PV unit in the period (i,t)

Battery bank parameters

Name Unit Description


ChargeBatteryEfficiency % The efficiency of the battery to charge energy
DischargeBatteryEfficiency % The efficiency of the battery to discharge energy
DeepOfDischarge % Minimum percentage of energy of the nominal capacity of the
battery
MaximunBatteryChargeTime hour Maximum time to charge from 0 % to a 100 % of energy in the
battery
MaximunBatteryDischarge- hour Maximum time to discharge from 100 % to a 0 % of energy in the
Time battery
BatteryInvesmentCost USD/Wh Investment cost to install a Wh of batteries
BatteryRepostionTime Years Time for the remplacement of the battery

Diesel generator parameters

Name Unit Description


GeneratorEfficiency % Generator efficiency to transform heat into electricity
LowHeatingValue W/L Low heating value of the diesel
DieselCost USD/L Diesel cost
GeneratorInvesmentCost USD/W Investment cost to install a diesel generator

Energy balance parameters

Name Unit Description


EnergyDemand (s,t) W The total energy demand of the system for each scenario.
LostLoadProbability % The percentage of the demand that the micro-grid has to provide
ValueOfLostLoad USD/W The price of the load that is not supply to the system

1.2. Model Description 5


Micro-Grids Documentation, Release 1.0.0

Project parameters

Name Unit Description


Periods Hours Number of periods of the year
Years Years Number of years in the project
DeltaTime Hours Time step of the analysis of the energy flow
PorcentageFunded % Percentage of the total investment that is Funded by a bank or another
entity
MaintenanceOperationCostPV % Percentage of the total investment spend in operation and management
of PV
MaintenanceOperationCost- % Percentage of the total investment spend in operation and management
Battery of the battery
MaintenanceOperationCost- % Percentage of the total investment spend in operation and management
Generator of the genset
DiscountRate % Discount rate of the project
InterestRate % Interest rate of the loan
ProbalityOccurrence (s) % Probability of occurrence of each scenario
N Years Years of duration of the project

1.2.3 Variables

PV variables

Name Unit Description


PVUnits unit Number of installed PV
TotalEnergyPV (s,t) Wh Energy generated for all the PVs in the system in each scenario
OyMCostPV USD Cost of the OyM of the PV during the life time of the proyect

Battery variables

Name Unit Description


BatteryNominalCapacity Wh Nominal capacity of the battery bank
EnergyBatteryDischarge (s,t) Wh Energy that flows out of the battery in each scenario
EnergyBatteryCharge (s,t) Wh Energy that flows in to the battery in each scenario
StateOfChargeBattery (s,t) Wh Energy inside the battery in each scenario
MaximunChargePower W Maximum charge power
MaximunDischargePower W Maximum discharge power

Diesel generator variables

Name Unit Description


GeneratorNominalCapacity W Nominal capacity of the diesel generator
DieselConsumed (s,t) L Diesel consumed to produce energy
GeneratorEnergy (s,t) Wh Energy produced by the diesel generator
DieselCostTotal (s) USD Cost of the diesel during the life time of the project

6 Chapter 1. Contents
Micro-Grids Documentation, Release 1.0.0

Energy balance variables

Name Unit Description


LostLoad (s,t) Wh Energy not supply by the system in each scenario
EnergyCurtailment (s,t) Wh Curtailment of solar energy in each scenario
LostLoadCostTotal (s) USD Cost of the Lost load during the life time of the project

Project variables

Name Unit Description


FinancialCost USD Annual constant payment for the loan adquire to finance the project
ScenarioNetPresentCost USD Net present cost of each scenario
InitialInversion USD Value of the inital inversion of the project
OyMCost USD Total cost of the Operation and maintenence during the life time of the project
FinancialCostTotal USD Total cost of the payment for the loan during the life time of the project
BatteryRepositionCost USD Cost for the reposition of the battery

1.2.4 Modeling of the system

1.2.5 Objective function

The objective function will minimize the sum of the multiplication of the net present cost of each scenario and their
probability of occurrence.
∑︁
𝑂𝑏𝑗𝑒𝑐𝑡𝑖𝑣𝑒𝐹 𝑢𝑛𝑡𝑖𝑜𝑛 = ScenarioNetPresentCost 𝑠 · ProbalityOccurrence 𝑠
𝑠

The net present cost of each scenario is computed with the following equation:

ScenarioNetPresentCost 𝑠 = 𝐼𝑛𝑖𝑡𝑖𝑎𝑙𝐼𝑛𝑣𝑒𝑟𝑠𝑖𝑜𝑛 + 𝑂𝑦𝑀 𝐶𝑜𝑠𝑡 + 𝐹 𝑖𝑛𝑎𝑛𝑐𝑖𝑎𝑙𝐶𝑜𝑠𝑡𝑇 𝑜𝑡𝑎𝑙


+𝐵𝑎𝑡𝑡𝑒𝑟𝑦𝑅𝑒𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛𝐶𝑜𝑠𝑡 + DieselCostTotal 𝑠 + LostLoadCostTotal 𝑠

The total investment equation is:

𝐼𝑛𝑖𝑡𝑖𝑎𝑙𝐼𝑛𝑣𝑒𝑟𝑠𝑖𝑜𝑛 = (𝑃 𝑉 𝑖𝑛𝑣𝑒𝑠𝑡𝑚𝑒𝑛𝑡𝐶𝑜𝑠𝑡 · 𝑃 𝑉 𝑁 𝑜𝑚𝑖𝑛𝑎𝑙𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦 · 𝑃 𝑉 𝑈 𝑛𝑖𝑡𝑠 + 𝐵𝑎𝑡𝑡𝑒𝑟𝑦𝑁 𝑜𝑚𝑖𝑛𝑎𝑙𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦 · 𝐵𝑎𝑡𝑡𝑒𝑟𝑦𝐼𝑛𝑣𝑒𝑠𝑡𝑚𝑒


+𝐺𝑒𝑛𝑒𝑟𝑎𝑡𝑜𝑟𝐼𝑛𝑣𝑒𝑠𝑡𝑚𝑒𝑛𝑡𝐶𝑜𝑠𝑡 · 𝐺𝑒𝑛𝑒𝑟𝑎𝑡𝑜𝑟𝑁 𝑜𝑚𝑖𝑛𝑎𝑙𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦) · (1 − 𝑃 𝑜𝑟𝑐𝑒𝑛𝑡𝑎𝑔𝑒𝐹

The OyMCost is calculated by the following equation:

𝑂𝑦𝑀 𝐶𝑜𝑠𝑡𝑃 𝑉 = 𝑃 𝑉 𝑖𝑛𝑣𝑒𝑠𝑚𝑒𝑛𝑡𝐶𝑜𝑠𝑡 · 𝑃 𝑉 𝑁 𝑜𝑚𝑖𝑛𝑎𝑙𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦 · 𝑃 𝑉 𝑈 𝑛𝑖𝑡𝑠 · 𝑀 𝑎𝑖𝑛𝑡𝑒𝑛𝑎𝑛𝑐𝑒𝑂𝑝𝑒𝑟𝑎𝑡𝑖𝑜𝑛𝐶𝑜𝑠𝑡𝑃 𝑉

𝑂𝑦𝑀 𝐶𝑜𝑠𝑡𝐵𝑎𝑡𝑡𝑒𝑟𝑦 = 𝐵𝑎𝑡𝑡𝑒𝑟𝑦𝑁 𝑜𝑚𝑖𝑛𝑎𝑙𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦 · 𝐵𝑎𝑡𝑡𝑒𝑟𝑦𝐼𝑛𝑣𝑒𝑠𝑚𝑒𝑛𝑡𝐶𝑜𝑠𝑡 · 𝑀 𝑎𝑖𝑛𝑡𝑒𝑛𝑎𝑛𝑐𝑒𝑂𝑝𝑒𝑟𝑎𝑡𝑖𝑜𝑛𝐶𝑜𝑠𝑡𝐵𝑎𝑡𝑡𝑒𝑟𝑦

𝑂𝑦𝑀 𝐶𝑜𝑠𝑡𝐺𝑒𝑛𝑒𝑟𝑎𝑡𝑜𝑟 = 𝐺𝑒𝑛𝑒𝑟𝑎𝑡𝑜𝑟𝐼𝑛𝑣𝑒𝑠𝑚𝑒𝑛𝑡𝐶𝑜𝑠𝑡 · 𝐺𝑒𝑛𝑒𝑟𝑎𝑡𝑜𝑟𝑁 𝑜𝑚𝑖𝑛𝑎𝑙𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦 · 𝑀 𝑎𝑖𝑛𝑡𝑒𝑛𝑎𝑛𝑐𝑒𝑂𝑝𝑒𝑟𝑎𝑡𝑖𝑜𝑛𝐶𝑜𝑠𝑡𝐺𝑒𝑛𝑒𝑟𝑎𝑡𝑜𝑟


∑︁ 𝑂𝑦𝑀 𝐶𝑜𝑠𝑡𝑃 𝑉 + 𝑂𝑦𝑀 𝐶𝑜𝑠𝑡𝐵𝑎𝑡𝑡𝑒𝑟𝑦 + 𝑂𝑦𝑀 𝐶𝑜𝑠𝑡𝐺𝑒𝑛𝑒𝑟𝑎𝑡𝑜𝑟
𝑂𝑦𝑀 𝐶𝑜𝑠𝑡 =
𝑛
(1 + 𝐷𝑖𝑠𝑐𝑜𝑢𝑛𝑡𝑅𝑎𝑡𝑒)𝑛
The financial cost is a fix amount, that is payed each period to pay the loan acquire to finance a percentage of the initial
investment and is calculated with the following equation:

𝐼𝑁 𝑉 · 𝑃 𝑜𝑟𝑐𝑒𝑛𝑡𝑎𝑔𝑒𝐹 𝑢𝑛𝑑𝑒𝑑 · 𝐼𝑛𝑡𝑒𝑟𝑒𝑠𝑡𝑅𝑎𝑡𝑒


𝐹 𝑖𝑛𝑎𝑛𝑐𝑖𝑎𝑙𝐶𝑜𝑠𝑡 =
1 − (1 + 𝐼𝑛𝑡𝑒𝑟𝑒𝑠𝑡𝑅𝑎𝑡𝑒)−𝑁

1.2. Model Description 7


Micro-Grids Documentation, Release 1.0.0

The total cost incurred in the lifetime of the project for the financial cost is calculated with equation:
∑︁ 𝐹 𝑖𝑛𝑎𝑛𝑐𝑖𝑎𝑙𝐶𝑜𝑠𝑡
𝐹 𝑖𝑛𝑎𝑛𝑐𝑖𝑎𝑙𝐶𝑜𝑠𝑡𝑇 𝑜𝑡𝑎𝑙 =
𝑛
(1 + 𝐷𝑖𝑠𝑐𝑜𝑢𝑛𝑡𝑅𝑎𝑡𝑒)𝑛

The replacement cost is given by the fallowing equation:


𝐵𝑎𝑡𝑡𝑒𝑟𝑦𝑁 𝑜𝑚𝑖𝑛𝑎𝑙𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦 · 𝐵𝑎𝑡𝑡𝑒𝑟𝑦𝐼𝑛𝑣𝑒𝑠𝑚𝑒𝑛𝑡𝐶𝑜𝑠𝑡
ReplacementCost 10 =
(1 + 𝐷𝑖𝑠𝑐𝑜𝑢𝑛𝑡𝑅𝑎𝑡𝑒)𝑁
The Diesel cost is calculated by:
∑︁ ∑︀ DieselConsumed 𝑠,𝑡 · 𝐷𝑖𝑒𝑠𝑒𝑙𝐶𝑜𝑠𝑡
𝑡
DieselCostTotal 𝑠 =
𝑛
(1 + 𝐷𝑖𝑠𝑐𝑜𝑢𝑛𝑡𝑅𝑎𝑡𝑒)𝑛

Finally the cost for the unmment load is calculated with the following equation:
∑︁ ∑︀ LostLoad 𝑠,𝑡 · 𝑉 𝑎𝑙𝑢𝑒𝑂𝑓 𝐿𝑜𝑠𝑡𝐿𝑜𝑎𝑑
𝑡
LostLoadCostTotal 𝑠 =
𝑛
(1 + 𝐷𝑖𝑠𝑐𝑜𝑢𝑛𝑡𝑅𝑎𝑡𝑒)𝑛

PV model

The equation that model the PV array energy yield is given by:

TotalEnergyPV 𝑠,𝑡 = PVEnergyProduction 𝑠,𝑡 · InverterEfficiency · PVUnits

Diesel generator

The fuel consumption is modeled by:

DieselConsumed 𝑠,𝑡 = GeneratorEnergy 𝑠,𝑡 /(GeneratorEfficiency · LowHeatingValue)

In order to ensure that the generator will not exceed his capacity the fallowing constraint is added to the model:

GeneratorNominalCapacity · DeltaTime ≥ GeneratorEnergy 𝑠,𝑡

Battery bank

The state of charge of the battery is modeled by:

StateOfChargeBattery 𝑠,1 = 𝐵𝑎𝑡𝑡𝑒𝑟𝑦𝑁 𝑜𝑚𝑖𝑛𝑎𝑙𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦 − EnergyBatteryCharge 𝑠,1 · ChargeBatteryEfficiency − EnergyBatteryD

StateOfChargeBattery 𝑠,𝑡 = 𝐵𝑎𝑡𝑡𝑒𝑟𝑦𝑁 𝑜𝑚𝑖𝑛𝑎𝑙𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦 − EnergyBatteryCharge 𝑠,𝑡 · ChargeBatteryEfficiency − EnergyBatteryD

In this equations is important to highlight that in the period 1 the stated of charge of the batterie is equal to the total
capacity of the battery.
In order to ensure the durability of the battery a minimum depth of discharge (%) and maximum charge are establish
as a constraint:

𝐵𝑎𝑡𝑡𝑒𝑟𝑦𝑁 𝑜𝑚𝑖𝑛𝑎𝑙𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦 · 𝐷𝑒𝑒𝑝𝑂𝑓 𝐷𝑖𝑠𝑐ℎ𝑎𝑟𝑔𝑒 ≤ StateOfChargeBattery 𝑠,𝑡 ≤ 𝐵𝑎𝑡𝑡𝑒𝑟𝑦𝑁 𝑜𝑚𝑖𝑛𝑎𝑙𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦

8 Chapter 1. Contents
Micro-Grids Documentation, Release 1.0.0

The maximum power of charge and discharge are modeled as follow:


𝑀 𝑎𝑥𝑖𝑚𝑢𝑛𝐶ℎ𝑎𝑟𝑔𝑒𝑃 𝑜𝑤𝑒𝑟 = 𝐵𝑎𝑡𝑡𝑒𝑟𝑦𝑁 𝑜𝑚𝑖𝑛𝑎𝑙𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦/𝑀 𝑎𝑥𝑖𝑚𝑢𝑛𝐵𝑎𝑡𝑡𝑒𝑟𝑦𝐶ℎ𝑎𝑟𝑔𝑒𝑇 𝑖𝑚𝑒
𝑀 𝑎𝑥𝑖𝑚𝑢𝑛𝐷𝑖𝑠𝑐ℎ𝑎𝑟𝑔𝑒𝑃 𝑜𝑤𝑒𝑟 = 𝐵𝑎𝑡𝑡𝑒𝑟𝑦𝑁 𝑜𝑚𝑖𝑛𝑎𝑙𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦/𝑀 𝑎𝑥𝑖𝑚𝑢𝑛𝐵𝑎𝑡𝑡𝑒𝑟𝑦𝐷𝑖𝑠𝑐ℎ𝑎𝑟𝑔𝑒𝑇 𝑖𝑚𝑒
The flow of energy is into and out of the battery is restricted by:
EnergyBatteryCharge 𝑠,𝑡 ≥ −𝑀 𝑎𝑥𝑖𝑚𝑢𝑛𝐶ℎ𝑎𝑟𝑔𝑒𝑃 𝑜𝑤𝑒𝑟 · 𝐷𝑒𝑙𝑡𝑎𝑇 𝑖𝑚𝑒
EnergyBatteryDischarge 𝑠,𝑡 ≤ 𝑀 𝑎𝑥𝑖𝑚𝑢𝑛𝐷𝑖𝑠𝑐ℎ𝑎𝑟𝑔𝑒𝑃 𝑜𝑤𝑒𝑟 · 𝐷𝑒𝑙𝑡𝑎𝑇 𝑖𝑚𝑒

Energy constraints

In order to ensure a perfect match between generation and demand, an energy balance is created as a constraint.
EnergyDemand 𝑠,𝑡 = TotalEnergyPV 𝑠,𝑡 + DieselConsumed 𝑠,𝑡 + EnergyBatteryCharge 𝑠,𝑡
+EnergyBatteryDischarge 𝑠,𝑡 + EnergyCurtailment 𝑠,𝑡 + LostLoad 𝑠,𝑡
This constraint is used to ensure that a percentage of the demand will always be supply and is express as follow:
∑︀
LostLoad 𝑠,𝑡
𝐿𝑜𝑠𝑡𝐿𝑜𝑎𝑑𝑃 𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 = ∑︀ 𝑡
𝑡 EnergyDemand 𝑠,𝑡

1.3 API Documentation

1.3.1 Model Creation

1.3.2 Initialize parameters

1.3.3 Model Resolution

1.3.4 Constraints

1.3.5 Economical analisis

1.3.6 Results

1.4 Tutorial

This section is a walkthrough of how to use the Micro-Grids library in order to obtain the optimal nominal capacity
for an isolated micro-grid with a given demand and PV production.

1.4.1 Requirements

The MicroGrid library can be use in Linux or windows and needs different programs and phyton libraries in order to
work.

Python

First of all Micro-Grids needs Python 3 install in the computer. The easiest way to obtain it, is download anaconda in
order to have all the tools needed to run python scripts.

1.3. API Documentation 9


Micro-Grids Documentation, Release 1.0.0

Python libraries

The python libraries needed to run Micro-Grids are the following:


• pyomo Optimization object library, interface to LP solver (e.g. CPLEX)
• pandas for input and result data handling
• matplotlib for plotting

Solver

Any of the fallowing solvers can be used during the optimization process in the Micro-Grids library:
• cplex

1.4.2 Download of MicroGrid library

For the moment the Micro-Grids library is in form of python scripts, in order to download them please follow this link:
https://github.com/squoilin/MicroGrids
Once they have been download, create a folder and put the scripts in there. Also create two folders with the names of
‘Results’ and Inputs as show in the following Figure:

1.4.3 Inputs

The Micro-grids library needs the input files are stored in the folder ‘Inputs’, these are the needed files:
Name of the file type of file Description
Data.dat Txt file In this file the value of the parameters are set
Demand.xls Excel file The demand of energy of the system for each period is set in this file
PV_Energy.xls Excel file The energy yield in each period from one PV is set in this file

Data.dat file

This file has to contain all the parameters for the Micro-Grids library to be able to perform an optimization of the
nominal capacity of the PV, battery bank and diesel generator. This file has to be write in AMPL data format. A table
of all the parameters with an example of value and how they have to be written in the txt can be seen in the next table.

10 Chapter 1. Contents
Micro-Grids Documentation, Release 1.0.0

Name of the parameter Ampl format Observation


Stardate param: StartDate := ‘01/01/2014 01:00:00’; month/day/year hour:minute:sec
PlotTime param: PlotTime := 1; The number of days to be plot
PlotDay param: PlotDay := ‘02/01/2014 01:00:00’; month/day/year hour:minute:sec
PlotScenario param: PlotScenario := 2; The scenario to be ploted
Delta_Time param: Delta_Time := 1.0; Duration of the periods
PVNominalCapacity param: PV_Nominal_Capacity := 300;
PVinvesmentCost param: PV_invesment_Cost := 1.6667;
InverterEfficiency param: Inverter_Efficiency := 0.986;
ChargeBatteryEfficiency param: Charge_Battery_Efficiency := 0.95;
DischargeBatteryEfficiency param: Discharge_Battery_Efficiency := 0.95;
DeepOfDischarge param: Deep_of_Discharge := 0.2; Between 0 a 1
MaximunBatteryChargeTime param: Maximun_Battery_Charge_Time := 5;
MaximunBatteryDischargeTime param: Maximun_Battery_Discharge_Time := 5;
BatteryInvesmentCost param: Battery_Invesment_Cost := 0.6;
N param: Battery_Reposition_Time := 10;
GeneratorEfficiency param: Generator_Efficiency := 0.337040782;
LowHeatingValue param: Low_Heating_Value := 9890; It depends on the fuel used
DieselCost param: Diesel_Unitary_Cost := 1.18;
GeneratorInvesmentCost param: Generator_Invesment_Cost := 1.48;
LostLoadProbability param: Lost_Load_Probability := 0.00; Between 0 and 1
ValueOfLostLoad param: Value_Of_Lost_Load := 0.18;
Periods param: Periods := 8760; A year has 8760 hours
Years param: Years := 20;
PorcentageFunded param: Porcentage_Funded := 0.55;
MaintenanceOperationCostPV param: Maintenance_Operation_Cost_PV := 0.015;
MaintenanceOperationCostBattery param: Maintenance_Operation_Cost_Battery:= 0.015;
MaintenanceOperationCostGenerator param: Maintenance_Operation_Cost_Generator := 0.015;
DiscountRate param: Discount_Rate := 0.12;
InterestRate param: Interest_Rate_Loan := 0.06;
s param: Scenarios :=3;

This file must be save inside the folder “Inputs”. An example can be downloaded in the fallowing link:
https://github.com/squoilin/MicroGrids/tree/master/MicroGrids/Example

Demand.xls file

The Demand.xls file has to have the energy demand of the system in each period of analysis. The excel file must have
a column with the periods and another with the demand in W as shown in the following figure.

1.4. Tutorial 11
Micro-Grids Documentation, Release 1.0.0

This file must be save inside the folder “Inputs”. An example can be downloaded in the fallowing link:
https://github.com/squoilin/MicroGrids/tree/master/MicroGrids/Example

PV_Energy.xls

The PV_Energy.xls file has to have the energy yield for one PV in each period of analysis. The excel file must have a
column with the periods and the number of columns equal to the number of scenarios energy yield in W as shown in
the following figure.

12 Chapter 1. Contents
Micro-Grids Documentation, Release 1.0.0

This file must be save inside the folder “Inputs”. An example can be downloaded in the fallowing link:
https://github.com/squoilin/MicroGrids/tree/master/MicroGrids/Example

1.4.4 Run Micro-Grids library

Once all the above steps are performed, the easiest way to run the Micro-grids library is opening the Micro-Grids.py
file in an development environment like spider and run the script inside it. Another way is to open a terminal in the
folder where all the scripts are and use the following command:
python Micro-Grids.py

1.4. Tutorial 13
Micro-Grids Documentation, Release 1.0.0

1.4.5 Outputs

After the optimization is finish a message will appear with the Levelized cost of energy and the net present value of
the system. Also 3 files will be created in the ‘Results’ folder, this files are specified in the following table.
Name of the file type of Description
file
Size.xls Txt file Contains the nominal capacities of the PV, Battery, Diesel generator and other
information
Time_series.xls Excel Contains the the energy flow in each period for all the energy variables and
file the diesel consume
Sce- Excel Contains some information of the scenarios
nario_Information.xls file
Energy_flow.png Excel Contains the Figure of the energy flow from the ‘PlotDay’ during for
file ‘PlotTime’ days

14 Chapter 1. Contents
CHAPTER 2

Indices and tables

• genindex
• modindex
• search

15
Micro-Grids Documentation, Release 1.0.0

16 Chapter 2. Indices and tables


CHAPTER 3

License

Copyright 2016 Sergio Balderrama, Sylvain Quoilin


Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent
versions of the EUPL (the “Licence”); You may not use this work except in compliance with the Licence. You may
obtain a copy of the Licence at:
http://ec.europa.eu/idabc/eupl
Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an
“AS IS” basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
Licence for the specific language governing permissions and limitations under the Licence.

3.1 References

17

You might also like