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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Issues related to em data [#2366](https://github.com/ie3-institute/simonaAPI/issues/366)
- `Fixed bugs in `ExtEntityMapping` [#373](https://github.com/ie3-institute/simonaAPI/issues/373)

## [0.11.0] - 2025-10-23

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,7 @@ public ExtEntityMapping include(
List<UUID> includedUuids =
included.stream().map(this::get).filter(Optional::isPresent).map(Optional::get).toList();

schemeOption.ifPresent(
scheme -> includedUuids.forEach(uuid -> primaryMapping.put(uuid, scheme.getValueClass())));
addExtEntities(dataType, includedUuids);

copy.includeIds(dataType, includedUuids, schemeOption);
return copy;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ import edu.ie3.datamodel.models.input.AssetInput
import edu.ie3.datamodel.models.input.EmInput
import edu.ie3.datamodel.models.input.NodeInput
import edu.ie3.datamodel.models.input.container.GraphicElements
import edu.ie3.datamodel.models.input.container.JointGridContainer
import edu.ie3.datamodel.models.input.container.RawGridElements
import edu.ie3.datamodel.models.input.container.SubGridContainer
import edu.ie3.datamodel.models.input.container.SystemParticipants
import edu.ie3.datamodel.models.input.system.FixedFeedInInput
import edu.ie3.datamodel.models.input.system.LoadInput
import edu.ie3.datamodel.models.input.system.SystemParticipantInput
import edu.ie3.datamodel.models.voltagelevels.GermanVoltageLevelUtils
import edu.ie3.datamodel.models.voltagelevels.VoltageLevel
import edu.ie3.util.quantities.PowerSystemUnits
import spock.lang.Shared
import spock.lang.Specification
Expand Down Expand Up @@ -102,6 +99,34 @@ class ExtEntityMappingTest extends Specification {
mapping.ems == [em.uuid] as Set
}

def "ExtEntityMapping can include specific external ids correctly"() {
given:
def node = new NodeInput(UUID.randomUUID(), "node", Quantities.getQuantity(1d, PowerSystemUnits.PU), false, NodeInput.DEFAULT_GEO_POSITION, GermanVoltageLevelUtils.LV, 1)
def em = new EmInput(UUID.randomUUID(), "em", "", null)
def participant = new FixedFeedInInput(UUID.randomUUID(), "ffi", node, null, em, Quantities.getQuantity(10, PowerSystemUnits.KILOVOLTAMPERE), 0.9)

List<AssetInput> gridAssets = [node]
List<SystemParticipantInput> participantInputs = [participant]

def grid = new SubGridContainer(
"test grid",
1,
new RawGridElements(gridAssets),
new SystemParticipants(participantInputs),
new GraphicElements([])
)
def mapping = new ExtEntityMapping(grid)

when:
def updated = mapping.include(DataType.RESULT, ["ffi"], Optional.empty())

then:
// only the included ids will be returned, other grid ids will be ignored
mapping.getAssets(DataType.RESULT) == [node.uuid, participant.uuid, em.uuid]
updated.getAssets(DataType.RESULT) == [participant.uuid]
}


def "ExtEntityMapping should return the data types correctly"() {
when:
def extEntryMapping = new ExtEntityMapping(assets)
Expand Down