private void mapFault(AcscFaultAnalysisXmlType scAnalysisXml) throws InterpssException { String idStr = scAnalysisXml.getName() != null ? scAnalysisXml.getName() : scAnalysisXml.getDesc(); if (scAnalysisXml.getAcscFault() == null) throw new InterpssException("acscAnalysis.fault not defined"); AcscBaseFaultXmlType faultXml = scAnalysisXml.getAcscFault().getValue(); if (faultXml.getFaultType() == AcscFaultTypeEnumType.BUS_FAULT) { AcscBusFaultXmlType busFaultXml = (AcscBusFaultXmlType) faultXml; String faultBusId = busFaultXml.getRefBus().getBusId(); AcscBusFault acscBusFault = CoreObjectFactory.createAcscBusFault(faultBusId, acscFaultNet); acscAglo.addBusFault(faultBusId, idStr, acscBusFault); AcscBus bus = acscFaultNet.getBus(faultBusId); double baseV = bus.getBaseVoltage(); double baseKVA = bus.getNetwork().getBaseKva(); setBusFaultInfo(busFaultXml, acscBusFault, baseV, baseKVA); } else if (faultXml.getFaultType() == AcscFaultTypeEnumType.BRANCH_FAULT) { AcscBranchFaultXmlType braFaultXml = (AcscBranchFaultXmlType) faultXml; String faultBranchId = braFaultXml.getRefBranch().getBranchId(); AcscBranchFault acscBraFault = CoreObjectFactory.createAcscBranchFault(faultBranchId, acscFaultNet); acscAglo.addBranchFault(faultBranchId, idStr, acscBraFault); AcscBranch acscBra = acscFaultNet.getBranch(faultBranchId); double baseV = acscBra.getFromAclfBus().getBaseVoltage(); double baseKVA = acscBra.getNetwork().getBaseKva(); setBranchFaultInfo(braFaultXml, acscBraFault, baseV, baseKVA); } else if (faultXml.getFaultType() == AcscFaultTypeEnumType.BRANCH_OUTAGE) { throw new InterpssException("Acsc branch outtage fault not implemented"); } }
@Test public void sampleTest() { AcscNetwork faultNet = CoreObjectFactory.createAcscNetwork(); SampleCases.load_SC_5BusSystem(faultNet); // System.out.println(faultNet.net2String()); assertTrue((faultNet.getBusList().size() == 5 && faultNet.getBranchList().size() == 5)); SimpleFaultAlgorithm algo = CoreObjectFactory.createSimpleFaultAlgorithm(faultNet); AcscBusFault fault = CoreObjectFactory.createAcscBusFault("2", algo); fault.setFaultCode(SimpleFaultCode.GROUND_3P); fault.setZLGFault(new Complex(0.0, 0.0)); fault.setZLLFault(new Complex(0.0, 0.0)); algo.calculateBusFault(fault); // System.out.println(fault.toString(faultBus.getBaseVoltage(), faultNet.getBaseKva())); /* fault amps(1): ( 0.0000 + j 32.57143) pu fault amps(2): ( 0.0000 + j 0.0000) pu fault amps(0): ( 0.0000 + j 0.0000) pu */ assertTrue( TestUtilFunc.compare( fault.getFaultResult().getSCCurrent_012(), 0.0, 0.0, 0.0, 32.57142857157701, 0.0, 0.0)); // System.out.println(AcscOut.faultResult2String(faultNet)); }