Skip to content

Commit 02cb4f0

Browse files
Enhancing Validation for sRated of HpTypeInput
1 parent de56f0b commit 02cb4f0

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010
- Enhanced check for invalid field names in sources [#1383](https://github.com/ie3-institute/PowerSystemDataModel/issues/1383)
1111
- Enhancing value retrieval in `TimeSeriesSource` [1280](https://github.com/ie3-institute/PowerSystemDataModel/issues/1280)
12+
- Enhancing Validation for sRated of `HpTypeInput` [1394](https://github.com/ie3-institute/PowerSystemDataModel/issues/1394)
1213

1314
### Fixed
1415

src/main/java/edu/ie3/datamodel/utils/validation/SystemParticipantValidationUtils.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ private static List<Try<Void, InvalidEntityException>> checkHp(HpInput hpInput)
337337
* Validates a HpTypeInput if:
338338
*
339339
* <ul>
340+
* <li>its rated power is positive
340341
* <li>its rated thermal power is positive
341342
* </ul>
342343
*
@@ -347,7 +348,10 @@ private static Try<Void, InvalidEntityException> checkHpType(HpTypeInput hpTypeI
347348
return Try.ofVoid(
348349
() ->
349350
detectZeroOrNegativeQuantities(
350-
new Quantity<?>[] {hpTypeInput.getpThermal()}, hpTypeInput),
351+
new Quantity<?>[] {
352+
hpTypeInput.getsRated(), hpTypeInput.getpThermal(),
353+
},
354+
hpTypeInput),
351355
InvalidEntityException.class);
352356
}
353357

src/test/groovy/edu/ie3/datamodel/utils/validation/SystemParticipantValidationUtilsTest.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,9 @@ class SystemParticipantValidationUtilsTest extends Specification {
294294
ex.message.contains(expectedException.message)
295295

296296
where:
297-
invalidHpType || expectedException
298-
new HpTypeInput(uuid, id, capex, opex, sRated, cosPhiRated, Quantities.getQuantity(0, ACTIVE_POWER_IN)) || new InvalidEntityException("The following quantities have to be positive: 0 kW", invalidHpType)
297+
invalidHpType || expectedException
298+
new HpTypeInput(uuid, id, capex, opex, Quantities.getQuantity(0, ACTIVE_POWER_IN), cosPhiRated, pThermal) || new InvalidEntityException("The following quantities have to be positive: 0 kW", invalidHpType)
299+
new HpTypeInput(uuid, id, capex, opex, sRated, cosPhiRated, Quantities.getQuantity(0, ACTIVE_POWER_IN)) || new InvalidEntityException("The following quantities have to be positive: 0 kW", invalidHpType)
299300
}
300301

301302
// Load

0 commit comments

Comments
 (0)