Skip to content

Commit

Permalink
Adapt to the latest merged changes of loadflow provider
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
  • Loading branch information
flo-dup committed Mar 18, 2022
1 parent e50e10b commit d7de637
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.google.auto.service.AutoService;
import com.powsybl.commons.extensions.ExtensionJsonSerializer;
import com.powsybl.commons.json.JsonUtil;
import com.powsybl.loadflow.json.JsonLoadFlowParameters;
import com.powsybl.loadflow.LoadFlowParameters;

import java.io.IOException;

/**
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com>
*/
@AutoService(JsonLoadFlowParameters.ExtensionSerializer.class)
public class OpenLoadFlowParameterJsonSerializer implements JsonLoadFlowParameters.ExtensionSerializer<OpenLoadFlowParameters> {
public class OpenLoadFlowParameterJsonSerializer implements ExtensionJsonSerializer<LoadFlowParameters, OpenLoadFlowParameters> {

@Override
public String getExtensionName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,10 @@ public OpenLoadFlowParameters setHvdcAcEmulation(boolean hvdcAcEmulation) {
}

public static OpenLoadFlowParameters load() {
return new OpenLoadFlowProvider().loadSpecificParameters(PlatformConfig.defaultConfig()).orElseThrow(IllegalStateException::new);
return new OpenLoadFlowProvider().loadSpecificParameters(PlatformConfig.defaultConfig())
.filter(OpenLoadFlowParameters.class::isInstance)
.map(OpenLoadFlowParameters.class::cast)
.orElseThrow(IllegalStateException::new);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.google.auto.service.AutoService;
import com.google.common.base.Stopwatch;
import com.powsybl.commons.config.PlatformConfig;
import com.powsybl.commons.extensions.Extension;
import com.powsybl.commons.extensions.ExtensionJsonSerializer;
import com.powsybl.commons.reporter.Reporter;
import com.powsybl.computation.ComputationManager;
Expand Down Expand Up @@ -268,12 +269,12 @@ public CompletableFuture<LoadFlowResult> run(Network network, ComputationManager
}

@Override
public Optional<ExtensionJsonSerializer> getParametersExtensionSerializer() {
public Optional<ExtensionJsonSerializer> getSpecificParametersSerializer() {
return Optional.of(new OpenLoadFlowParameterJsonSerializer());
}

@Override
public Optional<OpenLoadFlowParameters> loadSpecificParameters(PlatformConfig platformConfig) {
public Optional<Extension<LoadFlowParameters>> loadSpecificParameters(PlatformConfig platformConfig) {

OpenLoadFlowParameters parameters = new OpenLoadFlowParameters();

Expand Down

0 comments on commit d7de637

Please sign in to comment.