Skip to content

Commit

Permalink
Merge branch 'master' into small_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mathbagu committed Oct 4, 2017
2 parents 5e0a0c9 + 254a1df commit d071b98
Show file tree
Hide file tree
Showing 26 changed files with 1,644 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,6 +1,8 @@
# Maven projects
/ampl-export/target/
/entsoe-case-repository/target
/case-projector/target
/case-repository/target/
/distribution/target
/dymola-integration/target/
/EU2Mod_MB/target/
Expand All @@ -26,6 +28,7 @@
/modelica-events-adder/target/
/modelica-export/target
/modules/target/
/network-merge/target/
/offline-mpi/target/
/offline-server/target/
/offline-workflow/target/
Expand Down
49 changes: 49 additions & 0 deletions case-repository/pom.xml
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2016, RTE (http://www.rte-france.com)
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>eu.itesla_project</groupId>
<artifactId>itesla-parent</artifactId>
<version>0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>case-repository</artifactId>
<name>Case repository</name>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>iidm-converter-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>computation</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
@@ -0,0 +1,44 @@
/**
* Copyright (c) 2016, All partners of the iTesla project (http://www.itesla-project.eu/consortium)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package eu.itesla_project.cases;

import eu.itesla_project.iidm.network.Country;
import eu.itesla_project.iidm.network.Network;
import org.joda.time.DateTime;
import org.joda.time.Interval;

import java.util.List;
import java.util.Set;

/**
*
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com>
*/
public interface CaseRepository {

/**
* Load a case from the repository.
*
* @param date date of the case
* @param type type of the case, snapshot (SN) or forecast (FO)
* @param country case perimeter, merge if null
* @return a case
*/
List<Network> load(DateTime date, CaseType type, Country country);

/**
* Check if the all the data of a case is available
*
* @param date date of the case
* @param type type of the case, snapshot (SN) or forecast (FO)
* @param country case perimeter, merge if null
* @return true if all the data of a case is available, false otherwise
*/
boolean isDataAvailable(DateTime date, CaseType type, Country country);

Set<DateTime> dataAvailable(CaseType type, Set<Country> countries, Interval interval);
}
@@ -0,0 +1,18 @@
/**
* Copyright (c) 2016, All partners of the iTesla project (http://www.itesla-project.eu/consortium)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package eu.itesla_project.cases;

import eu.itesla_project.computation.ComputationManager;

/**
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com>
*/
public interface CaseRepositoryFactory {

CaseRepository create(ComputationManager computationManager);

}
@@ -0,0 +1,16 @@
/**
* Copyright (c) 2016, All partners of the iTesla project (http://www.itesla-project.eu/consortium)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package eu.itesla_project.cases;

/**
*
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com>
*/
public enum CaseType {
SN,
FO
}
@@ -0,0 +1,19 @@
/**
* Copyright (c) 2016, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package eu.itesla_project.cases;

import org.junit.Test;

/**
* @author Mathieu Bague <mathieu.bague at rte-france.com>
*/
public class CoverageTest {

@Test
public void testNothing() {
}
}
79 changes: 79 additions & 0 deletions entsoe-case-repository/pom.xml
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2016, RTE (http://www.rte-france.com)
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>eu.itesla_project</groupId>
<artifactId>itesla-parent</artifactId>
<version>0.1-SNAPSHOT</version>
</parent>

<artifactId>entsoe-case-repository</artifactId>
<name>ENTSO-E case repository</name>

<dependencies>
<!-- Compilation dependencies -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>eu.itesla_project</groupId>
<artifactId>case-repository</artifactId>
</dependency>
<dependency>
<groupId>eu.itesla_project</groupId>
<artifactId>commons</artifactId>
</dependency>
<dependency>
<groupId>eu.itesla_project</groupId>
<artifactId>iidm-converter-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>entsoe-util</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>com.google.jimfs</groupId>
<artifactId>jimfs</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

</project>
@@ -0,0 +1,53 @@
/**
* Copyright (c) 2016, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package eu.itesla_project.entsoe.cases;

import eu.itesla_project.cases.CaseRepository;
import eu.itesla_project.computation.ComputationManager;
import eu.itesla_project.commons.datasource.GenericReadOnlyDataSource;
import eu.itesla_project.commons.datasource.ReadOnlyDataSourceFactory;
import eu.itesla_project.iidm.import_.Importers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;
import java.util.List;

/**
* Common ENTSOE and IIDM case repository layout:
* <pre>
* CIM/SN/2013/01/15/20130115_0620_SN2_FR0.zip
* /FO/...
* UCT/SN/...
* /FO/...
* IIDM/SN/2013/01/15/20130115_0720_SN2_FR0.xml
* /FO/...
* </pre>
*
* @author Quinary <itesla@quinary.com>
*/
public class EntsoeAndXmlCaseRepository extends EntsoeCaseRepository {

private static final Logger LOGGER = LoggerFactory.getLogger(EntsoeAndXmlCaseRepository.class);

public EntsoeAndXmlCaseRepository(EntsoeCaseRepositoryConfig config, ComputationManager computationManager) {
super(config,
Arrays.asList(new EntsoeFormat(Importers.getImporter("CIM1", computationManager), "CIM"),
new EntsoeFormat(Importers.getImporter("UCTE", computationManager), "UCT"), // official ENTSOE formats)
new EntsoeFormat(Importers.getImporter("XIIDM", computationManager), "IIDM")), // XIIDM format
(directory, baseName) -> new GenericReadOnlyDataSource(directory, baseName));
}

public EntsoeAndXmlCaseRepository(EntsoeCaseRepositoryConfig config, List<EntsoeFormat> formats, ReadOnlyDataSourceFactory dataSourceFactory) {
super(config, formats, dataSourceFactory);
}

public static CaseRepository create(ComputationManager computationManager) {
return new EntsoeAndXmlCaseRepository(EntsoeAndXmlCaseRepositoryConfig.load(), computationManager);
}

}
@@ -0,0 +1,38 @@
/**
* Copyright (c) 2016, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package eu.itesla_project.entsoe.cases;

import com.google.common.collect.Multimap;
import eu.itesla_project.commons.config.PlatformConfig;
import eu.itesla_project.iidm.import_.Importers;
import eu.itesla_project.entsoe.util.EntsoeGeographicalCode;

import java.nio.file.Path;
import java.util.Collection;

/**
*
* @author Quinary <itesla@quinary.com>
*/
public class EntsoeAndXmlCaseRepositoryConfig extends EntsoeCaseRepositoryConfig {

public EntsoeAndXmlCaseRepositoryConfig(Path rootDir, Multimap<EntsoeGeographicalCode, String> forbiddenFormatsByGeographicalCode) {
super(rootDir, forbiddenFormatsByGeographicalCode);
}

public static EntsoeCaseRepositoryConfig load() {
return load(PlatformConfig.defaultConfig());
}

static EntsoeCaseRepositoryConfig load(PlatformConfig platformConfig) {
return load(platformConfig, Importers.getFormats());
}

static EntsoeCaseRepositoryConfig load(PlatformConfig platformConfig, Collection<String> supportedFormats) {
return EntsoeCaseRepositoryConfig.load("entsoeandxmlcaserepo", platformConfig, supportedFormats);
}
}
@@ -0,0 +1,23 @@
/**
* Copyright (c) 2016, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package eu.itesla_project.entsoe.cases;

import eu.itesla_project.cases.CaseRepository;
import eu.itesla_project.cases.CaseRepositoryFactory;
import eu.itesla_project.computation.ComputationManager;

/**
*
* @author Quinary <itesla@quinary.com>
*/
public class EntsoeAndXmlCaseRepositoryFactory implements CaseRepositoryFactory {
@Override
public CaseRepository create(ComputationManager computationManager) {
return EntsoeAndXmlCaseRepository.create(computationManager);
}
}

0 comments on commit d071b98

Please sign in to comment.