// Calculate Vsh to match the tuned constant V private Complex solveConstV(Complex vsh1, Complex vi, ConverterLF converter, double tunedValue) throws InterpssException { // 1. Change the bus type to be PV bus, Solve the load flow, get the Qsh to be compensated AclfNetwork tempNetwork = CoreObjectFactory.createAclfNetwork(this.net.serialize()); tempNetwork.getAclfBus(id).setGenCode(AclfGenCode.GEN_PV); tempNetwork.getAclfBus(id).setVoltageMag(tunedValue); double p = tempNetwork.getAclfBus(id).getLoadP(); double q = tempNetwork.getAclfBus(id).getLoadQ(); tempNetwork.getAclfBus(id).setGenP(-p); tempNetwork.getAclfBus(id).setLoadP(0.0); tempNetwork.getAclfBus(id).setLoadQ(0.0); LoadflowAlgorithm algo = CoreObjectFactory.createLoadflowAlgorithm(tempNetwork); tempNetwork.accept(algo); double qsh = tempNetwork.getAclfBus(id).getGenResults().getImaginary() + q; // 2. Calculate Vsh with constantQ control, control to Qsh Complex vsh = solveConstQ(converter.getVth(), tempNetwork.getAclfBus(id).getVoltage(), converter, qsh); net.getAclfBus(id) .setVoltage( tempNetwork .getAclfBus(id) .getVoltage()); // Bus voltage should be updated, otherwise there will be a non-zero // p // System.out.println(converter.getSij(net).getReal() + "+j" + // converter.getSij(net).getImaginary()); err = 0.0; return vsh; }
// Update vsh inside the statcom converter public void update(AclfNetwork net) throws InterpssException { Complex vi = net.getAclfBus(id).getVoltage(); Complex vsh1 = this.converter.getVth(); if (type == StatcomControlType.ConstB) { // Control of constant shunt admittance Complex vsh = solveConstB(vsh1, vi, this.converter, tunedValue); this.converter.setVth(vsh); } else if (type == StatcomControlType.ConstQ) { // Control of constant shunt reactive power compensation Complex vsh = solveConstQ(vsh1, vi, this.converter, tunedValue); this.converter.setVth(vsh); } else if (type == StatcomControlType.ConstV) { // Control of constant voltage magnitude Complex vsh = solveConstV(vsh1, vi, this.converter, tunedValue); this.converter.setVth(vsh); } Complex vsh2 = this.converter.getVth(); if (type != StatcomControlType.ConstV) err = (vsh1.subtract(vsh2)).abs(); }