Skip to content

Misconfigured nodes lead to "loops not allowed" #1310

Open
@sebastian-peter

Description

@sebastian-peter

If the two nodes that a (2w) transformer connects have the same subnet number, ContainerUtils crashes with:

java.lang.IllegalArgumentException: loops not allowed
	at org.jgrapht.graph.AbstractBaseGraph.addEdge(AbstractBaseGraph.java:277)
	at edu.ie3.datamodel.utils.ContainerUtils.buildSubGridTopologyGraph(ContainerUtils.java:582)
	at edu.ie3.datamodel.utils.ContainerUtils.buildSubGridTopologyGraph(ContainerUtils.java:515)
	at edu.ie3.datamodel.models.input.container.JointGridContainer.<init>(JointGridContainer.java:32)
	at edu.ie3.datamodel.io.source.csv.CsvJointGridContainerSource.read(CsvJointGridContainerSource.java:101)
	at edu.ie3.simona.io.grid.GridProvider$.gridFromConfig(GridProvider.scala:48)
	at edu.ie3.simona.sim.setup.SimonaStandaloneSetup.gridAgents(SimonaStandaloneSetup.scala:74)
	at edu.ie3.simona.sim.SimonaSim$$anonfun$edu$ie3$simona$sim$SimonaSim$$initializing$1.applyOrElse(SimonaSim.scala:114)

This is very much not helpful. So it'd be great to check for this condition beforehand and throw an exception that includes information about the error that occurred, including transformer and nodes.
One should also check for the same thing with 3w transformers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions