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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
//! [`EegGesetz`] — typed EEG law version for a plant.
//!
//! Every plant that receives EEG/KWKG payments is governed by exactly one law version,
//! determined at commissioning and frozen for the plant's entire Förderdauer
//! (§100 EEG 2023 Übergangsbestimmungen, §100 EEG 2017 Übergangsbestimmungen).
//!
//! ## Bestandsschutz (grandfather clause)
//!
//! A plant keeps the rules of the EEG in force when it was commissioned. This
//! type carries that vintage for the rules that are **keyed on the law version**:
//!
//! | Commissioned | Governing law | §52 Pflichtverstoß regime |
//! |---|---|---|
//! | before 2016-01-01 | EEG 2012 (or earlier) | Vergütung → 0 |
//! | 2016-01-01 – 2020-12-31 | EEG 2017 | Vergütung → 0 |
//! | 2021-01-01 – 2022-12-31 | EEG 2021 | Vergütung → 0 |
//! | 2023-01-01 + | EEG 2023 | separate Pflichtzahlung, Vergütung intact |
//!
//! ## §51 lives in [`crate::negativpreis`], not here
//!
//! §51 is **not** a function of the law year. The Solarspitzengesetz rewrote it
//! with effect from **25.02.2025**, mid-year, so two plants that are both
//! "EEG 2023" are governed by different §51 rules depending on the day they were
//! commissioned. [`crate::negativpreis::NegativpreisRegime::fuer_inbetriebnahme`]
//! is the only correct source for the §51 threshold and kW exemption; this type
//! deliberately exposes neither.
//!
//! ### Sources
//! - §100 Abs. 1 Satz 4 EEG 2017, §100 Abs. 2 Nr. 13 EEG 2021, §100 Abs. 1 EEG 2023
//! - §52 EEG 2023 (Pflichtzahlung) vs. §52 EEG ≤2021 (Vergütungskürzung)
// ── EegGesetz ─────────────────────────────────────────────────────────────────
/// The EEG law version governing a plant.
///
/// Determines the version-specific rules that are genuinely keyed on the law
/// year: §52 Pflichtverstöße (Vergütung suspension vs. €10/kW Pflichtzahlung)
/// and the §100 Übergangsbestimmungen. **§51 is not one of them** — use
/// [`crate::negativpreis::NegativpreisRegime::fuer_inbetriebnahme`].
///
/// ## Setting `eeg_gesetz` correctly
///
/// Store the EEG version in force when the plant was commissioned.
/// Use [`EegGesetz::from_inbetriebnahme_year`] as a fallback when not explicitly known.
///
/// ## DB mapping
///
/// | `EegGesetz` | DB `eeg_gesetz` SMALLINT |
/// |---|---|
/// | `Kwkg` | `0` |
/// | `Eeg2000` | `2000` |
/// | `Eeg2004` | `2004` |
/// | `Eeg2009` | `2009` |
/// | `Eeg2012` | `2012` or `2014` (EEG 2014 was an amendment to EEG 2012) |
/// | `Eeg2017` | `2017` |
/// | `Eeg2021` | `2021` |
/// | `Eeg2023` | `2023` |
// ── Error type ────────────────────────────────────────────────────────────────
/// Returned by [`EegGesetz::from_db_year`] when the value is not a known EEG year.
;
// ── § 101 EEG 2023 — beihilferechtlicher Genehmigungsvorbehalt ───────────────
/// The day the European Commission's state-aid approval made **§ 51b EEG 2023**
/// applicable: **18 September 2025**.
///
/// § 101 Abs. 2 Satz 1 lists § 51b among the provisions that may be applied
/// "erst nach der beihilferechtlichen Genehmigung durch die Europäische
/// Kommission". Unlike the provisions in Satz 2 it names no fallback version, so
/// there is nothing to apply to an earlier period — and § 51b zeroes a tendered
/// biogas plant's anzulegender Wert whenever the spot price is at or below
/// 2 ct/kWh, which was common well before September 2025.
pub const SECT51B_GENEHMIGT_AB: Date = date!;
/// Whether § 51b EEG 2023 may be applied to a settlement of the period starting
/// on `periodenbeginn` ([`SettleInput::billing_date`](crate::SettleInput)).
///
/// Keyed on the **supply period**, not on when the invoice is written: a
/// Gutschrift issued in 2026 for August 2025 settles a supply § 51b did not
/// reach.
///
/// Two answers are deliberately conservative. An unknown period is `false` — a
/// provision under a Genehmigungsvorbehalt is not applied on the strength of not
/// knowing when the supply happened. So is a period *starting* before the
/// approval day: a month straddling it has qualifying quarter-hours on both
/// sides, and the input carries one Marktwert for the period. A settlement that
/// needs the split bills the two parts as separate periods.