Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieve specific parameters overrides from PlatformConfig #383

Merged
merged 3 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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.Supplier;
import com.google.common.base.Suppliers;
import com.powsybl.commons.config.ModuleConfig;
import com.powsybl.commons.config.PlatformConfig;
import com.powsybl.commons.extensions.Extension;
import com.powsybl.commons.extensions.ExtensionJsonSerializer;
Expand Down Expand Up @@ -137,6 +138,11 @@ public List<Parameter> getSpecificParameters() {
return DynaFlowParameters.SPECIFIC_PARAMETERS;
}

@Override
public Optional<ModuleConfig> getModuleConfig(PlatformConfig platformConfig) {
return platformConfig.getOptionalModuleConfig(MODULE_SPECIFIC_PARAMETERS);
}

@Override
public Optional<ExtensionJsonSerializer> getSpecificParametersSerializer() {
return Optional.of(new JsonDynaFlowParametersSerializer());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.google.common.jimfs.Jimfs;
import com.powsybl.commons.config.InMemoryPlatformConfig;
import com.powsybl.commons.config.MapModuleConfig;
import com.powsybl.commons.parameters.Parameter;
import com.powsybl.commons.test.AbstractSerDeTest;
import com.powsybl.dynaflow.DynaFlowConstants.ActivePowerCompensation;
import com.powsybl.dynaflow.DynaFlowConstants.OutputTypes;
Expand Down Expand Up @@ -132,6 +133,16 @@ void checkDefaultParameters() {
assertTrue(parametersExt.isMergeLoads());
}

@Test
void testConfigSpecificParameters() {
MapModuleConfig moduleConfig = platformConfig.createModuleConfig(MODULE_SPECIFIC_PARAMETERS);
moduleConfig.setStringProperty("svcRegulationOn", "false");

List<Parameter> parameters = new DynaFlowProvider().getSpecificParameters(platformConfig);

assertEquals(false, parameters.get(0).getDefaultValue());
}

@Test
void checkAllParametersAssignedToString() {
LoadFlowParameters parameters = LoadFlowParameters.load(platformConfig);
Expand Down
Loading