|
13 | 13 | * @version $Id: $Id
|
14 | 14 | */
|
15 | 15 | public class SaturationPressureFunction extends LevenbergMarquardtFunction {
|
16 |
| - double molarMass = 0.0; |
| 16 | + double molarMass = 0.0; |
17 | 17 |
|
18 |
| - /** |
19 |
| - * <p> |
20 |
| - * Constructor for SaturationPressureFunction. |
21 |
| - * </p> |
22 |
| - */ |
23 |
| - public SaturationPressureFunction() { |
24 |
| - params = new double[1]; |
25 |
| - } |
26 |
| - |
27 |
| - /** {@inheritDoc} */ |
28 |
| - @Override |
29 |
| - public double calcValue(double[] dependentValues) { |
30 |
| - int plusNumber = 0; |
31 |
| - molarMass = params[0]; |
32 |
| - for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { |
33 |
| - if (system.getPhase(0).getComponent(i).isIsPlusFraction()) { |
34 |
| - plusNumber = i; |
35 |
| - } |
36 |
| - } |
37 |
| - SystemInterface tempSystem = system.clone(); |
38 |
| - tempSystem.resetCharacterisation(); |
39 |
| - tempSystem.createDatabase(true); |
40 |
| - tempSystem.setMixingRule(system.getMixingRule()); |
| 18 | + /** |
| 19 | + * <p> |
| 20 | + * Constructor for SaturationPressureFunction. |
| 21 | + * </p> |
| 22 | + */ |
| 23 | + public SaturationPressureFunction() { |
| 24 | + params = new double[1]; |
| 25 | + } |
41 | 26 |
|
42 |
| - tempSystem.getPhase(0).getComponent(plusNumber).setMolarMass(molarMass); |
43 |
| - tempSystem.getPhase(1).getComponent(plusNumber).setMolarMass(molarMass); |
44 |
| - tempSystem.setTemperature(dependentValues[0]); |
45 |
| - tempSystem.setPressure(50.0); |
46 |
| - tempSystem.getCharacterization().characterisePlusFraction(); |
47 |
| - tempSystem.createDatabase(true); |
48 |
| - tempSystem.setMixingRule(system.getMixingRule()); |
49 |
| - tempSystem.init(0); |
50 |
| - tempSystem.init(1); |
51 |
| - // \\tempSystem.display(); |
52 |
| - SaturationPressure satCalc = new SaturationPressure(tempSystem); |
53 |
| - double satPres = satCalc.calcSaturationPressure(); |
54 |
| - // tempSystem.display(); |
55 |
| - return satPres; |
| 27 | + /** {@inheritDoc} */ |
| 28 | + @Override |
| 29 | + public double calcValue(double[] dependentValues) { |
| 30 | + int plusNumber = 0; |
| 31 | + molarMass = params[0]; |
| 32 | + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { |
| 33 | + if (system.getPhase(0).getComponent(i).isIsPlusFraction()) { |
| 34 | + plusNumber = i; |
| 35 | + } |
56 | 36 | }
|
| 37 | + SystemInterface tempSystem = system.clone(); |
| 38 | + tempSystem.resetCharacterisation(); |
| 39 | + tempSystem.createDatabase(true); |
| 40 | + tempSystem.setMixingRule(system.getMixingRule()); |
57 | 41 |
|
58 |
| - /** {@inheritDoc} */ |
59 |
| - @Override |
60 |
| - public void setFittingParams(int i, double value) { |
61 |
| - params[i] = value; |
62 |
| - } |
| 42 | + tempSystem.getPhase(0).getComponent(plusNumber).setMolarMass(molarMass); |
| 43 | + tempSystem.getPhase(1).getComponent(plusNumber).setMolarMass(molarMass); |
| 44 | + tempSystem.setTemperature(dependentValues[0]); |
| 45 | + tempSystem.setPressure(50.0); |
| 46 | + tempSystem.getCharacterization().characterisePlusFraction(); |
| 47 | + tempSystem.createDatabase(true); |
| 48 | + tempSystem.setMixingRule(system.getMixingRule()); |
| 49 | + tempSystem.init(0); |
| 50 | + tempSystem.init(1); |
| 51 | + // \\tempSystem.display(); |
| 52 | + SaturationPressure satCalc = new SaturationPressure(tempSystem); |
| 53 | + double satPres = satCalc.calcSaturationPressure(); |
| 54 | + // tempSystem.display(); |
| 55 | + return satPres; |
| 56 | + } |
| 57 | + |
| 58 | + /** {@inheritDoc} */ |
| 59 | + @Override |
| 60 | + public void setFittingParams(int i, double value) { |
| 61 | + params[i] = value; |
| 62 | + } |
63 | 63 | }
|
0 commit comments