Ejemplo n.º 1
0
  public double calculateQmax() {

    double area_super = fixedParams.getArea();
    double area_sub = fixedParams.getArea_sub();
    double area_tot = 0f;

    /* if (effectsBox.containsKey("ampi_sub")) */
    if (area_sub != 0) {
      area_tot = area_sub + area_super;
    } else {
      area_tot = area_super;
    }

    double qmax =
        (double)
            (J
                * area_tot
                * (ModelsEngine.width_interpolate(ampidiff, iuhC.getTstarMax(), 0, 2)
                    - ModelsEngine.width_interpolate(ampidiff, iuhC.getTstarMax() - tpmax, 0, 2)));

    return qmax;
  }
 protected double equation(double time) {
   double d = 1.0 / k * Math.exp(-t / k) * ModelsEngine.width_interpolate(ampi_sub, time, 0, 1);
   return d;
 }
Ejemplo n.º 3
0
  public double[][] calculateQ() {
    double timestep = fixedParams.getTimestep();
    double area_super = fixedParams.getArea();
    double area_sub = fixedParams.getArea_sub();
    double area_tot = 0f;

    double tcorr = ampidiff[ampidiff.length - 1][0];
    double[][] Q = new double[(int) Math.floor((tcorr + tpmax) / timestep) + 1][4];

    if (area_sub != -9999.0) {
      area_tot = area_sub + area_super;
    } else {
      area_tot = area_super;
    }

    /*
     * calculate the discharge for t < tcorr
     */
    int j = 0;
    pm.beginTask("Calculating discharge for t < tcorr...", (int) tcorr);
    for (int t = 1; t < tcorr; t += timestep) {
      j = (int) Math.floor((t) / timestep);

      if (t <= tpmax) {
        Q[j][0] = t;
        Q[j][1] = (double) (J * area_tot * ModelsEngine.width_interpolate(ampidiff, t, 0, 2));
        Q[j][2] = Q[j - 1][2] + Q[j][1];
        Q[j][3] = h;
      } else {
        Q[j][0] = t;
        Q[j][1] =
            (double)
                (J
                    * area_tot
                    * (ModelsEngine.width_interpolate(ampidiff, t, 0, 2)
                        - ModelsEngine.width_interpolate(ampidiff, t - tpmax, 0, 2)));
        Q[j][2] = Q[j - 1][2] + Q[j][1];
        Q[j][3] = 0.0;
      }
      pm.worked((int) timestep);
    }
    pm.done();

    /*
     * calculate the discharge for t > tcorr
     */
    pm.beginTask("Calculating discharge for t > tcorr...", (int) tpmax);
    for (double t = tcorr; t < (tcorr + tpmax); t += timestep) {
      j = (int) Math.floor(((int) t) / timestep);
      Q[j][0] = t;
      Q[j][1] =
          (double)
              (J
                  * area_tot
                  * (ampidiff[ampidiff.length - 1][2]
                      - ModelsEngine.width_interpolate(ampidiff, t - tpmax, 0, 2)));
      Q[j][2] = Q[j - 1][2] + Q[j][1];
      Q[j][3] = 0.0;
      pm.worked((int) timestep);
    }
    pm.done();

    /*
     * calculate the volumes
     */
    // double vol = Q[Q.length - 2][2] * timestep;
    // double vol2 = (double) (area_tot * h / 1000);

    return Q;
  }