com.powsybl.dataframe.network.adders.InjectionSeries 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.update.IntSeries;
import com.powsybl.dataframe.update.StringSeries;
import com.powsybl.dataframe.update.UpdatingDataframe;
import com.powsybl.iidm.network.InjectionAdder;
import static com.powsybl.dataframe.network.adders.SeriesUtils.applyIfPresent;
/**
* Common series for all injections.
*
* @author Sylvain Leclerc {@literal }
*/
class InjectionSeries extends IdentifiableSeries {
private final StringSeries connectableBuses;
private final StringSeries buses;
private final IntSeries nodes;
InjectionSeries(UpdatingDataframe dataframe) {
super(dataframe);
this.connectableBuses = dataframe.getStrings("connectable_bus_id");
this.buses = dataframe.getStrings("bus_id");
this.nodes = dataframe.getInts("node");
}
protected void setInjectionAttributes(InjectionAdder, ?> adder, int row) {
setIdentifiableAttributes(adder, row);
applyIfPresent(connectableBuses, row, connectableBusId -> {
if (!connectableBusId.isEmpty()) {
adder.setConnectableBus(connectableBusId);
}
});
applyIfPresent(buses, row, bus -> {
if (!bus.isEmpty()) {
adder.setBus(bus);
}
});
applyIfPresent(nodes, row, adder::setNode);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy