Exemple #1
0
  private void writeVoltageReport() {
    int i, j;
    double VmagPU;
    int underCount;
    int overCount;
    double overVMax;
    double underVMin;
    Bus bus;

    /* For any bus with a defined voltage base, test for > Vmax or < Vmin */

    overCount = 0;
    underCount = 0;

    Circuit ckt = DSS.activeCircuit;

    overVMax = ckt.getNormalMinVolts();
    underVMin = ckt.getNormalMaxVolts();
    for (i = 0; i < ckt.getNumBuses(); i++) {
      bus = ckt.getBus(i);
      if (bus.getKVBase() > 0.0) {
        for (j = 0; j < bus.getNumNodesThisBus(); j++) {
          VmagPU = ckt.getSolution().getNodeV(bus.getRef(j)).abs() / bus.getKVBase() * 0.001;
          if (VmagPU > 0.1) { // ignore neutral buses
            underVMin = Math.min(underVMin, VmagPU);
            overVMax = Math.max(overVMax, VmagPU);
            if (VmagPU < ckt.getNormalMinVolts()) {
              underCount += 1;
              break; /* next i */
            } else if (VmagPU > ckt.getNormalMaxVolts()) {
              overCount += 1;
              break;
            }
          }
        }
      }
    } /* for i */

    PrintWriter pw = new PrintWriter(voltageFile);
    pw.printf("%-.6g,", ckt.getSolution().getDblHour());
    pw.printf(" %d, %-.6g, %d, %-.6g", underCount, underVMin, overCount, overVMax);
    pw.println();
    pw.close();
  }
Exemple #2
0
  public void resetMeterZonesAll() {
    int i;
    Circuit ckt = DSS.activeCircuit;

    if (ckt.getEnergyMeters().size() == 0) return;

    // initialize the checked flag for all circuit elements.
    for (CktElement elem : ckt.getCktElements()) {
      elem.setChecked(false);
      elem.setIsolated(true);
      for (i = 0; i < elem.getNumTerms(); i++) elem.getTerminal(i).setChecked(false);
    }

    /* Clear some things that will be set by the meter zone */
    for (PDElement elem : ckt.getPDElements()) {
      elem.setMeterObj(null);
      elem.setSensorObj(null);
      elem.setParentPDElement(null);
    }

    for (PCElement elem : ckt.getPCElements()) {
      elem.setMeterObj(null);
      elem.setSensorObj(null);
    }

    // set up the bus adjacency lists for faster searches to build meter zone lists
    CktTree.buildActiveBusAdjacencyLists(busAdjPD, busAdjPC);

    /* Set hasMeter flag for all cktElements */
    setHasMeterFlag();
    DSS.sensorClass.setHasSensorFlag(); // set all sensor branch flags, too.

    // initialise the checked flag for all buses
    for (i = 0; i < ckt.getNumBuses(); i++) ckt.getBus(i).setBusChecked(false);

    for (EnergyMeterObj meter : ckt.getEnergyMeters())
      if (meter.isEnabled()) meter.makeMeterZoneLists();

    CktTree.freeBusAdjacencyLists(busAdjPD, busAdjPC);
    busAdjPD = null;
    busAdjPC = null;
  }
Exemple #3
0
  /**
   * Scans the active circuit for overloaded PD elements and writes each to a file. This is called
   * only if in Demand Interval (DI) mode and the file is open.
   */
  private void writeOverloadReport() {
    double Cmax;
    Circuit ckt = DSS.activeCircuit;

    PrintWriter pw = new PrintWriter(overloadFile);

    /* Check PDElements only */
    for (PDElement elem : ckt.getPDElements()) {
      if (elem.isEnabled() && !elem.isShunt()) { // ignore shunts

        if (elem.getNormAmps() > 0.0 || elem.getEmergAmps() > 0.0) {
          elem.computeITerminal();
          Cmax = elem.maxTerminalOneIMag(); // for now, check only terminal 1 for overloads
          if (Cmax > elem.getNormAmps() || Cmax > elem.getEmergAmps()) {
            pw.printf("%-.6g,", ckt.getSolution().getDblHour());
            pw.printf(
                " %s, %-.4g, %-.4g,", Util.fullName(elem), elem.getNormAmps(), elem.getEmergAmps());
            if (elem.getNormAmps() > 0.0) {
              pw.printf(" %-.7g,", Cmax / elem.getNormAmps() * 100.0);
            } else {
              pw.print(" 0.0,");
            }
            if (elem.getEmergAmps() > 0.0) {
              pw.printf(" %-.7g,", Cmax / elem.getEmergAmps() * 100.0);
            } else {
              pw.print(" 0.0,");
            }
            /* Find bus of first terminal */
            pw.printf(
                " %-.3g ",
                ckt.getBus(ckt.getMapNodeToBus(elem.getNodeRef(0)).busRef - 1).getKVBase());

            pw.println();
          }
        }
      }
    }

    pw.close();
  }
Exemple #4
0
  /** Get DSS options requested and put in the global result string. */
  public static int doGetCmd() {
    int paramPointer;
    Circuit ckt = DSS.activeCircuit;

    try {
      DSS.globalResult = ""; // initialize for appending

      // continue parsing command line
      String paramName = Parser.getInstance().getNextParam();
      String param = Parser.getInstance().stringValue();

      // there will be no named parameters in this command and the params
      // themselves will be the parameter name to return
      while (param.length() > 0) {
        paramPointer = optionList.getCommand(param);

        switch (paramPointer) {
          case -1:
            DSS.doSimpleMsg("Unknown parameter \"" + paramName + "\" for Get command ", 133);
            break;
          case 0:
            DSS.appendGlobalResult(ckt.getActiveCktElement().getDSSClassName());
            break;
          case 11:
            DSS.appendGlobalResult(ckt.getActiveCktElement().getDSSClassName());
            break;
          case 1:
            DSS.appendGlobalResult(ckt.getActiveCktElement().getName());
            break;
          case 12:
            DSS.appendGlobalResult(ckt.getActiveCktElement().getName());
            break;
          case 2:
            DSS.appendGlobalResult(String.valueOf(ckt.getSolution().getIntHour()));
            break;
          case 3:
            DSS.appendGlobalResult(String.format("%g", ckt.getSolution().getDynaVars().t));
            break;
          case 4:
            DSS.appendGlobalResult(String.valueOf(ckt.getSolution().getYear()));
            break;
          case 5:
            DSS.appendGlobalResult(String.format("%g", ckt.getSolution().getFrequency()));
            break;
          case 6:
            DSS.appendGlobalResult(String.format("%g", ckt.getSolution().getDynaVars().h));
            break;
          case 17:
            DSS.appendGlobalResult(String.format("%g", ckt.getSolution().getDynaVars().h));
            break;
          case 7:
            DSS.appendGlobalResult(Util.getSolutionModeID());
            break;
          case 8:
            DSS.appendGlobalResult(Util.getRandomModeID());
            break;
          case 9:
            DSS.appendGlobalResult(String.valueOf(ckt.getSolution().getNumberOfTimes()));
            break;
          case 10:
            DSS.appendGlobalResult(
                String.format(
                    "[ %d, %g ]",
                    String.valueOf(ckt.getSolution().getIntHour()),
                    ckt.getSolution().getDynaVars().t));
            break;
          case 13:
            DSS.appendGlobalResult(ckt.getName());
            break;
          case 14:
            DSS.appendGlobalResult(DSS.defaultEditor);
            break;
          case 15:
            DSS.appendGlobalResult(
                String.format("%g", ckt.getSolution().getConvergenceTolerance()));
            break;
          case 16:
            DSS.appendGlobalResult(String.valueOf(ckt.getSolution().getMaxIterations()));
            break;
          case 18:
            DSS.appendGlobalResult(Util.getLoadModel());
            break;
          case 19:
            DSS.appendGlobalResult(String.format("%g", ckt.getLoadMultiplier()));
            break;
          case 20:
            DSS.appendGlobalResult(String.format("%g", ckt.getNormalMinVolts()));
            break;
          case 21:
            DSS.appendGlobalResult(String.format("%g", ckt.getNormalMaxVolts()));
            break;
          case 22:
            DSS.appendGlobalResult(String.format("%g", ckt.getEmergMinVolts()));
            break;
          case 23:
            DSS.appendGlobalResult(String.format("%g", ckt.getEmergMaxVolts()));
            break;
          case 24:
            DSS.appendGlobalResult(
                String.format("%g", ckt.getDefaultDailyShapeObj().getMean() * 100.0));
            break;
          case 25:
            DSS.appendGlobalResult(
                String.format("%g", ckt.getDefaultDailyShapeObj().getStdDev() * 100.0));
            break;
          case 26:
            DSS.appendGlobalResult(ckt.getLoadDurCurve());
            break;
          case 27:
            DSS.appendGlobalResult(String.format("%g", (ckt.getDefaultGrowthRate() - 1.0) * 100.0));
            break;
          case 28:
            DSS.appendGlobalResult(String.format("%g", ckt.getAutoAddObj().getGenKW()));
            break;
          case 29:
            DSS.appendGlobalResult(String.format("%g", ckt.getAutoAddObj().getGenPF()));
            break;
          case 30:
            DSS.appendGlobalResult(String.format("%g", ckt.getAutoAddObj().getCapKVAr()));
            break;
          case 31:
            switch (ckt.getAutoAddObj().getAddType()) {
              case GEN:
                DSS.appendGlobalResult("generator");
                break;
              case CAP:
                DSS.appendGlobalResult("capacitor");
                break;
            }
            break;
          case 32:
            if (ckt.isDuplicatesAllowed()) {
              DSS.appendGlobalResult("Yes");
            } else {
              DSS.appendGlobalResult("No");
            }
            break;
          case 33:
            if (ckt.isZonesLocked()) {
              DSS.appendGlobalResult("Yes");
            } else {
              DSS.appendGlobalResult("No");
            }
            break;
          case 34:
            DSS.appendGlobalResult(String.format("%g", ckt.getUEWeight()));
            break;
          case 35:
            DSS.appendGlobalResult(String.format("%g", ckt.getLossWeight()));
            break;
          case 36:
            DSS.appendGlobalResult(Util.intArrayToString(ckt.getUERegs(), ckt.getNumUERegs()));
            break;
          case 37:
            DSS.appendGlobalResult(Util.intArrayToString(ckt.getLossRegs(), ckt.getNumLossRegs()));
            break;
          case 38:
            DSS.globalResult = "(";
            for (double vBase : ckt.getLegalVoltageBases())
              DSS.globalResult += String.format("%g, ", vBase);
            DSS.globalResult += ")";
            break;
          case 39:
            switch (ckt.getSolution().getAlgorithm()) {
              case NORMAL:
                DSS.appendGlobalResult("normal");
                break;
              case NEWTON:
                DSS.appendGlobalResult("newton");
                break;
            }
            break;
          case 40:
            if (ckt.isTrapezoidalIntegration()) {
              DSS.appendGlobalResult("Yes");
            } else {
              DSS.appendGlobalResult("No");
            }
            break;
          case 41:
            for (int i = 0; i < ckt.getAutoAddBusList().listSize(); i++)
              DSS.appendGlobalResult(ckt.getAutoAddBusList().get(i));
            break;
          case 42:
            DSS.appendGlobalResult(Util.getControlModeID());
            break;
          case 43:
            if (ckt.getControlQueue().isTrace()) {
              DSS.appendGlobalResult("Yes");
            } else {
              DSS.appendGlobalResult("No");
            }
            break;
          case 44:
            DSS.appendGlobalResult(String.format("%g", ckt.getGenMultiplier()));
            break;
          case 45:
            DSS.appendGlobalResult(ckt.getDefaultDailyShapeObj().getName());
            break;
          case 46:
            DSS.appendGlobalResult(ckt.getDefaultYearlyShapeObj().getName());
            break;
          case 47:
            DSS.appendGlobalResult("Get function not applicable.");
            break;
          case 48:
            if (ckt.isPositiveSequence()) {
              DSS.appendGlobalResult("positive");
            } else {
              DSS.appendGlobalResult("multiphase");
            }
            break;
          case 49:
            DSS.appendGlobalResult(String.format("%g", ckt.getPriceSignal()));
            break;
          case 50:
            DSS.appendGlobalResult(ckt.getPriceCurve());
            break;
          case 51:
            DSS.appendGlobalResult(
                String.format("%d", ckt.getActiveCktElement().getActiveTerminalIdx()));
            break;
          case 52:
            DSS.appendGlobalResult(String.format("%g", ckt.getFundamental()));
            break;
          case 53:
            if (ckt.getSolution().isDoAllHarmonics()) {
              DSS.appendGlobalResult("ALL");
            } else {
              for (int i = 0; i < ckt.getSolution().getHarmonicListSize(); i++)
                DSS.appendGlobalResult(String.format("%g", ckt.getSolution().getHarmonicList()[i]));
            }
            break;
          case 54:
            DSS.appendGlobalResult(String.valueOf(ckt.getSolution().getMaxControlIterations()));
            break;
          case 55:
            DSS.appendGlobalResult(ckt.getBusList().get(ckt.getActiveBusIndex()));
            break;
          case 56:
            DSS.appendGlobalResult(DSS.dataDirectory);
            break;
          case 57:
            for (int i = 0; i < ckt.getNumBuses(); i++)
              if (ckt.getBus(i).isKeep()) DSS.appendGlobalResult(ckt.getBusList().get(i));
            break;
          case 58:
            DSS.appendGlobalResult(ckt.getReductionStrategyString());
            break;
          case 59:
            if (DSS.energyMeterClass.isSaveDemandInterval()) {
              DSS.appendGlobalResult("Yes");
            } else {
              DSS.appendGlobalResult("No");
            }
            break;
          case 60:
            DSS.appendGlobalResult(String.format("%-.g", ckt.getPctNormalFactor()));
            break;
          case 61:
            if (DSS.energyMeterClass.isDI_Verbose()) {
              DSS.appendGlobalResult("Yes");
            } else {
              DSS.appendGlobalResult("No");
            }
            break;
          case 62:
            DSS.appendGlobalResult(ckt.getCaseName());
            break;
          case 63:
            DSS.appendGlobalResult(String.format("%d", ckt.getNodeMarkerCode()));
            break;
          case 64:
            DSS.appendGlobalResult(String.format("%d", ckt.getNodeMarkerWidth()));
            break;
          case 65:
            if (ckt.isLogEvents()) {
              DSS.appendGlobalResult("Yes");
            } else {
              DSS.appendGlobalResult("No");
            }
            break;
          case 66:
            if (Executive.getInstance().isRecorderOn()) {
              DSS.appendGlobalResult("Yes");
            } else {
              DSS.appendGlobalResult("No");
            }
            break;
          case 67:
            if (DSS.energyMeterClass.isDoOverloadReport()) {
              DSS.appendGlobalResult("Yes");
            } else {
              DSS.appendGlobalResult("No");
            }
            break;
          case 68:
            if (DSS.energyMeterClass.isDoVoltageExceptionReport()) {
              DSS.appendGlobalResult("Yes");
            } else {
              DSS.appendGlobalResult("No");
            }
            break;
          case 69:
            DSS.appendGlobalResult("Get function not applicable.");
            break;
          case 70:
            if (DSS.autoShowExport) {
              DSS.appendGlobalResult("Yes");
            } else {
              DSS.appendGlobalResult("No");
            }
            break;
          case 71:
            DSS.appendGlobalResult(String.format("%d", DSS.maxAllocationIterations));
            break;
          case 72:
            DSS.appendGlobalResult(String.format("%d", DSS.defaultBaseFreq));
            break;
          case 73:
            if (ckt.isMarkSwitches()) {
              DSS.appendGlobalResult("Yes");
            } else {
              DSS.appendGlobalResult("No");
            }
            break;
          case 74:
            DSS.appendGlobalResult(String.format("%d", ckt.getSwitchMarkerCode()));
            break;
          case 75:
            DSS.appendGlobalResult(String.format("%-.6g", DSS.daisySize));
            break;
          case 76:
            if (ckt.isMarkTransformers()) {
              DSS.appendGlobalResult("Yes");
            } else {
              DSS.appendGlobalResult("No");
            }
            break;
          case 77:
            DSS.appendGlobalResult(String.format("%d", ckt.getTransMarkerCode()));
            break;
          case 78:
            DSS.appendGlobalResult(String.format("%d", ckt.getTransMarkerSize()));
            break;
          case 79:
            DSS.appendGlobalResult(Util.getActiveLoadShapeClass());
            break;
          case 80:
            DSS.appendGlobalResult(Util.getEarthModel(DSS.defaultEarthModel));
            break;
          case 81:
            if (DSS.logQueries) {
              DSS.appendGlobalResult("Yes");
            } else {
              DSS.appendGlobalResult("No");
            }
          default:
            // ignore excess parameters
            break;
        }

        paramName = Parser.getInstance().getNextParam();
        param = Parser.getInstance().stringValue();
      }

    } catch (Exception e) {
      DSS.appendGlobalResult("***Error***");
    }

    return 0;
  }