powsybl / pypowsybl

A PowSyBl and Python integration based on GraalVM native image
Mozilla Public License 2.0
55 stars 12 forks source link

TieLine contingency not supported in sensitivity analysis #677

Closed annetill closed 10 months ago

annetill commented 11 months ago

Describe the current behavior

image

Describe the expected behavior

I think we are missing a type in

    private static ContingencyElement createContingencyElement(Network network, String elementId) {
        Identifiable<?> identifiable = network.getIdentifiable(elementId);
        if (identifiable == null) {
            throw new PowsyblException("Element '" + elementId + "' not found");
        }
        if (identifiable instanceof Line) {
            return new LineContingency(elementId);
        } else if (identifiable instanceof TwoWindingsTransformer) {
            return new TwoWindingsTransformerContingency(elementId);
        } else if (identifiable instanceof HvdcLine) {
            return new HvdcLineContingency(elementId);
        } else if (identifiable instanceof BusbarSection) {
            return new BusbarSectionContingency(elementId);
        } else if (identifiable instanceof Generator) {
            return new GeneratorContingency(elementId);
        } else if (identifiable instanceof DanglingLine) {
            return new DanglingLineContingency(elementId);
        } else if (identifiable instanceof StaticVarCompensator) {
            return new StaticVarCompensatorContingency(elementId);
        } else if (identifiable instanceof ShuntCompensator) {
            return new ShuntCompensatorContingency(elementId);
        } else if (identifiable instanceof ThreeWindingsTransformer) {
            return new ThreeWindingsTransformerContingency(elementId);
        } else if (identifiable instanceof Load) {
            return new LoadContingency(elementId);
        } else if (identifiable instanceof Battery) {
            return new BatteryContingency(elementId);
        } else if (identifiable instanceof Switch) {
            return new SwitchContingency(elementId);
        } else {
            throw new PowsyblException("Element type not supported: " + identifiable.getClass().getSimpleName());
        }
    }

Describe the steps

No response

Environment

No response

Relevant Log Output

No response

Extra Information

No response

EtienneLt commented 10 months ago

done in #678