REQUIRE "thermodynamics.a4l"; REQUIRE "stream_holdup.a4l"; (* ----------------------------------------- Example 1 - Ideal Vapor Component ----------------------------------------- *) MODEL howto_thermo_ex1 REFINES cmumodel; cd IS_A components_data(['water'], 'water'); P IS_A pressure; T IS_A temperature; ivc IS_A ideal_vapor_component(P, T, cd.data['water']); METHODS METHOD default_self; RUN ivc.default_self; END default_self; METHOD scale_self; RUN ivc.scale_self; END scale_self; METHOD specify; RUN ivc.specify; END specify; METHOD values; P := 1 {atm}; T := 400 {K}; END values; END howto_thermo_ex1; (* ----------------------------------------- Example 2 - Liquid Component ----------------------------------------- *) MODEL howto_thermo_ex2 REFINES cmumodel; cd IS_A components_data(['water'], 'water'); P IS_A pressure; T IS_A temperature; ivc IS_A Rackett_liquid_component(P, T, cd.data['water']); METHODS METHOD default_self; RUN ivc.default_self; END default_self; METHOD scale_self; RUN ivc.scale_self; END scale_self; METHOD specify; RUN ivc.specify; END specify; METHOD reset_VP_problem; RUN ivc.specify; ivc.T.fixed := FALSE; ivc.VP.fixed := TRUE; ivc.VP := 1 {atm}; END reset_VP_problem; METHOD values; P := 1 {atm}; T := 300 {K}; END values; END howto_thermo_ex2; (* ----------------------------------------- Example 3 - Ideal Vapor Mixture ----------------------------------------- *) MODEL howto_thermo_ex3 REFINES cmumodel; cd IS_A components_data(['water','ethanol'], 'water'); ivm IS_A ideal_vapor_mixture(cd); METHODS METHOD default_self; RUN ivm.default_self; END default_self; METHOD scale_self; RUN ivm.scale_self; END scale_self; METHOD specify; RUN ivm.specify; END specify; METHOD values; ivm.P := 1 {atm}; ivm.T := 400 {K}; ivm.y['ethanol'] := 0.4; END values; END howto_thermo_ex3; (* ----------------------------------------- Example 4 - Pitzer Vapor Mixture ----------------------------------------- *) MODEL howto_thermo_ex4 REFINES cmumodel; cd IS_A components_data(['water','ethanol'], 'water'); ivm IS_A Pitzer_vapor_mixture(cd); METHODS METHOD default_self; RUN ivm.default_self; END default_self; METHOD scale_self; RUN ivm.scale_self; END scale_self; METHOD specify; RUN ivm.specify; END specify; METHOD values; ivm.P := 1 {atm}; ivm.T := 400 {K}; ivm.y['ethanol'] := 0.4; END values; END howto_thermo_ex4; (* ----------------------------------------- Example 4b - UNIFAC Liquid Mixture ----------------------------------------- *) MODEL howto_thermo_ex4b REFINES cmumodel; cd IS_A components_data(['water','ethanol'], 'water'); ulm IS_A UNIFAC_liquid_mixture(cd); METHODS METHOD default_self; RUN ulm.default_self; END default_self; METHOD scale_self; RUN ulm.scale_self; END scale_self; METHOD specify; RUN ulm.specify; END specify; METHOD values; ulm.P := 1 {atm}; ulm.T := 300 {K}; ulm.y['ethanol'] := 0.4; END values; END howto_thermo_ex4b; (* ----------------------------------------- Example 5 - Ideal Vapor Mixture (general interface) ----------------------------------------- *) MODEL howto_thermo_ex5 REFINES cmumodel; cd IS_A components_data(['water','ethanol'], 'water'); pd IS_A phases_data('V', 'ideal_vapor_mixture', 'none', 'none'); equilibrated IS_A boolean; phases ALIASES pd.phases; FOR j IN phases CREATE smt[j] IS_A select_mixture_type(cd, pd.phase_type[j]); END FOR; FOR j IN phases CREATE phase[j] ALIASES smt[j].phase; END FOR; state IS_A thermodynamics(cd, pd, phase, equilibrated); METHODS METHOD default_self; RUN state.default_self; END default_self; METHOD scale_self; RUN state.scale_self; END scale_self; METHOD specify; RUN state.specify; END specify; METHOD values; state.P := 1 {atm}; state.T := 450 {K}; state.y['ethanol'] := 0.4; equilibrated := TRUE; END values; END howto_thermo_ex5; (* ----------------------------------------- Example 6 - Unifac Liquid Mixture (general interface) ----------------------------------------- *) MODEL howto_thermo_ex6 REFINES cmumodel; cd IS_A components_data(['water','ethanol'], 'water'); pd IS_A phases_data('L', 'none', 'UNIFAC_liquid_mixture', 'none'); equilibrated IS_A boolean; phases ALIASES pd.phases; FOR j IN phases CREATE smt[j] IS_A select_mixture_type(cd, pd.phase_type[j]); END FOR; FOR j IN phases CREATE phase[j] ALIASES smt[j].phase; END FOR; state IS_A thermodynamics(cd, pd, phase, equilibrated); METHODS METHOD default_self; RUN state.default_self; END default_self; METHOD scale_self; RUN state.scale_self; END scale_self; METHOD specify; RUN state.specify; END specify; METHOD values; state.P := 1 {atm}; state.T := 300 {K}; state.y['ethanol'] := 0.4; equilibrated := TRUE; END values; END howto_thermo_ex6; (* --------------------------------------------- Example 7 - VL Mixture (relative volatility equilibrium) --------------------------------------------- *) MODEL howto_thermo_ex7 REFINES cmumodel; cd IS_A components_data(['water','ethanol'], 'water'); pd IS_A phases_data('VL', 'ideal_vapor_mixture', 'UNIFAC_liquid_mixture', 'none'); equilibrated IS_A boolean; phases ALIASES pd.phases; FOR j IN phases CREATE smt[j] IS_A select_mixture_type(cd, pd.phase_type[j]); END FOR; FOR j IN phases CREATE phase[j] ALIASES smt[j].phase; END FOR; state IS_A thermodynamics(cd, pd, phase, equilibrated); METHODS METHOD default_self; RUN state.default_self; END default_self; METHOD scale_self; RUN state.scale_self; END scale_self; METHOD specify; RUN state.specify; END specify; METHOD values; state.P := 1 {atm}; state.T := 360 {K}; state.y['ethanol'] := 0.4; state.phase['vapor'].alpha['ethanol'] := 2; state.phase['vapor'].alpha['water'] := 1; equilibrated := TRUE; END values; END howto_thermo_ex7; (* -------------------------------------------- Example 8 - VL Component (chemical potencial equilibrium) -------------------------------------------- *) MODEL howto_thermo_ex8 REFINES cmumodel; cd IS_A components_data(['water','ethanol'], 'water'); pd IS_A phases_data('VL', 'ideal_vapor_mixture', 'UNIFAC_liquid_mixture', 'none'); equilibrated IS_A boolean; phases ALIASES pd.phases; FOR j IN phases CREATE smt[j] IS_A select_mixture_type(cd, pd.phase_type[j]); END FOR; FOR j IN phases CREATE phase[j] ALIASES smt[j].phase; END FOR; state IS_A thermodynamics(cd, pd,phase, equilibrated); METHODS METHOD default_self; RUN state.default_self; END default_self; METHOD scale_self; RUN state.scale_self; END scale_self; METHOD specify; RUN state.specify; END specify; METHOD values; state.P := 1 {atm}; state.T := 300 {K}; state.y['ethanol'] := 0.5; equilibrated := TRUE; END values; METHOD reset_Px; equilibrated := TRUE; RUN state.specify; state.T.fixed := FALSE; state.phase['liquid1'].y['water'].fixed := TRUE; state.P := 1 {atm}; state.y['ethanol'] := 0.5; state.phase['liquid1'].y['water'] := 0.6; END reset_Px; END howto_thermo_ex8; (* -------------------------------------------- Example 9 - VL Equilibrim Chart -------------------------------------------- *) MODEL howto_thermo_ex9 REFINES cmumodel; cd IS_A components_data(['water','ethanol'], 'water'); pd IS_A phases_data('VL', 'Pitzer_vapor_mixture', 'UNIFAC_liquid_mixture', 'none'); equilibrated IS_A boolean; phases ALIASES pd.phases; FOR j IN phases CREATE smt[j] IS_A select_mixture_type(cd, pd.phase_type[j]); END FOR; FOR j IN phases CREATE phase[j] ALIASES smt[j].phase; END FOR; state IS_A thermodynamics(cd, pd,phase, equilibrated); METHODS METHOD default_self; RUN state.default_self; END default_self; METHOD scale_self; RUN state.scale_self; END scale_self; METHOD specify; RUN state.specify; END specify; METHOD values; state.P := 1 {atm}; state.T := 300 {K}; state.y['ethanol'] := 0.5; equilibrated := TRUE; END values; METHOD reset_Px; equilibrated := TRUE; RUN state.specify; state.T.fixed := FALSE; state.phase['liquid1'].y['water'].fixed := TRUE; state.P := 1 {atm}; state.y['ethanol'] := 0.5; state.phase['liquid1'].y['water'] := 0.6; END reset_Px; END howto_thermo_ex9; MODEL chittur REFINES cmumodel; cd IS_A components_data(['water','ethanol'], 'water'); pd IS_A phases_data('VL', 'Pitzer_vapor_mixture', 'UNIFAC_liquid_mixture', 'none'); equilibrated IS_A boolean; phases ALIASES pd.phases; FOR j IN phases CREATE smt[j] IS_A select_mixture_type(cd, pd.phase_type[j]); END FOR; FOR j IN phases CREATE phase[j] ALIASES smt[j].phase; END FOR; state IS_A thermodynamics(cd, pd,phase, equilibrated); METHODS METHOD values; RUN state.default_self; RUN state.scale_self; RUN state.specify; state.P := 1 {atm}; state.P.fixed := FALSE; state.T := 363.15 {K}; state.y['ethanol'] := 0.5; equilibrated := TRUE; state.T.fixed := TRUE; state.phase['liquid1'].y['water'].fixed := TRUE; state.x['ethanol'] := 0.2464; state.x['ethanol'].fixed := TRUE; state.phase['liquid1'].y['water'] := 0.6; END values; END chittur;