All Downloads are FREE. Search and download functionalities are using the official Maven repository.

termo.eos.alpha.Soave2Parameters Maven / Gradle / Ivy

Go to download

Thermodynamics properties and equilibria calculations for chemical engineering.

There is a newer version: 3.5
Show newest version
package termo.eos.alpha;

import termo.component.Compound;

/**
 *
 * @author Hugo
 */
public class Soave2Parameters extends Alpha{

    public Soave2Parameters(){
        setEquation("\\alpha(T) = 1+ (1- T_r) \\left( A + \\frac{B}{T_r}   \\right)");
    }
    @Override
    public double alpha(double temperature, Compound component) {
        double A = component.getA_Soave();
        double B = component.getB_Soave();
        double tr = temperature / component.getCriticalTemperature();
        return 1 + (1-tr)* (A + (B/tr));
    }

    @Override
    public double TempOverAlphaTimesDerivativeAlphaRespectTemperature(double temperature, Compound component) {
        double A = component.getA_Soave();
        double B = component.getB_Soave();
        double tc = component.getCriticalTemperature();
        double tr = temperature / tc;
        return (- (tr) *(A + (B/tr)) - (B/tr) *(1-tr))/ alpha(temperature, component);
    }
    
         @Override
    public int numberOfParameters() {
        return 2;
    }
    
    
       @Override
    public double getParameter(Compound component, int index) {
        switch(index){
            case 0 : return component.getA_Soave();
            case 1: return component.getB_Soave();
            default: return 0;
        }
    }

    @Override
    public void setParameter(double value, Compound component, int index) {
        switch(index){
            case 0 : component.setA_Soave(value);
                break;
            case 1: component.setB_Soave(value);
                break;
        }
    }
	@Override
	public String getParameterName(int index) {
		switch(index){
	        case 0 : return "A";
	        case 1: return "B";
	        default: return null;
		}
	
	}
    
    
    
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy