Smart Home - Electrical and Computer Engineering

advertisement
EE5900 Advanced Embedded System
For Smart Infrastructure
Computationally Efficient Smart Home Scheduling
Outline
1
Smart Home
2
Cloud Computing
3
Algorithm
4
Case Study
5
Conclusion
2
Smart Home
Power Line
Communication
Line
3
Start
Dish washer
End
13:00 18:00
Landry machine 09:00 18:00
PHEV
18:00 08:00
AC
17:00 N/A
……
4
Home Appliance (HA) in Smart Home
Non-schedulable HA
Restrictive-schedulable HA
Full-schedulable HA
5
Multiple Power Levels
Power level
350 W
500 W
820 W
1350 W
http://www.supplyairconditioner.com/1-4-9-split-wall-mounted-air-conditioner.html
6
Multiple Working Stages
Working cycles
Prewash
Spinning
Washing
Drying
Rinsing
 Assume all stages have same working frequency for simplicity
 Partition the whole task to multiple subtasks with precedence constraints
7
Plug-in Hybrid Electric Vehicles (PHEV)
Powered by an Electric Motor and Engine
• Internal combustion engine uses alternative
or conventional fuel
• Battery charged by outside electric power
source, engine, or regenerative breaking
• During urban driving, most power comes
from stored electricity. Long trips require
the engine
8
Contemporary Hybrids
Toyota Camry
Honda Civic
Saturn Vue
Toyota Prius
Honda Accord
Ford Escape
Toyota Highlander
Honda Insight
Lexus RX400h
Lexus GS450h
Chevy Silverado
9
Charging of PHEV
Level 1: 120 V, alternating current (AC) plug; dedicated circuit
Level 2: 240 V, AC plug and uses the same connector on the vehicle as
Level 1
Level 3: In development; faster AC charging
10
Existing Products of Battery
 Accord PHEV
120-volt: less than 3 hours
240-volt: one hour
 Toyata PHEV
120-volt: less than 3 hours
240-volt: 1.5 hours
Quick charge to 80% needs 30 minutes.
11
Dynamic Pricing from Utility Company
https://rrtp.comed.com/live-prices/?date=20130404
12
Dynamic Voltage and Frequency Scaling (DVFS)
Powerr
Power
5 cents / kwh
10 cents/kwh
10 cents/kwh
5 cents / kwh
10 kwh
5 kwh
1
2
Time
(a)
cost = 10 kwh * 10 cents/kwh = 100 cents
1
2
(b)
3
Time
cost = 5 kwh * 10 cents/kwh + 5 kwh * 5 cents/kwh
= 75 cents
13
Smart Home Scheduling (SHS)
 Given n home appliances, to schedule them for monetary cost minimization
satisfying the total energy constraint and deadline constraints
 Demand Side Management
– when to launch a home appliance
– at what frequency
– The variable frequency drive (DVFS) is to control the rotational speed
of an alternating current (AC) electric motor through controlling the
frequency of the electrical power supplied to the motor
– for how long
14
Benefit of Smart Home
– Reduce monetary expense
– Reduce peak load
15
Smart Home Scheduling (SHS)
Home appliance level
User level
Community level
16
Smart Home Scheduling (SHS)
 Home appliance level
 User level
 Community level
17
Single Home appliance Scheduling
Non-schedulable HA
Consider the non-schedulable home appliance as fix energy consumption
18
Single Home appliance Scheduling
Restrictive-schedulable HA
For restrictive-schedulable home appliance, set start time to be
earlier than the user’s requirement.
For example, in summer, user wants to come back to home at 5pm.
The AC should be on before 5pm.
19
Single Home appliance Scheduling
Full-schedulable HA
For full-schedulable home appliance, one needs to schedule
when to launch a home appliance at what frequency considering
DVFS for how long to minimize monetary cost satisfying that the
total energy is consumed.
20
Home Appliance Definition
 Ts: Start time
 Te: End time
 Pi: Power level
 E: Total required energy
 𝛼𝑡 : Unit price of time slot t
21
Dynamic Programming
 Given a home appliance, one processes time slot one by
one for all possibilities until the last time slot and choose
the best solution
𝑇𝑠
𝑇𝑠 + 1
𝑇𝑠 + 2
𝑇𝑒 − 1
𝑇𝑒
0
0
0
𝑃1
𝑃1
𝑃1
𝑃2
𝑃2
𝑃2
Choose the solution with total energy equal to E and minimal monetary cost
22
Characterizing
 For a solution in time slot i, energy consumption e and
cost c uniquely characterize its state
Time slot i
Time slot i+1
(ei, ci)
(ei+1, ci+1)
𝑒0 = 0, 𝑐0 = 0
𝑒𝑖+1 = 𝑒𝑖 + 𝑝𝑖+1
𝑐𝑖+1 = 𝑐𝑖 + 𝑝𝑖+1 ∙ 𝛼𝑖+1
23
Pruning
 For one time interval, (e1, c1) will dominate solution
(e2, c2), if e1>= e2 and c1<= c2
Time slot i
(15, 20)
(15, 25)
(11, 22)
24
Algorithmic Flow of Dynamic Programming
Start time t = Ts
Calculate all possible (e, c)
Prune all dominated (e, c)
End time t = Te
Next time slot
t=t+1
No
Yes
Choose the result (e, c) which
e = E and c is minimal
e<E
No Schedule
Schedule
25
Dynamic Programming based Appliance Optimization
Power level: {1, 2, 3}
𝛼1 = 2
Price
0
𝛼2 = 1
(3,6)
(3,3)
(2,4)
(2,2)
(1,2)
(1,1)
(0,0)
Dynamic Programming returns
optimal solution
t1
(0,0)
Runtime :
(6, 9) (5, 7) (4, 5) (3, 3)
(5, 8) (4, 6) (3, 4) (2, 2)
(4, 7) (3, 5) (2, 3) (1, 1)
Time
t2
2
O(m k )
–
# of distinct power levels = k
–
# time slots = m
26
Smart Home Scheduling (SHS)
 Home appliance level
 User level
 Community level
27
Scheduling Among Multiple Appliances for One
User
Appliances
Determine Scheduling
Appliances Order
An appliance
Schedule Current Task
Not all the appliance(s)
processed
Update Upper Bound of
Each Time Interval
All appliance process
Schedule
28
Smart Home Scheduling (SHS)
 Home appliance level
 User level
 Community level
29
Game Approach
Price Curve
0
1.5
3
4.5
6
7.5
9
10.5
12
13.5
15
16.5
18
19.5
21
22.5
24
14
12
10
8
6
4
2
0
User 1
User 2
.............
User m
A game approach is deployed where each customer acts as a player.
30
Game Theory
 For every player in a game, there is a set of strategies
and a payoff function, which is the profit of the player.
 Each player choose actions from the set of strategies in
order to maximize its payoff.
 When no player can increase its payoff without changing
the actions of others, Nash Equilibrium is reached.
31
Game Formulation in Community Level
Players: All the customers in the community
Payoff: −
𝑙ℎ,𝑗 𝐶ℎ
𝐿ℎ
Strategy: Choose power levels and launch time to maximize
payoff while the constraint conditions can be satisfied
32
Algorithmic Flow in Community Level
Each user schedules their
own appliances separately
All users share information
with each other
Each user reschedules their
own appliances separately
No
Equilibrium
Yes
Schedule
33
Multiple Customer Scheduling
u1
u2
u3
FPGA
FPGA
FPGA
r1
r2
r3
• Low frequency
• HighCommunication
cost
• Hard to maintain
First iteration
Communication
u1
u2
u3
FPGA
FPGA
FPGA
Second iteration
……
……
Schedule
Equilibrium
34
Cloud Computing
 In Cloud Computing, a new class
of network based computing
takes place over the Internet
 It is a collection/group of
integrated and networked
hardware, software and Internet
infrastructure
35
Why Cloud Computing
 Advantages
– Low cost
– High availability, flexibility, elasticity
– You can increase or decrease capacity within minutes,
not hours or days;
– You can commission one, hundreds or even thousands
of server instances simultaneously.
– Your application can automatically scale itself up and
down depending on its needs.
– Free of maintenance
– Security
36
Service models
Software as a
Service (SaaS)
Platform as a
Service (PaaS)
Infrastructure as a
Service (IaaS)
SalesForce
CRM
LotusLive
Google
App
Engine
37
Cloud Taxonomy
38
Some Commercial Cloud Offerings
39
Amazon EC2
 Amazon EC2 is one large complex web service.
 EC2 provided an API for instantiating computing
instances with any of the operating systems
supported.
 It can facilitate computations through Amazon
Machine Images (AMIs) for various other models.
40
Google App Engine
 This is more a web interface for a development
environment that offers a one stop facility for design,
development and deployment Java and Pythonbased applications in Java and Python.
 Google offers the same reliability, availability and
scalability at par with Google’s own applications
 Interface is software programming based
41
Windows Azure
 Enterprise-level on-demand capacity builder
 Fabric of cycles and storage available on-request for a cost
 You have to use Azure API to work with the infrastructure
offered by Microsoft
42
In Home vs. Cloud Computing Scheduling
 Cost
– High performance FPGA vs. Low performance FPGA + Cloud
– Low performance FPGA vs. Low performance FPGA + Cloud
 Upgrade
– Upgrade FPGA vs. Cloud service
 Maintenance
– Broken FPGA
– Cloud is free of maintenance
 Runtime
– In Home vs. Cloud Computing
43
Estimation of Computation Time of Low
Performance FPGA
 FPGA in smart home: 250 MHz
– 1000 users with 1000 FPGA
– Runtime is approximately 10 seconds in one iteration
– Communication time: 10kb/250kb/s=0.04s
– 100 iterations: (10+0.04)*100 = 1004 sec = 16.73 min
 Since the pricing policy is updated each 15 minutes by most utilities,
16.73 minutes are unacceptable.
 Why not using some quite high performance machines in each
home?
44
Cloud Based Distributed Algorithm
u1
u2
u3
FPGA
FPGA
FPGA
r1
r2
r3
Communication
First iteration
Communication
Cloud
r1
r2
r3
……
……
Equilibrium
Schedule
FPGA
FPGA
FPGA
u1
u2
u3
45
Monetary Cost Aware Scheduling Problem
 There are different types of machines in cloud
with different monetary cost, frequencies and
storage
 One is required to schedule those users’ tasks to
appropriate machines to minimize the monetary
cost of the distributed algorithm satisfying the
timing constraints
46
An example I
 FPGA: 250 MHz
 CPU in cloud: 2 GHz with $0.02/hour, 3 GHz with $0.06/hour
 Timing constraints Tc = 5
Runtime (s)
u1
u2
u3
u4
FPGA
12
14
10
15
2 GHz
1.5
1.75
1.25
1.88
3 GHz
1
1.17
0.83
1.25
If one schedules tasks of user 3 to CPU with 2 GHz and
schedules tasks of user 1, 2 and 4 to CPU with 3 GHz, then
The monetary cost
C = 1.25 / 3600 * 0.02 + (1+1.17+1.25) / 3600 * 0.06 = $6.39 * 10 -5.
The runtime T = max{1.25, 1+1.17+1.25} = 3.42 < Tc.
47
An example II
 FPGA: 250 MHz
 CPU in cloud: 2 GHz with $0.02/hour, 3 GHz with $0.06/hour
 Timing constraints Tc = 5
u1
u2
u3
u4
Runtime (s)
12
14
10
15
2 GHz (s)
1.5
1.75
1.25
1.88
3 GHz (s)
1
1.17
0.83
1.25
If one schedules tasks of user 1 and 2 to CPU with 2 GHz and
schedules tasks of user 3 and 4 to CPU with 3 GHz, then
The monetary cost
C = (1.5 + 1.75) / 3600 * 0.02 + (0.83 + 1.25) / 3600 * 0.06 = $5.27 * 10 -5.
The runtime T = max{1.5 + 1.75, 0.83 + 1.25} = 3.25 < Tc.
48
Problem Formulation
 Given 𝑛 users in smart home scheduling problems with
runtime 𝑡𝑟𝑖 running in local machine with frequency 𝑓𝑟 , 𝑚
types of machines in cloud with frequency 𝑓𝑗 and
monetary cost 𝑐𝑗 , one needs to schedule these 𝑛 users’
tasks to 𝑚 machines such that the total monetary cost is
minimized and maximum runtime over all the machines
satisfies the timing constraints.
49
Monetary Cost Problem Formulation
 𝑀𝑖𝑛
𝑠. 𝑡.
𝑀
𝑀=
𝑚
𝑗=1
𝑇𝑗 =
𝑛
𝑖=1 𝑥𝑖,𝑗
𝑚
𝑗=1 𝑥𝑖,𝑗
𝑛
𝑖=1 𝑥𝑖,𝑗
∙ 𝑡𝑟𝑖 ∙
∙ 𝑡𝑟𝑖 ∙ 𝑐𝑗 ∙
𝑓𝑟
𝑓𝑗
𝑓𝑟
𝑓𝑗
, 𝑗 = 1, 2, … , 𝑚
= 1, 𝑖 = 1, 2, … , 𝑛
𝑥𝑖,𝑗 = 0 𝑜𝑟 1
𝑀𝑎𝑥 𝑇𝑗 ≤ 𝑇𝑐
50
Linear Programming With Rounding
 𝑀𝑖𝑛
𝑠. 𝑡.
𝑀
𝑀=
𝑚
𝑗=1
𝑇𝑗 =
𝑛
𝑖=1 𝑥𝑖,𝑗
𝑚
𝑗=1 𝑥𝑖,𝑗
𝑛
𝑖=1 𝑥𝑖,𝑗
∙ 𝑡𝑟𝑖 ∙
∙ 𝑡𝑟𝑖 ∙ 𝑐𝑗 ∙
𝑓𝑟
𝑓𝑗
𝑓𝑟
𝑓𝑗
, 𝑗 = 1, 2, … , 𝑚
= 1, 𝑖 = 1, 2, … , 𝑛
𝑀𝑎𝑥 𝑇𝑗 ≤ 𝑇𝑐
For each 𝑖, round the largest 𝑥𝑖,𝑗 to be 1, others to 0
51
Algorithmic Flow
Solve the continuous fashion
problem combinatorially
Flag all machine to be available
Assign task fractionally to the
available machine with highest
ratio of 𝒄/𝒇
Sort all machines
increasingly by by
ratio of 𝒄/𝒇
No
Runtime of
machine is
reaching TC
Discretize the
continuous
solution
Yes
Flag the machine to
be unavailabe
52
Combinatorial solving
TC
Tc – Timing constraints
fi - Frequency of cloud machines
……
f1
f2
…… f
m-1
fm
53
Discretization
TC
3
2
3
1
T’
TC
3
2
1
f1
f2
f1
f2
(b)
(a) fractional scheduled task to machine
Since we always round
with smaller
𝑐
ratio 𝑓, the total monetary cost must be no greater than the optimal solution
𝑓
while the timing constraint may be violated by 𝑇𝐴𝐿𝐺 ≤ 𝑇𝐶 + max 𝑡𝑖 ∙ ( 𝑚𝑎𝑥 − 1)
𝑓𝑚𝑖𝑛
54
Theorem
 There exists an algorithm such that the total monetary
cost must be no greater than the solution of continuous
problem while the timing constraint may be violated by
𝑓𝑚𝑎𝑥
𝑇𝐴𝐿𝐺 ≤ 𝑇𝐶 + max 𝑡𝑖 ∙ (
− 1), running in 𝑂(𝑛𝑙𝑜𝑔𝑛) time
𝑓𝑚𝑖𝑛
55
High Level Algorithm
u1
u2
u3
FPGA
FPGA
FPGA
r1
r2
r3
Communication
Cloud
r1
r2
First iteration
Communication
r3
……
……
Equilibrium
Schedule
FPGA
FPGA
FPGA
u1
u2
u3
The distributed algorithm needs multiple iterations to achieve the
equilibrium, thus the scheduling algorithm needs to handle all the
iterations repeatedly.
56
FPGA & Amazon EC2
 Low performance FPGA in smart home: 250 MHz
 Computer in cloud:
– 1 core with 1 ECU (approx.. 1.7 GHz, $0.034 per hour)
– 1 core with 2 ECU (approx.. 3.5 GHz, $0.068 per hour)
– 2 cores with 2 ECU (approx.. 3.5 GHz, $0.136 per hour)
– 4 cores with 2 ECU (approx.. 3.5 GHz, $0.271 per hour)
 Communication time: 10kb/250kb/s=0.04s
 Observing that there are machines with multiple cores, we can
schedule multiple tasks to one machine with multiple cores at the
same time
57
Comparison for 1000 users
 W/o cloud
– 1000 users with 1000 FPGA
– Runtime is approximately 14 seconds in one iteration
– Communication time: 10kb/250kb/s=0.04s
– 100 iterations: (10+0.04)*100 = 1004 sec = 16.73 min
 W/ cloud of 1 core with 1 ECU
– 1000 computers in cloud
– Runtime is approximately 2 seconds in one iteration
– Communication time: 10kb/250kb/s=0.04s
– 100 iterations: (2+0.04)*100 = 3.4 min (4.92X)
58
Comparison for 1000 users
 W/ cloud of 1 core with 2 ECU
– 1000 computers in cloud
– Runtime is approximately 1 seconds in one iteration
– Communication time: 10kb/250kb/s=0.04s
– 100 iterations: (1+0.04)*100 = 1.7 min (9.84X)
 W/ cloud of 4 core with 2 ECU (Parallel in four cores)
– 250 computers in cloud
– Runtime is approximately 1 seconds in one iteration
– Communication time: 10kb/250kb/s=0.04s
– 100 iterations: (1+0.04)*100 = 1.73 min (9.67X)
59
Case Study Setup
 Low performance FPGA in smart home: 250 MHz, $200
 High performance FPGA in smart home: 1250 MHz, $2000
 Computer in cloud:
– 1 core with 1 ECU (approx.. 1.7 GHz, $61/yr upfront, $0.034/hr)
– 1 core with 2 ECU (approx.. 3.5 GHz, $122/yr upfront, $0.068/hr)
– 2 cores with 2 ECU (approx.. 3.5 GHz, $243/yr upfront, $0.136/hr)
– 4 cores with 2 ECU (approx.. 3.5 GHz, $486/yr upfront, $0.271/hr)
http://www.xilinx.com/support/documentation/data_sheets/ds160.pdf
http://www.amazon.com/C3-DRK-Digital-RadioKit/dp/B001KBPIOQ/ref=sr_1_8?s=pc&ie=UTF8&qid=1365106998&sr=1-8&keywords=fpga
http://aws.amazon.com/ec2/pricing/
60
Case Study Setup (Cont.)
 Home appliances category
Start time: 16:00
– Restrictive-schedulable
End time: 18:00
Frequency level: 20Hz,
40Hz, 60Hz, 80Hz
– Full-schedulable
Start time: 9:00
End time: 18:00
Frequency level: 20Hz,
40Hz, 60Hz, 80Hz
– Non-schedulable
Start time: 0:00
End time: 23:59
61
Case Study Setup (Cont.)
 200 to 1000 users in one community
 Each user could have 10 – 30 home appliance
– 30% of restrictive-schedulable home appliance
– 50% of full-schedulable home appliance
– 20% of non-schedulable home appliance
62
An Example – One User
HA
Start time
End time
Total energy
(kW.h)
Power
levels (W)
AC
17:00
20:00
8
{400, 600,
800, 1000,
3000}
Washer &
Dryer
09:00
18:00
5
1000
Dish Washer
09:00
18:00
3
1000
PHEV
18:00
07:00
12
{1900, 3000,
20k, 240k}
Refrigerator
00:00
23:59
1.2
50
http://www​.mpoweruk.​com/electricity_demand.htm
63
Total Bill – Monthly
Dollars
200
180
160
140
120
100
80
60
40
20
0
Utility Bill W/o SHS
Utility Bill w/ Low
Performance FPGA
In Home SHS
Utility Bill w/ Cloud
SHS
64
Runtime
Minutes
18
16
14
12
10
8
6
4
2
0
Runtime of Low
performance FPGA
In Home SHS
Runtime of Cloud
SHS
65
High Performance FPGA
 FPGA in smart home: 1250 MHz, $2000
 Runtime
– 1000 users with 1000 FPGA
– Runtime is approximately 2 seconds in one iteration
– Communication time: 10kb/250kb/s=0.04s
– 100 iterations: (2+0.04)*100 = 204 sec = 3.4 min
– No real time issue
66
Total Bill – First Year
Dollars
4000
3500
3000
2500
2000
1500
1000
500
0
Utility Bill W/o SHS
Utility Bill w/ High
performance FPGA
In Home SHS
Utility Bill w/ Cloud
SHS
67
Total Bill – Ten Years
Dollars
25000
20000
Utility Bill W/o SHS
15000
10000
5000
Utility Bill w/ High
performance FPGA
In Home SHS
Utility Bill w/ Cloud
SHS
0
68
Total Bill – Ten Years Cloud computing service cost
reduction
Dollars
25000
20000
Utility Bill W/o SHS
15000
10000
5000
Utility Bill w/ High
performance FPGA
In Home SHS
Utility Bill w/ Cloud
SHS
0
 Cloud computing service cost reduction rate: 10%/yr
69
Total Bill – Ten Years FPGA Maintenance
Dollars
25000
20000
Utility Bill W/o SHS
15000
10000
5000
Utility Bill w/ High
performance FPGA
In Home SHS
Utility Bill w/ Cloud
SHS
0
 FPGA maintenance cost: $50/yr
70
Total Bill – Ten Years FPGA Broken
Dollars
25000
20000
Utility Bill W/o SHS
15000
10000
5000
Utility Bill w/ High
performance FPGA
In Home SHS
Utility Bill w/ Cloud
SHS
0
 FPGA broken rate: 2.8%
http://homepages.cae.wisc.edu/~aminf/FCCM09%20%20FPGA%20Design%20Analysis%20of%20the%20Clustering%20Algorithm%20for%20the%20CERN%20Large
%20Hadron%20Collider.pdf
71
Total Bill – Ten Years US Dollars Inflation
Dollars
30000
25000
20000
15000
10000
5000
Utility Bill W/o SHS
Utility Bill w/ High
performance FPGA
In Home SHS
Utility Bill w/ Cloud
SHS
0
 Inflation rate of US dollars: 2%/yr
http://www.usinflationcalculator.com/inflation/historical-inflation-rates/
72
Conclusion
 According to case study, our approach by use of cloud
can make several times speed up comparing to low
performance FPGA based algorithms such that the timing
constraints could be satisfied and archive 18.95%
monetary cost reduction on average
 If high performance FPGA is chosen, user needs to pay
58.3% on average more than bill without SHS in first year
of buying FPGA; user will pay higher than cloud based
scheme considering cost reduction of cloud computing,
maintenance and broken of FPGA in first ten years
 Overall, cloud computing is better than both low
performance FPGA and high performance FPGA
73
Further Study
 Design an algorithm to decide the number of machines in
cloud to minimize the reservation cost
 More case study will be conducted to generalize my
conclusion
74
Thanks
75
Download