com.powsybl.openloadflow.ac.equations.ShuntCompensatorActiveFlowEquationTerm Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of powsybl-open-loadflow Show documentation
Show all versions of powsybl-open-loadflow Show documentation
An open source loadflow based on PowSyBl
The newest version!
/**
* Copyright (c) 2019, 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.openloadflow.ac.equations;
import com.powsybl.openloadflow.equations.Variable;
import com.powsybl.openloadflow.equations.VariableSet;
import com.powsybl.openloadflow.network.LfBus;
import com.powsybl.openloadflow.network.LfShunt;
import java.util.List;
import java.util.Objects;
/**
* @author Geoffroy Jamgotchian {@literal }
*/
public class ShuntCompensatorActiveFlowEquationTerm extends AbstractShuntCompensatorEquationTerm {
private final List> variables;
public ShuntCompensatorActiveFlowEquationTerm(LfShunt shunt, LfBus bus, VariableSet variableSet) {
super(shunt, bus, variableSet);
variables = List.of(vVar);
}
@Override
public List> getVariables() {
return variables;
}
private double g() {
return element.getG();
}
public static double p(double v, double g) {
return g * v * v;
}
public static double dpdv(double v, double g) {
return 2 * g * v;
}
@Override
public double eval() {
return p(v(), g());
}
@Override
public double der(Variable variable) {
Objects.requireNonNull(variable);
if (variable.equals(vVar)) {
return dpdv(v(), g());
} else {
throw new IllegalStateException("Unknown variable: " + variable);
}
}
@Override
protected String getName() {
return "ac_p_shunt";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy