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

com.powsybl.iidm.modification.tripping.SwitchTripping Maven / Gradle / Ivy

/**
 * 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/.
 * SPDX-License-Identifier: MPL-2.0
 */
package com.powsybl.iidm.modification.tripping;

import com.powsybl.commons.PowsyblException;
import com.powsybl.iidm.network.*;

import java.util.Objects;
import java.util.Set;

/**
 * @author Geoffroy Jamgotchian {@literal }
 */
public class SwitchTripping extends AbstractTripping {

    public SwitchTripping(String id) {
        super(id);
    }

    @Override
    public String getName() {
        return "SwitchTripping";
    }

    @Override
    public void traverse(Network network, Set switchesToOpen, Set terminalsToDisconnect, Set traversedTerminals) {
        Objects.requireNonNull(network);

        Switch aSwitch = network.getSwitch(id);
        if (aSwitch == null) {
            throw new PowsyblException("Switch '" + id + "' not found");
        }

        switchesToOpen.add(aSwitch);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy