Esempio n. 1
0
  // ## operation calculateG(Temperature)
  public double calculateFreeEnergy(Temperature p_temperature) {
    // #[ operation calculateG(Temperature)
    double T = p_temperature.getK();

    return (calculateEnthalpy(p_temperature) * 1000 - T * calculateEntropy(p_temperature)) / 1000;
    // #]
  }
Esempio n. 2
0
 public double calculateEntropy(Temperature temp) {
   double T = temp.getK();
   double entropy;
   if (T < 298) throw new TemperatureOutOfRangeException();
   else if (T < middleTemperature) {
     double[] a = new double[7];
     a = lowTemperatureCoefficients;
     entropy =
         a[0] * Math.log(T)
             + a[1] * T
             + a[2] * T * T / 2
             + a[3] * T * T * T / 3
             + a[4] * T * T * T * T / 4
             + a[6];
     entropy = entropy * GasConstant.getCalMolK();
     return entropy;
   } else if (T < highTemperature) {
     double[] a = new double[7];
     a = highTemperatureCoefficients;
     entropy =
         a[0] * Math.log(T)
             + a[1] * T
             + a[2] * T * T / 2
             + a[3] * T * T * T / 3
             + a[4] * T * T * T * T / 4
             + a[6];
     entropy = entropy * GasConstant.getCalMolK();
     return entropy;
   } else throw new TemperatureOutOfRangeException();
 }