Skip to content

Commit

Permalink
Merge branch 'dev' into ms/#1099-allow-for-topologies-without-transfo…
Browse files Browse the repository at this point in the history
…rmers

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
staudtMarius committed Jan 14, 2025
2 parents 87b5e6d + cdcbd30 commit 1002432
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
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)
- Added support for topologies without transformers and slack grids with multiple nodes [#1099](https://github.com/ie3-institute/simona/issues/1099)

### Changed
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

0 comments on commit 1002432

Please sign in to comment.