Skip to content
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

Throw exception if the slack node is not directly conected to a transformer. #1098

Merged
merged 3 commits into from
Jan 13, 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 @@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Create `CITATION.cff` [#1035](https://github.com/ie3-institute/simona/issues/1035)
- Introduce ThermalDemandWrapper [#1049](https://github.com/ie3-institute/simona/issues/1049)
- Added Marius Staudt to list of reviewers [#1057](https://github.com/ie3-institute/simona/issues/1057)
- Throw exception if the slack node is not directly conected to a transformer. [#525](https://github.com/ie3-institute/simona/issues/525)

### Changed
- Adapted to changed data source in PSDM [#435](https://github.com/ie3-institute/simona/issues/435)
Expand Down
22 changes: 22 additions & 0 deletions src/main/scala/edu/ie3/simona/io/grid/GridProvider.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package edu.ie3.simona.io.grid

import com.typesafe.scalalogging.LazyLogging
import edu.ie3.datamodel.exceptions.{InvalidGridException, SourceException}
import edu.ie3.datamodel.io.naming.FileNamingStrategy
import edu.ie3.datamodel.io.source.csv.{
CsvJointGridContainerSource,
Expand Down Expand Up @@ -51,6 +52,27 @@ object GridProvider extends LazyLogging {
// checks the grid container and throws exception if there is an error
ValidationUtils.check(jointGridContainer)

// check slack node location
val slackSubGrid = jointGridContainer.getSubGridTopologyGraph
.vertexSet()
.asScala
.filter(_.getRawGrid.getNodes.asScala.exists(_.isSlack))
.maxByOption(
_.getPredominantVoltageLevel.getNominalVoltage.getValue
.doubleValue()
)
.getOrElse(
throw new InvalidGridException(
"There is no slack node present in the grid."
)
)

if (slackSubGrid.getRawGrid.getNodes.size() > 1) {
throw new SourceException(
"There are too many nodes in the slack grid. This is currently not support."
)
}

jointGridContainer
case None =>
throw new RuntimeException(
Expand Down
Loading