]> git.basschouten.com Git - openhab-addons.git/blob
a79ca9ab5e9dc36a5b28ead229b8a85bd2218916
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.energidataservice.internal.api;
14
15 import static org.openhab.binding.energidataservice.internal.EnergiDataServiceBindingConstants.*;
16
17 import java.time.LocalDate;
18 import java.util.Set;
19
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21
22 /**
23  * Factory for creating a {@link DatahubTariffFilter} for a specific Grid Company GLN.
24  * 
25  * @author Jacob Laursen - Initial contribution
26  */
27 @NonNullByDefault
28 public class DatahubTariffFilterFactory {
29
30     private static final String GLN_AAL_ELNET = "5790001095451";
31     private static final String GLN_CERIUS = "5790000705184";
32     private static final String GLN_DINEL = "5790000610099";
33     private static final String GLN_ELEKTRUS = "5790000836239";
34     private static final String GLN_ELINORD = "5790001095277";
35     private static final String GLN_ELNET_MIDT = "5790001100520";
36     private static final String GLN_ELNET_KONGERSLEV = "5790002502699";
37     private static final String GLN_FLOW_ELNET = "5790000392551";
38     private static final String GLN_HAMMEL_ELFORSYNING_NET = "5790001090166";
39     private static final String GLN_HURUP_ELVAERK_NET = "5790000610839";
40     private static final String GLN_IKAST_E1_NET = "5790000682102";
41     private static final String GLN_KONSTANT = "5790000704842";
42     private static final String GLN_L_NET = "5790001090111";
43     private static final String GLN_MIDTFYNS_ELFORSYNING = "5790001089023";
44     private static final String GLN_N1 = "5790001089030";
45     private static final String GLN_NETSELSKABET_ELVAERK = "5790000681075";
46     private static final String GLN_NKE_ELNET = "5790001088231";
47     private static final String GLN_NORD_ENERGI_NET = "5790000610877";
48     private static final String GLN_NORDVESTJYSK_ELFORSYNING_NOE_NET = "5790000395620";
49     private static final String GLN_RADIUS = "5790000705689";
50     private static final String GLN_RAH_NET = "5790000681327";
51     private static final String GLN_RAVDEX = "5790000836727";
52     private static final String GLN_SUNDS_NET = "5790001095444";
53     private static final String GLN_TARM_ELVAERK_NET = "5790000706419";
54     private static final String GLN_TREFOR_EL_NET = "5790000392261";
55     private static final String GLN_TREFOR_EL_NET_OEST = "5790000706686";
56     private static final String GLN_VEKSEL = "5790001088217";
57     private static final String GLN_VORES_ELNET = "5790000610976";
58     private static final String GLN_ZEANET = "5790001089375";
59
60     private static final String NOTE_NET_TARIFF = "Nettarif";
61     private static final String NOTE_NET_TARIFF_C = NOTE_NET_TARIFF + " C";
62     private static final String NOTE_NET_TARIFF_C_HOUR = NOTE_NET_TARIFF_C + " time";
63     private static final String NOTE_NET_TARIFF_C_FLEX = NOTE_NET_TARIFF_C + " Flex";
64     private static final String NOTE_NET_TARIFF_C_FLEX_HOUR = NOTE_NET_TARIFF_C_FLEX + " - time";
65     private static final String NOTE_SYSTEM_TARIFF = "Systemtarif";
66     private static final String NOTE_ELECTRICITY_TAX = "Elafgift";
67     private static final String NOTE_TRANSMISSION_NET_TARIFF = "Transmissions nettarif";
68
69     public static final LocalDate N1_CUTOFF_DATE = LocalDate.of(2023, 1, 1);
70     public static final LocalDate RADIUS_CUTOFF_DATE = LocalDate.of(2023, 1, 1);
71     public static final LocalDate KONSTANT_CUTOFF_DATE = LocalDate.of(2023, 2, 1);
72
73     public static DatahubTariffFilter getNetTariffByGLN(String globalLocationNumber) {
74         switch (globalLocationNumber) {
75             case GLN_AAL_ELNET:
76                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("AAL-NT-05"), ChargeTypeCode.of("AAL-NTR05")),
77                         Set.of(NOTE_NET_TARIFF_C_HOUR), DateQueryParameter.of(DateQueryParameterType.START_OF_DAY));
78             case GLN_CERIUS:
79                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("30TR_C_ET")), Set.of(NOTE_NET_TARIFF_C_HOUR));
80             case GLN_DINEL:
81                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("TCL>100_02"), ChargeTypeCode.of("TCL<100_52")),
82                         Set.of(NOTE_NET_TARIFF_C_HOUR));
83             case GLN_ELEKTRUS:
84                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("6000091")), Set.of(NOTE_NET_TARIFF_C_HOUR),
85                         DateQueryParameter.of(DateQueryParameterType.START_OF_DAY));
86             case GLN_ELINORD:
87                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("43300")),
88                         Set.of("Transportbetaling, eget net C"));
89             case GLN_ELNET_MIDT:
90                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("T3002")), Set.of(NOTE_NET_TARIFF_C),
91                         DateQueryParameter.of(DateQueryParameterType.START_OF_DAY));
92             case GLN_ELNET_KONGERSLEV:
93                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("K_22100")), Set.of(NOTE_NET_TARIFF_C));
94             case GLN_FLOW_ELNET:
95                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("FE2 NT-01")), Set.of(NOTE_NET_TARIFF_C_HOUR),
96                         DateQueryParameter.of(DateQueryParameterType.START_OF_DAY));
97             case GLN_HAMMEL_ELFORSYNING_NET:
98                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("50001")), Set.of("Overliggende net"),
99                         DateQueryParameter.of(DateQueryParameterType.START_OF_DAY));
100             case GLN_HURUP_ELVAERK_NET:
101                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("HEV-NT-01")), Set.of(NOTE_NET_TARIFF));
102             case GLN_IKAST_E1_NET:
103                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("IEV-NT-11")),
104                         Set.of(NOTE_NET_TARIFF_C_HOUR, "Transport - Overordnet net"));
105             case GLN_KONSTANT:
106                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("151-NT01T"), ChargeTypeCode.of("151-NRA04T")),
107                         Set.of(), DateQueryParameter.of(KONSTANT_CUTOFF_DATE));
108             case GLN_L_NET:
109                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("4010")), Set.of(NOTE_NET_TARIFF_C_HOUR));
110             case GLN_MIDTFYNS_ELFORSYNING:
111                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("TNT15000")), Set.of(NOTE_NET_TARIFF_C_FLEX),
112                         DateQueryParameter.of(DateQueryParameterType.START_OF_DAY));
113             case GLN_N1:
114                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("CD"), ChargeTypeCode.of("CD R")), Set.of(),
115                         DateQueryParameter.of(N1_CUTOFF_DATE));
116             case GLN_NETSELSKABET_ELVAERK:
117                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("0NCFF")), Set.of(NOTE_NET_TARIFF_C + " Flex"),
118                         DateQueryParameter.of(DateQueryParameterType.START_OF_DAY));
119             case GLN_NKE_ELNET:
120                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("94TR_C_ET")), Set.of(NOTE_NET_TARIFF_C_HOUR),
121                         DateQueryParameter.of(DateQueryParameterType.START_OF_DAY));
122             case GLN_NORD_ENERGI_NET:
123                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("TAC")), Set.of(NOTE_NET_TARIFF_C),
124                         DateQueryParameter.of(DateQueryParameterType.START_OF_DAY));
125             case GLN_NORDVESTJYSK_ELFORSYNING_NOE_NET:
126                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("Net C")), Set.of(NOTE_NET_TARIFF_C));
127             case GLN_RADIUS:
128                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("DT_C_01")), Set.of(NOTE_NET_TARIFF_C_HOUR),
129                         DateQueryParameter.of(RADIUS_CUTOFF_DATE));
130             case GLN_RAH_NET:
131                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("RAH-C")), Set.of(NOTE_NET_TARIFF_C_HOUR),
132                         DateQueryParameter.of(DateQueryParameterType.START_OF_DAY));
133             case GLN_RAVDEX:
134                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("NT-C")), Set.of(NOTE_NET_TARIFF_C_HOUR),
135                         DateQueryParameter.of(DateQueryParameterType.START_OF_DAY));
136             case GLN_SUNDS_NET:
137                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("SEF-NT-05"), ChargeTypeCode.of("SEF-NT-05R")),
138                         Set.of(NOTE_NET_TARIFF_C_FLEX_HOUR),
139                         DateQueryParameter.of(DateQueryParameterType.START_OF_DAY));
140             case GLN_TARM_ELVAERK_NET:
141                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("TEV-NT-01"), ChargeTypeCode.of("TEV-NT-01R")),
142                         Set.of(NOTE_NET_TARIFF_C));
143             case GLN_TREFOR_EL_NET:
144                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("C")), Set.of(NOTE_NET_TARIFF_C_HOUR),
145                         DateQueryParameter.of(DateQueryParameterType.START_OF_DAY));
146             case GLN_TREFOR_EL_NET_OEST:
147                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("46")), Set.of(NOTE_NET_TARIFF_C_HOUR),
148                         DateQueryParameter.of(DateQueryParameterType.START_OF_DAY));
149             case GLN_VEKSEL:
150                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("NT-10")),
151                         Set.of(NOTE_NET_TARIFF_C_HOUR + "  NT-10"));
152             case GLN_VORES_ELNET:
153                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("TNT1009")), Set.of(NOTE_NET_TARIFF_C_HOUR),
154                         DateQueryParameter.of(DateQueryParameterType.START_OF_DAY));
155             case GLN_ZEANET:
156                 return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("43110")), Set.of(NOTE_NET_TARIFF_C_HOUR),
157                         DateQueryParameter.of(DateQueryParameterType.START_OF_DAY));
158             default:
159                 return new DatahubTariffFilter(Set.of(), Set.of(NOTE_NET_TARIFF_C),
160                         DateQueryParameter.of(DateQueryParameterType.START_OF_YEAR));
161         }
162     }
163
164     public static DatahubTariffFilter getSystemTariff() {
165         return new DatahubTariffFilter(Set.of(), Set.of(NOTE_SYSTEM_TARIFF),
166                 DateQueryParameter.of(ENERGINET_CUTOFF_DATE));
167     }
168
169     public static DatahubTariffFilter getElectricityTax() {
170         return new DatahubTariffFilter(Set.of(), Set.of(NOTE_ELECTRICITY_TAX),
171                 DateQueryParameter.of(ENERGINET_CUTOFF_DATE));
172     }
173
174     public static DatahubTariffFilter getTransmissionNetTariff() {
175         return new DatahubTariffFilter(Set.of(), Set.of(NOTE_TRANSMISSION_NET_TARIFF),
176                 DateQueryParameter.of(ENERGINET_CUTOFF_DATE));
177     }
178 }