Skip to content

Commit 67da4a1

Browse files
authored
Merge pull request #1395 from ie3-institute/df/#1394-hpTypeInput-validation-srated
Enhancing Validation for sRated of `HpTypeInput`
2 parents 54091ca + cc7577d commit 67da4a1

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
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)
1212
- Enhancing the `LoadProfileSource` to return the resolution [1288](https://github.com/ie3-institute/PowerSystemDataModel/issues/1288)
13+
- Enhancing Validation for sRated of `HpTypeInput` [1394](https://github.com/ie3-institute/PowerSystemDataModel/issues/1394)
1314

1415
### Fixed
1516

src/main/java/edu/ie3/datamodel/models/result/system/HpResult.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class HpResult extends SystemParticipantWithHeatResult {
2020
* @param inputModel uuid of the input model that produces the result
2121
* @param p active power output normally provided in MW
2222
* @param q reactive power output normally provided in MVAr
23-
* @param qDot provided head energy
23+
* @param qDot provided heat energy
2424
*/
2525
public HpResult(
2626
ZonedDateTime time,

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/io/naming/EntityPersistenceNamingStrategyTest.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ class EntityPersistenceNamingStrategyTest extends Specification {
243243
BmResult || "prefix_bm_res_suffix"
244244
PvResult || "prefix_pv_res_suffix"
245245
ChpResult || "prefix_chp_res_suffix"
246+
HpResult || "prefix_hp_res_suffix"
246247
WecResult || "prefix_wec_res_suffix"
247248
StorageResult || "prefix_storage_res_suffix"
248249
EvcsResult || "prefix_evcs_res_suffix"

src/test/groovy/edu/ie3/datamodel/io/naming/FileNamingStrategyTest.groovy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import edu.ie3.datamodel.models.result.system.EvResult
5252
import edu.ie3.datamodel.models.result.system.EvcsResult
5353
import edu.ie3.datamodel.models.result.system.FixedFeedInResult
5454
import edu.ie3.datamodel.models.result.system.FlexOptionsResult
55+
import edu.ie3.datamodel.models.result.system.HpResult
5556
import edu.ie3.datamodel.models.result.system.LoadResult
5657
import edu.ie3.datamodel.models.result.system.PvResult
5758
import edu.ie3.datamodel.models.result.system.StorageResult
@@ -105,6 +106,7 @@ class FileNamingStrategyTest extends Specification {
105106
FixedFeedInResult || Path.of("test_grid", "results", "participants")
106107
BmResult || Path.of("test_grid", "results", "participants")
107108
PvResult || Path.of("test_grid", "results", "participants")
109+
HpResult || Path.of("test_grid", "results", "participants")
108110
ChpResult || Path.of("test_grid", "results", "participants")
109111
WecResult || Path.of("test_grid", "results", "participants")
110112
StorageResult || Path.of("test_grid", "results", "participants")
@@ -247,6 +249,7 @@ class FileNamingStrategyTest extends Specification {
247249
BmResult || Path.of("test_grid", "results", "participants", "bm_res")
248250
PvResult || Path.of("test_grid", "results", "participants", "pv_res")
249251
ChpResult || Path.of("test_grid", "results", "participants", "chp_res")
252+
HpResult || Path.of("test_grid", "results", "participants", "hp_res")
250253
WecResult || Path.of("test_grid", "results", "participants", "wec_res")
251254
StorageResult || Path.of("test_grid", "results", "participants", "storage_res")
252255
EvcsResult || Path.of("test_grid", "results", "participants", "evcs_res")
@@ -469,6 +472,7 @@ class FileNamingStrategyTest extends Specification {
469472
BmResult || Optional.empty()
470473
PvResult || Optional.empty()
471474
ChpResult || Optional.empty()
475+
HpResult || Optional.empty()
472476
WecResult || Optional.empty()
473477
StorageResult || Optional.empty()
474478
EvcsResult || Optional.empty()
@@ -612,6 +616,7 @@ class FileNamingStrategyTest extends Specification {
612616
BmResult || Path.of("bm_res")
613617
PvResult || Path.of("pv_res")
614618
ChpResult || Path.of("chp_res")
619+
HpResult || Path.of("hp_res")
615620
WecResult || Path.of("wec_res")
616621
StorageResult || Path.of("storage_res")
617622
EvcsResult || Path.of("evcs_res")

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, S_RATED), cosPhiRated, pThermal) || new InvalidEntityException("The following quantities have to be positive: 0 kVA", 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)