コード例 #1
0
ファイル: EnergyMeter.java プロジェクト: DevFactory/DSS
  /** Set the hasMeter flag for all cktElement; */
  protected void setHasMeterFlag() {
    Circuit ckt = DSS.activeCircuit;

    /* Initialize all to false */
    for (PDElement elem : ckt.getPDElements()) {
      elem.setHasEnergyMeter(false);
    }

    for (EnergyMeterObj meter : ckt.getEnergyMeters()) {
      if (meter.getMeteredElement() != null) meter.getMeteredElement().setHasEnergyMeter(true);
    }
  }
コード例 #2
0
ファイル: EnergyMeter.java プロジェクト: DevFactory/DSS
  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;
  }
コード例 #3
0
ファイル: EnergyMeter.java プロジェクト: DevFactory/DSS
  /**
   * 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();
  }