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");
    }
  }
 public void setBusBranchFaultPanel() {
   faultLocPanel.remove(busFaultPanel);
   faultLocPanel.remove(branchFaultPanel);
   if (xmlFaultData.getFaultType() == AcscFaultTypeEnumType.BUS_FAULT) {
     AcscBusFaultXmlType busFault = (AcscBusFaultXmlType) xmlFaultData;
     faultLocPanel.add(busFaultPanel, java.awt.BorderLayout.NORTH);
     if (busFault.getRefBus() == null || busFault.getRefBus().getBusId().equals("")) {
       IpssLogger.getLogger()
           .info(
               "faultBusComboBox.getSelectedItem() -> " + this.faultBusComboBox.getSelectedItem());
       if (this.faultBusComboBox.getSelectedItem() != null)
         this.faultBusComboBox.setSelectedIndex(0);
     } else this.faultBusComboBox.setSelectedItem(busFault.getRefBus().getBusId());
     this.distanceTextField.setEnabled(false);
     IpssLogger.getLogger().info("Bus Fault input panel added");
   } else {
     AcscBranchFaultXmlType braFault = (AcscBranchFaultXmlType) xmlFaultData;
     faultLocPanel.add(branchFaultPanel, java.awt.BorderLayout.NORTH);
     if (braFault.getRefBranch() == null || braFault.getRefBranch().getBranchId().equals("")) {
       IpssLogger.getLogger()
           .info(
               "faultBranchComboBox.getSelectedItem() -> "
                   + this.faultBranchComboBox.getSelectedItem());
       this.faultBranchComboBox.setSelectedIndex(0);
     } else this.faultBranchComboBox.setSelectedItem(braFault.getRefBranch().getBranchId());
     this.distanceTextField.setEnabled(true);
     IpssLogger.getLogger().info("Branch Fault input panel added");
   }
 }
Example #3
0
  private AcscFaultAnalysisXmlType createCase() {
    IpssScenarioHelper helper = new IpssScenarioHelper(new AcscModelParser());
    AcscFaultAnalysisXmlType faultCaseXml = helper.getAcscFaultAnalysis();

    AcscBusFaultXmlType busFault = helper.createAcscBusFault();
    faultCaseXml.setAcscFault(odmObjFactory.createAcscBusFault(busFault));

    busFault.getRefBus().setBusId("2");
    busFault.setFaultType(AcscFaultTypeEnumType.BUS_FAULT);
    busFault.setFaultCategory(AcscFaultCategoryEnumType.FAULT_3_PHASE);

    return faultCaseXml;
  }
  /**
   * Save editor screen data to the form
   *
   * @param errMsg error messages during the saving process.
   * @return false if there is any problem
   */
  public boolean saveEditor2Form(Vector<String> errMsg) throws Exception {
    IpssLogger.getLogger().info("NBFaultLocDataPanel saveEditor2Form() called");

    boolean ok = true;

    if (xmlFaultData.getFaultType() == AcscFaultTypeEnumType.BUS_FAULT) {
      String id = (String) this.faultBusComboBox.getSelectedItem();

      AcscBusFaultXmlType busFault = (AcscBusFaultXmlType) xmlFaultData;
      busFault.getRefBus().setBusId(id);
    } else {
      String id = (String) this.faultBranchComboBox.getSelectedItem();
      AcscBranchFaultXmlType braFault = (AcscBranchFaultXmlType) xmlFaultData;
      braFault.getRefBranch().setBranchId(id);
      // TODO  setBranch fromId, toId, cirId

      braFault.setBranchReclosure(reclosureCheckBox.isSelected());
      if (reclosureCheckBox.isSelected()) {
        if (!SwingInputVerifyUtil.largeThan(this.atReclosureTimeTextField, 0.0d)) {
          errMsg.add("Branch reclosure at Time <= 0.0");
          ok = false;
        }
        braFault
            .getReclosureTime()
            .setValue((SwingInputVerifyUtil.getDouble(this.atReclosureTimeTextField)));
        braFault.getReclosureTime().setUnit(TimePeriodUnitType.SEC);
      }

      if (this.distanceTextField.isEnabled()) {
        if (!SwingInputVerifyUtil.largeEqualThan(this.distanceTextField, 0.0d)) {
          errMsg.add("Branch fault distance < 0.0");
          ok = false;
        }
        braFault.setDistance(SwingInputVerifyUtil.getDouble(this.distanceTextField));
      }
    }

    if (this.type3PRadioButton.isSelected())
      xmlFaultData.setFaultCategory(AcscFaultCategoryEnumType.FAULT_3_PHASE);
    else if (this.typeLGRadioButton.isSelected())
      xmlFaultData.setFaultCategory(AcscFaultCategoryEnumType.LINE_TO_GROUND);
    else if (this.typeLLRadioButton.isSelected())
      xmlFaultData.setFaultCategory(AcscFaultCategoryEnumType.LINE_TO_LINE);
    else if (this.typeLLGRadioButton.isSelected())
      xmlFaultData.setFaultCategory(AcscFaultCategoryEnumType.LINE_LINE_TO_GROUND);

    if (this.rLGTextField.isEnabled()) {
      if (!SwingInputVerifyUtil.largeEqualThan(this.rLGTextField, 0.0d)) {
        errMsg.add("Fault L-G R < 0.0");
        ok = false;
      }
      xmlFaultData.getZLG().setRe(SwingInputVerifyUtil.getDouble(this.rLGTextField));
    }

    if (this.xLGTextField.isEnabled()) {
      if (!SwingInputVerifyUtil.largeEqualThan(this.xLGTextField, 0.0d)) {
        errMsg.add("Fault L-G X < 0.0");
        ok = false;
      }
      xmlFaultData.getZLG().setIm(SwingInputVerifyUtil.getDouble(this.xLGTextField));
    }

    if (this.rLLTextField.isEnabled()) {
      if (!SwingInputVerifyUtil.largeEqualThan(this.rLLTextField, 0.0d)) {
        errMsg.add("Fault L-L R < 0.0");
        ok = false;
      }
      xmlFaultData.getZLL().setRe(SwingInputVerifyUtil.getDouble(this.rLLTextField));
    }

    if (this.xLLTextField.isEnabled()) {
      if (!SwingInputVerifyUtil.largeEqualThan(this.xLLTextField, 0.0d)) {
        errMsg.add("Fault L-L X < 0.0");
        ok = false;
      }
      xmlFaultData.getZLL().setIm(SwingInputVerifyUtil.getDouble(this.xLLTextField));
    }

    return ok;
  }