/** * Create a Dummy Bus (corresponding to a dangling line) * @param writerMo * @param modContext * @param modelicaModelsList * @param modelicaSim * @throws IOException */ private void exportDanglingBuses(Writer writerMo, ModExportContext modContext, List<String> modelicaModelsList, SimulatorInst modelicaSim) throws IOException { if ((dangLinesList.size() != 0) && (!dangLinesList.isEmpty())) { for (DanglingLine dl : dangLinesList) { Bus knownBus = dl.getTerminal().getBusBreakerView().getBus(); SV sv = new SV(0, 0, knownBus.getV(), knownBus.getAngle()); SV svDangling = sv.otherSide(dl); double voltage = svDangling.getU() / knownBus.getVoltageLevel().getNominalV(); double angle = svDangling.getA(); String name = "ext_" + dl.getId(); BusRecord busRecord = ModelConverter.getModelicaRecord(name, voltage, angle, modContext, _ddbManager, modelicaSim); this.danglingBuses.add(busRecord); this.addRecord(busRecord, writerMo, modContext, _ddbManager, modelicaSim); } } }
double p1 = t.getP(); double q1 = t.getQ(); SV sv = new SV(p1, q1, bus1 != null ? bus1.getV() : Double.NaN, bus1 != null ? bus1.getAngle() : Double.NaN).otherSide(dl); double p2 = sv.getP(); double q2 = sv.getQ(); double patl = getPermanentLimit(dl.getCurrentLimits()); formatter.writeCell(variantIndex)
public SV otherSide(DanglingLine dl) { return otherSide(dl.getR(), dl.getX(), dl.getG(), dl.getB(), 1); }
public SV otherSide(double r, double x, double g, double b, double ratio) { Complex z = new Complex(r, x); // z=r+jx Complex y = new Complex(g, b); // y=g+jb Complex s1 = new Complex(p, q); // s1=p1+jq1 Complex u1 = ComplexUtils.polar2Complex(u, Math.toRadians(a)); Complex v1 = u1.divide(Math.sqrt(3f)); // v1=u1/sqrt(3) Complex v1p = v1.multiply(ratio); // v1p=v1*rho Complex i1 = s1.divide(v1.multiply(3)).conjugate(); // i1=conj(s1/(3*v1)) Complex i1p = i1.divide(ratio); // i1p=i1/rho Complex i2 = i1p.subtract(y.multiply(v1p)); // i2=i1p-y*v1p Complex v2 = v1p.subtract(z.multiply(i2)); // v2=v1p-z*i2 Complex s2 = v2.multiply(3).multiply(i2.conjugate()); // s2=3*v2*conj(i2) Complex u2 = v2.multiply(Math.sqrt(3f)); return new SV(-s2.getReal(), -s2.getImaginary(), u2.abs(), Math.toDegrees(u2.getArgument())); }
@Override public void visitTwoWindingsTransformer(TwoWindingsTransformer twt, TwoWindingsTransformer.Side side) { visitBranch(twt, side, twt.getR(), twt.getX(), twt.getG(), twt.getB(), 0, 0, SV.getRatio(twt)); }
public SV otherSide(Line l) { return otherSide(l.getR(), l.getX(), l.getG1() + l.getG2(), l.getB1() + l.getB2(), 1); }
public SV otherSide(double r, double x, double g1, double b1, double g2, double b2, double ratio) { Complex z = new Complex(r, x); // z=r+jx Complex y1 = new Complex(g1, b1); // y1=g1+jb1 Complex y2 = new Complex(g2, b2); // y2=g2+jb2 Complex s1 = new Complex(p, q); // s1=p1+jq1 Complex u1 = ComplexUtils.polar2Complex(u, Math.toRadians(a)); Complex v1 = u1.divide(Math.sqrt(3f)); // v1=u1/sqrt(3) Complex v1p = v1.multiply(ratio); // v1p=v1*rho Complex i1 = s1.divide(v1.multiply(3)).conjugate(); // i1=conj(s1/(3*v1)) Complex i1p = i1.divide(ratio); // i1p=i1/rho Complex i2p = i1p.subtract(y1.multiply(v1p)); // i2p=i1p-y1*v1p Complex v2 = v1p.subtract(z.multiply(i2p)); // v2p=v1p-z*i2 Complex i2 = i2p.subtract(y2.multiply(v2)); // i2=i2p-y2*v2 Complex s2 = v2.multiply(3).multiply(i2.conjugate()); // s2=3*v2*conj(i2) Complex u2 = v2.multiply(Math.sqrt(3f)); return new SV(-s2.getReal(), -s2.getImaginary(), u2.abs(), Math.toDegrees(u2.getArgument())); }
/** * Create a Dummy Load (corresponding to a dangling line) * @param writerMo * @param modContext * @param modelicaModelsList * @param modelicaSim * @throws IOException */ private void exportDanglingLoads(Writer writerMo, ModExportContext modContext, List<String> modelicaModelsList, SimulatorInst modelicaSim) throws IOException { if ((dangLinesList.size() != 0) && (!dangLinesList.isEmpty())) { for (DanglingLine dl : dangLinesList) { Bus knownBus = dl.getTerminal().getBusBreakerView().getBus(); SV sv = new SV(0, 0, knownBus.getV(), knownBus.getAngle()); SV svDangling = sv.otherSide(dl); double busVoltage = svDangling.getU() / knownBus.getVoltageLevel().getNominalV(); double busAngle = svDangling.getA(); double p0 = dl.getP0(); double q0 = dl.getQ0(); String loadId = "ext_" + dl.getId(); LoadRecord loadRecord = ModelConverter.getModelicaRecord(loadId, p0, q0, busVoltage, busAngle, modContext, _ddbManager, modelicaSim, SNREF, this._sourceEngine); this.danglingLoads.add(loadRecord); this.addRecord(loadRecord, writerMo, modContext, _ddbManager, modelicaSim); } } }
public SV otherSideY1Y2(Line l) { return otherSide(l.getR(), l.getX(), l.getG1(), l.getB1(), l.getG2(), l.getB2(), 1); }
} else { Bus knownBus = dl.getTerminal().getBusBreakerView().getBus(); SV sv = new SV(0, 0, knownBus.getV(), knownBus.getAngle()); SV svDangling = sv.otherSide(dl); double busVoltage = svDangling.getU() / knownBus.getVoltageLevel().getNominalV(); double busAngle = svDangling.getA(); String busName = "ext_" + dl.getId(); double p0 = dl.getP0();
private void writeDanglingLineMiddleBuses(AmplExportContext context, TableFormatter formatter) throws IOException { for (DanglingLine dl : network.getDanglingLines()) { Terminal t = dl.getTerminal(); Bus b = AmplUtil.getBus(dl.getTerminal()); int middleCcNum = getDanglingLineMiddleBusComponentNum(context, dl); if (connectedComponentToExport(middleCcNum)) { String middleBusId = getDanglingLineMiddleBusId(dl); String middleVlId = getDanglingLineMiddleVoltageLevelId(dl); context.busIdsToExport.add(middleBusId); int middleBusNum = mapper.getInt(AmplSubset.BUS, middleBusId); int middleVlNum = mapper.getInt(AmplSubset.VOLTAGE_LEVEL, middleVlId); SV sv = new SV(t.getP(), t.getQ(), b != null ? b.getV() : Double.NaN, b != null ? b.getAngle() : Double.NaN).otherSide(dl); double nomV = t.getVoltageLevel().getNominalV(); double v = sv.getU() / nomV; double theta = Math.toRadians(sv.getA()); formatter.writeCell(variantIndex) .writeCell(middleBusNum) .writeCell(middleVlNum) .writeCell(middleCcNum) .writeCell(v) .writeCell(theta) .writeCell(0.0) // 0 MW injected at dangling line internal bus .writeCell(0.0) // 0 MVar injected at dangling line internal bus .writeCell(faultNum) .writeCell(actionNum) .writeCell(middleBusId); } } }