コード例 #1
0
 private void setVarName(LpSolve lpsolver) {
   int busIdx = 1;
   int genIndex = 1;
   try {
     for (Bus b : opfNet.getBusList()) {
       lpsolver.setColName(busIdx + this.numOfGen, "x" + (b.getSortNumber() + 1));
       if (opfNet.isOpfGenBus(b)) {
         lpsolver.setColName(genIndex, "Pg" + (b.getSortNumber() + 1));
         lpsolver.setColName(genIndex + this.numOfVar, "y" + (b.getSortNumber() + 1));
         genIndex++;
       }
       busIdx++;
     }
   } catch (LpSolveException e) {
     OPFLogger.getLogger().severe(e.toString());
   }
 }
コード例 #2
0
ファイル: ToolsXmlGenN1.java プロジェクト: partha67/interpss
  /** @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:"));
  }