Skip to content

Commit

Permalink
[IMG-1644] update powsybl-core version to 4.10.1
Browse files Browse the repository at this point in the history
Signed-off-by: marifunf <[email protected]>
  • Loading branch information
armic-artelys authored and marifunf committed Apr 18, 2023
1 parent fcc72e6 commit 1ae0cb5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public static MetrixConfig load() {
}

public static MetrixConfig load(PlatformConfig platformConfig) {
ModuleConfig moduleConfig = platformConfig.getModuleConfig("metrix");
ModuleConfig moduleConfig = platformConfig.getOptionalModuleConfig("metrix")
.orElseThrow(() -> new IllegalStateException("Metrix module configuration could not be found"));
Path homeDir = moduleConfig.getPathProperty("home-dir");
boolean debug = moduleConfig.getBooleanProperty("debug", DEFAULT_DEBUG);
boolean constantLossFactor = moduleConfig.getOptionalBooleanProperty("constant-loss-factor").orElse(DEFAULT_CONSTANT_LOAD_FACTOR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.ImmutableMap;
import com.powsybl.commons.config.ModuleConfig;
import com.powsybl.commons.config.PlatformConfig;

import java.util.Objects;
Expand All @@ -26,17 +25,15 @@ public class MetrixParameters {

public static MetrixParameters load() {
MetrixParameters parameters = new MetrixParameters();
if (PlatformConfig.defaultConfig().moduleExists("metrix-default-parameters")) {
ModuleConfig config = PlatformConfig.defaultConfig().getModuleConfig("metrix-default-parameters");
if (config != null) {
parameters.setComputationType(config.getOptionalEnumProperty("computation-type", MetrixComputationType.class)
.orElseGet(() -> config.getEnumProperty("computationType", MetrixComputationType.class, DEFAULT_COMPUTATION_TYPE)));
parameters.setLossFactor(config.getOptionalFloatProperty("loss-factor")
.orElseGet(() -> config.getFloatProperty("lossFactor", DEFAULT_LOSS_FACTOR)));
parameters.setNominalU(config.getOptionalIntProperty("nominal-u")
.orElseGet(() -> config.getIntProperty("nominalU", DEFAULT_NOMINAL_U)));
}
}
PlatformConfig.defaultConfig().getOptionalModuleConfig("metrix-default-parameters")
.ifPresent(config -> {
parameters.setComputationType(config.getOptionalEnumProperty("computation-type", MetrixComputationType.class)
.orElseGet(() -> config.getEnumProperty("computationType", MetrixComputationType.class, DEFAULT_COMPUTATION_TYPE)));
parameters.setLossFactor(config.getOptionalFloatProperty("loss-factor")
.orElseGet(() -> config.getFloatProperty("lossFactor", DEFAULT_LOSS_FACTOR)));
parameters.setNominalU(config.getOptionalIntProperty("nominal-u")
.orElseGet(() -> config.getIntProperty("nominalU", DEFAULT_NOMINAL_U)));
});
return parameters;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
package com.powsybl.metrix.mapping;

import com.google.common.collect.ImmutableMap;
import com.powsybl.commons.config.ModuleConfig;
import com.powsybl.commons.config.PlatformConfig;

import java.util.Objects;
Expand All @@ -20,13 +19,9 @@ public class MappingParameters {

public static MappingParameters load() {
MappingParameters parameters = new MappingParameters();
if (PlatformConfig.defaultConfig().moduleExists("mapping-default-parameters")) {
ModuleConfig config = PlatformConfig.defaultConfig().getModuleConfig("mapping-default-parameters");
if (config != null) {
parameters.setToleranceThreshold(config.getOptionalFloatProperty("tolerance-threshold")
.orElseGet(() -> config.getFloatProperty("toleranceThreshold", DEFAULT_TOLERANCE_THRESHOLD)));
}
}
PlatformConfig.defaultConfig().getOptionalModuleConfig("mapping-default-parameters")
.ifPresent(config -> parameters.setToleranceThreshold(config.getOptionalFloatProperty("tolerance-threshold")
.orElseGet(() -> config.getFloatProperty("toleranceThreshold", DEFAULT_TOLERANCE_THRESHOLD))));
return parameters;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

import com.powsybl.commons.datasource.DataSource;
import com.powsybl.commons.datasource.MemDataSource;
import com.powsybl.iidm.export.ExportOptions;
import com.powsybl.iidm.network.*;
import com.powsybl.iidm.network.extensions.HvdcAngleDroopActivePowerControl;
import com.powsybl.iidm.network.extensions.HvdcOperatorActivePowerRange;
import com.powsybl.iidm.network.extensions.LoadDetail;
import com.powsybl.iidm.network.extensions.LoadDetailAdder;
import com.powsybl.iidm.xml.ExportOptions;
import com.powsybl.iidm.xml.NetworkXml;
import com.powsybl.metrix.mapping.common.MetrixIidmConfiguration;
import com.powsybl.timeseries.TimeSeriesIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public static MetrixIidmConfiguration load() {
}

public static MetrixIidmConfiguration load(PlatformConfig platformConfig) {
ModuleConfig moduleConfig = platformConfig.getModuleConfig("metrix");

ModuleConfig moduleConfig = platformConfig.getOptionalModuleConfig("metrix")
.orElseThrow(() -> new IllegalStateException("Metrix module configuration could not be found"));
String iidmExportVersion = moduleConfig.getOptionalStringProperty("iidm-export-version")
.orElseGet(() -> moduleConfig.getStringProperty("iidmExportVersion", IIDM_EXPORT_VERSION));
return new MetrixIidmConfiguration(iidmExportVersion);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<mockito.version>3.9.0</mockito.version>
<slf4j.version>1.7.32</slf4j.version>

<powsyblcore.version>4.7.0</powsyblcore.version>
<powsyblcore.version>4.10.1</powsyblcore.version>
</properties>

<profiles>
Expand Down

0 comments on commit 1ae0cb5

Please sign in to comment.