Ejemplo n.º 1
0
 @Override
 public void backToLastConvgState() {
   IpssLogger.getLogger().info("return to lambda=" + this.convg_lambda);
   this.getLambda().setValue(this.convg_lambda);
   int cnt = 0;
   for (Bus b : this.cpfAlgo.getAclfNetwork().getBusList()) {
     AclfBus bus = (AclfBus) b;
     bus.setVoltageAng(this.convg_angle[cnt]);
     bus.setVoltageMag(this.convg_Vmag[cnt]);
     cnt++;
   }
 }
Ejemplo n.º 2
0
  private void saveConvgState() {

    int n = this.cpfAlgo.getAclfNetwork().getNoBus();
    this.convg_angle = new double[n];
    this.convg_Vmag = new double[n];
    this.convg_lambda = this.getLambda().getValue();

    int cnt = 0;
    for (Bus b : this.cpfAlgo.getAclfNetwork().getBusList()) {
      AclfBus bus = (AclfBus) b;
      this.convg_angle[cnt] = bus.getVoltageAng();
      this.convg_Vmag[cnt] = bus.getVoltageMag();
      cnt++;
    }
  }
Ejemplo n.º 3
0
  @Override
  public boolean solveCPF() {

    this.iteration = 0;
    this.outCnt = 0;
    lastLFConverged = true; // as a flag
    saveFlag = true;
    while (this.iteration < cpfAlgo.getCPFMaxInteration()) {
      IpssLogger.getLogger().info("CPF analysis Itr:" + this.iteration);
      /*
       * dynamically determine continuation parameter after four iterations
       * or last corrector step not converged.
       */

      if (this.iteration > 3 || !this.lastLFConverged) {
        IpssLogger.getLogger()
            .info(
                "update continuation parameter, last sort Number is #"
                    + this.getSortNumOfContParam()
                    + ",  now is #"
                    + getNextStepContParam());
        this.setSorNumofContParam(getNextStepContParam());
      }

      // run preStepSolver and update network buses' voltage with solved result;

      this.predStepSolver.stepSolver();
      /*
       * output the deltaX for test
       */
      //		  System.out.println("predictive
      // deltaXL"+this.predStepSolver.getDeltaXLambda().toString());

      // perform corrector step analysis
      LoadflowAlgorithm algo = CoreObjectFactory.createLoadflowAlgorithm();
      algo.setTolerance(this.cpfAlgo.getPflowTolerance());
      algo.setMaxIterations(this.cpfAlgo.getPfMaxInteration());
      // corrector step solver is just a customized Newton-Raphson solver;
      algo.setNrSolver(this.corrStepSolver);

      // if corrector step is not converged ,apply step size control
      if (!this.cpfAlgo.getAclfNetwork().accept(algo)) {
        if (this.cpfAlgo.getStepSize() < this.cpfAlgo.getMinStepSize() && this.iteration > 1) {
          IpssLogger.getLogger()
              .severe(
                  "predictor step size ="
                      + this.cpfAlgo.getStepSize()
                      + ",  is small enough,yet convergance problems still remains!");
          return false;
        }
        // step size control in the following step if this corrector step is not converged!
        this.predStepSolver.enableStepSizeControl(true);
        this.backToLastConvgState(); // back to the last converged state;
        IpssLogger.getLogger()
            .warning(
                "the previous Predictor step-size seems to be too large, need to be controlled");
        this.saveFlag = false;
      }

      /*
       * if corrector step is converged to the 'lower' curve because of too-large step size
       * in the predictor step; apply step control in the predictor step;
       */
      //		  else
      // if(!this.predStepSolver.isCrossMaxPwrPnt()&&(this.lambda.getValue()<this.convg_lambda)){
      //			  IpssLogger.getLogger().warning("this step lamba="+this.lambda.getValue()+"last
      // converged lambda="+this.convg_lambda+"\n"+
      //			  		", the corrector step converged in the 'lower' curve,back to last state and apply
      // step control");
      //			  this.predStepSolver.enableStepSizeControl(true);
      //			  this.backToLastConvgState();
      //			  this.saveFlag=false;
      //		  }
      else if (isCpfStopCriteriaMeet()) {
        IpssLogger.getLogger().info("one analysis Stop Criteria is meeted,CPF analysis end!");
        return true;
      }

      // save the last converged network state
      if (this.saveFlag) this.saveConvgState();

      // save the intermediate state for result output;
      if (this.cpfAlgo.getAclfNetwork().isLfConverged()) {
        this.lambdaList.add(this.getLambda().getValue());
        int index = 0;
        for (Bus b : this.cpfAlgo.getAclfNetwork().getBusList()) {
          AclfBus bus = (AclfBus) b;

          if (this.iteration == 0) {
            Hashtable<Integer, Double> ht =
                new Hashtable<Integer, Double>(this.cpfAlgo.getMaxIterations());
            ht.put(outCnt, bus.getVoltageMag());
            this.busPVCurveList.add(ht);

            this.pvOutPutList.add(bus.getVoltageMag() + ",");
          } else {
            String v = this.pvOutPutList.get(index);
            v += bus.getVoltageMag() + ",";
            this.pvOutPutList.set(index, v);

            this.busPVCurveList.get(index).put(outCnt, bus.getVoltageMag());
          }
          index++;
        }
        outCnt++;
      }
      IpssLogger.getLogger()
          .info(
              "converged? ="
                  + this.cpfAlgo.getAclfNetwork().isLfConverged()
                  + ", lambda="
                  + this.getLambda().getValue());

      this.iteration++;
      this.lastLFConverged = this.cpfAlgo.getAclfNetwork().isLfConverged();
      this.saveFlag = true;
      //		  System.out.println(AclfOutFunc.loadFlowSummary(cpfAlgo.getAclfNetwork()));
    }
    IpssLogger.getLogger().info("not converged within the max iteration!");
    return false;
  }