Skip to content

Enhancing Validation for sRated of HpTypeInput #1395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Enhanced check for invalid field names in sources [#1383](https://github.com/ie3-institute/PowerSystemDataModel/issues/1383)
- Enhancing value retrieval in `TimeSeriesSource` [1280](https://github.com/ie3-institute/PowerSystemDataModel/issues/1280)
- Enhancing the `LoadProfileSource` to return the resolution [1288](https://github.com/ie3-institute/PowerSystemDataModel/issues/1288)
- Enhancing Validation for sRated of `HpTypeInput` [1394](https://github.com/ie3-institute/PowerSystemDataModel/issues/1394)

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class HpResult extends SystemParticipantWithHeatResult {
* @param inputModel uuid of the input model that produces the result
* @param p active power output normally provided in MW
* @param q reactive power output normally provided in MVAr
* @param qDot provided head energy
* @param qDot provided heat energy
*/
public HpResult(
ZonedDateTime time,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ private static List<Try<Void, InvalidEntityException>> checkHp(HpInput hpInput)
* Validates a HpTypeInput if:
*
* <ul>
* <li>its rated power is positive
* <li>its rated thermal power is positive
* </ul>
*
Expand All @@ -347,7 +348,10 @@ private static Try<Void, InvalidEntityException> checkHpType(HpTypeInput hpTypeI
return Try.ofVoid(
() ->
detectZeroOrNegativeQuantities(
new Quantity<?>[] {hpTypeInput.getpThermal()}, hpTypeInput),
new Quantity<?>[] {
hpTypeInput.getsRated(), hpTypeInput.getpThermal(),
},
hpTypeInput),
InvalidEntityException.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ class EntityPersistenceNamingStrategyTest extends Specification {
BmResult || "prefix_bm_res_suffix"
PvResult || "prefix_pv_res_suffix"
ChpResult || "prefix_chp_res_suffix"
HpResult || "prefix_hp_res_suffix"
WecResult || "prefix_wec_res_suffix"
StorageResult || "prefix_storage_res_suffix"
EvcsResult || "prefix_evcs_res_suffix"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import edu.ie3.datamodel.models.result.system.EvResult
import edu.ie3.datamodel.models.result.system.EvcsResult
import edu.ie3.datamodel.models.result.system.FixedFeedInResult
import edu.ie3.datamodel.models.result.system.FlexOptionsResult
import edu.ie3.datamodel.models.result.system.HpResult
import edu.ie3.datamodel.models.result.system.LoadResult
import edu.ie3.datamodel.models.result.system.PvResult
import edu.ie3.datamodel.models.result.system.StorageResult
Expand Down Expand Up @@ -105,6 +106,7 @@ class FileNamingStrategyTest extends Specification {
FixedFeedInResult || Path.of("test_grid", "results", "participants")
BmResult || Path.of("test_grid", "results", "participants")
PvResult || Path.of("test_grid", "results", "participants")
HpResult || Path.of("test_grid", "results", "participants")
ChpResult || Path.of("test_grid", "results", "participants")
WecResult || Path.of("test_grid", "results", "participants")
StorageResult || Path.of("test_grid", "results", "participants")
Expand Down Expand Up @@ -247,6 +249,7 @@ class FileNamingStrategyTest extends Specification {
BmResult || Path.of("test_grid", "results", "participants", "bm_res")
PvResult || Path.of("test_grid", "results", "participants", "pv_res")
ChpResult || Path.of("test_grid", "results", "participants", "chp_res")
HpResult || Path.of("test_grid", "results", "participants", "hp_res")
WecResult || Path.of("test_grid", "results", "participants", "wec_res")
StorageResult || Path.of("test_grid", "results", "participants", "storage_res")
EvcsResult || Path.of("test_grid", "results", "participants", "evcs_res")
Expand Down Expand Up @@ -469,6 +472,7 @@ class FileNamingStrategyTest extends Specification {
BmResult || Optional.empty()
PvResult || Optional.empty()
ChpResult || Optional.empty()
HpResult || Optional.empty()
WecResult || Optional.empty()
StorageResult || Optional.empty()
EvcsResult || Optional.empty()
Expand Down Expand Up @@ -612,6 +616,7 @@ class FileNamingStrategyTest extends Specification {
BmResult || Path.of("bm_res")
PvResult || Path.of("pv_res")
ChpResult || Path.of("chp_res")
HpResult || Path.of("hp_res")
WecResult || Path.of("wec_res")
StorageResult || Path.of("storage_res")
EvcsResult || Path.of("evcs_res")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,9 @@ class SystemParticipantValidationUtilsTest extends Specification {
ex.message.contains(expectedException.message)

where:
invalidHpType || expectedException
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)
invalidHpType || expectedException
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)
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)
}

// Load
Expand Down