com.farao_community.farao.ra_optimisation.RaoComputationParameters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of farao-ra-optimisation-api Show documentation
Show all versions of farao-ra-optimisation-api Show documentation
Interface of a remedial actions optimisation task
/*
* Copyright (c) 2018, 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 com.farao_community.farao.ra_optimisation;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.powsybl.commons.config.PlatformConfig;
import com.powsybl.commons.extensions.AbstractExtendable;
import com.powsybl.commons.extensions.Extension;
import com.powsybl.commons.extensions.ExtensionConfigLoader;
import com.powsybl.commons.extensions.ExtensionProviders;
import com.powsybl.loadflow.LoadFlowParameters;
import java.util.Objects;
/**
* Parameters for rao computation.
* Extensions may be added, for instance for implementation-specific parameters.
*
* @author Mohamed Zelmat {@literal }
*/
public class RaoComputationParameters extends AbstractExtendable {
/**
* A configuration loader interface for the RaoComputationParameters extensions loaded from the platform configuration
* @param The extension class
*/
public static interface ConfigLoader> extends ExtensionConfigLoader {
}
public static final String VERSION = "1.0";
private static final Supplier> SUPPLIER =
Suppliers.memoize(() -> ExtensionProviders.createProvider(ConfigLoader.class, "rao-computation-parameters"));
private LoadFlowParameters loadFlowParameters = new LoadFlowParameters();
/**
* Load parameters from platform default config.
*/
public static RaoComputationParameters load() {
return load(PlatformConfig.defaultConfig());
}
/**
* Load parameters from a provided platform config.
*/
public static RaoComputationParameters load(PlatformConfig platformConfig) {
Objects.requireNonNull(platformConfig);
RaoComputationParameters parameters = new RaoComputationParameters();
parameters.readExtensions(platformConfig);
parameters.setLoadFlowParameters(LoadFlowParameters.load(platformConfig));
return parameters;
}
private void readExtensions(PlatformConfig platformConfig) {
for (ExtensionConfigLoader provider : SUPPLIER.get().getProviders()) {
addExtension(provider.getExtensionClass(), provider.load(platformConfig));
}
}
public LoadFlowParameters getLoadFlowParameters() {
return loadFlowParameters;
}
public RaoComputationParameters setLoadFlowParameters(LoadFlowParameters loadFlowParameters) {
this.loadFlowParameters = Objects.requireNonNull(loadFlowParameters);
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy