Skip to content

Commit 1fa2437

Browse files
committed
address reviewers comments
1 parent cc59554 commit 1fa2437

File tree

5 files changed

+77
-38
lines changed

5 files changed

+77
-38
lines changed

src/main/java/edu/ie3/datamodel/io/source/SystemParticipantSource.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,34 @@ Set<HpInput> getHeatPumps(
391391
Set<HpTypeInput> types,
392392
Set<ThermalBusInput> thermalBuses);
393393

394+
/**
395+
* Returns a unique set of {@link EmInput} instances.
396+
*
397+
* <p>This set has to be unique in the sense of object uniqueness but also in the sense of {@link
398+
* java.util.UUID} uniqueness of the provided {@link EmInput} which has to be checked manually, as
399+
* {@link EmInput#equals(Object)} is NOT restricted on the uuid of {@link EmInput}.
400+
*
401+
* @return a set of object and uuid unique {@link EmInput} entities
402+
*/
394403
Set<EmInput> getEmSystems();
395404

405+
/**
406+
* This set has to be unique in the sense of object uniqueness but also in the sense of {@link
407+
* java.util.UUID} uniqueness of the provided {@link EmInput} which has to be checked manually, as
408+
* {@link EmInput#equals(Object)} is NOT restricted on the uuid of {@link EmInput}.
409+
*
410+
* <p>In contrast to {@link #getHeatPumps()} this interface provides the ability to pass in an
411+
* already existing set of {@link NodeInput} and {@link OperatorInput} entities, the {@link
412+
* EmInput} instances depend on. Doing so, already loaded nodes can be recycled to improve
413+
* performance and prevent unnecessary loading operations.
414+
*
415+
* <p>If something fails during the creation process it's up to the concrete implementation of an
416+
* empty set or a set with all entities that has been able to be build is returned.
417+
*
418+
* @param operators a set of object and uuid unique {@link OperatorInput} that should be used for
419+
* the returning instances
420+
* @param nodes a set of object and uuid unique {@link NodeInput} entities
421+
* @return a set of object and uuid unique {@link EmInput} entities
422+
*/
396423
Set<EmInput> getEmSystems(Set<NodeInput> nodes, Set<OperatorInput> operators);
397424
}

src/main/java/edu/ie3/datamodel/io/source/csv/CsvSystemParticipantSource.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,6 @@ private Optional<ChpInputEntityData> buildChpEntityData(
741741
thermalStorage.get()));
742742
}
743743

744-
/** {@inheritDoc} */
745744
@Override
746745
public Set<EmInput> getEmSystems() {
747746
Set<OperatorInput> operators = typeSource.getOperators();

src/test/groovy/edu/ie3/datamodel/io/sink/CsvFileSinkTest.groovy

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -140,29 +140,29 @@ class CsvFileSinkTest extends Specification implements TimeSeriesTestData {
140140
def "A valid CsvFileSink without 'initFiles' should only persist provided elements correctly but not init all files"() {
141141
given:
142142
CsvFileSink csvFileSink = new CsvFileSink(testBaseFolderPath,
143-
new ProcessorProvider([
144-
new ResultEntityProcessor(PvResult),
145-
new ResultEntityProcessor(WecResult),
146-
new ResultEntityProcessor(EvResult),
147-
new ResultEntityProcessor(EvcsResult),
148-
new InputEntityProcessor(Transformer2WInput),
149-
new InputEntityProcessor(NodeInput),
150-
new InputEntityProcessor(EvcsInput),
151-
new InputEntityProcessor(Transformer2WTypeInput),
152-
new InputEntityProcessor(LineGraphicInput),
153-
new InputEntityProcessor(NodeGraphicInput),
154-
new InputEntityProcessor(CylindricalStorageInput),
155-
new InputEntityProcessor(ThermalHouseInput),
156-
new InputEntityProcessor(OperatorInput),
157-
new InputEntityProcessor(LineInput),
158-
new InputEntityProcessor(ThermalBusInput),
159-
new InputEntityProcessor(LineTypeInput),
160-
new InputEntityProcessor(LoadInput),
161-
new InputEntityProcessor(EmInput)
162-
], [] as Map),
163-
new FileNamingStrategy(),
164-
false,
165-
",")
143+
new ProcessorProvider([
144+
new ResultEntityProcessor(PvResult),
145+
new ResultEntityProcessor(WecResult),
146+
new ResultEntityProcessor(EvResult),
147+
new ResultEntityProcessor(EvcsResult),
148+
new InputEntityProcessor(Transformer2WInput),
149+
new InputEntityProcessor(NodeInput),
150+
new InputEntityProcessor(EvcsInput),
151+
new InputEntityProcessor(Transformer2WTypeInput),
152+
new InputEntityProcessor(LineGraphicInput),
153+
new InputEntityProcessor(NodeGraphicInput),
154+
new InputEntityProcessor(CylindricalStorageInput),
155+
new InputEntityProcessor(ThermalHouseInput),
156+
new InputEntityProcessor(OperatorInput),
157+
new InputEntityProcessor(LineInput),
158+
new InputEntityProcessor(ThermalBusInput),
159+
new InputEntityProcessor(LineTypeInput),
160+
new InputEntityProcessor(LoadInput),
161+
new InputEntityProcessor(EmInput)
162+
], [] as Map),
163+
new FileNamingStrategy(),
164+
false,
165+
",")
166166

167167
UUID uuid = UUID.fromString("22bea5fc-2cb2-4c61-beb9-b476e0107f52")
168168
UUID inputModel = UUID.fromString("22bea5fc-2cb2-4c61-beb9-b476e0107f52")

src/test/groovy/edu/ie3/datamodel/models/input/container/SystemParticipantsTest.groovy

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,20 @@ class SystemParticipantsTest extends Specification {
1212

1313
def "A valid collection of asset entities can be used to build a valid instance of SystemParticipants"() {
1414
given:
15-
def systemParticipants = SystemParticipantTestData.emptySystemParticipants
15+
def systemParticipants = new SystemParticipants(
16+
Collections.singleton(SystemParticipantTestData.bmInput),
17+
Collections.singleton(SystemParticipantTestData.chpInput),
18+
Collections.emptySet(),
19+
Collections.singleton(SystemParticipantTestData.evInput),
20+
Collections.singleton(SystemParticipantTestData.fixedFeedInInput),
21+
Collections.singleton(SystemParticipantTestData.hpInput),
22+
Collections.singleton(SystemParticipantTestData.loadInput),
23+
Collections.singleton(SystemParticipantTestData.pvInput),
24+
Collections.singleton(SystemParticipantTestData.storageInput),
25+
Collections.singleton(SystemParticipantTestData.wecInput),
26+
Collections.singleton(SystemParticipantTestData.emInput)
27+
)
28+
1629
when:
1730
def newlyCreatedSystemParticipants = new SystemParticipants(systemParticipants.allEntitiesAsList())
1831

src/test/groovy/edu/ie3/test/common/SampleJointGrid.groovy

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,20 @@ class SampleJointGrid extends SystemParticipantTestData {
6767
final PvInput pvInput =
6868
new PvInput(
6969
UUID.fromString("d56f15b7-8293-4b98-b5bd-58f6273ce229"),
70-
"test_pvInput",
71-
operator,
72-
operationTime,
70+
"test_pvInput",
71+
operator,
72+
operationTime,
7373
participantNode,
74-
cosPhiFixed,
75-
albedo,
76-
azimuth,
77-
etaConv,
78-
elevationAngle,
79-
kG,
80-
kT,
81-
false,
82-
sRated,
83-
cosPhiRated)
74+
cosPhiFixed,
75+
albedo,
76+
azimuth,
77+
etaConv,
78+
elevationAngle,
79+
kG,
80+
kT,
81+
false,
82+
sRated,
83+
cosPhiRated)
8484

8585
// Load
8686
final LoadInput loadInput =

0 commit comments

Comments
 (0)