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

termo.matter.builder.HeterogeneousMixtureBuilder 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.matter.builder;

import java.util.HashSet;
import java.util.Set;

import termo.component.Compound;
import termo.eos.mixingRule.MixingRule;
import termo.matter.HeterogeneousMixture;
import termo.matter.Mixture;
import termo.matter.Substance;
import termo.phase.Phase;

public class HeterogeneousMixtureBuilder {

	
	public HeterogeneousMixture fromMixture(Mixture mix){
		
		MixtureBuilder mb= new MixtureBuilder();
		
		mb.setEquationOfState(mix.getCubicEquationOfState());
		mb.setInteractionParameter(mix.getBinaryParameters());
		mb.setMixingRule(mix.getMixingRule());
		
		
		for(Substance sub:mix.getPureSubstances()){
			mb.addCompound(sub.getComponent(), sub.getAlpha(), sub.getMolarFraction());		
		}
				
		HeterogeneousMixture hm = new HeterogeneousMixture(mix.getCubicEquationOfState(),
				mix.getAlpha(),mix.getMixingRule(),
				mix.getComponents(),mix.getBinaryParameters()
				);
		hm.setLiquid(mb.setPhase(Phase.LIQUID).build());
		hm.setVapor(mb.setPhase(Phase.VAPOR).build());
		
		for(Substance sub:mix.getPureSubstances()){
			hm.setZFraction(sub.getComponent(), sub.getMolarFraction());
		}
		
		return hm;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy