Пример #1
0
 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");
   }
 }
Пример #2
0
  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");
    }
  }
Пример #3
0
  /**
   * Set form data to the editor
   *
   * @return false if there is any problem
   */
  public boolean setForm2Editor() {
    IpssLogger.getLogger().info("NBFaultLocDataPanel setForm2Editor() called");

    if (xmlFaultData.getFaultType() == AcscFaultTypeEnumType.BUS_FAULT) {

    } else {
      AcscBranchFaultXmlType braFault = (AcscBranchFaultXmlType) xmlFaultData;
      reclosureCheckBox.setSelected(
          braFault.isBranchReclosure() != null && braFault.isBranchReclosure());
      branchReclosureCheckboxActionPerformed(null);
      atReclosureTimeTextField.setText(
          Number2String.toStr(braFault.getReclosureTime().getValue(), "0.00"));

      if (this.distanceTextField.isEnabled()) {
        this.distanceTextField.setText(Number2String.toStr(braFault.getDistance(), "#0.##"));
      }
    }

    if (xmlFaultData.getFaultCategory() == AcscFaultCategoryEnumType.FAULT_3_PHASE)
      this.type3PRadioButton.setSelected(true);
    else if (xmlFaultData.getFaultCategory() == AcscFaultCategoryEnumType.LINE_TO_GROUND)
      this.typeLGRadioButton.setSelected(true);
    else if (xmlFaultData.getFaultCategory() == AcscFaultCategoryEnumType.LINE_TO_LINE)
      this.typeLLRadioButton.setSelected(true);
    else if (xmlFaultData.getFaultCategory() == AcscFaultCategoryEnumType.LINE_LINE_TO_GROUND)
      this.typeLLGRadioButton.setSelected(true);
    else this.typeAllRadioButton.setSelected(true);

    setLabelText();

    if (this.rLGTextField.isEnabled()) {
      double r = 0.0, i = 0.0;
      if (xmlFaultData.getZLG() != null) {
        r = xmlFaultData.getZLG().getRe();
        i = xmlFaultData.getZLG().getIm();
      }
      this.rLGTextField.setText(Number2String.toStr(r, "#0.0000"));
      this.xLGTextField.setText(Number2String.toStr(i, "#0.0000"));
    }

    if (this.rLLTextField.isEnabled()) {
      double r = 0.0, i = 0.0;
      if (xmlFaultData.getZLL() != null) {
        r = xmlFaultData.getZLL().getRe();
        i = xmlFaultData.getZLL().getIm();
      }
      this.rLLTextField.setText(Number2String.toStr(r, "#0.0000"));
      this.xLLTextField.setText(Number2String.toStr(i, "#0.0000"));
    }

    return true;
  }
Пример #4
0
 /**
  * set branch fault info from ODM to InterPSS model
  *
  * @param scFaultXml
  * @param acscBusFault
  * @param baseV
  * @param baseKVA
  */
 public static void setBranchFaultInfo(
     AcscBranchFaultXmlType scFaultXml,
     AcscBranchFault acscBusFault,
     double baseV,
     double baseKVA) {
   // AcscBranchFault is a subclass of AcscBusFault
   setFaultInfo(scFaultXml, acscBusFault, baseV, baseKVA);
   // set fault distance
   double faultDis = scFaultXml.getDistance();
   acscBusFault.setDistance(faultDis);
 }
Пример #5
0
  /**
   * 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;
  }