Final Report-A Microgrid With Renewable Energy Resources...

67
THE HONG KONG POLYTECHNIC UNIVERSITY DEPARTMENT OF ELECTRICAL ENGINEERING Project ID: FYP_46 A Microgrid With Renewable Energy Resources And Energy Storage by LAM Cheuk San Cheston 14074238D Final Report Bachelor of Engineering (Honours) in Electrical Engineering Of The Hong Kong Polytechnic University Supervisor: Dr Jerry Hu Date: 23/3/2018

Transcript of Final Report-A Microgrid With Renewable Energy Resources...

Page 1: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

THE HONG KONG POLYTECHNIC UNIVERSITY DEPARTMENT OF ELECTRICAL ENGINEERING

Project ID: FYP_46

A Microgrid With Renewable Energy Resources And Energy Storage

by

LAM Cheuk San Cheston

14074238D

Final Report

Bachelor of Engineering (Honours) in

Electrical Engineering

Of

The Hong Kong Polytechnic University Supervisor: Dr Jerry Hu Date: 23/3/2018

Page 2: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

i

Abstract

The application and benefits of microgrids (MGs) have been greatly discussed in recent

years. Microgrids utilise different local renewable energy resources to provide

electricity to the community. They enhance the stability and reliability of the main grid.

Recent studies show that there are certain advantages using DC distribution over

traditional AC systems.

This project designed, simulated and constructed a prototype of a DC MG based on a

provided laboratory scale Wind-PV-Battery MG from another study, aiming to develop

an islanded microgrid that provides stable electricity to rural isolated households.

A preliminary circuit design was simulated via Simulink. Circuit design was adjusted

for optimum results. Final circuit design and components selected were used for

reference in prototype development.

The simulation environment is completely different from reality. Circuit design for the

prototype was modified again to achieve requirements. Bootstrap gate-drive technique

was adopted in the actual circuit. In the laboratory environment with limitations, PV

simulator consisting of a DC power source connected to MPPT controller was used to

simulate the actual solar PV. Arduino Uno with Timer1 and PID library was used as the

controller.

The results are satisfactory under certain constraints. DC bus voltage is stable at 24V

and battery automatically changes between charge and discharge mode in different

conditions. Valuable experiences in prototyping can be studied in this project report.

Page 3: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

ii

Acknowledgement

I would like to express my special thanks to Dr Jerry Hu for his suggestions throughout

whole final year project. When I selected this project, Dr. Hu recommended me to take

the subject ‘Advanced power electronics’. The subject contents are relevant to this

project and provide me basic knowledge about DC-DC converters used in this project.

In the circuit design process, Dr. Hu inspired me a lot until preliminary circuit design

was successfully made. I really appreciate the concrete comments and ideas to further

improve the prototype.

I would also like to thank Dr. Siqi Bu for giving me useful directions in circuit

requirements and report writing after mid-term presentation. Although we only talked

once, I realised the importance to ensure the output power quality.

Moreover, I would like to appreciate the pleasant support from Mr. H. T. Wong in

EF001. Providing equipment and allocating lockers to us. This provided us a satisfying

environment for work.

Lastly, I enjoy this opportunity to complete this project sponsored by the Electrical

Engineering department. This is a great experience to handle a project using our

engineering knowledge.

Page 4: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

iii

Contents 1. Significance and Objectives ................................................................................... 1 2. Background ............................................................................................................ 4 3. Methodology .......................................................................................................... 8

3.1. Simulation Stage .................................................................................... 9 3.1.1. Preliminary circuit design .............................................................. 9

3.1.1.A. Early assessment – Battery system ...................................... 12 3.1.1.B. Early assessment – PV system with MPPT control ............. 14 3.1.1.C. Early assessment – Control system ...................................... 17 3.1.1.D. Early assessment – Load simulation ................................... 20

3.1.2. 1st Simulation result ..................................................................... 22 3.1.3. Pre-charge circuit ......................................................................... 23 3.1.4. Adjusted initial reference voltage ................................................ 24 3.1.5. Simulation result .......................................................................... 26

3.2. Prototype development ........................................................................ 29 3.2.1. Component selection .................................................................... 29

3.2.1.A. Microcontroller .................................................................... 29 3.2.1.B. MOSFET ............................................................................. 30 3.2.1.C. PV array & MPPT controller ............................................... 30 3.2.1.D. Current sensor ...................................................................... 30

3.2.2. 1st Circuit design .......................................................................... 31 3.2.2.A. Hardware ............................................................................. 31 3.2.2.B. Software ............................................................................... 32 3.2.2.C. 1st Circuit test (Failed) ......................................................... 34

3.2.3. 2nd Circuit design ......................................................................... 35 3.2.3.A. Bootstrap Gate-Drive Technique ......................................... 35 3.2.3.B. Dead time ............................................................................. 36 3.2.3.C. Out of phase logic input for low side output property ......... 37 3.2.3.D. 2nd Circuit test ...................................................................... 38

3.2.4. Final circuit .................................................................................. 40 3.2.4.A. MPPT controller .................................................................. 41 3.2.4.B. PID controller tuning ........................................................... 42

4. Results .................................................................................................................. 43

4.1. PV switch-off mode ............................................................................. 44

Page 5: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

iv

4.1.1. Fixed load only ............................................................................ 44 4.1.2. 1led & fixed load ......................................................................... 45 4.1.3. 2led & fixed load ......................................................................... 47 4.1.4. Switch off load ............................................................................. 48

4.2. PV feed-in mode .................................................................................. 49 4.2.1. Fixed load only ............................................................................ 50 4.2.2. 1led & fixed load ......................................................................... 51 4.2.3. 2led & fixed load ......................................................................... 52

4.3. Detailed Parameters ............................................................................. 53 5. Discussion & further development ...................................................................... 54

5.1. Laboratory enviornment ....................................................................... 54 5.2. Applications ......................................................................................... 55 5.3. Battery management system ................................................................ 56 5.4. Control panel ........................................................................................ 57 5.5. Circuit expansion ................................................................................. 57

6. Conclusion ........................................................................................................... 58 7. Apendix ................................................................................................................ 59 8. Reference ............................................................................................................. 61

Page 6: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

1

1. Significance and Objectives

Microgrid (MG) is a small power grid comprised with distributed energy resources

(DERs) (such as solar, wind, and hydro energy), storage units and local flexible loads

which are typically located at LV level. It can be operating in grid-connected and

islanded mode [1].

Due to depletion of fossil fuel, other energy sources needed to be adopted alleviating

the rate of consumption of fossil fuel while meeting the demand for electricity.

Developed MGs can utilise different local renewable energy resources to generate

electricity sharing both real and reactive load of main grid [2]. The MG can also

increase local power quality and reliability as an emergency power supply without long-

distance power transmission [3].

In Hong Kong, the government published the Hong Kong’s Climate Action Plan 2030+

in 2017. It stated that the government will take the lead to facilitate the implementation

of renewable energy (RE) in Hong Kong which has about 3-4% of realisable potential

between now and 2030. Different types of PV projects such as PV systems on buildings,

PV on reservoirs and rock slopes and PV on government buildings are being considered.

Cooperating with CLP and The Hong Kong Electric Company, the government plans

to development MGs that feed in the grid. In the latest Scheme of Control agreement,

the power companies also accepted to adopt feed-in tariff encouraging the private sector

to own a MG [4].

Page 7: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

2

In rural areas, MG can provide stable and reliable electricity utilising local resources if

control is well performed. The MG can be connected to the main grid enhancing local

power quality and reliability if there is further development of power distribution.

One successful islanded MG system on Town Island in Hong Kong was built by CLP

in 2012. The system contains 672 PV panels, 2 wind turbines and 576 batteries that

have a generating capacity up to 200kW. This project utilised the solar, wind and land

resources on Town Island meeting the basic electricity needs of Town Island [5].

With the enhancement of performance in power electronics, control of MGs become

easier. This is a valuable opportunity to utilise all developed technology in renewable

energy to construct reliable, stable and eco-friendly MGs. Therefore, this project aims

to simulate an islanded low voltage direct current (DC) MG and to construct a stable

prototype of laboratory scale model of DC MG demonstrating the practicability of

applying this technology in rural areas.

Page 8: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

3

Objective

The goal of this project is to develop an islanded microgrid that provides stable

electricity to the rural household that is not connected to the main grid. This project has

2 main objectives:

1. With the aid of Simulink, design and simulate a fully functional islanded low

voltage DC MG with following requirements:

n Contains photovoltaic(PV) panel, battery, DC bus and DC loads.

n Apply bus voltage control that the DC bus voltage is within ±10% range of

designed voltage in various load and generation condition.

n The DC MG will be islanded mode only (i.e. will not be connected to the

grid).

n The mode of battery (charge / discharge) depends on the available power,

demand and the state of charge. The mode will be changed automatically.

n Electricity generated is sufficient for basic light load household usage.

2. Build a miniature DC MG prototype according to the design with photovoltaic panel,

battery, load with DC bus

This report will discuss the process and result of the simulation and prototype

development separately. Many failures were experienced in the process and multiple

improvements must be made in future development.

Page 9: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

4

2. Background

To enjoy the benefits from MGs, studies shown that there are some major issues needed

to concern [6]:

- Stability: DERs are volatile and always rely on nature. Since an islanded MG is

dominated by DERs, a sudden change in load or generation can affect the whole

system easily.

- Inertia: If the MG built have no synchronous rotating mass generator (e.g. diesel

generator), there will be less inertia hence less excess energy. The frequency and

current tend to oscillate and the whole grid becomes unstable.

Recent studies show that DC MGs have greater advantages compare with its AC

counterpart. DC MGs have higher reliability and efficiency, simpler control and natural

interface with DERs, electronic loads and storage units. Moreover, problems generated

from AC system such as synchronization, reactive power flow, harmonics and

unbalances will be eliminated [7]. The balance of power is reflected on the DC bus

voltage only, therefore control the DC bus voltage to constant means a power balance

in the system. It can be managed via the battery [8].

Page 10: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

5

Since MGs consist of various generators, storage units and loads, multiple control

schemes are required to regulate different parameters such as voltage, current, load flow

and frequency to supply continuous and reliable electric power to local loads [9]. There

are 3 major control architecture for DC MGs - decentralised control, centralised control

and distributed control [10]. Decentralised control is the simplest form of control since

no digital communication link is involved. Power lines will act as the only medium of

communication. In centralised control architecture, data are collected from different

distributed units. The collected data will be processed in a centralised aggregator and

command will be sent back to different units via digital communication link.

Distributed control architecture requires digital communication link between units. The

control strategies are processed locally. For local DC current and voltage control, PID

controller or fuzzy controller can be deployed to accelerate transient response and

reduce steady-state error [11]. Decentralised control with PID controller would be

preferred in this project due to its simplicity.

There is a extensive number of articles discussing DC MGs, including different control

architectures and local control methods. One provided the control algorithm and

topology of a laboratory scale Wind-PV-Battery MG [12]. The MG has an open

architecture structure that different converter configurations and algorithms can be

applied. The provided system will be the backbone of this project. Different

configurations will be simulated to obtain a satisfactory performance of the MG.

Page 11: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

6

Fig. 1. The provided laboratory scale Wind-PV-Battery MG [10]

Refer to the provided system, decentralised control architecture will be utilised. Each

component will have its dedicated control system.

- PV system: contains PV modules and DC-DC boost converter to perform maximum

power point tracking (MPPT) with steady output voltage. MPPT / off-MPPT mode

can be controlled.

- Wind turbine system: Would not be included due to lack of suitable turbine in the

market.

- Battery: Lead acid battery and bidirectional DC-DC buck-boost converter will be

used. The converter is critical to control DC bus voltage to constant under any load

or source variation conditions. Charging or discharging mode can be selected.

- Load: Since most of the basic home appliance consume DC power, the load of the

system would be DC load to simplify the system.

Page 12: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

7

This microgrid design has low rotating mass inertia. Fluctuation of DC bus voltage,

current and output power can be severe. Commonly, a hybrid energy storage system

can solve this problem easily [13]. In this islanded MG without large rotating mass, the

battery control becomes crucial. One study suggested a battery control strategy based

on adaptive droop coefficient [14]. The result shows that the adaptive droop coefficient

can improve the MG’s inertia in island mode to reduce fluctuation in DC bus current.

Another study suggested a hybrid energy storage system with ultra-capacitor to further

optimise the stability of the islanded MG [15]. An ultra-capacitor is installed between

DC bus and the DC-DC buck-boost converter of battery control. The ultra-capacitor

can absorb system power fluctuation quickly and protect the battery. The same study

provided the battery control strategy for reference. This will not be applied in this

project since the voltage level in this project is low. This may be useful for future

development when the voltage level is increased.

Fig. 2. The provided battery control strategy [13]

Page 13: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

8

3. Methodology

This project is composed of two main stages – simulation (left-hand side in the

flowchart) and prototype development (right-hand side in the flowchart).

In simulation stage, a preliminary circuit design based on the mentioned laboratory

scale Wind-PV-Battery MG is simulated via Simulink. Results are reviewed and

detailed specifications and circuit design are modified until the performance is

acceptable.

In prototype development stage, components are selected based on the simulation result.

Arduino Uno Rev 3 is used to perform the control of the circuit. The circuit design and

the source code of Arduino needed to be fine-tuned to meet the acceptable performance.

Fig. 3. Flowchart of the Project

Page 14: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

9

3.1. Simulation Stage

The simulation will be performed via Simulink. Simscape block set will be utilised to

construct the designed circuit. The calculation is mainly facilitated by the ‘Powergui’

block, with fixed-step discrete solver in a 10 second interval in accelerator mode

throughout the simulation process. Waveforms obtained will be compared with the

requirements.

3.1.1. Preliminary circuit design

The backbone of the design will be based on the mentioned study [10]. The focus will

mainly on the battery control topology design.

Fig. 4. Sample battery control topology [10]

This control topology compares the DC bus voltage to the reference voltage. The

difference will pass through a PI controller to generate the current reference to compare

with the current Ibat. The direction of Ibat represents the direction of energy flow

(charging/discharging). The difference between current reference and Ibat will pass

through another PI controller and generate two PWM signal to control the duty ratio of

Page 15: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

10

two transistors. This can control the bi-directional buck-boost converter to either buck

mode (charging) or boost mode (discharging). Forming a closed loop control system.

Bi-directional buck-boost converter

As the two switches in the bi-directional buck-boost converter complimentary to each

other, there are only two states: Q1 on Q2 off (State 1) / Q1 off Q2 on (State 2). The

power flow can be controlled by changing between State 1 and 2 in different duty ratio

[16].

Fig. 5. Circuit of State 1 [16]

Fig. 6. Circuit of State 2 [16]

Fig. 7. Transition of Power Flow Using Duty Cycle Control [16]

Page 16: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

11

After consulted some advice from Dr Hu, a preliminary circuit design has been

constructed.

Fig. 8. General view of the whole system

This system can be explained in 4 main parts.

1. Battery system

2. PV system with Maximum Power Point Tracking (MPPT) control

3. Control system

4. Load simulation

Page 17: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

12

3.1.1.A. Early assessment – Battery system

The battery system consists of:

- A battery for energy storage.

- Two MOSFET to construct a bidirectional DC-DC buck-boost converter to control

the current flow direction and the DC bus voltage level.

- A current sensor to measure the current flow out / into the battery.

- A voltage sensor to measure the DC bus voltage.

- A filter inductor.

- An output capacitor.

In the early assessment of the battery system, an ideal DC voltage source is used to

stabilise the DC bus voltage to 20V. Current mode control is implemented.

Fig. 9. Early assessment of battery system

Page 18: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

13

Inductor - Assume the battery output voltage is 12V, as the inductor size increases, the

output current ripple would be reduced significantly. However, the size of the inductor

should be restricted because of the limited room of components and budget. After

considering the effectiveness and searching from the market, a 200uH with 15A rating

inductor was chosen.

Fig. 10. Ibat when L = 20uH Fig. 11. Ibat when L = 200uH

Fig. 12. Ibat when L = 500uH

Battery – There are two common types of batteries in MG – lead acid battery and Li-

ion battery. Some even suggest using both of it in a single MG to optimise the working

state and improve the battery life [17].In this early assessment process, output voltage

12V lead acid battery, 14.8V & 18.5V (4 / 5 18650 batteries in series) have been tested.

The differences are not significant. However, Li-ion battery can be damaged easily, to

be safe, 12V lead acid battery was preferred.

Page 19: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

14

3.1.1.B. Early assessment – PV system with MPPT control

The PV system consists of

- A PV array.

- A MPPT controller to facilitate MPPT technique to optimise the power output.

- Filter inductor and capacitor.

- Anti-backflow diode.

Fig. 13. Early assessment of PV system

PV array – The PV Array block in Simulink provides a tremendous amount of PV

module selection. However, most of the module’s maximum power is above 120W. In

this laboratory scale system, we require 10 to 20W only. Therefore, a PV module with

the least maximum power provided in the PV Array block (Suntech Power STP050D-

5-ZCB) is chosen in the simulation.

MPPT controller – Different MPPT techniques such as Fixed Duty Cycle, Constant

Voltage, Perturb and Observe (P&O) and Incremental Conductance (IC) methods are

compared in other research [18]. In this simulation, the IC method is adapted. IC

Page 20: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

15

method is an easier method compare to P&O because it eliminates the process of

calculating the PV output power. It also provides a good transient performance in rapid

change of different condition.

Fig. 14. Maximum power point of STP050D-5-ZCB in different irradiance

IC method utilise the fact that dP/dV = 0 at maximum power point.

With p = vi; '(')= ' )*

')= ')

')𝑖 + '*

')𝑣 = 𝑖 + 𝑣 '*

')= 0

We have '*')= − *

) at maximum power point.

Fig. 15. Flowchart of the IC algorithm [18]

Page 21: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

16

Fig. 16. Circuit of the MPPT Controller

The change in duty ratio would be generated and the final PWM signal would be

generated to control the boost controller to perform MPPT.

Fig. 17. Voltage and current response under MPPT in different irradiance level

From Fig. 14., we can observe that the maximum power point between irradiance 100

to 1000 W/m^2 is around 7V. In the result of testing the MPPT controller shown in Fig.

17., the MPPT controller is switched on at t = 0.2s. In the whole period, the voltage

level is controlled at the maximum power point except two distinct ripples (t = 2.3s and

t = 3.1s). The output power is also affected by these ripples.

Page 22: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

17

3.1.1.C. Early assessment – Control system

Fig. 18. Control system

The control system is utilising the voltage mode control with inner current mode control

technique. This aims to control the output voltage to 20V with smooth, swift and

errorless transient response.

The DC bus voltage is compared to a 20V reference voltage. The difference will pass

through a PI controller to eliminate the steady state error. This signal would be the

reference current to the later inner average current mode control.

The reference current is compared to the battery output current. The difference will pass

through another PI controller. The signal will control the PWM generator to generate a

PWM signal to control two MOSFET. Two signals are complementary i.e. When

MOSFET 1 is ON, MOSFET 2 is OFF.

PI controller tuning

Since the first PI controller output the current reference, the importance of precise

tuning of the first PI controller is overwhelming. Some of the PI setting combinations

for the first PI controller are tested.

Page 23: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

18

Fig. 19. Current reference when kP=1 kI=3

Fig. 20. Current reference when kP=1 kI=10

Fig. 21. Current reference when kP=2 kI=3

Fig. 22. Current reference when kP=2 kI=10

Page 24: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

19

Comparing Fig. 19, 20 and Fig. 21, 22, increasing kP would significantly increase the

amplitude of oscillation. Hence kP = 1 is chosen to reduce the oscillation amplitude.

From Fig. 19 and 20, increasing kI would slightly increase the error correction speed

(obvious in t=4s and t=5s). Further testing is needed to select the kI value.

Fig. 23. Current reference when kP=1 kI=20

Fig. 24. Current reference when kP=1 kI=50

We can observe that even if we further increase the kI setting, the increase of speed is

not significant. However, it is not recommended to have such a high setting of kI

because it may introduce overshooting. Therefore, PI setting kP=1 kI=20 is selected to

have a swift control of the output voltage without causing serious overshooting.

Page 25: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

20

3.1.1.D. Early assessment – Load simulation

Fig. 25. Load side

Assuming the resistors are ideal, as P = V^2/R, each resistor is 40Ω to act as a 10W

load. The load is separated into 3 parts. 10W when R1 is connected only, 30W when

R2 and R3 are connected and 50W when all resistors are online. The switching is

controlled by two ideal switches. The load switching would be simulated with the

following schedule.

10W: t<4s and t>8s

30W: 4s<t<5s and 7s<t<8s

50W: 5s<t<7s

Page 26: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

21

Output Capacitor – To minimise the ripple and overshooting of the output voltage,

and output capacitor is necessary.

Fig. 26. 200uF Fig. 27. 500uF

Fig. 28. 1000uF Fig. 29. 2000uf

With the increase of capacitance, the ripple of output voltage reduces significantly.

However, the size of the capacitance will also become larger. To balance all

performance, 1000uF 35V capacitor is preferred.

Page 27: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

22

3.1.2. 1st Simulation result

After all components have been selected, all subsystems are connected to form the

system shown in Fig. 8. The system is simulated to generate waveforms for 10s, with a

discrete fixed step of 5us. The results are shown below.

Fig. 30. State of charge of battery

Fig. 31. Output current of battery

Fig. 32. Output voltage

Page 28: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

23

Fig. 33. First 15ms of output current of battery

It can be easily observed that there is an unacceptable inrush current due to the initial

charging of the large capacitor. The peak inrush current is about 42A. It will cause some

damage to the components and wires due to excess heat. Pre-charge technique is

suggested to solve this problem.

3.1.3. Pre-charge circuit

Fig. 34. Pre-charge circuit

The switch is open initially. The inrush current would be suppressed by the resistor. By

adding the 1Ω resistor connected in series in the first 0.5s, and be shorted afterward.

The following battery output current waveform is obtained.

Page 29: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

24

Fig. 35. First 0.08s of output current of battery

It is noticed that the inrush current is suppressed to 20A. However, it is still not a

satisfied value. The pre-charge process can be enhanced by another method – Changing

the initial voltage reference in control circuit.

3.1.4. Adjusted initial reference voltage

Fig. 36. Adjusted reference voltage to reduce inrush current

To eliminate the huge voltage difference of reference voltage with DC bus voltage, the

reference voltage is adjusted to 0 at initial, ramping up to 20V in 0.5s.

Page 30: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

25

Fig. 37. First 0.08s of output current of battery after adjusted reference voltage

The inrush current is suppressed to about 9A in <0.01s which is a satisfactory result. At

the moment of switching out the resistor at t = 0.5s, there is another current ripple. The

amplitude is below ±5A. It would not cause any damage to the components and wires

while it is in a short period.

Fig. 38. Final circuit diagram

Page 31: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

26

3.1.5. Simulation result

Fig. 39. Final waveform of DC bus voltage

Fig. 40. Final waveform of 1) State of charge of battery, 2) Battery output current, 3)

Battery output voltage

Page 32: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

27

Fig. 41. Final waveform of 1) PV output voltage, 2) PV output current, 3) PV output

power

DC bus voltage

The stable DC bus voltage after t = 1.7s is around 20V, with a ±0.2V fluctuation in

various changes in load and PV generation. The fluctuation is mainly caused by the

MPPT controller. It is suppressed by the large capacitor in the output side. Switching

of the load caused about 1-2V ripple. The voltage range set in the proposal was ±10%.

Hence, the DC bus voltage performance is satisfying.

Page 33: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

28

State of charge of battery

The state of charge of the battery depends on 1) loading, 2) PV power output. In the

first 4 second and last 2 second that is in light load condition (10W), the charging rate

is changing due to change in irradiance input to the PV array. The minimum output

power of PV array in this time range is 30W that is sufficient to supply the 10W load

and charge up the battery.

In 4s < t < 8s, the load is increased to 30W / 50W. The power output from PV array is

not sufficient. Therefore, the battery discharge to supply the required power.

Battery output current

The stable current range is between ±2.5A. The inrush current is suppressed to about

5A. There is another current ripple caused by the switching of the pre-charge circuit

that is below ±8A. The current range is acceptable for all components.

PV array output

The PV output voltage is controlled by the MPPT controller in around 7V, which is the

maximum power point in different irradiance range. Reacting to the change in

irradiance, the output current varies. Hence, the output power varies within 30W and

40W with irradiance within 600W/m^2 to 1000W/m^2.

Page 34: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

29

3.2. Prototype development

The prototype is constructed based on the simulation circuit. However, to ensure the

DC bus can directly connect to common loads, the DC bus voltage is set to 24V. Some

components are added when necessary such as the gate driver. All components are

selected depends on specifications. Circuit are tested on breadboard until requirements

are met before soldering on a circuit board.

3.2.1. Component selection

3.2.1.A. Microcontroller

Arduino offers a series of models having different properties that suit in different

conditions. In this project, Arduino Uno Rev 3 is selected due to its low price, capability

to generate high-quality PWM signal and sufficient I/O port.

Using ATmega328 microcontroller, Arduino Uno Rev 3 can output a 16-bit PWM

signal with maximum 100kHz which is suitable for the switching of the MOSFET.

Compare with Arduino Due, it has a better performance in calculation speed since it

has 84MHz clock rate while Uno only gets 16MHz. However, Arduino Due works in

3.3V environment which limits the resolution of the voltage input using voltage divider

technique to measure the output voltage. Hence, Arduino Uno Rev 3 is chosen in this

project.

Page 35: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

30

3.2.1.B. MOSFET

The PWM signal would be generated by Arduino, which has a low voltage (5V), a low

gate-source voltage with 100V 40A rating MOSFET model STP40NF10L has been

chosen. It provides a relatively low drain-source on resistance (RDS(on)) that have a low

conduction loss. However, after some circuit test, a gate driver is added to the final

circuit. The gate-source voltage (VGS) would be boosted up to 10-15V. From

STP40NF10L’s datasheet, the absolute maximum VGS rating is ±17V that still satisfy

the requirement.

3.2.1.C. PV array & MPPT controller

For this laboratory-scale system, a low power PV module is sufficient. The PV module

has a maximum power of 10W with 17.5V working voltage and 21.5V open circuit

voltage. A MPPT controller with 12-60V input voltage and 15-90V output voltage is

purchased directly.

3.2.1.D. Current sensor

ACS712 is a fully Integrated, Hall Effect-based linear current sensor. Having 3 models,

5A, 20A and 30A. The maximum current output of the battery is limited below 20A,

ACS712 20A would be adequate.

Page 36: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

31

3.2.2. 1st Circuit design

In the first attempt, the PV system was eliminated to simplify the circuit. The objective

was to use the bi-directional buck-boost converter to control the output voltage supplied

by the battery to 24V in different load condition. The following circuit was constructed.

3.2.2.A. Hardware

Fig. 42. Schematic diagram of 1st circuit built

In this design, the output voltage is measured by voltage divider technique since

Arduino Uno only supports analogue input between 0-5V. Choosing 10kΩ and 68kΩ

resistor can measure actual output voltage between 0-34V.

Page 37: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

32

3.2.2.B. Software

To generate 2 PWM signals for MOSFET switching, TimerOne library is used in the

Arduino program. Timer 1 enables ATmega168 to generate 16-bit PWM signal, in pin

9 & 10 for Arduino Uno. The period of the PWM signal can be set by the function

initialize(period) in µs. 50µs period (20kHz) is used in this case. After initialized, the

PWM duty can be set by function setPwmDuty(pin, duty). The duty ratio from 0-100%

is represented by 0-1023. For example, setPwmDuty(9, 512) would set the PWM

generated in pin 9 to 50% duty ratio.

Fig. 43. Waveform of setPwmDuty(9, 512), period = 50µs

Page 38: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

33

PID control

PID_v1 library provides a convenient platform to conduct PID calculation with

functions. 5 variables can be set in the function – input, setpoint, kp, ki and kd. Input

variable is set to be the measured output voltage in the circuit for the feedback control.

Setpoint, kp, ki and kd is set when the function initialized. The function will calculate

the output and the range of limit can be set to 0 to 1023. This output is suitable to set

the PWM duty.

Current mode with inner voltage loop control is adapted, 2 PID functions are used. The

first PID controller compares the measured voltage with the setpoint i.e. 24V. The

output will become the setpoint of the 2nd PID controller. This is limited from -2A to

2A. The 2nd PID controller will output a value between 0-1023 as the duty of the PWM

signal. Since two PWM signals are required and they are complementary, the second

PWM signal can be generated by just inverting the first signal.

Fig. 44. Flow chat of PID control

Page 39: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

34

3.2.2.C. 1st Circuit test (Failed)

Fig. 45. 1st circuit built

The 1st Circuit fails in the design. Since the PWM signal generated by Arduino Uno is

+5V to the reference, only the low side MOSFET in the half bridge can be turned on.

The source voltage of the high side MOSFET equals to the input voltage = 12V. To turn

on the high side MOSFET, a 5V gate-source voltage is required hence 17V to the

reference is needed. This accumulated some heat on the low side MOSFET and caused

some damage to the jumper wire.

Fig. 46. Damage to jumper wire

Page 40: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

35

3.2.3. 2nd Circuit design

3.2.3.A. Bootstrap Gate-Drive Technique

In the 2nd design, a gate driver IR21834 is added to the circuit. IR21834 is driver

designed for bootstrap operation. A bias circuit that referenced to the source of the high

side MOSFET is added. Both driver and bias circuit swing between two input voltage

rails together with the source of the MOSFET. The operation principle is shown below.

When Vs is below the supply voltage VDD, the bootstrap capacitor CBOOT charges

through the bootstrap diode DBOOT from VDD. When Vs is pulled to a higher voltage,

VBS supply floats and the bootstrap diode become reverses bias to block the rail voltage

from VDD [19].

Fig. 47. Bootstrap Circuit

Page 41: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

36

3.2.3.B. Dead time

The PWM signal generated from Arduino Uno even have some delay, the MOSFET

also need some time to turn off completely. Hence, there is some moment that both

MOSFETs turned on, causing the input and output directly shorted to the ground.

This issue can be solved by adding dead time between switching to ensure both

MOSFETs would not be turned on at the same moment. IR21834 provides a

programmable dead-time pin that enables the adjustment of the built-in dead time

function of the IC.

Fig. 48. Short circuit if both MOSFET turn on

Page 42: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

37

3.2.3.C. Out of phase logic input for low side output property

Another specific property that IR21834 provides is its logic input for low side output is

out of phase comparing to the high side. This can generate the 2 complementary PWM

signal required by input only 1 PWM signal from Arduino, with dead time mentioned.

The following figures show the waveforms of Arduino PWM output, high side output

and low side output.

Fig. 49. Out of phase – low side Fig. 50. In phase – high side

Fig. 51. Low side & high side complementary

In Fig. 41 & 42, channel 1 shows the Arduino PWM output, channel 2 shows the gate

driver PWM output. This provides the complementary PWM signals for MOSFET

switching.

Page 43: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

38

3.2.3.D. 2nd Circuit test

Fig. 52. Schematic diagram of 2nd circuit built

Not including the PV system, this circuit still attempts to maintain the output voltage to

24V by battery supply. Since bootstrap gate-drive technique is utilized via IR21834, a

dedicated DC power supply is used to provide voltage needed for IR21834 to ensure

stability.

This circuit successfully boosts the output voltage to 24V to turn on a series of led in

24V rating. About 0.5A current flow was recorded by ACS712. This circuit built up the

foundation of later development adding the PV system to charge the battery.

Page 44: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

39

Fig. 53. 2nd circuit built Fig. 54. 24V output turn led on

Fig. 55. 0.5A current captured

Page 45: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

40

3.2.4. Final circuit

The final circuit aims to add the PV system into the 2nd circuit, enable load sharing and

charging mode on battery at light load condition. A 10W PV module and a MPPT

controller is purchased. However, the normal lighting condition in the laboratory is not

sufficient to drive the MPPT controller. A DC power source is used instead of the PV

module.

Fig. 56. Final circuit

Page 46: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

41

3.2.4.A. MPPT controller

MPPT controller model MPT-7210A is used in this circuit. It supports DC input 12-

60V and output 15-90V, working in boost mode i.e. input voltage must lower than

output. The output setpoint is adjustable. For this project, output of 24V is used to fit in

the circuit.

Fig. 57. Interface of MPT-7210A

Fig. 58. Final circuit connection

Page 47: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

42

3.2.4.B. PID controller tuning

The PID tuning is crucial to the circuit performance since it affects the stability,

overshooting problem, speed of transient response and steady state error directly.

Since the setpoint of 2nd PID controller is determined by the 1st controller’s output, the

response of the 1st controller refer to the error must be swift. Otherwise, if the response

of 1st controller is not fast enough, the 2nd controller may not have a correct setpoint at

that instant. The whole system response would lag and the control may fail. Hence, a

relatively high kD & kI value should be set in the 1st controller.

However, the 2nd controller should have a relatively low kD & kI setting. High kD &

kI may cause the overshooting problem. The output of the 2nd controller is the PWM

signal to control the 2 MOSFET. If the overshooting is high, the output voltage and

current flow through the circuit may rise severely. In the test, some fuses were blown

due to this problem.

After serval times of testing, kD = 5, kI = 500 in the first PID controller and kD = 2, kI

= 20 in the second PID controller are selected.

Page 48: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

43

4. Results

The final circuit was tested to simulate different load and PV generation condition.

Again, a DC power source is used instead of PV module in the test since the PV module

cannot provide sufficient power in the laboratory. Waveforms were recorded using CRO

and Arduino serial plotter.

In the final circuit, 3 load conditions can be switched:

1. Fixed load only (1kΩ cement resistor).

2. Fixed load with 1 * 24V 5W led.

3. Fixed load with 2 * 24V 5W led.

PV module (DC power source) can be chosen to feed in or not. This allows the test to

have 6 different combinations of condition.

Fixed load 1led & fixed load 2led & fixed load

PV switch-off PV switch-off,

Fixed load

PV switch-off,

1led & fixed load

PV switch-off,

2led & fixed load

PV feed-in PV feed-in,

Fixed load

PV feed-in,

1led & fixed load

PV feed-in,

2led & fixed load

Fig. 59. Conditions to be selected

Page 49: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

44

4.1. PV switch-off mode

Without feeding in the PV module (DC power source), all loads are supplied by the

battery. The results and waveforms are shown below. For the serial plotter, the blue

waveform represents the output voltage, red waveform represents battery output current.

Hence, a negative value in red waveform means the charging current of battery. For

CRO, channel 1 is the low side gate-drive signal, channel 2 is the high side PWM signal.

4.1.1. Fixed load only

Fig. 60. PV switch-off, fixed load

Fig. 61. Output voltage (blue)& battery output current; PV switch-off, fixed load only

Page 50: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

45

Fig. 62. Low side (yellow) and high side gate-drive signal; PV switch-off, fixed load

The output voltage is stable at 24V. With recorded data, the voltage ripples between

23.6V to 24.2V. Since no led is turned on, a 1kΩ fixed load cause a stable 0-0.1A current

output from the battery. The gate-drive signals stay complementary.

4.1.2. 1led & fixed load

Fig. 63. PV switch-off, 1led & fixed load

Page 51: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

46

Fig. 64. Output voltage & battery output current; PV switch-off, 1led & fixed load

Fig. 65. Low side and high side gate-drive signal; PV switch-off, 1led & fixed load

At the moment of switching on 1 led, a 0.5A increase in battery output current and 0.2V

decrease in output voltage can be observed. The battery output current remains

unchanged after the switching action in about 0.5 - 0.6A. Some oscillation in output

voltage from 23.4V to 24.4V can be observed due to switching action. The output

voltage becomes stable in 24V again after the oscillation.

Page 52: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

47

4.1.3. 2led & fixed load

Fig. 66. PV switch-off, 2led & fixed load

Fig. 67. Output voltage & battery output current; PV switch-off, 2led & fixed load

Fig. 68. Low side and high side gate-drive signal; PV switch-off, 2led & fixed load

Page 53: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

48

At the moment of switching on the 2nd led, another 0.5A increase in battery output

current and 0.2V decrease in output voltage can be observed. The battery output current

remains unchanged after the switching action in about 1-1.1A. 0.2V drop in output

voltage can be observed due to switching action. The output voltage becomes stable in

24V with ripple between 23.8V to 24.2V after oscillation.

4.1.4. Switch off load

Fig. 69. Output voltage & battery output current; PV switch-off, 2led & fixed load

When switching off each led, the battery output current decreases for about 0.5A and

become stable. At the same moment, the output voltage experiences 0.2V increase in

each switching action and return back to 24V afterward.

Page 54: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

49

4.2. PV feed-in mode

Feeding in the PV module (DC power source), the battery can work in charging mode

and discharging mode depends on the load. The battery is charged in constant voltage

mode only. The results and waveforms are shown below.

Fig. 70. Output parameters of PV system

In this particular moment, the PV module (DC power source) is supplying 0.54A to the

DC bus. The current might flow to supply the load or to charge the battery depends on

different load condition.

Page 55: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

50

4.2.1. Fixed load only

Fig. 71. Output voltage & battery output current; PV feed-in, fixed load only

Fig. 72. Low side and high side gate-drive signal; PV feed-in, fixed load only

The output voltage is stable at 24V with ripples between 23.6V to 24.2V. With no led

turned on, a 1kΩ fixed load would consume 0-0.1A current at 24V proved from

previous test (Fig. 61.). In Fig. 70., with PV feeding in, the battery output current

recorded is -1A i.e. the battery is charging with 1A current supplied by the PV module

(DC power source) while the fixed load still consuming power.

Page 56: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

51

4.2.2. 1led & fixed load

Fig. 73. Output voltage & battery output current; PV feed-in, 1led & fixed load

Fig. 74. Low side and high side gate-drive signal; PV feed-in, 1led & fixed load

At the moment of switching on 1 led, a 0.5A increase in battery output current and 0.2V

decrease in output voltage can be observed. The battery output current changed from -

1A to -0.5A. The battery is still in charging mode. The output voltage becomes stable

in 24V with ripple between 23.6V to 24.2V.

Page 57: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

52

4.2.3. 2led & fixed load

Fig. 75. Output voltage & battery output current; PV feed-in, 2led & fixed load

Fig. 76. Low side and high side gate-drive signal; PV feed-in, 2led & fixed load

Switching on the 2nd led, an increase in battery output current and 0.2V decrease in

output voltage can be observed. The battery output current changed from -0.5A to 0A.

The battery is not charging nor discharging. All power consumed by the led and fixed

load is supplied from the PV module (DC power source). The output voltage becomes

stable in 24V again with some ripple between 23.8V to 24.4V.

Page 58: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

53

4.3. Detailed Parameters

PV switch-off PV feed-in

Fixed load 1led &

fixed load

2led &

fixed load

Fixed load 1led &

fixed load

2led &

fixed load

Stable output

voltage

24V

24V

24V

24V

24V

24V

Maximum

recorded

output voltage

24.2V 24.4V 24.2V 24.2V 24.2V 24.4V

Minimum

recorded

output voltage

23.6V 23.4 23.8V 23.6V 23.6V 23.8V

Voltage drop

from

switching

from previous

load condition

N/A 0.2V 0.2V N/A 0.2V 0.2V

Battery output

current

~0.1A

~0.5A ~1A ~-1A ~-0.5A ~0A

Low side

PWM duty

46.4% 47.6% 48.4% 42.1% 42.1% 43.5%

High side

PWM duty

52.4% 52.4% 51.6% 57.1% 57.1% 57.1%

Fig. 77. Detailed results in table form

Page 59: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

54

5. Discussion & further development

After all tests, all results in different conditions show that the bi-directional buck-boost

converter with PID control in the MG can successfully maintain a stable 24V output

voltage in different conditions. Also, it enables charging and discharging mode of

battery depends on different conditions.

Mode of battery (Charging / Discharging)

Fixed load 1led & fixed load 2led & fixed load

PV switch-off Discharging (0.1A) Discharging (0.5A) Discharging (1A)

PV feed-in Charging (1A) Charging (0.5A) Not charging nor

discharging

Fig. 78. Battery mode in different conditions

5.1. Laboratory enviornment

All tests are performed in the laboratory with DC power source instead of real PV

module. Switching in & out of PV module is a step function instead of continuous

fluctuation of power generated. In reality, using PV module directly under sunlight as

an input source, the output voltage & battery output current may fluctuate in a larger

range. The PID controller setting may need to be adjusted to optimise performance.

Page 60: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

55

5.2. Applications

In this prototype, it is proved that the present setup is sufficient to provide stable supply

to light load such as essential lighting. However, the rating of components and wires is

relatively low. This prototype may be damaged if the current in the circuit rise above

6A. Heavy load such as high power DC motors are not recommended to connect the

DC bus until wires with higher rating are substituted.

In reality, this configuration may not be the best way handling lead acid batteries. Lead

acid batteries may experience sulfation if they are charged insufficiently. Sulfation

would cause a reduction in charging cycle, efficiency, incomplete charging and higher

battery temperature. To avoid sulfation, the battery needs to be fully recharged

immediately after a discharge cycle [20]. Since PV module cannot provide stable and

reliable supply to charge the battery, sulfation may occur in the lead acid battery.

Lithium ion battery can be considered to eliminate this problem.

Besides battery selection, many improvements can be made in the future to enhance the

performance of the prototype. Such as introducing a battery management system, a

control panel, and circuit expansion.

Page 61: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

56

5.3. Battery management system

To extend the service life of battery, a battery management system must be introduced.

The state of charge (SOC) of the battery can be calculated. The SOC of the battery can

be estimated by the open circuit voltage. Over-charging and over-discharging can be

prohibited using the SOC reference.

Approximate SOC

0% 25% 50% 75% 100%

Open circuit Voltage

11.89V 12.06V 12.24V 12.45V 12.65V

Fig. 79. Approximate SOC of 12V lead acid battery estimated by open circuit voltage

In the current prototype, the battery can only be charged in constant voltage (CV) mode.

Constant current constant voltage (CC/CV) charge method can be adapted. In the first

stage of charging (about first 70% of charge), constant current charge should be applied.

The remain 30% should be charged at constant voltage charge (stage 2) that is slower.

The switch from stage 1 to 2 should occur when the battery reaches the set voltage. This

can be coordinated with the SOC mentioned. If CC mode is selected, the feedback

control should be changed from voltage control to current control. This can be adjusted

by the Arduino code.

Page 62: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

57

5.4. Control panel

To facilitate multiple output voltage, a control panel can be added. In the current

prototype, the voltage setpoint is fixed in the Arduino code. 24V is chosen because it is

a common rated voltage of DC load. Value of setpoint in the code must be adjusted if

the desired output voltage changes. The simplest way is to add two buttons as input,

one for +0.5V and one for -0.5V adjusting the setpoint. A display can also be included

to show the setpoint, output voltage and battery output current.

5.5. Circuit expansion

This circuit is extensible. Multiple batteries can be connected in series increasing input

voltage or connected in parallel increasing capacity. Multiple PV modules can be

connected in parallel to increase total power output. However, current values would

increase simultaneously, wires need to be upgraded to stands that current level. Heavier

load can be supplied after these enhancements.

Page 63: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

58

6. Conclusion

This project designed, simulated and constructed a prototype of a DC MG based on a

provided laboratory scale Wind-PV-Battery MG. The process also provided useful

experiences in transferring simulator circuit design to actual circuit prototype. Possible

further improvements for the current prototype are suggested to enhance the

performance of the DC MG.

Via Simulink, a preliminary circuit design was simulated to select suitable components

meeting the requirements. The design was modified for optimising results in simulation

environment. A final circuit is made for reference in the prototype construction stage.

In the process of prototype construction, both circuit and software design failure was

found. Those experiences are useful for people who decide to transfer simulation circuit

to an actual prototype. Several amendments in circuit design were made to construct a

working prototype finally.

Overall, the basic objectives of this project are achieved in laboratory environment with

constraints. The prototype built applied voltage control with inner current loop using

PID controller to stabilise the DC bus voltage to 24V±0.5V, supplying some loads such

as essential lighting. The charge / discharge of battery is changed automatically in

different power input and load demand. However, DC power source was used instead

of PV module due to environment limitation. Therefore, the prototype is still receiving

power from the main grid. Multiple improvements still need to be made to let this DC

MG become practical in rural areas.

Page 64: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

59

7. Apendix

Arduino code: #include "TimerOne.h" //include the library we need to create the PWM signal

#include "PID_v1.h" //include the library we need to use PID

/*

Measuring Current Using ACS712

*/

const int analogIn = A0;

int mVperAmp = 100; // use 100 for 20A Module and 66 for 30A Module

int RawValue= 0;

int ACSoffset = 2500;

double Voltage = 0;

double Amps = 0;

double Iref;

/*

PID Setup

*/

double boost_Input, boost_Output, InputV, OutputV, InputI, OutputI, invOutputI; //PID

variables

double vout;

double invOutput;

double Setpoint = 24; //PID setpoint in V

double kpV = 5,kiV = 500 ,kdV =0;//

double kpI = 2,kiI = 20 ,kdI =0;

PID pidV(&InputV, &OutputV, &Setpoint, kpV, kiV, kdV, DIRECT); //Setup the PID calculation

PID pidI(&InputI, &OutputI, &Iref, kpI, kiI, kdI, DIRECT);

double feedback; //the variable that tells us the actual voltage

float R1 = 68000;

float R2 = 10200;

void setup()

Serial.begin(9600); //initialize the serial monitor for debugging

pidV.SetOutputLimits(-512,512);

Page 65: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

60

pidV.SetMode(AUTOMATIC);

pidV.SetTunings(kpV,kiV,kdV);

pidI.SetOutputLimits(0,1023);

pidI.SetMode(AUTOMATIC);

pidI.SetTunings(kpI,kiI,kdI);

pinMode(9, OUTPUT); //this is the pin that controls the MOSFET

pinMode(A1, INPUT); //the feedback input, lets us know what the voltage is currently at

Timer1.initialize(50); // initialize timer1 at our set frequency

Timer1.pwm(9, 100); // setup pwm on pin 9,

void loop()

/*

Voltage mode

*/

vout = (analogRead(A1) * 5.0) / 1023.0;

feedback = vout / (R2/(R1+R2)); //read in the actual voltage, the math part is to account for the voltage divider and the

arduino's conversion to a number between 0 and 1024

InputV = feedback;

pidV.Compute();

Iref = OutputV*2/1023;

/*

* Current Mode

*/

RawValue = analogRead(analogIn);

Voltage = (RawValue / 1024.0) * 5000; // Gets you mV

InputI = ((Voltage - ACSoffset) / mVperAmp);

Serial.print(InputV);

Serial.print(" ");

Serial.println(InputI);

pidI.Compute();

invOutputI = 1024-OutputI;

Timer1.setPwmDuty(9, (int)invOutputI);

Page 66: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

61

8. Reference

[1] C. Schwaegerl and L. Tao, "The Microgrids Concept," in Microgrids: John Wiley and Sons Ltd, 2013, pp. 1-24.

[2] H. Jinwei and L. Yun Wei, "An Enhanced Microgrid Load Demand Sharing Strategy," Power Electronics, IEEE Transactions on, vol. 27, no. 9, pp. 3984-3995, 2012.

[3] K. Lacommare and C. Marnay, "Microgrids and Heterogeneous Power Quality and Reliability," 2007.

[4] E. Bureau, "Hong Kong's Climate Action Plan 2030+," 2017. [5] CLP, "Hong Kong’s First Commercial-scale Standalone Renewable Energy

System Completes on Town Island CLP Expects to Reduce Annual CO2 Emissions by 70,000 kg," 2012.

[6] M. S. Saleh, A. Althaibani, Y. Esa, Y. Mhandi, and A. A. Mohamed, "Impact of clustering microgrids on their stability and resilience during blackouts," ed, 2015, pp. 195-200.

[7] T. Dragicevic, X. Lu, J. Vasquez, and J. Guerrero, "DC Microgrids-Part II: A Review of Power Architectures, Applications, and Standardization Issues," IEEE Transactions on Power Electronics, vol. 31, no. 5, pp. 3528-3549, 2016.

[8] Z. Zhao, J. Hu, and H. Chen, "Bus Voltage Control Strategy for Low Voltage DC Microgrid Based on AC Power Grid and Battery," presented at the 2017 IEEE International Conference on Energy Internet (ICEI), 2017.

[9] M. A. Elbaz, "Real-Time Load Frequency Control for an Isolated Microgrid System," Thesis (M.S.)--West Virginia University, 2012., 2012.

[10] T. Dragicevic, X. Lu, J. C. Vasquez, and J. M. Guerrero, "DC Microgrids-Part I: A Review of Control Strategies and Stabilization Techniques," Power Electronics, IEEE Transactions on, vol. 31, no. 7, pp. 4876-4891, 2016.

[11] J. Y. Liping Guo, R. M. Hung, and R. M. Nelms, "Evaluation of DSP-Based PID and Fuzzy Controllers for DC-DC Converters," Industrial Electronics, IEEE Transactions on, vol. 56, no. 6, pp. 2237-2248, 2009.

[12] A. Merabet, H. Ibrahim, and R. Beguenane, "Energy Management and Control System for Laboratory Scale Microgrid Based Wind-PV-Battery," IEEE Transactions on Sustainable Energy, vol. 8, no. 1, pp. 145-154, 2017.

[13] A. Etxeberria, I. Vechiu, H. Camblong, and J. M. Vinassa, "Comparison of three topologies and controls of a hybrid energy storage system for microgrids," Energy Conversion and Management, 2011.

Page 67: Final Report-A Microgrid With Renewable Energy Resources ...eeserver.ee.polyu.edu.hk/FYP/FYP_201718/FT/FYP_46/FYP_46-Final_Report-14074238D-LAM...power quality and reliability if there

62

[14] Y. U. M. Ren Ya-zhao, "Inertia Control of DC Microgrid Based on Battery Energy Storage," Control and Instruments in Chemical Industry, vol. 44, no. 07, pp. 656-661, 2017.

[15] L. Jing, S. Yanxia, W. Dinghui, and Z. Zhipu, "A control strategy for islanded DC microgrid with battery/ultra-capacitor hybrid energy storage system," L. Jing, Ed., ed, 2016, pp. 6810-6813.

[16] ManishBhardwaj, "Modeling Bi-Directional Buck/Boost Converter for Digital Control Using C2000 Microcontrollers," Application Report, TEXAS Instruments Incorporated, Texas, vol. SPRABX5, 2015.

[17] H.-W. Tian, X.-S. Li, T. Chen, and S. Tan, "Comprehensive control strategy of hybrid energy storage-based photovoltaic island microgrid," Power System Protection and Control, vol. 42, no. 19, pp. 122-128, 2014.

[18] M. A. G. de Brito, L. P. Sampaio, G. Luigi, G. A. E Melo, and C. A. Canesin, "Comparative analysis of MPPT techniques for PV applications," ed, 2011, pp. 99-104.

[19] O. Semiconductor, "Design and Application Guide of Bootstrap Circuit for High-Voltage Gate-Drive IC," AN-6076, 2014.

[20] M. Broussely and G. Pistoia, Industrial applications of batteries: from cars to aerospace and energy storage. Elsevier, 2007.