You are on page 1of 93

Design and Simulation of a Small Scale Demand Response Scheme for Smart Grid Applications

By

Abid Al-Hamid Al-Souri, Mutaz Raid & Rami Al-Shafei

Supervised by

Dr. Majd Ghazi Batarseh

Submitted in partial fulfillment of the requirements for the degree of

BACHELOR OF SCIENCE
in

Electrical Power and Energy Department

at

PRINCESS SUMAYA UNIVERSITY FOR TECHNOLOGY

Amman, Jordan

Second Semester 2016/2017


This is to certify that I have examined

This copy of an engineering documentation by

Abid Al-Hamid Al-Souri, Mutaz Raid & Rami Al-Shafei

And have found that it is complete and satisfactory in all respect,


And that any and all revisions required by the final Examining Committee have been made

Dr. Majd Ghazi Batarseh

II
Acknowledgments

Acknowledgments
First and foremost, we would like to express our gratitude to our university, Princess Sumaya
University for Technology and all the professors and engineers who helped us become the people we
are today.

This project would not have succeeded without the guidance and supervision of Dr. Majd Batarseh
our supervisor and team leader, her continuous support that kept us going till the end of this project.

Last but not least, we owe this project's success to our dear families who gave us the encouragement
throughout this journey, and supported is through our ups and downs.

III
Abstract

Abstract
The electricity market is in continues progress, the traditional grids are changing to smart grids with
smart meters and smart appliances in the near future. The fuel cost and power stations operation cost
increase from one day to another in addition to their environmental impact, which is causing
dangerous Global Warming issues.

The main objective of this project is to introduce one of the smart grids features, which is Demand
Response in order to reduce the consumer bill. Appliances in a typical house can be controlled and
scheduled to work on appropriate times, and thus, bill reduction is possible by shifting operational
time to off peak hours and avoid the much expensive tariff of on-peak hours.

A typical house with its' domestic appliances are modeled to be controlled by a smart meter. The smart
meter is designed to get signals from the electricity company and the appliance. A Real Time Pricing
(RTP) signal is sent from the electricity company and the appliances are shifted to the most suitable
time. The comfort of the consumer was achieved with the flexibility of the appliances operation.

In this project, a photovoltaic (PV) system was designed as different design approaches, but not taken
into consideration due to its long payback period. The final design achieved its requirements and the
cost of the consumer electricity bill was reduced.

IV
Table of Contents

Table of Contents
1 Introduction ................................................................................................................................................ 1

1.1 Design Requirements and Realistic Constraints ........................................................................... 3

1.1.1 Design Requirements.................................................................................................................... 3

1.1.2 Realistic Constraints ..................................................................................................................... 3

1.2 Design Achieved (Brief Description) ............................................................................................. 3

1.3 Work Distribution: ............................................................................................................................ 4

1.4 Organization of the Rest of the Documentation ......................................................................... 4

2 Background and Literature Review .......................................................................................................... 5

2.1 Literature Review .............................................................................................................................. 5

2.1.1 Smart Grid...................................................................................................................................... 5

2.1.2 Smart Meter.................................................................................................................................... 5

2.1.3 Demand Side Management .......................................................................................................... 6

2.1.4 Demand Response Techniques ................................................................................................... 6

2.1.5 Demand Response Programs ...................................................................................................... 7

2.1.6 Demand Response Approaches ......................................................................................................... 9

3 Design ....................................................................................................................................................... 11

3.1 Design Requirements and Realistic Constraints .........................................................................11

3.2 Analysis of Requirements and Constraints ..................................................................................11

3.2.1 Analysis of Design Requirements .............................................................................................11

3.2.2 Analysis of Realistic Constraints ...............................................................................................11

3.3 Different Designs Approaches......................................................................................................12

3.4 Developed Design ...........................................................................................................................21

3.5 Did the Design Meet Requirements and Constraints ................................................................32

4 Results ...................................................................................................................................................... 33

V
Table of Contents

4.1 Prototype Setup ...............................................................................................................................33

4.2 Simulation Setup..............................................................................................................................33

4.3 Experiment/Simulation Results Discussion: ..............................................................................35

4.4 Validation of Requirements with Realistic Constraints .............................................................45

5 Conclusion and Future Work ................................................................................................................. 47

6 References .................................................................................................................................................. 48

7 Appendices ............................................................................................................................................... 50

7.1 Appendix (A): Hourly Insolation, Ambient Temperature, and Cell Temperature for May .50

7.2 Appendix (B): Algorithm Code .....................................................................................................69

VI
List of Figures

List of Figures
Figure 1.1: Power and information flow throughout a power system ....................................................... 2
Figure 2.1: HAN between utility and appliances of households................................................................. 5
Figure 2.2: (a) peak clipping by cutting the peak demand, (b) valley filling to promote the off peak
energy consumption & (c) load shifting by shifting loads on peak to off peak hours............................. 6
Figure 2.3: (a) ToU pricing where electricity price on-peak is maximum, (b) RTP price of electricity
defers throughout day & (c) IBR fixed pricing for a certain amount of consumption ........................... 8
Figure 3.1: PVWATTS Calculator setup ......................................................................................................15
Figure 3.2: CSI calculator results ...................................................................................................................17
Figure 3.3: Flowchart of the design ...............................................................................................................21
Figure 3.4: Over all circuit schematic ............................................................................................................23
Figure 3.5: AC voltage source, clock and powergui....................................................................................23
Figure 3.6: Ideal switch ...................................................................................................................................23
Figure 3.7: Sum block and Scope ..................................................................................................................24
Figure 3.8: Voltage/ Current measurement and scope ..............................................................................24
Figure 3.9: Goto and from blocks .................................................................................................................24
Figure 3.10: Parallel RL load ..........................................................................................................................24
Figure 3.11: MATLAB function for non-shiftable .....................................................................................27
Figure 3.12: MATLAB function for shiftable loads ...................................................................................28
Figure 3.13: (a) Non-shiftable interrupt function, (b) Shiftable interrupt function ...............................30
Figure 3.14: (a) Main function1 for non-shiftable devices, (b) Main function2 for shiftable device...31
Figure 4.1: Model configuration parameters window .................................................................................33
Figure 4.2: Powergui block .............................................................................................................................34
Figure 4.3: Powergui settings window ..........................................................................................................34
Figure 4.4: RTP signal .....................................................................................................................................35
Figure 4.5: Operation time for shiftable appliances....................................................................................36
Figure 4.6: Current through shiftable appliances ........................................................................................36
Figure 4.7: Power consumption for shiftable appliances ...........................................................................37
Figure 4.8: Price of electricity consumption for shiftable appliances per hour ......................................37
Figure 4.9: Operation time for non-shiftable appliances ...........................................................................38
Figure 4.10: Current through non-shiftable appliances ..............................................................................38
Figure 4.11: Power consumption for non-shiftable appliances ................................................................39

VII
List of Figures

Figure 4.12: Price of electricity consumption for non-shiftable appliances per hour ............................40
Figure 4.13: Total cost of electricity of each appliance per day ................................................................40
Figure 4.14: Survey results ..............................................................................................................................46

VIII
List of Tables

List of Tables
Table 1.1: Realistic constraints ......................................................................................................................... 3
Table 1.2: Work deviation................................................................................................................................. 4
Table 3.1: Electric bill of one month ............................................................................................................12
Table 3.2: Average daily solar radiation (Whr/m2.d) for the years (2004-2010) in Jordan [13]...........13
Table 3.3: Data sheet of Sunpower/UK SPR-240E-WHT-D ..................................................................13
Table 3.4: PVWATTS Calculator results ......................................................................................................15
Table 3.5: ABB:UNO-8.6-TL-OUTD-S-US-A (240) inverter data sheet ...............................................18
Table 3.6: Energy Consumption and Electricity Prices for installing a 7KW PV System ....................20
Table 3.7: Home appliances’ information ....................................................................................................25
Table 3.8: RTP Signal Sent to Smart Meter .................................................................................................26
Table 4.1: Electrical bill without smart grid application.............................................................................41
Table 4.2: Electrical bill with smart grid application ..................................................................................42
Table 4.3: Summery of four trials ..................................................................................................................44
Table 4.4: Design requirements .....................................................................................................................45
Table 4.5: Realistic constraints .......................................................................................................................45

IX
Introduction

1 Introduction
With the continuous technological development, the use and dependency on electrical devices has
increased especially home appliances. The huge growth of the industrial sector and the increase of the
population, showed a huge increase of electricity demand, which is leading to more overload and
blackouts throughout those grids [1]. Moreover, the price of electricity generated from fossil fuels is
in continuous increase due to the high cost of extraction and conversion fuel into useful materials, in
addition to harmful effect they have on the environment [2].

It was time to introduce a smart electrical grid that can handle, measure and optimize all the increase
of electricity demand, in return decreasing the use of fossil fuels and their environmental impact. A
smart grid includes a variety of operational and energy measures including smart meters, smart
appliances, and renewable energy resources such as the use of solar & wind energy, and energy
efficiency resources by taking the best decision in order to save energy either from the electrical utility
side or consumers’ side [3]. Smart meters are a new generation of electricity meters being installed by
energy suppliers in every home, they come with an in-home display screen that show you exactly how
much energy is being used in near real time and will bring an end to estimated bills. Smart appliances
utilize modern computer and communications technology to make functions faster, cheaper and more
energy-efficient. The appliances can take advantage of a smart grid, being implemented by utility
companies nationwide. When the smart grid technology is finally implemented, refrigerators, toasters,
dishwashers and washing machines can tap into the smart grid power source. Two way
communications between utility and consumer is the main feature of smart grids; this communication
happens through an Advanced Metering Infrastructure (AMI), which allows flow of information and
control in two ways between utilities and customers. AMI has the feature of remote collection of
meter data transmitted to the utility, typically within 15 minutes intervals over power line itself or radio
link. This connection reduces the number of consumers affected by an outage and shortens the
response time for such outage [4].

1
Introduction

Figure 1.1 shows the power and information flow in a smart grid. If an outage occurs in a certain
neighborhood, the Fault Detection Isolation and Restoration (FDIR) system automatically isolates the
fault so that repair crew can work safely and automatic alerts and updates can be sent to the affected
consumers [4].

Figure 1.1: Power and information flow throughout a power system [3]

In this project, a smart grid with a smart meter and smart appliances using MATLAB Simulink
software was designed and implemented. The scope is to design a smart meter which gets signals from
the utility and appliances to control the energy consumed by a typical house to keep it within pre-
determined amount. The main objective of this project is the ability to manage and control all smart
appliances in a house to decrease the bill of the consumer, with taking into consideration consumers’
comfort and no additional cost added to annual payments.

2
Introduction

1.1 Design Requirements and Realistic Constraints

1.1.1 Design Requirements

 A minimum of 10% bill reduction shall be achieved.


 The system shall adapt to any operational changes the user might create (operation outside the
specified time).
 The uncontrolled devices shall operate independently based on the user’s settings.
 The controlled devices shall operate in the off-peak hours.

1.1.2 Realistic Constraints

This project was bounded by a number of constrains as shown in table 1.1.

Table 1.1: Realistic constraints


Ethical Users’ convenience shall be considered.

Manufacturability A known high-level programing language in the algorithm implementation shall


be used.
Economical The total bill shall not exceed 2750 JD per year.

1.2 Design Achieved (Brief Description)


The project main target is to design a proper algorithm that guarantees a minimum of 10% reduction
on the electricity bill as well as maintains the user’s privacy, as much as possible, using one of the
smart grid methodologies (Load Shifting).

In this project, a dynamic real time pricing (RTP) and a complete house hold appliances were included,
and an algorithm was formed accordingly.

In our design, we did not only manage to reduce the bill by 13%, we also succeeded in maintaining
the users’ convenience along with keeping their load profiles discrete.

We also achieved some secondary targets such as easing the burden on the generation side. A survey
was launched during the designing assured that this design guarantees comfortability for over 60% of
the possible users.

3
Introduction

1.3 Work Distribution:


Table 1.2 shows the distribution of this project tasks among team members.

Table 1.2: Work deviation

Task Team Member

1. General Research Abid Al-Hamid, Rami & Mutaz

2. Literature review and background Rami & Mutaz

3. Appliances selection Abid Al-Hamid & Mutaz

4. Appliances model design and calculations Abid Al-Hamid & Rami

5. Algorithm schematic design Abid Al-Hamid & Rami

6. Algorithm coding and testing Abid Al-Hamid

7. Different design approaches Abid Al-Hamid, Rami & Mutaz

8. Analytical design results validation Abid Al-Hamid, Rami & Mutaz

9. Documentation Abid Al-Hamid, Rami & Mutaz

1.4 Organization of the Rest of the Documentation


The rest of the document is organized as follows: Chapter 2 presents literature review of some papers
related to the project’s subject. Chapter 3 presents the design approaches, constraints and
requirements in detail. Chapter 4 presents the final results of the design and discusses whether the
constraints and requirements were met or not. Chapter 5 presents the conclusion and future work to
improve the design.

4
Background and Literature Review

2 Background and Literature Review


2.1 Literature Review

2.1.1 Smart Grid


It won't be surprising if the new-generation of grid systems future serious changes compared to the
incumbent grids. The introduction of smart grid seems inevitable, as it increases the reliability, security
and efficiency of the grid system. Smart grid involves many features that allow adaption of renewable
energy systems, distributed generation and energy storage systems on both sides of meters [1]. A smart
grid encourages demand response (DR), which is the change of customers' power consumption to
better match the demand of power with the supply [1]. A smart grid also enables demand side
management (DSM), which is any type of program that attempts to modify consumer energy use
through the integration of smart meters, smart appliances and costumer information and incentive
programs [1]. Many countries nowadays are implementing these programs; an example is the state of
California in the US, where residential and commercial sectors are managed to save about 4 billion
dollars per year in electricity. The California state also managed to reduce its peak demand by 5500MW
[2].

2.1.2 Smart Meter


The two-way communication between the utility and the consumer via a smart meter is crucial feature
in the smart grid. The interaction between the utility and the consumer allows the utility (via the smart
meter) to monitor the amount of energy consumed by each household, and allows the consumers to
manage their consumption and reduce their bill. As shown in figure 2.1, there is an energy
consumption scheduler (ECS) embedded in the smart meter at each household, its role is to control
the on-off switch and operating mode of each appliance.

Figure 2.1: HAN between utility and appliances of households [3]

5
Background and Literature Review

The electricity price provided by the power utility and the user’s energy demand are exchanged via
Home Area Network (HAN). The smart meter acts as a controller that coordinates all appliances to
satisfy the user’s need. After knowing the power demand of all appliances, the smart meter will send
on/off control commands with specified operating modes to all appliances, according to the resulting
energy consumption schedule [3].

2.1.3 Demand Side Management


DSM main goal is to optimally utilize the available energy instead of increasing the production.

DSM has three concepts to frame [2]:

1. Energy Efficiency (EE) by maintaining service, but reducing energy usage, as an example
replacing light bulbs with LEDs.
2. Energy Conversion (EC) by monitoring and adjusting the consumption of energy, to make
sure it stays within predetermined level.
3. Demand Response (DR) is related to electricity market and price signals. By demand response
wide range of actions can be taken at the consumer side in response to high pricing [4].

2.1.4 Demand Response Techniques

From the smart grid perspective, demand response is achieved by rescheduling the consumer energy
consumption to reduce the operating expense from generators and reduce the emissions of CO2,
which causes environmental pollution. There are three types of DR techniques as shown in figure 2.2
which can be used to make the energy consumption throughout the day as constant as possible and
trying to reduce or shift the on peak consumption.

Figure 2.2: (a) peak clipping by cutting the peak demand, (b) valley filling to promote the off peak
energy consumption & (c) load shifting by shifting loads on peak to off peak hours [3]

6
Background and Literature Review

1. Peak clipping is to reduce the peak energy consumption. This can delay the need for additional
generation capacity. The net effect is a reduction in both peak demand and total energy
consumption. Peak clipping can be achieved by direct control of customers’ appliances.
2. Valley filling the process of making an energy production and delivery system more efficient
by encouraging additional energy use during periods of lowest system demand, by promoting
the off-peak energy consumption through energy storage devices.
3. Load shifting (combination of peak clipping and valley filling) is widely applied, as it is the
most effective technique [5]. It takes advantage of time independence of loads and shifts them
from peak hour to off peak hour.

Note that, not all appliances (loads) can be shifted from peak hours or most expensive time of
electricity, thus loads are classified into three types [4]:

1. Base loads have low power consumption and operating duration of long time such as
lightning and personal computer.
2. Regular loads have higher power consumption and operating duration of longer time such
as the refrigerator and HVAC.
3. Burst loads have high power consumption and a fixed operating duration such as the
washing machine, dishwasher.

The burst loads and some of the regular loads are the loads that can be controlled and their operation
tasks can be shifted to a different time period, using a certain algorithm. This project introduces an
algorithm that shifts these loads from peak hours and maximum price to off peak hours and minimum
price and maintaining the consumer comfort.

2.1.5 Demand Response Programs

There are two types of DR programs [3]:

1. Incentive Programs which are used by the electricity distribution company to have direct
control over the appliances and equipment of the consumer in order to cut down the power
demand at peak hours. In return, consumers are awarded by having an incentive payment.
2. Price-Based Programs which are used by the consumer to control their own appliances (load)
operation time based on different prior pricing techniques.

7
Background and Literature Review

Price-Based Programs tend to be more comfortable and efficient for reducing the electricity bill for a
consumer and more comfortable. Customers may alter their power demand by delaying some tasks
that require large amount of electric power to a time where price of electricity is at its minimum value
[1].

Price-based programs have four different categories, figure 2.3 shows three of them, the Time-of-use
(ToU), Real-time pricing (RTP) and the Inclining block rate (IBR) [3].

Figure 2.3: (a) ToU pricing where electricity price on-peak is maximum, (b) RTP price of electricity
defers throughout day & (c) IBR fixed pricing for a certain amount of consumption [3]

1. Time-of-Use (ToU) Pricing: Users consume energy at different time intervals of a day; the
electricity price at the on peak time is much higher than that at the mid-peak and off-peak in
order to induce users to shift their load over the time horizon. (Kept unchanged for a long
time period).
2. Critical Peak Pricing (CPP): Similar to the ToU except on days where the grid reliability is in
dangerous situation (normal peak price is then replaced by a pre-specified higher rate).
3. Real Time Pricing (RTP): the electricity price varies at different time intervals, it's usually
released an hour ahead or a day ahead basis.
4. Inclining Block Rate (IBR): This tariff is designed with two-level rate structures, such that the
more electricity a user consumes, the more they pay. This is the one used in Jordan.

8
Background and Literature Review

2.1.6 Demand Response Approaches

Most researches use mathematical optimization to achieve the optimal loading scheme in order to
reduce the electricity cost with different constraints. Demand response is usually formulated as
optimization problems, which are solved by various approaches.

1. Convex optimization: [7] Linear programing is a type of convex optimization. Demand


Response is usually formulated as utility maximization or cost minimization. Constrains are
also formulated as convex function. Mathematically:
Minimize f(x) under constrains, fi(x) <bi* were i = 1, 2, 3, 4…, 24
x: is the appliance energy cost
fi(x): total appliances energy cost at specified time i.
bi: threshold of energy consumption at time i.
*The total appliance energy consumption cost at specified time should always be less threshold.
2. Dynamic Programing: [3] Decomposes complex problems into sub problems and are solved
backwards over each stage.
The advantage of this type of programing is that it consumes less time in solving problems,
but consumes higher memory and computational overhead.
There are two types of dynamic programming:
a) Stochastic dynamic programming, where the uncertainty aspect comes from the random
characteristics of renewable generation and consumption.
b) Multi-stage optimization using approximate dynamic programming, where the long-term
problem is decomposed into a number of short-term sub problems, and solved effectively and
efficiently by a computational learning system.
3. Game Theory: [10] Each game (G) consists of random number of players (N)
and their strategies (Xi) And Payoff Functions (Wi) where (i є N). Each player aims to select
the best strategy to maximize his Payoff (Wi). Where each player Payoff function depends on
two things, the same player strategy & all the other players strategies. The game theoretic
approaches for demand response converge to equilibrium such as Nash equilibrium. “The
Nash Equilibrium is a concept of game theory where the optimal outcome of a game is one
where no player has an incentive to deviate from his chosen strategy after considering an
opponent's choice. Overall, an individual can receive no incremental benefit from changing

9
Background and Literature Review

actions, assuming other players remain constant in their strategies. A game may have multiple
Nash Equilibria or none at all.”

Furthermore, to start the optimization important constraints are to be maintained to ensure the design
is realistic. As it is essential to maintain the comfort of the consumer, the load priority is taken under
consideration. In [9], an algorithm shows how to maintain the load with specific order the consumers
decides. The author uses Pseudo code for the domestic load scheduling program. In [10], the electricity
cost and emission of CO2 is to be minimized by power scheduling. The problem was solved by
approaching the Knapsack procedure. The Knapsack problem is one the traditional problems of
computer science in combinational optimization literature [11].

In the next chapter the design of this project will be explained in details. Different approaches for this
project will be introduced. The MATLAB Simulink software and all components being used will be
explained and how the algorithm and the control of appliance of a typical household will reduce the
bill of the consumer.

10
Design

3 Design
3.1 Design Requirements and Realistic Constraints
The general design requirements for this project are:

1- A minimum of 10% bill reduction shall be achieved.


2- The system shall adapt to any operational changes the user might create (operation outside the
specified time).
3- The uncontrolled devices shall operate independently based on the user’s settings.
4- The controlled devices shall operate in the off-peak hours.

The general design constraints for this project are:

1- Users’ convenience shall be considered.


2- A known high-level programing language in the algorithm implementation shall be used.
3- The total bill shall not exceed 2750 JD per year.

3.2 Analysis of Requirements and Constraints


3.2.1 Analysis of Design Requirements
To achieve previous requirements, the design algorithm shall reduce the bill by 10% by using
Demand Response (DR) techniques such as load shifting on a DR program such as real time
pricing. In addition, the design algorithm shall include an interrupt technique, which can give
the customer the option whether to use smart grid algorithm to optimize their energy
consumption or to turn it off and consume energy as usual.

3.2.2 Analysis of Realistic Constraints


- Ethical Constraint: in order to measure the users’ convenience, a survey will be conducted and
data is analyzed.
- Manufacturability: after doing some research to find the suitable high-level program, it was
found that using Matlab would give a variety of tools to achieve the required design.
- Economical: while the design should take into account that the total annual bill payment of the
customer must not exceed 2750 JD, thus, any extra feature (including PV system) that doesn’t
meet this constraint will be excluded.

11
Design

3.3 Different Designs Approaches


In this project, the design is chosen to be from the consumer’s perspective, so the design is based on
one of the price based DR programs. The chosen price type is RTP, since it gives more accurate and
efficient results guaranteeing consumer’s comfort [4]. There are a number of ways to fulfil this design,
some are illustrated below:

1) Using a Design Algorithm with a Renewable Source (Photovoltaic System):


To consider whether this design approach meets the requirements or not, a PV design was carried
out based on smart grid application and the worst full load case scenario (meaning, when all
devices are working daily for the same working hours) this design option can be explained as
follows:

i. The first step is to estimate the yearly energy consumption of the house, by using only one
bill, we multiplied the energy consumption of this month by 12.5. So, the estimated yearly
energy consumption will be= 12.5*933.9= 11673.75 kWh/yr. Table 3.1 below shows the bill
of one month.
Table 3.1: Electric bill of one month

Without Smart Grid Application


Power Consumption Working Hours
Loads Energy Consumption (KWhr) Cost (JD)
(KW) (hr)
Washing Machine 1.085 2 2.17 0.16
Clothes Dryer 3.135 1 3.135 0.13
Dish Washer 2.055 2 4.11 0.31
AC 1.31 5 6.55 0.88
TV 0.079 7 0.553 0.09
Lights 0.25 6 1.5 0.20
Oven 2 2 4 0.15
PC 0.12 4 0.48 0.05
Refrigerator 0.54 24 12.96 6.51
Total energy consumption for one month 1063.74 -
Total cost for one month 254.43

12
Design

ii. Estimating daily insolation of Amman which is given from the table 3.2 below and equals to
5711Wh/m2.d=5.711KWh/m2.d.

Table 3.2: Average daily solar radiation (Whr/m2.d) for the years (2004-2010) in Jordan [13]

Choosing the PV module type, the Sunpower/UK SPR-240E-WHT-D panel was selected and its data
sheet is in table 3.3 below where “STC” refers to Standard Test Conditions and “PTC” refers to
Photovoltaics for Utility Scale Applications Test Conditions or PVUSA Test Conditions.

Table 3.3: Data sheet of Sunpower/UK SPR-240E-WHT-D

13
Design

iii. Calculating total derate factor, now the derate factor without Normal Operating Cell Temperature
(NOCT) equals to 0.77
To calculate the NOCT derate factor, the data given in Appendix 7.1 (A) was used.
The equation to calculate the Effective Ic (kW/m2) is:
[1-(Temp.Coefficient of Power of the module*(Tcell-25))]*Irradiance Ic (kW/m2) (1)
and the chosen month was May, then:
Total Effective Ic = 121948.4 kW/m2
Total Irradiance Ic = 128660.1846 kW/m2
Total Effective Ic
NOCT derate factor = (2)
Total Irradiance Ic
121948.4
= = 0.94783
128660.1846
So, the total derate factor = Total Derate without NOCT* NOCT Derate Factor (3)
= 0.77*0.94783 = 0.72983
iv. Calculating the estimated DC-STC power required to supply the estimated energy using
equation (4):
Energy(kWh)
Pdc,STC(kW) = (4)
Total Derate Factor*h/d(peaksun)*365d/yr

14
Design

11673.75
= = 7.673 kWdc
365*0.72983*5.711
The results can now be verified by using PVWATTS Calculator, which is an online calculator that
verifies your hand calculations by modifying the inputs as shown in figure 3.1. Table 3.4 shows the
verification of hand calculations results by using PVWATTS Calculator.

Figure 3.1: PVWATTS Calculator setup

Table 3.4: PVWATTS Calculator results

15
Design

System losses = 1- Total Derate Factor (5)


= 1-0.72983 = 0.27017 = 27.017%, but instead of that 23% was selected because the
PVWATTS Calculator does not take into account NOCT derate factor.
Calculating number of panels by using equation (6):
Pdc,stc
Number of panels = (6)
Ppanel
7.673 *103
= = 31.97, the exact number of 31 modules or 32 modules will be figured out while
240
selecting the inverter type and do proper calculations.
v. Calculating the area required by the system by using equation (7):
Pdc,stc
Area = (7)
ηpanel
7.673
= = 39.78 m2 ≈ 40 m2.
0.1929
vi. Selecting inverter type:
To do that, form CSI Calculator the suitable inverter type was chosen based on the design,
which was ABB:UNO-8.6-TL-OUTD-S-US-A (240). Figure 3.3 verifies that the chosen
inverter is suitable for the design.

16
Design

Figure 3.2: CSI calculator results


17
Design

Table 3.5 shows the data sheet of the chosen ABB:UNO-8.6-TL-OUTD-S-US-A (240) inverter:
Table 3.5: ABB:UNO-8.6-TL-OUTD-S-US-A (240) inverter data sheet

18
Design

Hand calculation of modules per string from the chosen PV panel & inverter:
- Voltage maximum power point (Vmpp) range of the inverter from 185-480 V
- Vmpp (PV Panel) = 40.5 V
- For the worst case Tcell (cold) = -10°C
- Vmpp,cold = {1-[Temp.Coefficient of Voltage*(Tcell,cold-25)]}*Vmpp,panel (8)
= {1-[0.00132*(-10-25)]}*40.5 = 42.37 V
-Maximum number (upper limit) of modules per string for the worst case (cold weather
conditions) = Upper limit of Vmpp for the inverter / Vmpp,cold = 480/42.3711 = 11.33; chosen
11 modules per string for now.
- Voc,panel = 48.6 V
- Voc,cold = {1-[Temp.Coefficient of Voltage*(Tcell,cold-25)]}*Voc,panel (9)
= {1-[0.00132*(-10-25)]}*48.6 = 50.85 V
- Due the National Electrical Code, it restricts all voltages on residential systems to no more
than 600 V, so Maximum number (upper limit) of modules per string for the worst case
= 600/Voc,cold = 600/50.85=11.8; the chosen will be 11 modules per string.
- So, the upper limit now is the lower value between the previous answers, which is 11
modules per string.
- NOCT of PV Panel = 45°C
-For hot weather conditions, Tamb = 45°C; given,
(NOCT-20)*S
Tcell,hot = Tamb + (10)
0.8
(45-20)*1
= 45 + = 76.25°C
0.8
-Vmpp,hot = {1-[Temp.Coefficient of Voltage*(Tcell,hot-25)]}*Vmpp,panel (11)

= {1-[0.00132*(76.25-25)]}*40.5 = 37.76 V
-Minimum number (lower limit) of modules per string for hot weather conditions = lower
limit of Vmpp for the inverter / Vmpp,hot = 185/ 37.76 = 4.9; chosen 5 modules per string. -So,
the lower limit is 5 modules per string, then the range will be from 5-11 modules per string.
- Isc of PV Panel = 6.3 A
- Maximum Isc for the inverter = 36 A
- We chose for the design, 4 strings and 8 modules for each string, total number of modules

19
Design

will be 32, then the total Isc = number of strings * Isc of PV Panel = 4*6.3 = 25.2 A < 36 A;
satisfies the design.

vii. Economic calculations for the PV design:


The size of the PV model being designed is 7KW. According to "Mellenium Energy Industry"
each 1KW PV system will cost 2130JD [17]. So the 7KW system will cost 14910JD (initial
cost). Table 3.6 shows in details the energy consumption and electricity prices for installing a
PV System which is 7KW PV system.

Table 3.6: Energy Consumption and Electricity Prices for installing a 7KW PV System

7KW PV system
Per Day Per Month Per Year

Energy produced by PV system/KWh 12-15 360-450 -


Energy Consumption after installing PV/KWh - 480-580 -
(original con. – PV production)
Total cost of electricity before installing PV/JD - 175 2100
Total cost of electricity after installing PV/JD - 90-100 1040-1200
Savings (Total cost before – Total cost after)/JD - 75-80 900-1060

Intial Cost
The Payback period = (12)
Savings
14910 JD 14910JD
= JD JD = 14 – 16 years.
1060year 900year

After doing calculations, a renewable source may not be the best solution due to current pricing, but
long term things may change, when the technology became cheaper.
2) Using a Design Algorithm without a Renewable Source:
The design will be implemented on MATLAB Simulink using its libraries. The appliances will be
modeled and function generators will be used to control the appliances and implement the
algorithm designed. This design was chosen to maintain the economical constraint and add no
extra cost to the consumer as his annual payment will increase if a PV system is installed. The next
section 3.4 will explain in details the developed design.

20
Design

3.4 Developed Design


For better understanding, the developed design is going to be illustrated as a simple flow chart first,
then a full schematic A3 paper is attached. The figure 3.3 below represents a simple flow chart for the
developed design.

Figure 3.3: Flowchart of the design

21
Design

The figure 3.4 represents the full design schematic, with every component explained later on, and due
to its huge size it will be uploaded to CD.

22
Design

Figure 3.4: Over all circuit schematic

In this design, an AC voltage source of 50Hz and 220 volts which represents the output given by the
electric grid, is connected to all modeled appliance.

A clock is connected to the circuit to keep track of the current simulation time at each simulation
step as well as validating the function run is correct.

Furthermore, an important block that needs to be placed at the top of the circuit for optimal circuitry
performance is the power graphical user interface (powergui). The Powergui block is necessary for
simulation of any Simulink model containing SimPowerSystems™ blocks. It stores the equivalent
Simulink circuit that represents the state-space equations of the model. In this design it is set to be
'discrete' rather than 'continuous', which is explained briefly in the simulation setup.

Figure 3.5 shows the voltage source, clock and the powergui block used in the design respectively.

Figure 3.5: AC voltage source, clock and powergui

To control the appliances, an ideal switch shown in figure 3.6 is used, it is fully controlled by the
gate signal (g > 0 or g = 0). The Ideal Switch block turns on when a positive signal is present at the
gate input (g > 0). It turns off when the gate signal equals 0 (g = 0). It get its signal from the main
function which turns the appliance ON or OFF.

Figure 3.6: Ideal switch

To take the measurements of voltage and current a voltage and current measurement block is used
and results are displayed through the scope shown in figure 3.7 is used. Prices of electricity being
consumed are also shown through the scope.

23
Design

Figure 3.8: Voltage/ Current measurement and scope

To validate the real power and the price of electricity consumed by the appliances. A sum block is
being used with a scope as shown in figure 3.8.

Figure 3.7: Sum block and Scope

To keep the system as neat as possible with least amount of wiring, Goto and From blocks were
used shown in figure 3.9.

Figure 3.9: Goto and from blocks

The appliances are modeled as Parallel RL Loads shown in figure 3.10. The Parallel RL Load block
implements a linear load as a parallel combination of RL elements. At the specified frequency, the
load exhibits constant impedance. The active and reactive powers absorbed by the load are
proportional to the square of the applied voltage.

Figure 3.10: Parallel RL load

The apparent power is important to be known for each appliance. Due to lack of information about
the reactive power of the appliances, some of the appliances information was obtained from variable

24
Design

resources, in order to determine the power factor of each appliance and the equivalent circuit model
of each appliance [4][14][15][16]. After determining the power factor of each appliance, the active and
reactive power were calculated. Table 3.7 shows the power factor, the total active and total reactive
power for each appliance. It also indicates whether the appliances are shiftable or non-shiftable and
the equivalent circuit model for each.

Table 3.7: Home appliances’ information

Load Power Total Active Total Reactive Shiftable or Non-Shiftable Equivalent


Factor Power (W) Power (VAR) Circuit
Model
TV 0.992 79 10 Non-Shiftable RL
Lights 1 250 - Non-Shiftable R
Oven 1 2000 - Non-Shiftable R
Refrigerator 0.9955 540 12.85 Non-Shiftable RL
PC 0.997 120 10 Non-Shiftable RL
Washing 0.57 1085 1564.01 Shiftable RL
Machine
Clothes Dryer 1/0.455 3135 362.07 Shiftable RL
Dishwasher 0.635/1/1 2055 334.55 Shiftable RL
AC 0.96/1 1310 342.71 Shiftable RL

The design assumed that all appliances are turned ON daily. It means that the consumer cooks every
day and uses the Clothes Dryer and Washing Machine every day. The goal of the algorithm is to ensure
that the appliances are always scheduled to work on the most suitable time every day.

Since there is no Real Time Pricing (RTP) in Jordan, the project was designed based on RTP data
available for the United States [17]. However, the currency was changed from the US dollar to
Jordanian dinar. Table 3.8 shows the prices sent from the electricity company one day ahead to the
consumers' smart meter.

25
Design

Table 3.8: RTP Signal Sent to Smart Meter


Time (Hour) Price (JOD/KWhr)
12:00 AM 0.014889
1:00 AM 0.014889
2:00 AM 0.015598
3:00 AM 0.015598
4:00 AM 0.016307
5:00 AM 0.015598
6:00 AM 0.019852
7:00 AM 0.020561
8:00 AM 0.021979
9:00 AM 0.023397
10:00 AM 0.024106
11:00 AM 0.02836
12:00 PM 0.024815
1:00 PM 0.021979
2:00 PM 0.019143
3:00 PM 0.018434
4:00 PM 0.019143
5:00 PM 0.032614
6:00 PM 0.041831
7:00 PM 0.021979
8:00 PM 0.016307
9:00 PM 0.018434
10:00 PM 0.016302
11:00 PM 0.019852

26
Design

User Defined Function Generators

The circuit is divided into two parts, shiftable and non-shiftable appliances.
It was implemented by six user defined MATLAB functions. The MATLAB function created executes
the simulation and generates code for a Simulink Coder™ target.
The 1st function used for the non shiftable loads shown in figure 3.11. This function has 2 inputs and
8 outputs.
Inputs:

1- Clock: aims to track the code functionality over a 24-hours period.


2- RTP: is used in the price calculations validation.

Outputs:

1- (Refrigerator, TV, Lights, Oven, and PC): each output is a binary signal sent to the switches
in the appliances circuit that targets to switch the device ON or Off according to the user
profile presets.
2- Power: measures the total power consumption of the shiftable loads.
3- Price: measures the total electric cost of the shiftable loads.

Figure 3.11: MATLAB function for non-shiftable

27
Design

The user defined function of “non-shiftable loads” aims to:

1- Define the user’s profile for each appliance operation time.


2- Receive the RTP signal from the electrical utility.
3- Calculate the power consumption (for validation).
4- Calculate the price (for validation).
5- Operate each device at the specified time.

The 2nd function used for the shiftable loads shown in figure 3.12. This function has 3 inputs and 6
outputs.

Figure 3.12: MATLAB function for shiftable loads


Inputs:

1- Clock and RTP were explained previously.


2- Nonshiftprice: which is the total cost of the non-shiftable appliances operation, its importance
comes when calculating the total price for all devices.

28
Design

Outputs:

1- (AC, Dishwasher, Clothes Dryer and Washing Machine): each output is a binary signal sent to
the switches in the appliances circuit that targets to switch the device ON or OFF according
to the results of the algorithm applied to the RTP signal.
2- Shiftpower and Shiftableprices: measure the power consumption and the price of the
consumed power respectively.

For the user defined function of “shiftable loads”: This user defined function (Shiftable Function)
contains our algorithm which is explained as follows:

This function receives an RTP signal one day ahead from the electric company, this RTP signal is
copied into a secondary matrix and undergoes a series of procedures such as:

Sorting, rearranging, size changing and removal of duplicated elements if there were any, to obtain the
matrix that contains the best operational times for any device based on RTP. The matrix then controls
the devices according to each device working nature (early working time or late working time).A delay
function is added to make sure the time is sufficient to apply all the procedures.

To make this project as realistic as possible three more MATLAB functions are added. These functions
are used as an interrupt in case the user need to turn ON or OFF any appliance at any other time
outside its scheduled times. The 3rd and 4th User Defined Functions shown in figure 3.13 are the Non-
shiftable interrupt function and shiftable interrupt function.

29
Design

(a) (b)

Figure 3.13: (a) Non-shiftable interrupt function, (b) Shiftable interrupt function
Each interrupt function has 6 inputs as follows:

1- Interruptonline : acts as a main switch for the entire function ( ON/OFF)


2- Load: selects the interrupted load.
3- State: selects the interrupted device status (1-ON / 0-OFF).
4- Duration: defines the interrupt time duration.
5- Start_time: defines the starting time of the interrupt.
6- Clock: keeps track of the time.

As for outputs, each interrupt output number is defined by the relation (2 × number of devices
operating).

Evidently, shiftable interrupt would have (2*4 = 8 outputs).

30
Design

And non-shiftable interrupt would have (2 *5 = 10 outputs)

An extra output (interruptsigonline) was added at the nonshiftable interrupt function to pass on the
interruptonline signal to the main function which will be explained later on.

Each interrupt yields 2 output signals which are sent to the main function, for example if a refrigerator
interrupt is scheduled, two signals would go online interrupt1 refrigerator and interrupt1sig. Interrupt1
refrigerator takes the desired state of the interrupt and Interrupt1sig is a confirmation that the interrupt
online switch was ON when the interrupt is requested as well as interrupt1sig acts as ‘start’ flag in the
main function. The interrupt functions code basically classifies the user request and sends a signal
accordingly.

The 5th and 6th user defined function “Main Function1” & “Main Function2” shown in figure 3.14.
Where main function 1 is for non-shiftable devices and main function 2 is for Shiftable devices
respectively.

(a) (b)

Figure 3.14: (a) Main function1 for non-shiftable devices, (b) Main function2 for shiftable device

31
Design

Each function has a number of inputs that can be calculated through the relation:
Each function has a number of inputs that can be calculated through the relation:
Inputs=(3*devices)+1.
Accordingly Main Function1 has (5*3) +1 = 16 inputs & Main function2 has (4*3) +1 = 13 inputs.

For each function the inputs are:

1- For each device there are 3 inputs which are the output of the shiftable/non-shiftable function
and the 2 outputs shiftable/non-shiftable interrupt function.
2- An interrupt online signal which acts as a main switch for the whole program.

Those user defined functions have a crucial role in the program, they can be described as the program
organizer, since the main job of them is to set the priority of the multiple outputs of the circuit.

As an illustrating example , assume that we have an interrupt on the refrigerator which in the normal
case its working 24-hours a day ( always ON ), the main function job is to prioritize the interrupt job
over the normal operation when the confirmation is present, i.e. in normal states the main function is
basically mirroring the signal of the device received form the Shiftable/non-shiftable functions, but
when the interrupt switch is ON and the interrupt information is given, the main functions now
mirrors the signal of the interrupt instead of the Shiftable/non-shiftable functions.

3.5 Did the Design Meet Requirements and Constraints


Yes, the design did meet the requirements and constraints. After running the simulation and without
a smart meter the consumer bill was 254.43 JD/month. On the other hand, after running the
simulation with a smart meter the consumer bill was 219.67 JD/month (2636.04 JD annually). This
shows a reduction of 13.66% in consumers' bill. The simulation also was flexible with the consumer
as any appliance can be switched ON and OFF at any time making sure comfort of consumer is
guaranteed and consumer can change any setup of appliances scheduled as the survey showed.
Furthermore, the design without a PV system was chosen so no extra cost to users' annual payments
is added and the payback period for installing the PV system is 14-16 years.

32
Results

4 Results
4.1 Prototype Setup
The design is verified in simulation, so the prototype setup is as follows: Matlab Simulink was chosen
as the simulation platform. Voltage, current and power sensors were added to measure each separately
for every component of the circuit.

4.2 Simulation Setup


In this section, we are going to discuss the simulation setup and settings that were set before
constructing the module in order to simulate the design successfully. In the simulation setup, we
assumed that each 1 second in the simulation time represents an hour, therefore the time of the
simulation was set to 24 seconds which represents the 24-hours of a day. Secondly, under Simulation
we selected Model Configuration Parameters, as shown in figure 4.1 below:

Figure 4.1: Model configuration parameters window

33
Results

Our objective is to cover as much as possible time of the day, as well as keeping the simulation run
smooth and fast.

We selected the SOLVER TYPE to be a Fixed-step and we selected 0.00005 as a sample time.
The accuracy of the results increases as the sample time decreases [18], which is our case.

Figure 4.2: Powergui block

From figure 4.2 shown above that the powergui block should be added to the circuit in order to run
(Simulink requirement), the user can double check the settings by Double-clicking on the block as
shown in figure 4.3 below:

Figure 4.3: Powergui settings window

Now all the simulation settings are set and the simulation can start safely with no errors or loss in the
results.

34
Results

4.3 Experiment/Simulation Results Discussion:


The RTP signal shown in figure 4.4 is sent to the consumers' smart meter. It shows the price of
electricity each hour of the day. It shows that the peak hour is between 5p.m to 6p.m. The appliances
are scheduled to the most suitable time through the day and shifted from ON peak hours to OFF
peak hours. In this design it was assumed that the RTP signal is the same for every day for one month.
This means that the total electricity price of all appliances per day is multiplied by 30 days to calculate
the total electricity price with and without a smart meter for one month.

RTP Signal (JD/KWhr)


0.045

0.04

0.035

0.03

0.025

0.02

0.015

0.01

0.005

0
12:00a.m
01:00a.m
02:00a.m
03:00a.m
04:00a.m
05:00a.m
06:00a.m
07:00a.m
08:00a.m
09:00a.m
10:00a.m

08:00p.m
12:00p.m
01:00p.m
02:00p.m
03:00p.m
04:00p.m
05:00p.m
06:00p.m
07:00p.m

09:00p.m
10:00p.m
11:00p.m
11:00a.m

Figure 4.4: RTP signal

For the Shiftable appliances the operation time for each is shown in figure 4.5. The first graph shows
the operation time of the AC (from 4 p.m. to 6 p.m.). The second graph is for the washing machine
(from 9 p.m. to 11 p.m.). The third graph is for the dish washer (from 10 p.m. to 12 a.m.). The fourth
graph is for the clothes dryer (from 10 p.m. to 11 p.m.).

35
Results

Figure 4.5: Operation time for shiftable appliances

Figure 4.6 shows the current through all appliances. This proves all shiftable appliances are working
on the scheduled time.

Figure 4.6: Current through shiftable appliances

The total power consumed per hour by the shiftable appliances is shown in figure 4.7. Between
4 p.m. and 6 p.m. the power consumption was 19.65 W. The power then between 9 p.m. and
10 p.m. was 17.37 W and then it increased to 90 W from 10 p.m. to 11 p.m. The power then decreased
to 28.55 W from 11 p.m. to 12 a.m.

36
Results

Figure 4.7: Power consumption for shiftable appliances

The total price per hour for the shiftable loads is shown in figure 4.8. Between 4 p.m. and 6 p.m. the
price is 0.145 JD. The price then between 9 p.m. and 10 p.m. dropped to 0.12 JD, after that it increased
to 0.5 JD between 10 p.m. to 11 p.m. Between 11p.m to 12 p.m. the price decreased to 0.2 JD.

Figure 4.8: Price of electricity consumption for shiftable appliances per hour

For the Non-Shiftable appliances, they are scheduled as shown in figure 4.9. The first graph shows
the time the TV works (from 6 p.m. to 11 p.m.). The second graph shows that the Lights are turned
ON (from 6 p.m. to 12 a.m.). The third graph shows the Oven operation time (from 4 p.m. to 6 p.m.).

37
Results

The fourth graph is for the PC (from 9 p.m. to 11 p.m.). The fifth graph shows that the refrigerator
is always turned ON 24 hours a day.

Figure 4.9: Operation time for non-shiftable appliances

Figure 4.10 shows the current through all appliances. This proves that the non-shiftable appliances
are working in their scheduled time.

Figure 4.10: Current through non-shiftable appliances

The total power consumed per hour by the non-shiftable appliances is shown in figure 4.11. From 12
a.m. to 3p.m the power consumption was 7.2 W. The power then increased between 3p.m and 6p.m

38
Results

to 11.2 W. It decreased to 9 W from 6 p.m. to 9 p.m. Between 9 p.m. to 11 p.m. the power was 9.335
W, after that the power decreased to 8.9 W from 11 p.m. to 12 .am.

Figure 4.11: Power consumption for non-shiftable appliances

The total price per hour for the non-shiftable loads is shown in figure 4.12. From 12 a.m. to 3 p.m.
the prices was 0.27 JD. The price increased to 0.3095 JD between 3 p.m. to 4 p.m. and then dropped
to 0.3075 JD from 4 p.m. to 5 p.m. From 5 p.m. to 6 p.m. it increased again to 0.309 JD. From 6 p.m.
to 7 p.m. the prices decreased to 0.282 JD. The price between 7 p.m. to 8 p.m. was 0.2849 JD and
then dropped to stay constant between 8 p.m. to 10 p.m. to be 0.27825 JD. After that, the price
increased to 0.279 JD between 10 p.m. to 11 p.m., and decreased finally to 0.277 from 11 p.m. to 12
p.m.

39
Results

Figure 4.12: Price of electricity consumption for non-shiftable appliances per hour

To keep it as simple as possible figure 4.13 shows the total electricity cost for each appliance for one
day.

Cost of each appliance for one day


JOD 7.00 JOD 6.51
JOD 6.00
JOD 5.00
JOD 4.00
JOD 3.00
JOD 2.00
JOD 1.00 JOD 0.08 JOD 0.05 JOD 0.15 JOD 0.14 JOD 0.05 JOD 0.20 JOD 0.15 JOD 0.01
JOD 0.00
Washing Clothes Dish AC TV Lights Oven PC Freezer
Machine Dryer Washer

Figure 4.13: Total cost of electricity of each appliance per day

40
Results

Without applying our algorithm (without smart grid application), the electrical bill including working
hours and energy consumption of each appliance was 254.43 JD/Month as shown in details in table
4.1 below. The cost was relatively high due to there is not Real Time Pricing (RTP) system in Jordan,
so the RTP signal was exchanged to Jordan’s currency (JD).

Table 4.1: Electrical bill without smart grid application

Without Smart Grid Application


Power Consumption Working Hours
Loads Energy Consumption (KWhr) Cost (JD)
(KW) (hr)
Washing Machine 1.085 2 2.17 0.16
Clothes Dryer 3.135 1 3.135 0.13
Dish Washer 2.055 2 4.11 0.31
AC 1.31 5 6.55 0.88
TV 0.079 7 0.553 0.09
Lights 0.25 6 1.5 0.20
Oven 2 2 4 0.15
PC 0.12 4 0.48 0.05
Refrigerator 0.54 24 12.96 6.51
Total energy consumption for one month 1063.74 -
Total cost for one month 254.43

The main target is to minimize the consumer’s bill by 10%. The algorithm determined the suitable
hour to turn on the appliances, which can reduce the bill, so after applying our algorithm which was
trial 1, the bill was reduced from 254.43 JD to 219.67 JD which is equal to 13.66% of reduction (more
than the desired percentage). The new minimized bill is shown in details in table 4.2 below.

41
Results

Table 4.2: Electrical bill with smart grid application

With Smart Grid Application


Power Consumption Working Hours
Loads Energy Consumption (KWhr) Cost (JD)
(KW) (hr)
Washing Machine 1.085 2 2.17 0.08
Clothes Dryer 3.135 1 3.135 0.05
Dish Washer 2.055 2 4.11 0.15
AC 1.31 2 2.62 0.14
TV 0.079 5 0.395 0.05
Lights 0.25 6 1.5 0.20
Oven 2 2 4 0.15
PC 0.12 2 0.24 0.01
Refrigerator 0.54 24 12.96 6.51
Total energy consumption for one month 933.9 -
Total cost for one month 219.67

We also added to the algorithm an interrupt technique that allows the user to freely choose whether
to adopt the DR and optimize their energy consumption or to turn it off and consume energy as usual.
We did 3 more trials with interrupt applied and it is explained as follows:

 Trial 2:
We did 13 interrupts as follows: in week 1, 3 interrupts happened, 2 for the TV that let it on
for 2 hours more, twice a week, and the last interrupt was for the refrigerator that turned it off
for 1 hour, once a week. After the interrupt was ended, the appliances were back to work
according to our algorithm.
In week 2, 4 interrupts happened, 2 for the washing machine that let it on for 2 hours more,
twice a week, and the other 2 were for the clothes dryer that let it on for 1 hour more, once a
week. After the interrupt was ended, the appliances back to work according to our algorithm.
In week 3, 5 interrupts happened, 2 for the oven that let it on for 2 hours more, twice a week,
2 were for the dishwasher that let it on for 2 hours more, twice a week, and the last interrupt

42
Results

was for the PC that let it on for 2 hours more, once a week. After the interrupt was ended, the
appliances back to work according to our algorithm.
In week 4, one interrupt happened for the AC that let it on for 2 hours more once a week.
After the interrupt was ended, the appliances back to work according to our algorithm.
The total energy consumption for month in this trial was 963.827 KWhr and the total cost
was 222.2 JD.
 Trial 3:
We did 18 interrupts as follows: in week 1, 4 interrupts happened, 2 for the oven that let it on
for 2 hours more, twice a week, and the last interrupt was for the dishwasher that let it on for
2 hours more, twice a week. After the interrupt was ended, the appliances back to work
according to our algorithm.
In week 2, 4 interrupts happened, 3 for the AC that let it on for 2 hours more, three times a
week, and the last one for the PC that let it on for 2 hours more, once a week. After the
interrupt was ended, the appliances back to work according to our algorithm.
In week 3, 4 interrupts happened, all were for the TV that let it on for 3 hours more, four
times a week. After the interrupt was ended, the appliances back to work according to our
algorithm.
In week 4, 6 interrupts happened, 3 for the washing machine that let it on for 1 hour more,
three times a week, and the other 3 were for the clothes dryer that let it on for 1 more hour,
three times a week. After the interrupt was ended, the appliances back to work according to
our algorithm.
The total energy consumption for month in this trial was 973.04 KWhr and the total cost was
223.5 JD.
 Trial 4:
We did 20 interrupts as follows: in week 1, 8 interrupts happened, 4 for the washing machine
that let it on for 2 hours more, four times a week and the other 4 were for the clothes dryer
that let it on for 1 hour more, three times a week. After the interrupt was ended, the appliances
back to work according to our algorithm.
In week 2, 4 interrupts happened, 2 for the oven that let it on for 2 hours more, twice a week,
and the other 2 for the dishwasher that let it on for 2 hours more, twice a week. After the
interrupt was ended, the appliances back to work according to our algorithm.

43
Results

In week 3, 4 interrupts happened, 2 for the TV that let it on for 3 hours more, twice a week,
and the other 2 for the AC that let it on for 2 hours more, twice a week. After the interrupt
was ended, the appliances back to work according to our algorithm.
In week 4, 4 interrupts happened, 2 for the PC that let it on for 2 hours, twice a week, and the
other 2 were for the lights that let it on for 3 hours, twice a week. After the interrupt was
ended, the appliances back to work according to our algorithm.
The total energy consumption for month in this trial was 979.514 KWhr and the total cost
was 224.4 JD. Table 4.3 summarizes all of above.

Table 4.3: Summery of four trials

Total Number of Energy Consumption Cost per


Number Interrupts per Month Month
of Trials per month (KWhr/Month) (JD/Month)
1 0 933.90 219.67
2 13 963.827 222.2
3 18 973.04 223.5
4 20 979.514 224.4

44
Results

4.4 Validation of Requirements with Realistic Constraints


At the beginning of our project, we stated some requirements and constrains that must be achieved
as shown in table 4.4 and table 4.5 below. In this section we are going to validate that the design has
achieved all the requirements and constraints

Table 4.4: Design requirements

A minimum of 10% bill reduction shall be achieved.


The system shall adapt to any operational changes the user might create.
The uncontrolled devices shall operate independently based on the user’s settings.
The controlled devices shall operate in the off-peak hours.

Table 4.5: Realistic constraints

Ethical Users’ convenience shall be considered.

Manufacturability A known high-level programing language in the algorithm implementation shall


be used.
Economical The total bill shall not exceed 2750 JD per year.

Manufacturability Validation: in our design MATLAB SIMULINK© was used which is a well-known
high-level programming language.

Economical Validation: in our design the total bills through the year were 2636.04 JD which is less
than 2750 JD per year.

Ethical Validation: in order to measure the user’s comfort, we decided to conduct a survey to obtain
the general opinion toward the smart-grid control.

45
Results

The survey question as shown in the figure 4.14 below was:

Would you rather:

A) Let the electrical utility fully control their appliances for a 15% reduced bill (you have no control).

B) Control your own devices by using a smart grid for a 10% reduced bill.

C) Control your house normally and pay retail (usual amount).

Figure 4.14: Survey results

The survey result shows that 62.7% would like to use the smart grid and get a reduced bill while
controlling their loads, 32.2% would rather control their house appliances their own way regardless
of the price, and 5.1% would side with a more discount at the price of their privacy and control of
their own appliances.

46
Conclusion and Future Work

5 Conclusion and Future Work


Electricity never ceased in being a crucial daily life need, therefore, its generation and consumption
issues are growing more important day after day, this project assuming Real-Time pricing successfully
applied a demand side management, using load shifting technique, it also preserved the user’s privacy
and kept the appliances under their complete control.

This project also proved that technology can aid the generation by easing the consumption burden
just like smart-grid systems do.

Using smart grid control also reduced the cost especially when the real-time pricing is in play, it also
gives the user the opportunity to remotely control and monitor his appliances.

Possible improvements and future work:

1- Hardware implementation for error detection.


2- Increasing the number of appliances to include all the electrical devices in larger houses.
3- Have separate controller, i.e. “kitchen devices controller” could include all the appliances that are
in the kitchen alone, this way it’s easier and faster for the user to monitor their devices.
4- User can voluntarily send his consumption information anonymously, i.e. an encryption software
can be added to the controller, where the information is sent through it and thus the company
won’t recognize the sender.
5- Use the system with a renewable source once technology became cheaper.

47
References

6 References
[1] Pouyan Pourbeik, Mike Bahrman, Eric John, and Willie Wong "Modern Countermeasures to
Blackouts" IEEE Power and Energy Magazine, Volume: 4, Issue: 5, Sept.-Oct. 2006.
[2] A. Williams "Role of fossil fuels in electricity generation and their environmental impact" IEE
Proceedings A - Science, Measurement and Technology, Volume: 140, Issue: 1, Jan. 1993.
[3] Ruilong Deng, Zaiyue Yang, Mo-Yuen Chow, and Jiming Chen, “A Survey on Demand
Response in Smart Grids: Mathematical Models and Approaches”.
[4] Gilbert M. Masters: “Renewable and Efficient Electric Power Systems”.
[5] F. Boshell, O.P. Veloza “Review of developed demand side management programs including
different concepts and their results" Transmission and Distribution Conference and Exposition:
Latin America, 2008 IEEE/PES.
[6] Muahammad Awais, Nadeem Javaid and Nusrat Shaheen "Real-Time Pricing with Demand
Response Model for Autonomous Homes" Complex, Intelligent, and Software Intensive Systems
(CISIS), 2015.
[7] Thillainathan Logenthiran, Dipti Srinivasan and Tan Zong Shun "Demand Side Management in
Smart Grid Using Heuristic Optimization". IEEE Transactions on Smart Grid, Volume: 3, Issue: 3,
Sept. 2012.
[8] https://www.youtube.com/watch?v=C7gZzhs6JMk
[9] A. Mohsenian-Rad, V. W. Wong, J. Jatskevich, R. Schober, and A. Leon-Garcia, “Autonomous
demand-side management based on game-theoretic energy consumption scheduling for the future
smart grid” IEEE Transactions on Smart Grid, vol. 1, no. 3, pp. 320–331, 2010.
[10] Semiah, “Scheduling Shiftable Loads Under Demand Response programs using HEMS",
http://semiah.eu/wp-content/uploads/2015/04/D5.1_Algorithms-for-demand-response-and-load-
control.pdf.
[11] Armin Ghasem Azar and Rune Hylsberg Jacobsen "Appliance Scheduling Optimization for
Demand Response" International Journal on Advances in Intelligent System, vol9 no 1&2, 2016.
[12] H. Kellerer, U. Pferschy, and D. Pisinger, Knapsack Problems. Berlin, Heidelberg: Springer
Berlin Heidelberg, 2004, ch. Introduction to NP-Completeness of Knapsack Problems, pp. 483–493.
[Online]. Available: http://dx.doi.org/10.1007/978-3-540-24777-7_16.
[13] Qasaimeh, Ahmad. "Solar Energy Optimization through Seasons: Case Study in Jordan". Smart
Grid and Renewable Energy 3.04 (2012): 275.

48
References

[14] A. Subeih, A. AlGhababsheh, and I. Hattar, “Design of a Consumer-Side Load Shifting Scheme
for Improving Domestic Load Profile”. Princess Sumaya University for Technology, Amman-
Jordan, 2015.
[15] M. Pipattanasomporn, M. Kuzlu, S. Rahman, and Y. Teklu, “Load Profiles of Selected Major
Household Appliances and Their Demand Response Opportunities”. IEEE TRANSACTIONS ON
SMART GRID, VOL. 5, NO. 2, MARCH 2014.
[16] K. Haddad, L. Lababidi, and R. Al Mdanat, “Design of a Smart Power Monitoring &
Management System”. Princess Sumaya University for Technology, Amman-Jordan, 2017.
[17] http://millenniumenergy.co.uk
[18] https://www.mathworks.com/help/simulink/ug/choosing-a-solver.html
[19] https://hourlypricing.comed.com/live-prices/?date=20170322

49
Appendices

7 Appendices
7.1 Appendix (A): Hourly Insolation, Ambient Temperature, and Cell Temperature
for May

Hourly Insolation, Ambient temperature, and Cell temperature For May


Amman latitude: 31.5º N, Longitude: 36.1º E Altitude: 918m
Cell
Irradiance Ic Ambient Temperature
Day Hour (KW/m^2) Temperature (C) (C) S effective
1 0 0 13.9 13.9 0
1 1 0 15.4 15.4 0
1 2 0 15.8 15.8 0
1 3 0 15.3 15.3 0
1 4 0 14.8 14.8 0
1 5 0 14.4 14.4 0
1 6 46.09230769 14.6 13.102 48.1762515
1 7 27.38461538 14.6 13.71 28.5594702
1 8 16.49230769 12.1 11.564 17.3343521
1 9 13.44615385 9.3 8.863 14.2706801
1 10 2.369230769 9.8 9.723 2.50677078
1 11 9.753846154 11 11.317 10.2610013
1 12 12.61538462 11.2 11.61 13.2572806
1 13 14.4 13.5 13.968 15.003671
1 14 221.8153846 14.1 21.309 224.926523
1 15 300.1538462 14.6 24.355 300.889523
1 16 132.4615385 13.6 17.905 136.032834
1 17 42.55384615 12.4 13.783 44.3676868
1 18 7.723076923 11.6 11.349 8.12370227
1 19 0 11.6 11.6 0
1 20 0 10.7 10.7 0
1 21 0 9.9 9.9 0
1 22 0 9.8 9.8 0
1 23 0 9.5 9.5 0
2 0 0 9.4 9.4 0
2 1 0 8.7 8.7 0
2 2 0 8.7 8.7 0
2 3 0 8.7 8.7 0
2 4 0 8.7 8.7 0

50
Appendices

2 5 0 9.1 9.1 0
2 6 36.4 10.5 11.683 38.2420074
2 7 253.6 12.3 20.542 257.896085
2 8 386.7692308 13.5 26.07 385.196627
2 9 562.7384615 14.6 32.889 545.868575
2 10 703.1384615 15.4 38.252 667.730096
2 11 558.3384615 16 34.146 538.93352
2 12 586.2153846 17.4 36.452 560.704698
2 13 650.6769231 16.3 37.447 619.900816
2 14 469.7230769 16.4 31.666 457.824616
2 15 368.2769231 16.5 28.469 363.422223
2 16 170.9230769 15 20.555 173.810139
2 17 43.50769231 13.8 15.214 45.1256042
2 18 6.123076923 12.7 12.501 6.41389981
2 19 0 12.2 12.2 0
2 20 0 10.3 10.3 0
2 21 0 10.3 10.3 0
2 22 0 9.7 9.7 0
2 23 0 8.8 8.8 0
3 0 0 8.8 8.8 0
3 1 0 9.2 9.2 0
3 2 0 8.8 8.8 0
3 3 0 8.4 8.4 0
3 4 0 8 8 0
3 5 0 9 9 0
3 6 68.21538462 11.7 13.917 71.0883028
3 7 358.0615385 13.4 25.037 358.011195
3 8 524.7076923 15 32.053 510.644792
3 9 698.3692308 16.6 39.297 660.427808
3 10 733.4769231 18.1 41.938 686.267121
3 11 751.9692308 19.8 44.239 696.994114
3 12 748.2153846 20.8 45.117 691.018359
3 13 661.9692308 21 42.514 617.91306
3 14 504.3384615 19.8 36.191 482.891065
3 15 329.2923077 18.6 29.302 323.909169
3 16 187.1384615 17.8 23.882 187.933501
3 17 54.67692308 16.1 17.877 56.1568852
3 18 5.169230769 14.5 14.332 5.37878311
3 19 0 13.4 13.4 0
3 20 0 12.2 12.2 0

51
Appendices

3 21 0 12.7 12.7 0
3 22 0 13 13 0
3 23 0 13.2 13.2 0
4 0 0 12.9 12.9 0
4 1 0 12.4 12.4 0
4 2 0 12.5 12.5 0
4 3 0 12.6 12.6 0
4 4 0 12.8 12.8 0
4 5 0 12.6 12.6 0
4 6 65.96923077 15.2 17.344 67.8884604
4 7 301.5692308 17.7 27.501 298.703177
4 8 446 18.6 33.095 432.280594
4 9 575.1384615 19.2 37.892 546.962658
4 10 645.4461538 21 41.977 603.806744
4 11 730.3692308 22 45.737 672.815697
4 12 761.4153846 24 48.746 692.70922
4 13 709.0769231 24.2 47.245 649.137942
4 14 633.0461538 23.1 43.674 588.124439
4 15 368.6461538 22 33.981 356.065072
4 16 213.4769231 22.3 29.238 210.039005
4 17 60.4 21 22.963 60.8675322
4 18 4.4 18.2 18.057 4.51608696
4 19 0 17.6 17.6 0
4 20 0 17.6 17.6 0
4 21 0 17 17 0
4 22 0 16.2 16.2 0
4 23 0 16.2 16.2 0
5 0 0 15.2 15.2 0
5 1 0 14 14 0
5 2 0 14.3 14.3 0
5 3 0 14.6 14.6 0
5 4 0 15 15 0
5 5 0 16.6 16.6 0
5 6 75.16923077 19.4 21.843 76.071006
5 7 281.4769231 22.4 31.548 274.473102
5 8 421.6615385 23 36.704 402.908057
5 9 537.4461538 24.2 41.667 503.407217
5 10 663.5384615 26 47.565 606.642029
5 11 715.8769231 26.6 49.866 648.23314
5 12 730.5846154 27.3 51.044 658.280702

52
Appendices

5 13 732.8923077 28 51.819 658.20164


5 14 622.4615385 28.2 48.43 567.041298
5 15 480.6153846 28.4 44.02 445.878427
5 16 196.2153846 26 32.377 190.714957
5 17 65.96923077 24.5 26.644 65.5571078
5 18 1.753846154 22.8 22.857 1.76812842
5 19 0 21.8 21.8 0
5 20 0 22.4 22.4 0
5 21 0 22 22 0
5 22 0 20.4 20.4 0
5 23 0 18 18 0
6 0 0 18 18 0
6 1 0 18 18 0
6 2 0 17.3 17.3 0
6 3 0 16.7 16.7 0
6 4 0 16 16 0
6 5 0 18 18 0
6 6 72.52307692 22 24.357 72.7002798
6 7 317.0461538 25.8 36.104 303.668328
6 8 451.0769231 27.2 41.86 422.177327
6 9 584.0615385 27.8 46.782 535.71783
6 10 680.5538462 29 51.118 613.009966
6 11 762.9846154 28.6 53.397 680.652014
6 12 612.4615385 28 47.905 559.153499
6 13 594.8615385 29 48.333 542.117902
6 14 505.4769231 28.9 45.328 466.43065
6 15 375.1384615 28.8 40.992 352.341447
6 16 218.6153846 27.6 34.705 210.553068
6 17 62.36923077 27 29.027 61.4148194
6 18 2.676923077 22.6 22.513 2.70222161
6 19 0 21.4 21.4 0
6 20 0 21.4 21.4 0
6 21 0 21.4 21.4 0
6 22 0 21.8 21.8 0
6 23 0 20 20 0
7 0 0 20 20 0
7 1 0 19.5 19.5 0
7 2 0 18.8 18.8 0
7 3 0 18.1 18.1 0
7 4 0 17.4 17.4 0

53
Appendices

7 5 0 15.4 15.4 0
7 6 57.93846154 20 21.883 58.6247194
7 7 274.5230769 25.6 34.522 264.589844
7 8 473.9076923 26.7 42.102 443.109569
7 9 549.1692308 28 45.848 505.662726
7 10 662.5230769 28.7 50.232 598.999304
7 11 715.1384615 29.9 53.142 638.661841
7 12 746.5538462 29.9 54.163 663.821197
7 13 639.2307692 30 50.775 576.621312
7 14 537.1692308 29.6 47.058 492.143491
7 15 393.6 29.3 42.092 368.035837
7 16 239.6307692 29 36.788 228.896653
7 17 78.67692308 27.1 29.657 77.284609
7 18 1.2 24.4 24.439 1.20255816
7 19 0 24.5 24.5 0
7 20 0 22.3 22.3 0
7 21 0 23.2 23.2 0
7 22 0 25.1 25.1 0
7 23 0 24.4 24.4 0
8 0 0 23.7 23.7 0
8 1 0 21.5 21.5 0
8 2 0 21 21 0
8 3 0 20.5 20.5 0
8 4 0 20 20 0
8 5 0 20.5 20.5 0
8 6 44.43076923 24 25.444 44.3558056
8 7 223.3230769 27 34.258 215.466482
8 8 350.8 27.6 39.001 332.136107
8 9 512.2461538 28.6 45.248 472.832705
8 10 619.5076923 30.6 50.734 558.926531
8 11 570.7692308 31.2 49.75 517.088385
8 12 617.2307692 32.2 52.26 553.293068
8 13 637.4153846 32.5 53.216 569.071197
8 14 552 33.5 51.44 496.539456
8 15 379.3846154 34.4 46.73 348.05731
8 16 220.0615385 31.6 38.752 208.561651
8 17 84.61538462 30 32.75 82.1234615
8 18 6.430769231 27.5 27.709 6.36456961
8 19 0 26 26 0
8 20 0 26 26 0

54
Appendices

8 21 0 26 26 0
8 22 0 25.4 25.4 0
8 23 0 24.5 24.5 0
9 0 0 24 24 0
9 1 0 22.4 22.4 0
9 2 0 19.9 19.9 0
9 3 0 15.5 15.5 0
9 4 0 14.8 14.8 0
9 5 0 15.6 15.6 0
9 6 4.553846154 16 16.148 4.70702661
9 7 56.55384615 17.4 19.238 57.7921265
9 8 118.4923077 18.8 22.651 119.549994
9 9 327.2 20.2 30.834 319.946238
9 10 501.1692308 21.6 37.888 476.624768
9 11 560.2153846 21.6 39.807 528.69397
9 12 556.3692308 21.6 39.682 525.328501
9 13 575.9076923 22 40.717 541.511836
9 14 461.9692308 22.2 37.214 440.52776
9 15 339.0461538 22.3 33.319 328.328159
9 16 192.6769231 21.4 27.662 190.72788
9 17 57.96923077 19.6 21.484 58.7437461
9 18 0.707692308 17 16.977 0.72926801
9 19 0 16 16 0
9 20 0 16.2 16.2 0
9 21 0 16.2 16.2 0
9 22 0 15.3 15.3 0
9 23 0 15.3 15.3 0
10 0 0 15 15 0
10 1 0 15 15 0
10 2 0 15 15 0
10 3 0 15 15 0
10 4 0 15 15 0
10 5 0 14.2 14.2 0
10 6 56.21538462 17 18.827 57.5340514
10 7 274.6153846 22.7 31.625 267.701942
10 8 395.5076923 23.2 36.054 378.894313
10 9 526.7384615 24.4 41.519 493.673929
10 10 622.5230769 25.8 46.032 572.770037
10 11 708.4615385 27.2 50.225 640.551958
10 12 606.4 26.6 46.308 557.299549

55
Appendices

10 13 491.1692308 27 42.963 457.642314


10 14 488.0615385 26.8 42.662 455.304995
10 15 366.4307692 26.7 38.609 347.481095
10 16 191.5076923 25.4 31.624 186.687214
10 17 71.69230769 23.8 26.13 71.3844609
10 18 2.953846154 21.6 21.504 2.99308741
10 19 0 20.4 20.4 0
10 20 0 21 21 0
10 21 0 21.1 21.1 0
10 22 0 19.7 19.7 0
10 23 0 19.8 19.8 0
11 0 0 20.3 20.3 0
11 1 0 19.5 19.5 0
11 2 0 19.1 19.1 0
11 3 0 18.7 18.7 0
11 4 0 18.2 18.2 0
11 5 0 18.5 18.5 0
11 6 65.63076923 21.4 23.533 65.9966345
11 7 224.5846154 24 31.299 219.208913
11 8 370.3076923 25 37.035 353.372411
11 9 622.1230769 26.6 46.819 570.541484
11 10 736.9230769 28.6 52.55 659.7746
11 11 645.1692308 28.8 49.768 584.446935
11 12 526.8307692 29.4 46.522 483.744652
11 13 475.2307692 29 44.445 440.115492
11 14 406.4615385 28.5 41.71 380.652044
11 15 324.2769231 28 38.539 307.593459
11 16 199.8461538 27 33.495 193.39492
11 17 53.75384615 25 26.747 53.3969959
11 18 1.692307692 23.3 23.355 1.70288631
11 19 0 23 23 0
11 20 0 22.8 22.8 0
11 21 0 22.8 22.8 0
11 22 0 22.8 22.8 0
11 23 0 22.4 22.4 0
12 0 0 21.8 21.8 0
12 1 0 21 21 0
12 2 0 20.2 20.2 0
12 3 0 19.4 19.4 0
12 4 0 18.6 18.6 0

56
Appendices

12 5 0 19 19 0
12 6 27.16923077 21.5 22.383 27.4394179
12 7 254.3692308 26.6 34.867 244.831758
12 8 405.6 27.8 40.982 380.967263
12 9 558.1538462 27.8 45.94 513.740428
12 10 604.5846154 28.7 48.349 550.94212
12 11 607.5692308 28.9 48.646 552.976219
12 12 571.1692308 29.3 47.863 521.546391
12 13 479.1384615 29.8 45.372 442.046628
12 14 334.7692308 29.3 40.18 315.458402
12 15 268.2461538 28.8 37.518 255.486114
12 16 192.6769231 28 34.262 185.895543
12 17 64.92307692 26.6 28.71 64.0077914
12 18 7.169230769 24.6 24.367 7.18647564
12 19 0 23 23 0
12 20 0 21.6 21.6 0
12 21 0 21 21 0
12 22 0 20.8 20.8 0
12 23 0 20.5 20.5 0
13 0 0 20.3 20.3 0
13 1 0 19.3 19.3 0
13 2 0 19.4 19.4 0
13 3 0 19.5 19.5 0
13 4 0 19.7 19.7 0
13 5 0 20 20 0
13 6 69.50769231 21.6 23.859 69.8090638
13 7 201.4461538 26.6 33.147 195.209663
13 8 420.5230769 28 41.667 393.889416
13 9 562.2461538 28.8 47.073 515.086408
13 10 622.3384615 29.5 49.726 563.864286
13 11 636.2153846 30.5 51.177 572.929386
13 12 633.2615385 30.5 51.081 570.500381
13 13 518.7384615 29.5 46.359 476.635469
13 14 440.8307692 29.1 43.427 409.962653
13 15 214.6153846 28.8 35.775 205.827958
13 16 135.8153846 28 32.414 131.989031
13 17 59.56923077 25.8 27.736 58.9499014
13 18 7.015384615 23.8 23.572 7.0534529
13 19 0 23 23 0
13 20 0 22.8 22.8 0

57
Appendices

13 21 0 23.8 23.8 0
13 22 0 23 23 0
13 23 0 23.5 23.5 0
14 0 0 23.5 23.5 0
14 1 0 23.2 23.2 0
14 2 0 22.3 22.3 0
14 3 0 21.4 21.4 0
14 4 0 20.4 20.4 0
14 5 0 23 23 0
14 6 5.784615385 24.8 24.612 5.79314422
14 7 33.66153846 26.2 27.294 33.3681041
14 8 205.3230769 26.6 33.273 198.868253
14 9 189.3230769 27.4 33.553 183.169812
14 10 362.7384615 28.1 39.889 342.215372
14 11 387.4153846 29.9 42.491 361.665511
14 12 635.6 31 51.657 571.215881
14 13 397.8153846 30.6 43.529 369.805124
14 14 298.5230769 29.1 38.802 282.866258
14 15 142.2769231 27.6 32.224 138.371251
14 16 103.1384615 26.9 30.252 101.080065
14 17 56.95384615 27.4 29.251 56.0338251
14 18 7.815384615 26.2 25.946 7.78728987
14 19 0 24.5 24.5 0
14 20 0 23.8 23.8 0
14 21 0 23.2 23.2 0
14 22 0 23.8 23.8 0
14 23 0 24 24 0
15 0 0 24.2 24.2 0
15 1 0 24 24 0
15 2 0 23.6 23.6 0
15 3 0 23.2 23.2 0
15 4 0 22.8 22.8 0
15 5 0 22.6 22.6 0
15 6 8.492307692 22.8 22.524 8.57221012
15 7 55.38461538 24.7 26.5 55.0689231
15 8 173.8153846 25.5 31.149 169.75398
15 9 317.4461538 27 37.317 302.588214
15 10 316.7076923 28.8 39.093 299.746919
15 11 376.4 29.3 41.533 352.752519
15 12 361.7230769 29.8 41.556 338.966065

58
Appendices

15 13 390.1538462 30.6 43.28 363.052199


15 14 341.0769231 31.5 42.585 318.28514
15 15 308.9846154 32.4 42.442 288.505239
15 16 189.0153846 31.7 37.843 179.790791
15 17 51.75384615 29.8 31.482 50.4790661
15 18 13.13846154 29 28.573 12.9600754
15 19 0 30 30 0
15 20 0 30 30 0
15 21 0 28.8 28.8 0
15 22 0 28.3 28.3 0
15 23 0 24.4 24.4 0
16 0 0 17.8 17.8 0
16 1 0 17.4 17.4 0
16 2 0 16.1 16.1 0
16 3 0 14.8 14.8 0
16 4 0 13.5 13.5 0
16 5 0 13 13 0
16 6 24.86153846 12.5 11.692 26.1187964
16 7 4.492307692 15 14.854 4.66550772
16 8 219.3538462 15 22.129 221.746953
16 9 223.1076923 15.8 23.051 224.760072
16 10 341.7230769 17.5 28.606 337.040514
16 11 386.4 17.5 30.058 378.973237
16 12 383.3538462 18.5 30.959 374.673105
16 13 258.4923077 17.4 25.801 257.705509
16 14 325.0461538 16.9 27.464 322.002682
16 15 215.2307692 16.4 23.395 216.543462
16 16 109.4153846 16.4 19.956 111.512571
16 17 32.09230769 15.2 16.243 33.1602306
16 18 10.21538462 14.8 14.468 10.6242207
16 19 0 14.4 14.4 0
16 20 0 13.4 13.4 0
16 21 0 13.4 13.4 0
16 22 0 13.4 13.4 0
16 23 0 13.2 13.2 0
17 0 0 13.2 13.2 0
17 1 0 13.2 13.2 0
17 2 0 12.9 12.9 0
17 3 0 12.6 12.6 0
17 4 0 12.4 12.4 0

59
Appendices

17 5 0 12.4 12.4 0
17 6 66.67692308 13.4 15.567 69.0669841
17 7 193.2 14.3 20.579 196.445721
17 8 322.7384615 15.2 25.689 321.893468
17 9 560.7384615 16.4 34.624 540.231583
17 10 671.8769231 17.8 39.636 634.509279
17 11 645.3538462 18.6 39.574 609.613376
17 12 572.0307692 19.3 37.891 544.009384
17 13 534 19.5 36.855 509.943834
17 14 436.4307692 19.4 33.584 422.194747
17 15 340.4 19.4 30.463 333.3335
17 16 223.3230769 18.5 25.758 222.679817
17 17 60.92307692 17 18.98 62.3167532
17 18 3.292307692 15.2 15.093 3.41625188
17 19 0 14 14 0
17 20 0 13.2 13.2 0
17 21 0 12.8 12.8 0
17 22 0 12.1 12.1 0
17 23 0 12 12 0
18 0 0 11 11 0
18 1 0 10.7 10.7 0
18 2 0 10.8 10.8 0
18 3 0 10.9 10.9 0
18 4 0 10.9 10.9 0
18 5 0 11.5 11.5 0
18 6 76.92307692 12.9 15.4 79.7292308
18 7 251.4461538 15 23.172 253.192799
18 8 465.1384615 17 32.117 452.558978
18 9 609.9692308 19 38.824 577.926815
18 10 677.2615385 20.4 42.411 632.452696
18 11 735.2923077 22 45.897 676.903775
18 12 674.0615385 22 43.907 625.632509
18 13 574.3692308 22.5 41.167 539.083087
18 14 494.4307692 21.8 37.869 470.252017
18 15 329.9692308 21.2 31.924 321.287344
18 16 204.8 20 26.656 203.511235
18 17 53.69230769 18.5 20.245 54.662474
18 18 6.769230769 16.6 16.38 6.99096369
18 19 0 15 15 0
18 20 0 13.6 13.6 0

60
Appendices

18 21 0 13.6 13.6 0
18 22 0 13.6 13.6 0
18 23 0 15.5 15.5 0
19 0 0 14 14 0
19 1 0 15.5 15.5 0
19 2 0 14.8 14.8 0
19 3 0 14.1 14.1 0
19 4 0 13.4 13.4 0
19 5 0 15.4 15.4 0
19 6 76.52307692 17.5 19.987 77.9807956
19 7 273.2923077 19 27.882 270.29932
19 8 438.6461538 21.8 36.056 420.217401
19 9 577.0769231 23.5 42.255 539.238566
19 10 724.4615385 24.3 47.845 661.570308
19 11 772.8923077 25 50.119 699.118037
19 12 735.2615385 26 49.896 665.702268
19 13 683.1692308 27.4 49.603 619.298783
19 14 530.1538462 24.8 42.03 495.84547
19 15 333.2615385 22.2 33.031 323.091129
19 16 163.3230769 22.2 27.508 161.766543
19 17 59.50769231 21.8 23.734 59.7939719
19 18 8.892307692 19.2 18.911 9.09805969
19 19 0 18.8 18.8 0
19 20 0 18.7 18.7 0
19 21 0 17.8 17.8 0
19 22 0 17.5 17.5 0
19 23 0 17.2 17.2 0
20 0 0 17.7 17.7 0
20 1 0 17 17 0
20 2 0 17 17 0
20 3 0 17 17 0
20 4 0 17 17 0
20 5 0 14.8 14.8 0
20 6 83.72307692 17.2 19.921 85.3389491
20 7 218.9230769 22.2 29.315 215.333395
20 8 309.6615385 21.5 31.564 301.937589
20 9 480.8923077 23 38.629 455.986799
20 10 616.8 24.2 44.246 571.690455
20 11 629.6 24.9 45.362 580.884322
20 12 627.1384615 25.9 46.282 576.420771

61
Appendices

20 13 522.8615385 26 42.993 487.111717


20 14 391.6615385 25.1 37.829 372.56796
20 15 293.8769231 24.2 33.751 284.104399
20 16 184.9230769 23.8 29.81 181.543053
20 17 67.04615385 22.5 24.679 67.1279367
20 18 2.923076923 21.1 21.005 2.96745215
20 19 0 20 20 0
20 20 0 19.1 19.1 0
20 21 0 18.4 18.4 0
20 22 0 16.9 16.9 0
20 23 0 16.6 16.6 0
21 0 0 15.8 15.8 0
21 1 0 15.1 15.1 0
21 2 0 14.5 14.5 0
21 3 0 13.9 13.9 0
21 4 0 13.4 13.4 0
21 5 0 13.4 13.4 0
21 6 22.95384615 14.1 14.846 23.8395249
21 7 143.2615385 15.2 19.856 146.0619
21 8 229.9692308 15.8 23.274 231.477553
21 9 377.2615385 17.2 29.461 370.866276
21 10 443.7538462 17.6 32.022 431.912896
21 11 472.1230769 18 33.344 457.153376
21 12 489.3538462 18 33.904 472.796461
21 13 451.6 18.2 32.877 438.082438
21 14 381.1384615 17.6 29.987 373.915659
21 15 266.9230769 17 25.675 266.238419
21 16 158.4 15.8 20.948 160.83898
21 17 48.52307692 14.6 16.177 50.1499295
21 18 8.892307692 13 12.711 9.30756246
21 19 0 13 13 0
21 20 0 13 13 0
21 21 0 12 12 0
21 22 0 12 12 0
21 23 0 11.7 11.7 0
22 0 0 11.7 11.7 0
22 1 0 11.7 11.7 0
22 2 0 11.6 11.6 0
22 3 0 11.5 11.5 0
22 4 0 11.5 11.5 0

62
Appendices

22 5 0 12 12 0
22 6 3.753846154 13 12.878 3.92676182
22 7 152.4615385 12.8 17.755 156.658957
22 8 126.1230769 14.2 18.299 129.33465
22 9 176.7076923 16.2 21.943 178.760435
22 10 193.6615385 14.3 20.594 196.903975
22 11 86.58461538 14 16.814 89.2779857
22 12 119.6 15.4 19.287 122.196444
22 13 181.7538462 16.2 22.107 183.751939
22 14 208.2461538 16 22.768 210.012414
22 15 177.0769231 15.8 21.555 179.395037
22 16 129.7846154 15 19.218 132.636191
22 17 32.58461538 14.3 15.359 33.7783788
22 18 12.52307692 13.8 13.393 13.0754273
22 19 0 13.2 13.2 0
22 20 0 12.6 12.6 0
22 21 0 11.7 11.7 0
22 22 0 10.7 10.7 0
22 23 0 10.8 10.8 0
23 0 0 10.8 10.8 0
23 1 0 11.1 11.1 0
23 2 0 11.3 11.3 0
23 3 0 11.5 11.5 0
23 4 0 11.6 11.6 0
23 5 0 11.8 11.8 0
23 6 76.06153846 12.7 15.172 78.9021631
23 7 221.8769231 15.2 22.411 224.059793
23 8 426.9230769 15.8 29.675 419.338788
23 9 617.9076923 18.4 38.482 586.251293
23 10 600.6461538 19 38.521 569.785075
23 11 715.9076923 20 43.267 666.213246
23 12 681.8461538 21.7 43.86 632.979604
23 13 572.2769231 22 40.599 538.354522
23 14 401.2307692 21.1 34.14 387.295222
23 15 320.7076923 20.3 30.723 313.733134
23 16 205.4769231 19.3 25.978 204.713289
23 17 55.53846154 17.6 19.405 56.7192648
23 18 3.138461538 15.8 15.698 3.24939862
23 19 0 14.5 14.5 0
23 20 0 13.4 13.4 0

63
Appendices

23 21 0 14.2 14.2 0
23 22 0 13.9 13.9 0
23 23 0 13.4 13.4 0
24 0 0 13.4 13.4 0
24 1 0 13.7 13.7 0
24 2 0 13.3 13.3 0
24 3 0 12.9 12.9 0
24 4 0 12.6 12.6 0
24 5 0 13.4 13.4 0
24 6 6.246153846 16 16.203 6.45495402
24 7 184.6153846 18.4 24.4 185.036308
24 8 390.6769231 19.5 32.197 379.992456
24 9 508.6461538 20.6 37.131 485.198685
24 10 704.4307692 22.1 44.994 650.910092
24 11 735.0461538 23 46.889 673.906338
24 12 763.4153846 25.2 50.011 690.859012
24 13 661.9692308 26 47.514 605.335645
24 14 480.5538462 24.7 40.318 452.581576
24 15 303.3230769 23.5 33.358 293.689415
24 16 191.3538462 22.4 28.619 188.72231
24 17 57.2 19.6 21.459 57.9696718
24 18 7.015384615 18.4 18.172 7.19740859
24 19 0 17.2 17.2 0
24 20 0 16.8 16.8 0
24 21 0 16.5 16.5 0
24 22 0 16 16 0
24 23 0 15.5 15.5 0
25 0 0 16 16 0
25 1 0 15.4 15.4 0
25 2 0 15.1 15.1 0
25 3 0 14.8 14.8 0
25 4 0 14.6 14.6 0
25 5 0 15.4 15.4 0
25 6 9.230769231 17.6 17.9 9.47981538
25 7 154.9538462 21.2 26.236 154.226059
25 8 282.2769231 22.8 31.974 274.796246
25 9 209.2307692 23.2 30 205.255385
25 10 383.6615385 23.2 35.669 368.107056
25 11 574.2461538 24.8 43.463 533.957388
25 12 616.0307692 25.3 45.321 568.460996

64
Appendices

25 13 588.4 26.5 45.623 542.288622


25 14 443.0153846 27 41.398 415.410033
25 15 276.0307692 27.4 36.371 264.103535
25 16 173.8461538 26.4 32.05 169.188815
25 17 71.56923077 24.6 26.926 71.0454299
25 18 4.553846154 23 23.148 4.5858943
25 19 0 21 21 0
25 20 0 20 20 0
25 21 0 20 20 0
25 22 0 17.5 17.5 0
25 23 0 17.5 17.5 0
26 0 0 17.5 17.5 0
26 1 0 18.6 18.6 0
26 2 0 17.7 17.7 0
26 3 0 16.8 16.8 0
26 4 0 16 16 0
26 5 0 18 18 0
26 6 92.24615385 16.6 19.598 94.139746
26 7 247.4461538 17 25.042 247.406661
26 8 413.7230769 17.7 31.146 404.060657
26 9 442.5230769 18.6 32.982 429.100644
26 10 371.7538462 19.5 31.582 362.455688
26 11 271.5076923 19.5 28.324 268.078224
26 12 308.8 19.2 29.236 303.829308
26 13 327.6 19.6 30.247 321.068115
26 14 317.4153846 18.8 29.116 312.450754
26 15 226.6769231 18.1 25.467 226.274662
26 16 136.0307692 17.5 21.921 137.622356
26 17 62.67692308 16.4 18.437 64.2400479
26 18 13.78461538 15 15.448 14.2849638
26 19 0 14.6 14.6 0
26 20 0 13.9 13.9 0
26 21 0 13.7 13.7 0
26 22 0 13.3 13.3 0
26 23 0 13.2 13.2 0
27 0 0 13.1 13.1 0
27 1 0 13.4 13.4 0
27 2 0 13 13 0
27 3 0 12.6 12.6 0
27 4 0 12.2 12.2 0

65
Appendices

27 5 0 12.4 12.4 0
27 6 1.230769231 12.7 12.66 1.28848246
27 7 127.0461538 13.3 17.429 130.701246
27 8 121.1076923 14.3 18.236 124.220548
27 9 136.9846154 15.8 20.252 139.456147
27 10 303.5692308 16.5 26.366 301.993464
27 11 461.4153846 16.5 31.496 450.025438
27 12 337.1076923 16.5 27.456 333.961534
27 13 266.4923077 16 24.661 266.835603
27 14 230.7692308 15.7 23.2 232.347692
27 15 142.4615385 15.4 20.03 145.152067
27 16 97.96923077 14.4 17.584 100.730082
27 17 43.93846154 14 15.428 45.5366616
27 18 4.923076923 13.2 13.04 5.14682092
27 19 0 12.8 12.8 0
27 20 0 12 12 0
27 21 0 12 12 0
27 22 0 12 12 0
27 23 0 11.7 11.7 0
28 0 0 11.7 11.7 0
28 1 0 11.7 11.7 0
28 2 0 11.7 11.7 0
28 3 0 11.7 11.7 0
28 4 0 11.6 11.6 0
28 5 0 12.3 12.3 0
28 6 7.323076923 12.6 12.838 7.66151732
28 7 131.4153846 13 17.271 135.275081
28 8 238.6153846 14.5 22.255 241.104382
28 9 323.7538462 14.6 25.122 323.603754
28 10 296.7076923 15.9 25.543 296.095466
28 11 265.7538462 16.8 25.437 265.312535
28 12 355.1076923 18.1 29.641 348.845084
28 13 404.9538462 18 31.161 395.473148
28 14 424.4615385 17.3 31.095 414.630585
28 15 257.2923077 16.6 24.962 257.329461
28 16 118.8615385 16 19.863 121.181787
28 17 41.93846154 15 16.363 43.314907
28 18 8.030769231 14.1 13.839 8.37136861
28 19 0 13.5 13.5 0
28 20 0 12.7 12.7 0

66
Appendices

28 21 0 12.3 12.3 0
28 22 0 12.1 12.1 0
28 23 0 11.7 11.7 0
29 0 0 11.6 11.6 0
29 1 0 10.6 10.6 0
29 2 0 10.4 10.4 0
29 3 0 10.2 10.2 0
29 4 0 9.9 9.9 0
29 5 0 10.8 10.8 0
29 6 29.78461538 12 12.968 31.1464157
29 7 213.5384615 15.2 22.14 215.859198
29 8 454 17.4 32.155 441.656194
29 9 683.8153846 19.2 41.424 641.137646
29 10 707.7230769 20.6 43.601 657.69852
29 11 667.1692308 21.8 43.483 620.310333
29 12 628.0615385 21.8 42.212 586.982797
29 13 583.3230769 21 39.958 550.16676
29 14 391.9384615 21.3 34.038 378.47757
29 15 311.6923077 21.6 31.73 303.721089
29 16 194 21 27.305 192.300754
29 17 69.32307692 18.5 20.753 70.4418543
29 18 2.892307692 17.2 17.294 2.97700256
29 19 0 16.6 16.6 0
29 20 0 15.4 15.4 0
29 21 0 15.3 15.3 0
29 22 0 15.8 15.8 0
29 23 0 14.6 14.6 0
30 0 0 14.6 14.6 0
30 1 0 12.8 12.8 0
30 2 0 12.6 12.6 0
30 3 0 12.4 12.4 0
30 4 0 12.2 12.2 0
30 5 0 13 13 0
30 6 55.01538462 14.5 16.288 56.8367019
30 7 210.8615385 15.6 22.453 212.902383
30 8 264.1846154 16.9 25.486 263.696719
30 9 336.9230769 17.6 28.55 332.377985
30 10 581.4769231 18.8 37.698 553.419266
30 11 541.0769231 19.3 36.885 516.640266
30 12 495.2615385 20.5 36.596 473.437938

67
Appendices

30 13 494.7692308 20 36.08 473.937467


30 14 403.1384615 19.4 32.502 391.645952
30 15 305.6307692 18.9 28.833 301.179135
30 16 185.2307692 18 24.02 185.920569
30 17 50.15384615 15.9 17.53 51.5775132
30 18 1.969230769 14.4 14.336 2.0490303
30 19 0 13.4 13.4 0
30 20 0 12.8 12.8 0
30 21 0 12.8 12.8 0
30 22 0 12.2 12.2 0
30 23 0 12 12 0
31 0 0 11.3 11.3 0
31 1 0 11.4 11.4 0
31 2 0 11.1 11.1 0
31 3 0 10.8 10.8 0
31 4 0 10.5 10.5 0
31 5 0 10.7 10.7 0
31 6 70.70769231 12.3 14.598 73.5025977
31 7 132.8615385 13.8 18.118 136.33608
31 8 272.1538462 15 23.845 273.348329
31 9 573.2615385 16 34.631 552.281427
31 10 666.3076923 17.6 39.255 630.214471
31 11 748.6153846 18.6 42.93 697.609224
31 12 711.5076923 21.3 44.424 658.990456
31 13 624.6461538 20.2 40.501 587.852122
31 14 497.9076923 19.9 36.082 476.940003
31 15 379.1076923 19.7 32.021 368.993175
31 16 202 18.5 25.065 201.950106
31 17 59.47692308 16.7 18.633 60.9159434
31 18 2.492307692 14.4 14.481 2.59193071
31 19 0 13.9 13.9 0
31 20 0 13.4 13.4 0
31 21 0 13 13 0
31 22 0 14 14 0
31 23 0 14.5 14.5 0

Tcell Avg= 24.33440054

sum
irradiance 128660.1846 sum effective 121948.415

68
Appendices

7.2 Appendix (B): Algorithm Code


User defined function code:

Nonshiftable function:

1. function [p,freezer,tv,lights,oven,pc,power,price] = fcn(clk,RTP)


2. %#codegen
3. freezer=0; %FREEZER
4. tv=0; %TV
5. lights=0; %LIGHTS
6. oven=0; %OVEN
7. pc=0; %PC
8. RTP_DATA= [ 0.014889 ,0.014889 ,0.015598, 0.015598, 0.016307, 0.015598, 0.019852,
0.020561, 0.021979, 0.023397, 0.024106, 0.02836, 0.024815, 0.021979, 0.019143, 0.018434, 0.019143,
0.032614, 0.041831, 0.021979, 0.016307, 0.018434, 0.016302, 0.019852 ];
9. p=0;
10. power=0;
11. p = floor(clk);
12. price1 = 0;
13. price2 = 0;
14. price3 = 0;
15. price4 = 0;
16. price5 = 0;
17. freezer=1;
18. power = power +0.3 * 24; %daily only
19. fr=1;
20. while(fr <= 24)
21. price1 = price1(1) + RTP_DATA(fr)*0.54;
22. fr=fr+1;
23. end
24. if(p==18 || (p>18 && p<23))
25. tv=1;
26. % display('Tv is on');

69
Appendices

27. power = power + 0.079 * 5;


28. price2 = price2 + RTP_DATA(p)*0.079;
29. end
30. if(p==18 || (p>18 && p<24))
31. lights=1;
32. % display('Lights are on');
33. power = power + 0.25 * 6;
34. price3 = price3 + RTP_DATA(p)*0.25;
35. end
36. if(p==15 || (p>15 && p<18))
37. oven=1;
38. % display('Oven is on');
39. power = power + 2 * 2;
40. price4 = price4 + RTP_DATA(p)*2;
41. end
42. if(p==21 || (p>21 && p<24))
43. pc=1;
44. % display('PC is on');
45. power = power + 0.12 * 2;
46. price5 = price5 + RTP_DATA(p)*0.12;
47. end
48. if(p==24)
49. tv=0;
50. lights=0;
51. %display('TV and lights Are off\n Your nonshiftable Daily Consumption is');
52. %display(power);
53. end
54. if(p==15)
55. oven=0;
56. % display('Oven is off\n');
57. end
58. if(p==23)

70
Appendices

59. pc=0;
60. % display('PC is off\n');
61. end
62. %{
63. while(flag == false)
64. if(p==q)
65. flag= true;
66. q=q+1;
67. end
68. %}
69. %end
70. price = price1 + price2 + price3 + price4 + price5;
71. end

Non-shiftable function interrupt:

1. function
[interrupt1freezer,interrupt1sig,interrupt2oven,interrupt2sig,interrupt3lights,interrupt3sig,interrupt4t
v,interrupt4sig,interrupt5pc,interrupt5sig,interruptsigonline]= fcn(interruptonline,load ,clock,state ,
duration ,start_time )
2. %#codegen
3. % display ( ' select the load to be interrupted')
4. % display ( ' input the wanted state of load' ) on, off (1,0)
5. % display ( ' input the duration of the interrupt ')
6. % display ( ' input the starting time ')
7. t = floor(clock) ;
8. interrupt1freezer = 0;
9. interrupt2oven = 0;
10. interrupt3lights = 0;
11. interrupt4tv = 0;
12. interrupt5pc = 0;
13. interrupt1sig = 0;

71
Appendices

14. interrupt2sig = 0;
15. interrupt3sig = 0;
16. interrupt4sig = 0;
17. interrupt5sig = 0;
18. if(interruptonline ==1)
19. if (load == 1 )
20. if(t == start_time)
a. interrupt1sig = 1;
21. if( t < (start_time + duration))
22. interrupt1freezer = state;
23. %else
24. %interrupt1freezer = 0;
25. end
26. end
27. end
28. if (load ==2 )
29. if(t == start_time)
a. interrupt2sig=1;
30. if( t < (start_time + duration))
31. interrupt2oven = state;
32. end
33. end
34. end
35. if (load ==3 )
36. if(t == start_time)
a. interrupt3sig = 1;
37. if( t < (start_time + duration))
38. interrupt3lights = state;
39. end
40. end
41. end
42. if (load ==4 )

72
Appendices

43. if(t == start_time)


a. interrupt4sig = 1;
44. if( t < (start_time + duration))
45. interrupt4tv = state;
46. end
47. end
48. end
49. if (load ==5 )
50. if(t == start_time)
a. interrupt5sig =1;
51. if( t < (start_time + duration))
52. interrupt5pc = state;
53. end
54. end
55. end
56. end
57. interruptsigonline = interruptonline ;
58. %{
59. interrupt1price = 0 ;
60. cntr = 0;
61. duration1 = 2;
62. while(duration1 > 0)
63. interrupt1price = interrupt1price + RTP_DATA(start_time + cntr) * 1.2
64. duration1 = duration1 - 1;
65. cntr = cntr +1;
66. end
67. %}

Main function1:

1. function [out1,out2,out3,out4,out5] =
fcn(interruptonline,interrupt1sig,interrupt1freezer,out1func,interrupt2sig,interrupt2oven,out2func,in

73
Appendices

terrupt3sig,interrupt3lights,out3func,interrupt4sig,interrupt4tv,out4func,interrupt5sig,interrupt5pc,o
ut5func)
2. out1=0;
3. out2=0;
4. out3=0;
5. out4=0;
6. out5=0;
7. if(interrupt1sig == 1 )
8. if(interruptonline ==1)
9. out1 = interrupt1freezer ;
10. end
11. else
12. out1 = out1func;
13. end
14. if(interrupt2sig == 1 )
15. if(interruptonline ==1)
16. out2 = interrupt2oven ;
17. end
18. else
19. out2 = out2func;
20. end
21. if(interrupt3sig == 1 )
22. if(interruptonline ==1)
23. out3 = interrupt3lights ;
24. end
25. else
26. out3 = out3func;
27. end
28. if(interrupt4sig == 1 )
29. if(interruptonline ==1)
30. out4 = interrupt4tv ;
31. end

74
Appendices

32. else
33. out4 = out4func;
34. end
35. if(interrupt5sig == 1 )
36. if(interruptonline ==1)
37. out5 = interrupt5pc ;
38. end
39. else
40. out5 = out5func;
41. end

Shiftable function:

1. function [ac,washmach,dishwasher,clothesdry,shiftableprices,shiftpower]=
fcn(RTP,nonshiftprice,clock)
2. ac = 0;
3. washmach=0;
4. dishwasher=0;
5. clothesdry=0;
6. shiftableprices=0;
7. RTP_DATA= [ 0.014889 ,0.014889 ,0.015598, 0.015598, 0.016307, 0.015598, 0.019852,
0.020561, 0.021979, 0.023397, 0.024106, 0.02836, 0.024815, 0.021979, 0.019143, 0.018434, 0.019143,
0.032614, 0.041831, 0.021979, 0.016307, 0.018434, 0.016302, 0.019852 ];
8. % ref https://hourlypricing.comed.com/live-prices/
9. b=zeros(1,24);
10. x=RTP_DATA;
11. %minimums= sort(x);
12. b=unique(x);
13. i1 = 1;
14. i2=1;
15. f1= zeros(1,24);
16. i3 = 1;

75
Appendices

17. while ( i1 <= max(size(b)))


18. s = find(x==b(i1));
19. while(i2<= max(size(s)))
a. f1(i3)=s(i2);
b. i2=i2+1;
c. i3=i3+1;
20. end
21. i2 = 1;
22. i1=i1+1;
23. end
24. % while ( mcounter < 24)
25. % if(minimums(mcounter) ~= min(b))
26. % a = min(minimums);
27. % y= find(x==a);
28. % i = max(size(y));
29. % q1=1;
30. % bc = max(size(find(b==0)));
31. %
32. % while(q1 <= max(size(y)) )
33. %
34. % while(bc > 0 && i>0)
35. %
36. % if(b(bc)==0)
37. %
38. % b(bc)= y(bc);
39. %
40. % i=i-1;
41. % bc = bc -1;
42. % end
43. % end
44. % q1=q1+1;
45. % end

76
Appendices

46. % mcounter= mcounter +1;


47. % else
48. %
49. % mcounter = mcounter +1;
50. % end
51. % end
52. %A2 = sort(A(:));
53. %out = A2(2);
54. shiftpower = 0 ;
55. u =zeros( 1,24);
56. mp = max(RTP_DATA); % max point value
57. mp1 = find(x==mp); % max point location
58. l2 = zeros(1,24);
59. l1 = 1;
60. while ( l1 <= 24 )
61. l2(l1) = l1 ;
62. l1 = l1+1;
63. end
64. %{
65. %for ac
66. acop=find(f1<=(mp1-3));
67. if((clock >= acop && clock <= acop+2)) %AC
68. ac = 1;
69. shiftpower = shiftpower + 1.2; % ALL LOADS IN KW
70. else ac = 0;
71. end
72. wmop = find(f1>=(mp1+2));
73. if((clock >= wmop && clock <= wmop+2)) %WM
74. s2=1;
75. shiftpower = shiftpower + 0.250;
76. else s2=0;
77. end

77
Appendices

78. cdop = wmop + 1;


79. if((clock >= cdop && clock <= cdop +1.75)) %CD
80. s4=1;
81. shiftpower = shiftpower + 0.250;
82. else s4 =0;
83. end
84. dwop = cdop + 5 ;
85. if((clock >= dwop && clock <= dwop+1.5)) %DW
86. s3 = 1;
87. shiftpower = shiftpower + 2.026;
88. else s3=0;
89. end
90. l2 = zeros(1,24);
91. l1 = 1;
92. while ( l1 <= 24 )
93. l2(l1) = l1 ;
94. l1 = l1+1;
95. end
96. %}
97. x222 = f1;
98. k2 = l2(mp1);
99. counter1 = 1;
100. counter2 = 1;
101. counter3 = 1;
102. counter4 = 1;
103. un= unique(RTP_DATA);
104. unsorted = sort(un,'descend');
105. unlocation= find(x==unsorted(1));
106. maxhours = [unlocation,unlocation+1,unlocation-1];
107. acdelay = 1;
108. while(acdelay < 24)
109. if( f1(counter1)+2 == maxhours(3))

78
Appendices

110. if( (clock >= f1(counter1)&& clock <= f1(counter1)+2) ) %AC Algorithm GRAPH 1
111. ac = 1;
112. shiftpower = shiftpower + 1.31 ;
113. shiftableprices = shiftableprices + 2*( 1.31*RTP_DATA(f1(counter1)) +
1.31*RTP_DATA(f1(counter1+1)));
114. else
115. ac = 0;
116. end
117. else
118. counter1=counter1+1;
119. end
120. acdelay = acdelay+1;
121. end
122. delay=1;
123. while(delay < 24)
124. if( f1(counter2) == maxhours(2)+1)
125. if((clock >= f1(counter2)&& clock <= f1(counter2)+2)) %WM algorithm GRAPH 2
126. washmach=1;
127. shiftpower = shiftpower + 1.085 ;
128. shiftableprices = shiftableprices + 2*(1.085*RTP_DATA(f1(counter2)) +
1.085*RTP_DATA(f1(counter2+1)));
129. else
130. washmach=0;
131. end
132. else
133. counter2=counter2+1;
134. end
135. delay=delay+1;
136. end
137. delay2=1;
138. while(delay2 < 24)
139. if(f1(counter3) == maxhours(2)+2)

79
Appendices

140. if((clock >= f1(counter3)&& clock <= f1(counter3)+2)) %DW


141. dishwasher=1;
142. shiftpower = shiftpower + 2.055 ;
143. shiftableprices = shiftableprices + 2*(2.055*RTP_DATA(f1(counter3)) +
2.055*RTP_DATA(f1(counter3+1)));
144. else
145. dishwasher =0;
146. end
147. else
148. counter3 = counter3+1;
149. end
150. delay2=delay2+1;
151. end
152. delay3=1;
153. while(delay3 < 24)
154. if(f1(counter4) == maxhours(2)+2)
155. if((clock >= f1(counter4) && clock <= f1(counter4)+1)) %CD
156. clothesdry = 1;
157. shiftpower = shiftpower + 3.135 ;
158. shiftableprices = shiftableprices + 3.135*RTP_DATA(f1(counter4)) +
3.135*RTP_DATA(f1(counter4+1));
159. else
160. clothesdry=0;
161. end
162. else
163. counter4=counter4+1;
164. end
165. delay3=delay3+1;
166. end
167. %{
168. if( ac ==1 )
169. shiftpower = shiftpower + 1.2 ;

80
Appendices

170. end
171. if( washmach ==1 )
172. shiftpower = shiftpower + 0.25 ;
173. end
174. if( dishwasher ==1 )
175. shiftpower = shiftpower + 2.026 ;
176. end
177. if( clothesdry ==1 )
178. shiftpower = shiftpower + 0.25 ;
179. end
180. shiftpowerprice = shiftpower * 0.09 ;
181. totalprices = nonshiftprice + shiftpowerprice ;
182. %}

Shiftable function interrupt:

1. function
[interrupt1WM,interrupt1sig,interrupt2CD,interrupt2sig,interrupt3DW,interrupt3sig,interrupt4AC,in
terrupt4sig]= fcn(load ,clock,state , duration ,start_time )
2. %#codegen
3. % display ( ' select the load to be interrupted')
4. % display ( ' input the wanted state of load' ) on, off (1,0)
5. % display ( ' input the duration of the interrupt ')
6. % display ( ' input the starting time ')
7. t = floor(clock) ;
8. interrupt1WM = 0;
9. interrupt2CD = 0;
10. interrupt3DW = 0;
11. interrupt4AC = 0;
12. interrupt1sig=0;
13. interrupt2sig=0;
14. interrupt3sig=0;

81
Appendices

15. interrupt4sig=0;
16. if (load == 1 )
17. if(t == start_time)
a. interrupt1sig = 1;
18. if( t < (start_time + duration))
19. interrupt1WM = 1;
20. else
21. interrupt1WM =0 ;
22. end
23. end
24. end
25. if (load ==2 )
26. if(t == start_time)
a. interrupt2sig = 1;
27. if( t < (start_time + duration))
28. interrupt2CD = state;
29. end
30. end
31. end
32. if (load ==3 )
33. if(t == start_time)
a. interrupt3sig=1;
34. if( t < (start_time + duration))
35. interrupt3DW = state;
36. end
37. end
38. end
39. if (load ==4 )
40. if(t == start_time)
a. interrupt4sig = 1;
41. if( t < (start_time + duration))
42. interrupt4AC = state;

82
Appendices

43. end
44. end
45. end
46. %{
47. interrupt1price = 0 ;
48. cntr = 0;
49. duration1 = 2;
50. while(duration1 > 0)
51. interrupt1price = interrupt1price + RTP_DATA(start_time + cntr) * 1.2
52. duration1 = duration1 - 1;
53. cntr = cntr +1;
54. end
55. %}

Main function2:

1. function [out1,out2,out3,out4] =
fcn(interruptonline,interrupt1sig,interrupt1WM,out1func,interrupt2sig,interrupt2CD,out2func,interr
upt3sig,interrupt3DW,out3func,interrupt4sig,interrupt4AC,out4func)
2. out1=0;
3. out2=0;
4. out3=0;
5. out4=0;
6. if(interrupt1sig == 1 )
7. if(interruptonline ==1)
8. out1 = interrupt1WM ;
9. end
10. else
11. out1 = out1func;
12. end
13. if(interrupt2sig == 1 )
14. if(interruptonline ==1)

83
Appendices

15. out2 = interrupt2CD ;


16. end
17. else
18. out2 = out2func;
19. end
20. if(interrupt3sig == 1 )
21. if(interruptonline ==1)
22. out3 = interrupt3DW ;
23. end
24. else
25. out3 = out3func;
26. end
27. if(interrupt4sig == 1 )
28. if(interruptonline ==1)
29. out4 = interrupt4AC ;
30. end
31. else
32. out4 = out4func;
33. end
34. %{
35. if(interrupt5sig == 1 )
36. out5 = interrupt5pc ;
37. else
38. out5 = out5func;
39. end
40. %}

84

You might also like