Beispiel #1
0
  private boolean runLoadflow_internal(AclfNetwork aclfAdjNet, LoadflowAlgorithm algo) {
    algo.setAclfNetwork(aclfAdjNet);
    EditorPluginSpringFactory.getXml2LfAlgorithmMapper()
        .map2Model(this.getAclfCaseData().getAclfAlgorithm(), algo);

    algo.loadflow();

    return aclfAdjNet.isLfConverged();
  }
Beispiel #2
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;
  }