com.powsybl.dataframe.network.adders.LineDataframeAdder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pypowsybl Show documentation
Show all versions of pypowsybl Show documentation
A C interface to powsybl, for pypowsybl implementation
The 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/.
* SPDX-License-Identifier: MPL-2.0
*/
package com.powsybl.dataframe.network.adders;
import com.powsybl.dataframe.SeriesMetadata;
import com.powsybl.dataframe.update.UpdatingDataframe;
import com.powsybl.iidm.network.Network;
import java.util.Collections;
import java.util.List;
/**
* @author Yichen TANG {@literal }
* @author Etienne Lesot {@literal }
* @author Sylvain Leclerc {@literal }
*/
public class LineDataframeAdder extends AbstractSimpleAdder {
private static final List METADATA = List.of(
SeriesMetadata.stringIndex("id"),
SeriesMetadata.strings("voltage_level1_id"),
SeriesMetadata.strings("bus1_id"),
SeriesMetadata.strings("connectable_bus1_id"),
SeriesMetadata.ints("node1"),
SeriesMetadata.strings("voltage_level2_id"),
SeriesMetadata.strings("bus2_id"),
SeriesMetadata.strings("connectable_bus2_id"),
SeriesMetadata.ints("node2"),
SeriesMetadata.strings("name"),
SeriesMetadata.doubles("b1"),
SeriesMetadata.doubles("b2"),
SeriesMetadata.doubles("g1"),
SeriesMetadata.doubles("g2"),
SeriesMetadata.doubles("r"),
SeriesMetadata.doubles("x")
);
@Override
public List> getMetadata() {
return Collections.singletonList(METADATA);
}
@Override
public void addElements(Network network, UpdatingDataframe dataframe) {
LineSeries series = new LineSeries(dataframe);
for (int row = 0; row < dataframe.getRowCount(); row++) {
series.create(network, row).add();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy