-
Notifications
You must be signed in to change notification settings - Fork 7
Vb/#586 grid io it #709
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
Merged
Merged
Vb/#586 grid io it #709
Changes from 17 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
fa0c1e1
avoid shortening wec input doubles while reading
lararou 3939bbd
Merge branch 'dev' into lr/#586-grid-io-it
lararou 1a683fb
Merge branch 'dev' into lr/#586-grid-io-it
lararou 74354ce
fmt
lararou 29e8919
finalising and deleting comments
lararou d03dbf1
Merge branch 'dev' into lr/#586-grid-io-it
lararou 37b6e79
committing joint grid csv files
lararou 9d712fd
create temporary output directory
lararou e878a19
Merge remote-tracking branch 'origin/lr/#586-grid-io-it' into vb/#586…
vickybung1 12fd1db
Merge branch 'dev' into vb/#586-grid-io-it
vickybung1 9d4fefa
Completion of CSVJointGridContainer test
vickybung1 6daa3ef
Update
vickybung1 262a37a
Merge branch 'dev' into vb/#586-grid-io-it
vickybung1 cff6071
Merge branch 'vb/#710_decimalPlaces_deSerialize' into vb/#586-grid-io-it
vickybung1 a2b3620
Merge branch 'dev' into vb/#586-grid-io-it
vickybung1 a4a76d5
Update and adapted Changelog
vickybung1 ed217a6
Merge branch 'dev' into vb/#586-grid-io-it
vickybung1 43d1bc9
Merge branch 'dev' into vb/#586-grid-io-it
vickybung1 886a781
Merge branch 'dev' into vb/#586-grid-io-it
vickybung1 29539fa
Update
vickybung1 0f96d4e
Update
vickybung1 489b1c3
Merge branch 'dev' into vb/#586-grid-io-it
sebastian-peter 6d6c841
Minor code improvements
sebastian-peter e7cac1f
Adding JavaDoc for test
sebastian-peter 47a6629
Merge branch 'dev' into vb/#586-grid-io-it
sebastian-peter 8addddd
Merge branch 'dev' into vb/#586-grid-io-it
vickybung1 7abe85a
Merge remote-tracking branch 'origin/vb/#586-grid-io-it' into vb/#586…
vickybung1 0027e04
Moved package
vickybung1 b5c09c8
Fixing code smell: Inlining variable
sebastian-peter de9a002
Fixed changelog
sebastian-peter 8549389
Improved JavaDoc
sebastian-peter 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
57 changes: 57 additions & 0 deletions
57
src/main/java/edu/ie3/datamodel/io/source/csv/CsvJointGridContainerSource.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,57 @@ | ||
| /* | ||
| * © 2022. TU Dortmund University, | ||
| * Institute of Energy Systems, Energy Efficiency and Energy Economics, | ||
| * Research group Distribution grid planning and operation | ||
| */ | ||
| package edu.ie3.datamodel.io.source.csv; | ||
|
|
||
| import edu.ie3.datamodel.exceptions.SourceException; | ||
| import edu.ie3.datamodel.io.naming.FileNamingStrategy; | ||
| import edu.ie3.datamodel.io.source.*; | ||
| 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.SystemParticipants; | ||
|
|
||
| public class CsvJointGridContainerSource { | ||
sebastian-peter marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| private CsvJointGridContainerSource() {} | ||
|
|
||
| public static JointGridContainer read(String gridName, String csvSep, String directoryPath) | ||
| throws SourceException { | ||
|
|
||
| /* Parameterization */ | ||
|
|
||
| FileNamingStrategy namingStrategy = new FileNamingStrategy(); // Default naming strategy | ||
|
|
||
| /* Instantiating sources */ | ||
| TypeSource typeSource = new CsvTypeSource(csvSep, directoryPath, namingStrategy); | ||
| RawGridSource rawGridSource = | ||
| new CsvRawGridSource(csvSep, directoryPath, namingStrategy, typeSource); | ||
| ThermalSource thermalSource = | ||
| new CsvThermalSource(csvSep, directoryPath, namingStrategy, typeSource); | ||
| SystemParticipantSource systemParticipantSource = | ||
| new CsvSystemParticipantSource( | ||
| csvSep, directoryPath, namingStrategy, typeSource, thermalSource, rawGridSource); | ||
| GraphicSource graphicsSource = | ||
| new CsvGraphicSource(csvSep, directoryPath, namingStrategy, typeSource, rawGridSource); | ||
|
|
||
| /* Loading models */ | ||
| RawGridElements rawGridElements = | ||
| rawGridSource | ||
| .getGridData() | ||
| .orElseThrow(() -> new SourceException("Error during reading of raw grid data.")); | ||
| SystemParticipants systemParticipants = | ||
| systemParticipantSource | ||
| .getSystemParticipants() | ||
| .orElseThrow( | ||
| () -> new SourceException("Error during reading of system participant data.")); | ||
| GraphicElements graphicElements = | ||
| graphicsSource | ||
| .getGraphicElements() | ||
| .orElseThrow(() -> new SourceException("Error during reading of graphic elements.")); | ||
| JointGridContainer fullGrid = | ||
| new JointGridContainer(gridName, rawGridElements, systemParticipants, graphicElements); | ||
|
|
||
| return fullGrid; | ||
| } | ||
| } | ||
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,52 @@ | ||
| /* | ||
| * © 2022. TU Dortmund University, | ||
| * Institute of Energy Systems, Energy Efficiency and Energy Economics, | ||
| * Research group Distribution grid planning and operation | ||
| */ | ||
| package edu.ie3.datamodel.io | ||
sebastian-peter marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| import edu.ie3.datamodel.io.sink.CsvFileSink | ||
| import edu.ie3.datamodel.io.source.csv.CsvJointGridContainerSource | ||
| import edu.ie3.datamodel.io.source.csv.CsvTestDataMeta | ||
| import spock.lang.Specification | ||
|
|
||
| import java.nio.file.Files | ||
|
|
||
| class GridIoIT extends Specification implements CsvTestDataMeta { | ||
|
|
||
| def "Input JointGridContainer equals Output JointGridContainer."(){ | ||
|
|
||
| given: | ||
| // create joint grid container | ||
| def gridname = new String("vn_simona") | ||
| def seperator = new String(",") | ||
| def folderpath = new String(jointGridFolderPath) | ||
sebastian-peter marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| def firstGridContainer = CsvJointGridContainerSource.read(gridname, seperator, folderpath) | ||
|
|
||
| // output: prepare output folder | ||
| def tempDirectory = Files.createTempDirectory("GridIoIT") | ||
| def outDirectoryPath = tempDirectory.toAbsolutePath().toString() | ||
| def sink = new CsvFileSink(outDirectoryPath) | ||
|
|
||
| when: | ||
| // write files from joint grid container in output directory | ||
| sink.persistJointGrid(firstGridContainer) | ||
|
|
||
| // create second grid container from output folder | ||
| def secondGridContainer = CsvJointGridContainerSource.read(gridname, seperator, outDirectoryPath) | ||
|
|
||
| // delete files in output directory | ||
| tempDirectory.toFile().eachFile { | ||
| it.deleteOnExit() | ||
| } | ||
sebastian-peter marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| then: | ||
| //compare input and output joint grid container | ||
|
|
||
| firstGridContainer.equals(secondGridContainer) | ||
sebastian-peter marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
|
|
||
| } | ||
|
|
||
| } | ||
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
2 changes: 2 additions & 0 deletions
2
src/test/resources/edu/ie3/datamodel/io/source/csv/_joint_grid/bm_input.csv
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,2 @@ | ||
| "uuid","cost_controlled","feed_in_tariff","id","market_reaction","node","operates_from","operates_until","operator","q_characteristics","type" | ||
| a3b7576b-cac7-4350-90ff-06316cdca192,true,51.0,BM_Test,true,f5839ade-5968-4879-a824-90b5fb3552cd,,,,cosPhiFixed:{(0.00,1.00)},2fdca5f1-c11b-4169-a695-4c98f0e0a84a |
2 changes: 2 additions & 0 deletions
2
src/test/resources/edu/ie3/datamodel/io/source/csv/_joint_grid/bm_type_input.csv
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,2 @@ | ||
| "uuid","active_power_gradient","capex","cos_phi_rated","eta_conv","id","opex","s_rated" | ||
| 2fdca5f1-c11b-4169-a695-4c98f0e0a84a,5.0,0.0,1.0,1.0,typ_01,0.05,190.0 |
3 changes: 3 additions & 0 deletions
3
src/test/resources/edu/ie3/datamodel/io/source/csv/_joint_grid/evcs_input.csv
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,3 @@ | ||
| "uuid","cos_phi_rated","id","node","operates_from","operates_until","operator","q_characteristics","chargingpoints","type","location_type","v2gSupport" | ||
| 06a14909-366e-4e94-a593-1016e1455b30,0.9,test_evcs_1,5f1c776c-6935-40f7-ba9e-60646e08992b,,,,cosPhiFixed:{(0.00,1.0)},4,ChargingStationType1,HOME,false | ||
| 104acdaa-5dc5-4197-aed2-2fddb3c4f237,0.9,test_evcs_2,ed4697fd-016c-40c2-a66b-e793878dadea,,,,cosPhiFixed:{(0.00,1.0)},4,ChargingStationType1,HOME,false |
2 changes: 2 additions & 0 deletions
2
src/test/resources/edu/ie3/datamodel/io/source/csv/_joint_grid/fixed_feed_in_input.csv
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,2 @@ | ||
| "uuid","cos_phi_rated","id","node","operates_from","operates_until","operator","q_characteristics","s_rated" | ||
| 9abe950d-362e-4efe-b686-500f84d8f368,0.9,test_feed_in,5f1c776c-6935-40f7-ba9e-60646e08992b,,,,cosPhiFixed:{(0.00,0.95)},200.0 |
2 changes: 2 additions & 0 deletions
2
...u/ie3/datamodel/io/source/csv/_joint_grid/its_pq_8c04e94e-76b0-4369-a55c-f5e1117fb83e.csv
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,2 @@ | ||
| "uuid","p","q","time" | ||
| 4df88950-dc48-4905-b41f-63d0757eae03,3.999998968803,0.0,2011-01-01T00:00:00Z |
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.