Skip to content
Merged
Show file tree
Hide file tree
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 Aug 9, 2022
3939bbd
Merge branch 'dev' into lr/#586-grid-io-it
lararou Aug 9, 2022
1a683fb
Merge branch 'dev' into lr/#586-grid-io-it
lararou Aug 9, 2022
74354ce
fmt
lararou Aug 9, 2022
29e8919
finalising and deleting comments
lararou Aug 21, 2022
d03dbf1
Merge branch 'dev' into lr/#586-grid-io-it
lararou Aug 21, 2022
37b6e79
committing joint grid csv files
lararou Aug 23, 2022
9d712fd
create temporary output directory
lararou Aug 23, 2022
e878a19
Merge remote-tracking branch 'origin/lr/#586-grid-io-it' into vb/#586…
vickybung1 Dec 6, 2022
12fd1db
Merge branch 'dev' into vb/#586-grid-io-it
vickybung1 Dec 9, 2022
9d4fefa
Completion of CSVJointGridContainer test
vickybung1 Dec 9, 2022
6daa3ef
Update
vickybung1 Dec 21, 2022
262a37a
Merge branch 'dev' into vb/#586-grid-io-it
vickybung1 Dec 21, 2022
cff6071
Merge branch 'vb/#710_decimalPlaces_deSerialize' into vb/#586-grid-io-it
vickybung1 Dec 21, 2022
a2b3620
Merge branch 'dev' into vb/#586-grid-io-it
vickybung1 Jan 10, 2023
a4a76d5
Update and adapted Changelog
vickybung1 Jan 10, 2023
ed217a6
Merge branch 'dev' into vb/#586-grid-io-it
vickybung1 Jan 24, 2023
43d1bc9
Merge branch 'dev' into vb/#586-grid-io-it
vickybung1 Jan 31, 2023
886a781
Merge branch 'dev' into vb/#586-grid-io-it
vickybung1 Feb 7, 2023
29539fa
Update
vickybung1 Feb 7, 2023
0f96d4e
Update
vickybung1 Feb 7, 2023
489b1c3
Merge branch 'dev' into vb/#586-grid-io-it
sebastian-peter Feb 13, 2023
6d6c841
Minor code improvements
sebastian-peter Feb 13, 2023
e7cac1f
Adding JavaDoc for test
sebastian-peter Feb 13, 2023
47a6629
Merge branch 'dev' into vb/#586-grid-io-it
sebastian-peter Feb 13, 2023
8addddd
Merge branch 'dev' into vb/#586-grid-io-it
vickybung1 Feb 14, 2023
7abe85a
Merge remote-tracking branch 'origin/vb/#586-grid-io-it' into vb/#586…
vickybung1 Feb 14, 2023
0027e04
Moved package
vickybung1 Feb 14, 2023
b5c09c8
Fixing code smell: Inlining variable
sebastian-peter Feb 16, 2023
de9a002
Fixed changelog
sebastian-peter Feb 16, 2023
8549389
Improved JavaDoc
sebastian-peter Feb 16, 2023
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Writers used to write time series are closed right away
- Changed class name in FlexOptionsResult.toString [#693](https://github.com/ie3-institute/PowerSystemDataModel/issues/693)
- Deleted parameter decimalPlaces and changed naming of serialization method [#710](https://github.com/ie3-institute/PowerSystemDataModel/issues/710)
- Deleted parameter decimalPlaces [#710](https://github.com/ie3-institute/PowerSystemDataModel/issues/710)
- Created convenience function JointGridContainer [#502](https://github.com/ie3-institute/PowerSystemDataModel/issues/502)
- Completion of CSVJointGridContainer test [#586](https://github.com/ie3-institute/PowerSystemDataModel/issues/586)

## [2.0.1] - 2021-07-08

Expand Down
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 {
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;
}
}
52 changes: 52 additions & 0 deletions src/test/groovy/edu/ie3/datamodel/io/GridIoIT.groovy
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

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)
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()
}

then:
//compare input and output joint grid container

firstGridContainer.equals(secondGridContainer)



}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ trait CsvTestDataMeta {
static String coordinatesCosmoFolderPath = getResourceAbs("_coordinates/cosmo")
static String weatherCosmoFolderPath = getResourceAbs("_weather/cosmo")
static String weatherIconFolderPath = getResourceAbs("_weather/icon")
static String jointGridFolderPath = getResourceAbs("_joint_grid")

static String gridDefaultFolderPath = getResourceAbs("_grid/default")
static String gridMalformedFolderPath = getResourceAbs("_grid/malformed")
Expand Down
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
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
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
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
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
Loading