Ejemplo n.º 1
0
  private boolean runLoadflow(DistNetwork distNet, SimuContext simuCtx) {
    boolean converge = true;
    if (distNet.getLoadScheduleData().getSchedulePoints() == 0) {
      setNameplateAclfNetData(distNet);
      converge = runLoadflow_internal(distNet.getAcscNet(), simuCtx.getLoadflowAlgorithm());

      if (this.xmlCaseData.getAclfAlgorithm().isDisplaySummary()) {
        IOutputTextDialog dialog = UISpringFactory.getOutputTextDialog("Loadflow Analysis Info");
        dialog.display(distNet.getAcscNet());
      }
    } else {
      double loss = 0.0;
      for (int i = 0; i < distNet.getLoadScheduleData().getSchedulePoints(); i++) {
        distNet.setPointAclfNetData(i);
        if (!runLoadflow_internal(distNet.getAcscNet(), simuCtx.getLoadflowAlgorithm()))
          converge = false;

        for (Bus b : distNet.getBusList()) {
          DistBus distBus = (DistBus) b;
          DistBusAdapter aBusApt = (DistBusAdapter) distBus.getAdapter(DistBusAdapter.class);
          aBusApt.setPointVoltage(distBus.getAcscBus().getVoltage(), i);
        }
      }

      distNet.getLoadScheduleData().setTotalLossKwHr(loss);
      if (this.xmlCaseData.getAclfAlgorithm().isDisplaySummary()) {
        IOutputTextDialog dialog =
            UISpringFactory.getOutputTextDialog("Distribution Loadflow Analysis Info");
        dialog.display(distNet);
      }
    }
    return converge;
  }
Ejemplo n.º 2
0
  /** @see java.awt.event.ActionListener#actionPerformed(ActionEvent) */
  public void actionPerformed(ActionEvent e) {
    IAppSimuContext project;
    try {
      project = GraphSpringFactory.getIpssGraphicEditor().getCurrentAppSimuContext();
    } catch (Exception ex) {
      IpssLogger.logErr(ex);
      return;
    }

    SimuContext simuCtx = (SimuContext) project.getSimuCtx();
    Network<Bus, Branch> net = simuCtx.getNetwork();
    AclfStudyCaseListXmlType list = IpssXmlParser.getFactory().createAclfStudyCaseListXmlType();
    for (Branch bra : net.getBranchList()) {
      AclfStudyCaseXmlType studyCase = IpssXmlParser.getFactory().createAclfStudyCaseXmlType();
      list.getAclfStudyCase().add(studyCase);
      String id =
          bra.getFromBus().getId() + "-" + bra.getToBus().getId() + "_" + bra.getCircuitNumber();
      studyCase.setRecId("StudyCase_OpenBranch_" + id);
      studyCase.setRecDesc("Open branch " + bra.getId());
      ModificationXmlType mod = IpssXmlParser.getFactory().createModificationXmlType();
      studyCase.setModification(mod);
      BranchChangeRecXmlType changeRec = IpssXmlParser.getFactory().createBranchChangeRecXmlType();
      mod.setBranchChangeRecList(
          IpssXmlParser.getFactory().createModificationXmlTypeBranchChangeRecList());
      mod.getBranchChangeRecList().getBranchChangeRec().add(changeRec);
      changeRec.setRecId("OpenBranch_" + id);
      changeRec.setFromBusId(bra.getFromBus().getId());
      changeRec.setToBusId(bra.getToBus().getId());
      changeRec.setOffLine(true);
    }

    for (Bus bus : net.getBusList()) {
      if (bus.isActive() && ((AclfBus) bus).isGen() && !((AclfBus) bus).isSwing()) {
        AclfStudyCaseXmlType studyCase = IpssXmlParser.getFactory().createAclfStudyCaseXmlType();
        list.getAclfStudyCase().add(studyCase);
        studyCase.setRecId("StudyCase_GenOutage_" + bus.getId());
        studyCase.setRecDesc("Generator outage at bus " + bus.getId());
        ModificationXmlType mod = IpssXmlParser.getFactory().createModificationXmlType();
        studyCase.setModification(mod);
        BusChangeRecXmlType changeRec = IpssXmlParser.getFactory().createBusChangeRecXmlType();
        mod.setBusChangeRecList(
            IpssXmlParser.getFactory().createModificationXmlTypeBusChangeRecList());
        mod.getBusChangeRecList().getBusChangeRec().add(changeRec);
        changeRec.setRecId("GenOutage_" + bus.getId());
        changeRec.setBusId(bus.getId());
        changeRec.setGenOutage(true);
      }
    }

    IOutputTextDialog dialog = UISpringFactory.getOutputTextDialog("N-1 Modification Xml Document");
    dialog.display(
        list.toString()
            .replaceAll("xmlns:sch", "xmlns:ipss")
            .replaceAll("<sch:", "<ipss:")
            .replaceAll("</sch:", "</ipss:"));
  }
Ejemplo n.º 3
0
  public boolean runCase(SimuContext simuCtx) {
    boolean converge = false;
    if (this.xmlGridOpt.isEnableGridRun()) {
      final AclfNetwork aclfNet = simuCtx.getAclfNet();
      Grid grid = GridEnvHelper.getDefaultGrid();
      if (this.contingencyAnalysis) {
        IpssLogger.getLogger().info("Run Grid contingency analysis");

        try {
          GridContingencyAnalysis analysis =
              GridObjectFactory.createGridContingencyAnalysis(
                  simuCtx.getNetType(), simuCtx.getAclfNet(), grid);
          analysis.setLimitRunCase(this.xmlContingency.isLimitRunCases());
          if (analysis.isLimitRunCase())
            analysis.setMaxRunCase(this.xmlContingency.getMaxRunCases());

          LoadflowAlgorithm algo = simuCtx.getLoadflowAlgorithm();
          EditorPluginSpringFactory.getXml2LfAlgorithmMapper()
              .map2Model(this.xmlContingency.getDefaultAclfAlgorithm(), algo);
          analysis.perform(algo, ContingencyAnalysisType.N1);
          // System.out.println(analysis.getResult(IRemoteResult.DisplayType_SecViolation));
          // System.out.println(analysis.getResult(IRemoteResult.DisplayType_SecAssessment));

          IOutputTextDialog dialog =
              UISpringFactory.getOutputTextDialog("Contingency Analysis Info");
          StringBuffer buffer = new StringBuffer();
          buffer.append(analysis.getResult(IRemoteResult.DisplayType_SecViolation));
          buffer.append(analysis.getResult(IRemoteResult.DisplayType_SecAssessment));
          dialog.display(buffer);
        } catch (InterpssException e) {
          EditorPluginSpringFactory.getEditorDialogUtil()
              .showErrMsgDialog("Grid Aclf Error", e.toString());
          return false;
        }
      } else {
        String nodeId = GridEnvHelper.nodeIdLookup(this.xmlGridOpt.getRemoteNodeName());
        DStabSingleJobTask.RemoteNodeId = nodeId;
        GridRunner.MasterNodeId = grid.getLocalNode().getId().toString();
        try {
          RemoteMessageTable result =
              new GridRunner(grid, "InterPSS Grid Aclf Calculation", simuCtx.getLoadflowAlgorithm())
                  .executeSingleJobTask(this.xmlGridOpt.getTimeout());
          String str = result.getSerializedAclfNet();
          AclfNetwork adjNet = (AclfNetwork) SerializeEMFObjectUtil.loadModel(str);
          adjNet.rebuildLookupTable();
          simuCtx.setAclfNet(adjNet);
          converge = adjNet.isLfConverged();
          if (this.xmlCaseData.getAclfAlgorithm().isDisplaySummary()) {
            IOutputTextDialog dialog =
                UISpringFactory.getOutputTextDialog(
                    "Loadflow Analysis Run by Remote " + this.xmlGridOpt.getRemoteNodeName());
            dialog.display(adjNet);
          }
        } catch (GridException e) {
          EditorPluginSpringFactory.getEditorDialogUtil()
              .showErrMsgDialog("Grid Aclf Error", e.toString());
          return false;
        }
      }
      simuCtx.setAclfNet(aclfNet);
    } else {
      if (this.contingencyAnalysis) {
        IpssLogger.getLogger().info("Run contingency analysis");

        ContingencyAnalysis analysis =
            SimuObjectFactory.createContingencyAnalysis(
                SimuCtxType.ACLF_NETWORK, simuCtx.getAclfNet());
        analysis.setLimitRunCase(this.xmlContingency.isLimitRunCases());
        if (analysis.isLimitRunCase()) analysis.setMaxRunCase(this.xmlContingency.getMaxRunCases());

        LoadflowAlgorithm algo = simuCtx.getLoadflowAlgorithm();
        EditorPluginSpringFactory.getXml2LfAlgorithmMapper()
            .map2Model(this.xmlContingency.getDefaultAclfAlgorithm(), algo);
        analysis.analysis(algo, ContingencyAnalysisType.N1);

        IOutputTextDialog dialog = UISpringFactory.getOutputTextDialog("Contingency Analysis Info");
        dialog.display(ContingencyOutFunc.securityMargin(analysis));
      } else converge = runLoadflow(simuCtx.getAclfNet(), simuCtx);
    }
    return converge;
  }
Ejemplo n.º 4
0
 public void displaySummaryResult(SimuContext simuCtx) {
   if (this.xmlCaseData.getAclfAlgorithm().isDisplaySummary()) {
     IOutputTextDialog dialog = UISpringFactory.getOutputTextDialog("Loadflow Analysis Info");
     dialog.display(simuCtx.getAclfNet());
   }
 }