Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sensi integration #940

Merged
merged 2 commits into from
Feb 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -187,37 +187,23 @@ SensitivityAnalysisResultContext run(Network network, SensitivityAnalysisParamet
}
}

switch (matrix.getFunctionType()) {
case BRANCH_ACTIVE_POWER_1, BRANCH_ACTIVE_POWER_2, BRANCH_ACTIVE_POWER_3,
BRANCH_REACTIVE_POWER_1, BRANCH_REACTIVE_POWER_2, BRANCH_REACTIVE_POWER_3,
BRANCH_CURRENT_1, BRANCH_CURRENT_2, BRANCH_CURRENT_3 -> {
for (String variableId : rows) {
for (String branchId : columns) {
SensitivityVariableType variableType = matrix.getVariableType();
boolean variableSet = false;
if (variableType == null) {
variableType = getVariableType(network, variableId);
if (variableType == null) {
if (variableSetsById.containsKey(variableId)) {
variableSet = true;
variableType = SensitivityVariableType.INJECTION_ACTIVE_POWER;
} else {
throw new PowsyblException("Variable '" + variableId + "' not found");
}
}
}
for (ContingencyContext cCtx : contingencyContexts) {
handler.onFactor(matrix.getFunctionType(), branchId, variableType, variableId, variableSet, cCtx);
for (String variableId : rows) {
for (String functionId : columns) {
SensitivityVariableType variableType = matrix.getVariableType();
boolean variableSet = false;
if (variableType == null) {
variableType = getVariableType(network, variableId);
if (variableType == null) {
if (variableSetsById.containsKey(variableId)) {
variableSet = true;
variableType = SensitivityVariableType.INJECTION_ACTIVE_POWER;
} else {
throw new PowsyblException("Variable '" + variableId + "' not found");
}
}
}
}
case BUS_VOLTAGE -> {
for (String targetVoltageId : rows) {
for (String busVoltageId : columns) {
handler.onFactor(SensitivityFunctionType.BUS_VOLTAGE, busVoltageId,
SensitivityVariableType.BUS_TARGET_VOLTAGE, targetVoltageId, false, ContingencyContext.all());
}
for (ContingencyContext cCtx : contingencyContexts) {
handler.onFactor(matrix.getFunctionType(), functionId, variableType, variableId, variableSet, cCtx);
}
}
}
Expand Down
Loading