termo.eos.alpha.TwoEquationsAlphaExpression Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of materia Show documentation
Show all versions of materia Show documentation
Thermodynamics properties and
equilibria calculations for
chemical engineering.
package termo.eos.alpha;
import termo.component.Compound;
/**
*
* @author Hugo Redon Rivera
*/
public class TwoEquationsAlphaExpression extends Alpha{
private Alpha alphaAboveTc;
private Alpha alphaBelowTc;
@Override
public String getEquation() {
if(equation == null){
StringBuilder b = new StringBuilder();
b.append("-----T < T_c ");
b.append("\\\\");
b.append(alphaBelowTc.getEquation());
b.append("\\\\");
b.append("-----T > T_c");
b.append("\\\\");
b.append(alphaAboveTc.getEquation());
equation = b.toString();
}
return equation;
}
@Override
public double alpha(double temperature,Compound component){
return getProperAlpha(temperature, component).alpha(temperature, component);
}
@Override
public double TempOverAlphaTimesDerivativeAlphaRespectTemperature(double temperature, Compound component) {
return getProperAlpha(temperature, component).TempOverAlphaTimesDerivativeAlphaRespectTemperature(temperature, component);
}
public Alpha getProperAlpha(double temperature ,Compound component){
double criticalTemperature = component.getCriticalTemperature();
double q = component.getK_StryjekAndVera();
double reducedTemperature = temperature / criticalTemperature;
if(reducedTemperature <1){
return alphaBelowTc;
}else{
return alphaAboveTc;
}
}
/**
* @return the alphaAboveTc
*/
public Alpha getAlphaAboveTc() {
return alphaAboveTc;
}
/**
* @param alphaAboveTc the alphaAboveTc to set
*/
public void setAlphaAboveTc(Alpha alphaAboveTc) {
this.alphaAboveTc = alphaAboveTc;
}
/**
* @return the alphaBelowTc
*/
public Alpha getAlphaBelowTc() {
return alphaBelowTc;
}
/**
* @param alphaBelowTc the alphaBelowTc to set
*/
public void setAlphaBelowTc(Alpha alphaBelowTc) {
this.alphaBelowTc = alphaBelowTc;
}
@Override
public int numberOfParameters() {
return alphaBelowTc.numberOfParameters();
}
@Override
public double getParameter(Compound component, int index) {
return alphaBelowTc.getParameter(component, index);
}
@Override
public void setParameter(double value, Compound component, int index) {
alphaBelowTc.setParameter(value, component, index);
}
@Override
public String getParameterName(int index) {
return alphaBelowTc.getParameterName(index);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy