-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgetSeasonalElectricityTariff.m
114 lines (101 loc) · 4.49 KB
/
getSeasonalElectricityTariff.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
function [rate] = getSeasonalElectricityTariff(buildingType, currentDate)
%getSeasonalElectricityTariff Returns a vector with the electricity
%tariff for each time step during the considered day, for the requested building.
% Based on the createElectricityTariffProfile.m file.
%% Handling inputs
arguments
buildingType (1,1) BuildingType {mustBeInteger, mustBeGreaterThanOrEqual(buildingType,1), mustBeLessThanOrEqual(buildingType,5)}
currentDate (1,1) datetime
end
if buildingType == 5
buildingType = 1; % If the building is hospital use "commercial tall", which is
end % the same tariff as large hotel (buildingType=1)
persistent RATES
%% Constants
if isempty(RATES), RATES = LOAD_TARIFFS(); end
%% Determine the relevant rate:
switch buildingType
case BuildingType.LargeHotel
if day(currentDate) ~= Weekday.Sunday && any(month(currentDate) == 6:9)
rate = RATES("285S");
else
rate = RATES("285");
end
case {BuildingType.FullServiceRestaurant, BuildingType.SmallHotel} % aka "FSR"
if all(day(currentDate) ~= [Weekday.Sunday, Weekday.Saturday]) && any(month(currentDate) == 6:9)
rate = RATES("282S");
else
rate = RATES("282");
end
case BuildingType.ResidentialHIGH % Residential high
if any(day(currentDate) == [Weekday.Sunday, Weekday.Saturday])
rate = RATES("184WE");
else
if any(month(currentDate) == 6:9)
rate = RATES("184S");
else
rate = RATES("184W");
end
end
end
end
function tariffs = LOAD_TARIFFS()
% All data is taken from https://www.lipower.org/about-us/tariff/
% Last update: LIPA-Tariff-September-2020.pdf
%% Rate 182 (unused)
%% Rate 184 (June-September Weekdays)
% Voluntary Large Residential Service with Multiple Rate Periods
% Here we are ignoring the "first 125 kWh" rates!
OOI = [0.0256, 0.2853, NaN]; % Off-Peak/On-Peak/Intermediate rates
tariffIdAtHour = [ones(10,1); ... 0am-10am
2*ones(10,1); ... 10am- 8pm
ones(4,1)]; % 8pm- 0am
R184S = ElectricityTariff( OOI(tariffIdAtHour), "184S", (0:23).' );
%% Rate 184 (October-May Weekdays)
% Voluntary Large Residential Service with Multiple Rate Periods
% Here we are ignoring the "first 125 kWh" rates!
OOI = [0.0256, 0.0801, NaN]; % Off-Peak/On-Peak/Intermediate rates
tariffIdAtHour = [ones(10,1); ... 0am-10am
2*ones(10,1); ... 10am- 8pm
ones(4,1)]; % 8pm- 0am
R184W = ElectricityTariff( OOI(tariffIdAtHour), "184W", (0:23).' );
%% Rate 184 (Weekends)
% Voluntary Large Residential Service with Multiple Rate Periods
OOI = [0.0256, NaN, NaN]; % Off-Peak/On-Peak/Intermediate rates
tariffIdAtHour = ones(24,1);
R184WE = ElectricityTariff( OOI(tariffIdAtHour), "184WE", (0:23).' );
%% Rate 282 (June-September Weekdays)
% Voluntary Large Demand Metered Service With Multiple Rate Periods
OOI = [0.0035, 0.0251, 0.021]; % Off-Peak/On-Peak/Intermediate rates
tariffIdAtHour = [ones(7,1); ... 0am- 7am
3*ones(5,1); ... 7am-12pm
2*ones(8,1); ... 12pm- 8pm
3*ones(3,1); ... 8pm-11pm
ones(1,1)]; % 11pm- 0am
R282S = ElectricityTariff( OOI(tariffIdAtHour), "282S", (0:23).' );
%% Rate 282 (Non-Summer + Weekends in Summer)
% Voluntary Large Demand Metered Service With Multiple Rate Periods
OOI = [0.0035, NaN, 0.021]; % Off-Peak/On-Peak/Intermediate rates
tariffIdAtHour = [ones(7,1); ... 0am- 7am
3*ones(16,1); ... 7am-11pm
ones(1,1)]; % 11pm- 0am
R282 = ElectricityTariff( OOI(tariffIdAtHour), "282", (0:23).' );
%% Rate 285 (June-September, "Secondary" consumer)
% Large General and Industrial Service With Multiple Rate Periods
OOI = [0.0058, 0.0376, 0.024]; % Off-Peak/On-Peak/Intermediate rates
tariffIdAtHour = [ones(7,1); ... 0am- 7am
3*ones(3,1); ... 7am-10am
2*ones(12,1); ... 10am-10pm
3*ones(2,1)]; % 10pm- 0am
R285S = ElectricityTariff( OOI(tariffIdAtHour), "285 (Summer)", (0:23).' );
%% Rate 285 (October-May + Sunday in Summer)
% Large General and Industrial Service With Multiple Rate Periods
OOI = [0.0058, NaN, 0.024]; % Off-Peak/On-Peak/Intermediate rates
tariffIdAtHour = [ones(7,1); ... 0am-7am
3*ones(17,1)]; % 7am-0am
R285 = ElectricityTariff( OOI(tariffIdAtHour), "285", (0:23).' );
%% Rate 580 (unused)
%% Pack all tariffs
tariffs = containers.Map(["184S", "184W", "184WE", "282S", "282", "285S", "285"],...
{R184S, R184W, R184WE, R282S, R282, R285S, R285});
end