| @@ 210-227 (lines=18) @@ | ||
| 207 | ) |
|
| 208 | ||
| 209 | # Case 3: Output > 0 but input = 0 - ERROR |
|
| 210 | if output_capacity > 0 and input_capacity == 0: |
|
| 211 | return RuleResult( |
|
| 212 | rule_id=self.rule_id, |
|
| 213 | task=self.task, |
|
| 214 | table=self.table, |
|
| 215 | kind=self.kind, |
|
| 216 | success=False, |
|
| 217 | observed=output_capacity, |
|
| 218 | expected=0.0, |
|
| 219 | message=( |
|
| 220 | f"{self.carrier} {self.component_type} capacity was distributed " |
|
| 221 | f"even though no input was provided! " |
|
| 222 | f"Output: {output_capacity:.2f} MW, Input: 0 MW for {self.scenario}" |
|
| 223 | ), |
|
| 224 | severity=Severity.ERROR, |
|
| 225 | schema=self.schema, |
|
| 226 | table_name=self.table_name, |
|
| 227 | rule_class=self.__class__.__name__ |
|
| 228 | ) |
|
| 229 | ||
| 230 | # Case 4: Both > 0 - Check deviation |
|
| @@ 190-206 (lines=17) @@ | ||
| 187 | ) |
|
| 188 | ||
| 189 | # Case 2: Input > 0 but output = 0 - ERROR |
|
| 190 | if input_capacity > 0 and output_capacity == 0: |
|
| 191 | return RuleResult( |
|
| 192 | rule_id=self.rule_id, |
|
| 193 | task=self.task, |
|
| 194 | table=self.table, |
|
| 195 | kind=self.kind, |
|
| 196 | success=False, |
|
| 197 | observed=0.0, |
|
| 198 | expected=input_capacity, |
|
| 199 | message=( |
|
| 200 | f"{self.carrier} {self.component_type} capacity was not distributed at all! " |
|
| 201 | f"Input: {input_capacity:.2f} MW, Output: 0 MW for {self.scenario}" |
|
| 202 | ), |
|
| 203 | severity=Severity.ERROR, |
|
| 204 | schema=self.schema, |
|
| 205 | table_name=self.table_name, |
|
| 206 | rule_class=self.__class__.__name__ |
|
| 207 | ) |
|
| 208 | ||
| 209 | # Case 3: Output > 0 but input = 0 - ERROR |
|
| @@ 170-186 (lines=17) @@ | ||
| 167 | input_capacity = float(df["input_capacity_mw"].values[0]) |
|
| 168 | ||
| 169 | # Case 1: Both zero - OK, no capacity needed |
|
| 170 | if output_capacity == 0 and input_capacity == 0: |
|
| 171 | return RuleResult( |
|
| 172 | rule_id=self.rule_id, |
|
| 173 | task=self.task, |
|
| 174 | table=self.table, |
|
| 175 | kind=self.kind, |
|
| 176 | success=True, |
|
| 177 | observed=0.0, |
|
| 178 | expected=0.0, |
|
| 179 | message=( |
|
| 180 | f"No {self.carrier} {self.component_type} capacity needed " |
|
| 181 | f"for {self.scenario} (both input and output are zero)" |
|
| 182 | ), |
|
| 183 | severity=Severity.INFO, |
|
| 184 | schema=self.schema, |
|
| 185 | table_name=self.table_name, |
|
| 186 | rule_class=self.__class__.__name__ |
|
| 187 | ) |
|
| 188 | ||
| 189 | # Case 2: Input > 0 but output = 0 - ERROR |
|