-
Notifications
You must be signed in to change notification settings - Fork 7
Correctly persist EmInput entities in CsvFileSink #1429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pierrepetersmeier
wants to merge
32
commits into
dev
Choose a base branch
from
pp/#1337-eminputs-arent-written-while-persisting-a-jointgridcontainer
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 18 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
83cf8d7
Correctly persist EmInput entities in CsvFileSink
pierrepetersmeier 7c5936f
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
pierrepetersmeier 87937f9
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
pierrepetersmeier d0b9e56
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
pierrepetersmeier ac5b72a
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
staudtMarius 15eb11a
Add a test that reads in the persisted grid and compares it with the …
pierrepetersmeier 175e758
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
pierrepetersmeier 14416ca
Add em_inputs.csv for GridIoIT
pierrepetersmeier 41ee164
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
pierrepetersmeier 71c5159
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
pierrepetersmeier 7a9cac3
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
danielfeismann 5f6da26
Add test for persisting JointGridContainer with EmInput
pierrepetersmeier 15686a3
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
pierrepetersmeier 88b61d8
Refactor GridIoIT setup and cleanup methods for improved clarity beca…
pierrepetersmeier cc3605c
Merge remote-tracking branch 'origin/pp/#1337-eminputs-arent-written-…
pierrepetersmeier fdf5bbb
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
danielfeismann 7fa92bc
reintroduce EnergyManagementUnits
danielfeismann 1aa5e70
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
danielfeismann baa0e5a
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
danielfeismann 3db2a86
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
danielfeismann 2f56e84
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
staudtMarius 9800c50
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
pierrepetersmeier 226345c
Fix EmInput serialization in CsvFileSink.java.
pierrepetersmeier 058966e
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
pierrepetersmeier 0d6ea6e
add missing EmInput to SampleJointGrid data and fmt
pierrepetersmeier 8bd4863
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
pierrepetersmeier c1c79ed
Refactor persistJointGrid to remove redundant set allocations
pierrepetersmeier 79022d7
Merge remote-tracking branch 'origin/pp/#1337-eminputs-arent-written-…
pierrepetersmeier acc2321
add examples for emControlStrategy to docs
danielfeismann 57a90c4
optimize imports
danielfeismann bd3f1e1
Merge branch 'dev' into pp/#1337-eminputs-arent-written-while-persist…
danielfeismann cad3c6b
Adres review comments
pierrepetersmeier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
src/main/java/edu/ie3/datamodel/models/input/container/EnergyManagementUnits.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| /* | ||
| * © 2023. 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.datamodel.models.input.EmInput; | ||
| import java.util.*; | ||
| import java.util.function.Function; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| /** Represents the accumulation of energy management units */ | ||
| public class EnergyManagementUnits implements InputContainer<EmInput> { | ||
|
|
||
| protected final Map<UUID, EmInput> emUnits; | ||
pierrepetersmeier marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| public EnergyManagementUnits(Set<EmInput> emUnits) { | ||
| this.emUnits = | ||
| emUnits.stream().collect(Collectors.toMap(EmInput::getUuid, Function.identity())); | ||
| } | ||
|
|
||
| /** | ||
| * Combine different already existing containers | ||
| * | ||
| * @param emUnits already existing containers | ||
| */ | ||
| public EnergyManagementUnits(Collection<EnergyManagementUnits> emUnits) { | ||
| this.emUnits = | ||
| emUnits.stream() | ||
| .flatMap(units -> units.emUnits.entrySet().stream()) | ||
| .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); | ||
| } | ||
|
|
||
| public Set<EmInput> getEmUnits() { | ||
| return new HashSet<>(emUnits.values()); | ||
| } | ||
|
|
||
| @Override | ||
| public List<EmInput> allEntitiesAsList() { | ||
| return emUnits.values().stream().toList(); | ||
| } | ||
|
|
||
| public Map<UUID, EmInput> getEmUnitsMap() { | ||
| return emUnits; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (this == o) return true; | ||
| if (!(o instanceof EnergyManagementUnits that)) return false; | ||
| return Objects.equals(emUnits, that.emUnits); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(emUnits); | ||
| } | ||
|
|
||
| @Override | ||
| public EnergyManagementUnitsCopyBuilder copy() { | ||
| return new EnergyManagementUnitsCopyBuilder(this); | ||
| } | ||
|
|
||
| /** | ||
| * A builder pattern based approach to create copies of {@link EnergyManagementUnits} containers | ||
| * with altered field values. For detailed field descriptions refer to Javadocs of {@link | ||
| * EnergyManagementUnits} | ||
| */ | ||
| public static class EnergyManagementUnitsCopyBuilder extends InputContainerCopyBuilder<EmInput> { | ||
| protected Set<EmInput> emUnits; | ||
|
|
||
| /** | ||
| * Constructor for {@link EnergyManagementUnits.EnergyManagementUnitsCopyBuilder} | ||
| * | ||
| * @param energyManagementUnits instance of {@link EnergyManagementUnits} | ||
| */ | ||
| protected EnergyManagementUnitsCopyBuilder(EnergyManagementUnits energyManagementUnits) { | ||
| this.emUnits = energyManagementUnits.getEmUnits(); | ||
| } | ||
|
|
||
| /** | ||
| * Method to alter the {@link EmInput}s | ||
| * | ||
| * @param emUnits set of altered {@link EmInput}s | ||
| * @return this instance of {@link EnergyManagementUnits.EnergyManagementUnitsCopyBuilder} | ||
| */ | ||
| public EnergyManagementUnits.EnergyManagementUnitsCopyBuilder emUnits(Set<EmInput> emUnits) { | ||
| this.emUnits = emUnits; | ||
| return this; | ||
| } | ||
|
|
||
| @Override | ||
| public EnergyManagementUnits build() { | ||
| return new EnergyManagementUnits(emUnits); | ||
| } | ||
|
|
||
| @Override | ||
| public InputContainerCopyBuilder<EmInput> thisInstance() { | ||
| return this; | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.