com.powsybl.psse.model.pf.PssePowerFlowModel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of powsybl-psse-model Show documentation
Show all versions of powsybl-psse-model Show documentation
PSS/E raw format data model
/**
* Copyright (c) 2020, 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.psse.model.pf;
import com.powsybl.psse.model.PsseVersioned;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
*
* @author Geoffroy Jamgotchian {@literal }
*/
public class PssePowerFlowModel {
private final PsseCaseIdentification caseIdentification;
private final List buses = new ArrayList<>();
private final List loads = new ArrayList<>();
private final List fixedShunts = new ArrayList<>();
private final List generators = new ArrayList<>();
private final List nonTransformerBranches = new ArrayList<>();
private final List transformers = new ArrayList<>();
private final List areas = new ArrayList<>();
private final List twoTerminalDcTransmissionLines = new ArrayList<>();
private final List voltageSourceConverterDcTransmissionLines = new ArrayList<>();
private final List transformerImpedanceCorrections = new ArrayList<>();
private final List multiTerminalDcTransmissionLines = new ArrayList<>();
private final List lineGrouping = new ArrayList<>();
private final List zones = new ArrayList<>();
private final List interareaTransfer = new ArrayList<>();
private final List owners = new ArrayList<>();
private final List facts = new ArrayList<>();
private final List switchedShunts = new ArrayList<>();
private final List gneDevice = new ArrayList<>();
private final List inductionMachines = new ArrayList<>();
public PssePowerFlowModel(PsseCaseIdentification caseIdentification) {
this.caseIdentification = Objects.requireNonNull(caseIdentification);
}
public PsseCaseIdentification getCaseIdentification() {
return caseIdentification;
}
public void addBuses(List buses) {
this.buses.addAll(modelled(buses));
}
public List getBuses() {
return Collections.unmodifiableList(buses);
}
public void addLoads(List loads) {
this.loads.addAll(modelled(loads));
}
public List getLoads() {
return Collections.unmodifiableList(loads);
}
public void addFixedShunts(List fixedShunts) {
this.fixedShunts.addAll(fixedShunts);
}
public List getFixedShunts() {
return Collections.unmodifiableList(fixedShunts);
}
public void addGenerators(List generators) {
this.generators.addAll(modelled(generators));
}
public List getGenerators() {
return Collections.unmodifiableList(generators);
}
public void addNonTransformerBranches(List nonTransformerBranches) {
this.nonTransformerBranches.addAll(modelled(nonTransformerBranches));
}
public List getNonTransformerBranches() {
return Collections.unmodifiableList(nonTransformerBranches);
}
public void addTransformers(List transformers) {
this.transformers.addAll(modelled(transformers));
}
public List getTransformers() {
return Collections.unmodifiableList(transformers);
}
public void addAreas(List areas) {
this.areas.addAll(areas);
}
public List getAreas() {
return Collections.unmodifiableList(areas);
}
public void addTwoTerminalDcTransmissionLines(List twoTerminalDcTransmissionLines) {
this.twoTerminalDcTransmissionLines.addAll(modelled(twoTerminalDcTransmissionLines));
}
public List getTwoTerminalDcTransmissionLines() {
return Collections.unmodifiableList(twoTerminalDcTransmissionLines);
}
public void addVoltageSourceConverterDcTransmissionLines(List voltageSourceConverterDcTransmissionLines) {
this.voltageSourceConverterDcTransmissionLines.addAll(modelled(voltageSourceConverterDcTransmissionLines));
}
public List getVoltageSourceConverterDcTransmissionLines() {
return Collections.unmodifiableList(voltageSourceConverterDcTransmissionLines);
}
public void addTransformerImpedanceCorrections(List transformerImpedanceCorrections) {
this.transformerImpedanceCorrections.addAll(transformerImpedanceCorrections);
}
public List getTransformerImpedanceCorrections() {
return Collections.unmodifiableList(transformerImpedanceCorrections);
}
public void addMultiTerminalDcTransmissionLines(List multiTerminalDcTransmissionLines) {
this.multiTerminalDcTransmissionLines.addAll(multiTerminalDcTransmissionLines);
}
public List getMultiTerminalDcTransmissionLines() {
return Collections.unmodifiableList(multiTerminalDcTransmissionLines);
}
public void addLineGrouping(List lineGrouping) {
this.lineGrouping.addAll(lineGrouping);
}
public List getLineGrouping() {
return Collections.unmodifiableList(lineGrouping);
}
public void addZones(List zones) {
this.zones.addAll(zones);
}
public List getZones() {
return Collections.unmodifiableList(zones);
}
public void addInterareaTransfer(List interareaTransfer) {
this.interareaTransfer.addAll(interareaTransfer);
}
public List getInterareaTransfer() {
return Collections.unmodifiableList(interareaTransfer);
}
public void addOwners(List owners) {
this.owners.addAll(owners);
}
public List getOwners() {
return Collections.unmodifiableList(owners);
}
public void addFacts(List facts) {
this.facts.addAll(modelled(facts));
}
public List getFacts() {
return Collections.unmodifiableList(facts);
}
public void addSwitchedShunts(List switchedShunts) {
this.switchedShunts.addAll(modelled(switchedShunts));
}
public List getSwitchedShunts() {
return Collections.unmodifiableList(switchedShunts);
}
public void addGneDevice(List gneDevice) {
this.gneDevice.addAll(gneDevice);
}
public List getGneDevice() {
return Collections.unmodifiableList(gneDevice);
}
public void addInductionMachines(List inductionMachines) {
this.inductionMachines.addAll(inductionMachines);
}
public List getInductionMachines() {
return Collections.unmodifiableList(inductionMachines);
}
public PssePowerFlowModel referenceAndCopyPssePowerFlowModel() {
PssePowerFlowModel newPsseModel = new PssePowerFlowModel(this.getCaseIdentification());
referencePermanentBlocks(this, newPsseModel);
copyModifiedBlocks(this, newPsseModel);
return newPsseModel;
}
private static void referencePermanentBlocks(PssePowerFlowModel psseModel, PssePowerFlowModel newPsseModel) {
newPsseModel.addAreas(psseModel.getAreas());
newPsseModel.addTwoTerminalDcTransmissionLines(psseModel.getTwoTerminalDcTransmissionLines());
newPsseModel.addVoltageSourceConverterDcTransmissionLines(psseModel.getVoltageSourceConverterDcTransmissionLines());
newPsseModel.addTransformerImpedanceCorrections(psseModel.getTransformerImpedanceCorrections());
newPsseModel.addMultiTerminalDcTransmissionLines(psseModel.getMultiTerminalDcTransmissionLines());
newPsseModel.addLineGrouping(psseModel.getLineGrouping());
newPsseModel.addZones(psseModel.getZones());
newPsseModel.addInterareaTransfer(psseModel.getInterareaTransfer());
newPsseModel.addOwners(psseModel.getOwners());
newPsseModel.addFacts(psseModel.getFacts());
newPsseModel.addGneDevice(psseModel.getGneDevice());
newPsseModel.addInductionMachines(psseModel.getInductionMachines());
}
private static void copyModifiedBlocks(PssePowerFlowModel psseModel, PssePowerFlowModel newPsseModel) {
psseModel.getBuses().forEach(psseBus -> newPsseModel.buses.add(psseBus.copy()));
psseModel.getLoads().forEach(psseLoad -> newPsseModel.loads.add(psseLoad.copy()));
psseModel.getFixedShunts().forEach(psseFixedShunt -> newPsseModel.fixedShunts.add(psseFixedShunt.copy()));
psseModel.getGenerators().forEach(psseGenerator -> newPsseModel.generators.add(psseGenerator.copy()));
psseModel.getNonTransformerBranches().forEach(nonTransformerBranch -> newPsseModel.nonTransformerBranches.add(nonTransformerBranch.copy()));
psseModel.getTransformers().forEach(psseTransformer -> newPsseModel.transformers.add(psseTransformer.copy()));
psseModel.getSwitchedShunts().forEach(psseSwitchedShunt -> newPsseModel.switchedShunts.add(psseSwitchedShunt.copy()));
}
private List modelled(List elements) {
for (PsseVersioned v : elements) {
v.setModel(this);
}
return elements;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy