Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
*/
package edu.ie3.datamodel.models.input.container;

import edu.ie3.datamodel.exceptions.InvalidGridException;
import edu.ie3.datamodel.graph.SubGridTopologyGraph;
import edu.ie3.datamodel.utils.ContainerUtils;
import java.util.Objects;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/** Model class to hold input models for more than one galvanically separated subnet */
public class JointGridContainer extends GridContainer {
/** A graph describing the subnet dependencies */
private final SubGridTopologyGraph subGridTopologyGraph;

private static final Logger logger = LoggerFactory.getLogger(JointGridContainer.class);

public JointGridContainer(
String gridName,
RawGridElements rawGrid,
Expand Down Expand Up @@ -46,9 +49,10 @@ public JointGridContainer(
* @param subGridTopologyGraph The graph to check
*/
private void checkSubGridTopologyGraph(SubGridTopologyGraph subGridTopologyGraph) {
if (subGridTopologyGraph.vertexSet().size() == 1)
throw new InvalidGridException(
if (subGridTopologyGraph.vertexSet().size() == 1) {
logger.warn(
"This joint grid model only contains one single grid. Consider using SubGridContainer.");
}
}

public SubGridTopologyGraph getSubGridTopologyGraph() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* © 2021. TU Dortmund University,
* Institute of Energy Systems, Energy Efficiency and Energy Economics,
* Research group Distribution grid planning and operation
*/
package edu.ie3.datamodel.models.input.container

import edu.ie3.test.common.GridTestData
import spock.lang.Specification

class JointGridContainerTest extends Specification {
private static final GRID_NAME = "single_grid"

private static final RawGridElements RAW_GRID = new RawGridElements(
[GridTestData.nodeA] as Set,
[] as Set,
[] as Set,
[] as Set,
[] as Set,
[] as Set)

private static final SystemParticipants SYSTEM_PARTICIPANTS = new SystemParticipants(
[] as Set,
[] as Set,
[] as Set,
[] as Set,
[] as Set,
[] as Set,
[] as Set,
[] as Set,
[] as Set,
[] as Set)

private static final GraphicElements GRAPHIC_ELEMENTS = new GraphicElements(
[] as Set,
[] as Set)

def "A single subgrid can be used to build a JointGridContainer"() {
when:
def jointGridContainer = new JointGridContainer(GRID_NAME, RAW_GRID, SYSTEM_PARTICIPANTS, GRAPHIC_ELEMENTS)

then:
noExceptionThrown()
jointGridContainer.subGridTopologyGraph.vertexSet().size() == 1
}
}