Skip to content

Commit

Permalink
Fix update of specific parameters (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinebhs authored Jun 21, 2024
1 parent 656d97b commit c94ee6a
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package org.gridsuite.loadflow.server.service;

import com.powsybl.commons.PowsyblException;
import com.powsybl.commons.config.PlatformConfig;
import com.powsybl.commons.extensions.Extension;
import com.powsybl.loadflow.LoadFlowParameters;
import com.powsybl.loadflow.LoadFlowProvider;
Expand Down Expand Up @@ -35,9 +36,10 @@ public LoadFlowParameters buildParameters() {
LoadFlowProvider lfProvider = LoadFlowProvider.findAll().stream()
.filter(p -> p.getName().equals(provider))
.findFirst().orElseThrow(() -> new PowsyblException("LoadFLow provider not found " + provider));
Extension<LoadFlowParameters> extension = lfProvider.loadSpecificParameters(parameters.specificParameters())
Extension<LoadFlowParameters> specificParametersExtension = lfProvider.loadSpecificParameters(PlatformConfig.defaultConfig())
.orElseThrow(() -> new PowsyblException("Cannot add specific loadflow parameters with provider " + provider));
params.addExtension((Class) extension.getClass(), extension);
lfProvider.updateSpecificParameters(specificParametersExtension, parameters.specificParameters());
params.addExtension((Class) specificParametersExtension.getClass(), specificParametersExtension);
return params;
}

Expand Down

0 comments on commit c94ee6a

Please sign in to comment.