All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.powsybl.openrao.data.crac.io.cim.parameters.CimCracCreationParametersConfigLoader Maven / Gradle / Ivy

There is a newer version: 6.2.1
Show newest version
/*
 * Copyright (c) 2022, 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.powsybl.openrao.data.crac.io.cim.parameters;

import com.powsybl.openrao.data.crac.api.parameters.AbstractAlignedRaCracCreationParameters;
import com.powsybl.openrao.data.crac.api.parameters.CracCreationParameters;
import com.google.auto.service.AutoService;
import com.powsybl.commons.config.ModuleConfig;
import com.powsybl.commons.config.PlatformConfig;

import java.util.Optional;

/**
 * @author Baptiste Seguinot {@literal }
 */
@AutoService(CracCreationParameters.ConfigLoader.class)
public class CimCracCreationParametersConfigLoader implements CracCreationParameters.ConfigLoader {

    private static final String MODULE_NAME = "cim-crac-creation-parameters";

    @Override
    public CimCracCreationParameters load(PlatformConfig platformConfig) {
        CimCracCreationParameters parameters = new CimCracCreationParameters();
        Optional configOptional = platformConfig.getOptionalModuleConfig(MODULE_NAME);
        if (configOptional.isPresent()) {
            ModuleConfig config = configOptional.get();
            parameters.setRangeActionGroupsAsString(config.getStringListProperty("range-action-groups", AbstractAlignedRaCracCreationParameters.getDefaultRaGroupsAsString()));
        }
        return parameters;
    }

    @Override
    public String getExtensionName() {
        return "CimCracCreatorParameters";
    }

    @Override
    public String getCategoryName() {
        return "crac-creation-parameters";
    }

    @Override
    public Class getExtensionClass() {
        return CimCracCreationParameters.class;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy