#*------------------------------------------------------------------- * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. * * This LIBRARY is free software; you can distribute it and/or modify * it under the therms of the ALSOC FREE LICENSE as available at * http://www.enq.ufrgs.br/alsoc. * * EMSO Copyright (C) 2004 - 2007 ALSOC, original code * from http://www.rps.eng.br Copyright (C) 2002-2004. * All rights reserved. * * EMSO is distributed under the therms of the ALSOC LICENSE as * available at http://www.enq.ufrgs.br/alsoc. * *---------------------------------------------------------------------- * File containg models of columns: distillation, stripping, absorbers * rectifier, .... * * The default nomenclature is: * Type_Column_reboilertype_condensertyper * * where: * Type = refluxed or reboiled or section * Column = Stripping, Absorption, Rectifier, Distillation * Reboiler type (if exists) = kettle or thermosyphon * Condenser type (if exists) = with subccoling or without subcooling * *----------------------------------------------------------------------- * Author: Paula B. Staudt * $Id: column.mso 511 2008-05-12 17:25:33Z paula $ *---------------------------------------------------------------------*# using "tray"; using "reboiler"; using "condenser"; using "mixers_splitters/splitter"; using "tank"; using "pressure_changers/pump"; Model ControlSection ATTRIBUTES Pallete = false; Brief = "Control variables for column section."; PARAMETERS outer NComp as Integer (Brief="Number of components"); Tindicator_TrayNumber as Integer (Brief="Temperature Indicator in the tray"); Pindicator_TrayNumber as Integer (Brief="Pressure Indicator in the tray"); end Model InitializeSection ATTRIBUTES Pallete = false; Brief = "Initial conditions for column section."; PARAMETERS outer NComp as Integer (Brief="Number of components"); TopTemperature as temperature (Brief = "Tray Temperature at Column Top", Default = 300); BottomTemperature as temperature (Brief = "Tray Temperature at Column Bottom", Default = 330); LevelFraction as fraction (Brief = "Tray Level Fraction", Default = 0.5); TopComposition(NComp) as fraction (Brief = "Component Molar Fraction at Column Top", Default = 0.30); BottomComposition(NComp) as fraction (Brief = "Component Molar Fraction at Column Bottom", Default = 0.30); end Model InitializeStage ATTRIBUTES Pallete = false; Brief = "Initial conditions for Packed column section."; PARAMETERS outer NComp as Integer (Brief="Number of components"); TopStageTemperature as temperature (Brief = "Tray Temperature at Column Top", Default = 300); BottomStageTemperature as temperature (Brief = "Tray Temperature at Column Bottom", Default = 300); TopStageComposition(NComp) as fraction (Brief = "Component Molar Fraction at Top"); BottomStageComposition(NComp) as fraction (Brief = "Component Molar Fraction at Bottom"); LiquidMolarHoldup as mol (Brief="Molar liquid holdup", Default=0.01); end Model Section_ColumnBasic ATTRIBUTES Pallete = false; Brief = "Model of a basic column section."; Info = "Model of a basic column section containing a vetor of TRAYS numbered from the top-down."; PARAMETERS outer PP as Plugin (Brief="External Physical Properties", Type="PP"); outer NComp as Integer (Brief="Number of components"); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Section Column Feed Tray - Side Streams Location and Numbering #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NumberOfTrays as Integer (Brief="Number of trays", Default=8); FeedTrayIndex(NumberOfTrays) as Integer (Brief="Feed Tray Index", Default=0,Hidden=true); LiqSideTrayIndex(NumberOfTrays) as Integer (Brief="Liquid Side Tray Index", Default=0,Hidden=true); VapSideTrayIndex(NumberOfTrays) as Integer (Brief="Vapour Side Tray Index", Default=0,Hidden=true); FeedTrayLocation as Integer (Brief="Feed tray Location", Default=2); LiquidSideStreamLocation as Integer (Brief="Liquid Side Stream Location", Default=2); VapourSideStreamLocation as Integer (Brief="Vapour Side Stream Location", Default=2); g as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true); Mw(NComp) as molweight (Brief="Component Mol Weight",Hidden=true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Section Column Flow Model for Liquid and Vapour #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ VapourFlowModel as Switcher (Valid = ["Reepmeyer", "Feehery_Fv", "Roffel_Fv", "Klingberg", "Wang_Fv", "Elgue"], Default = "Reepmeyer"); LiquidFlowModel as Switcher (Valid = ["default", "Wang_Fl", "Olsen", "Feehery_Fl", "Roffel_Fl"], Default = "default"); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Section Column Tray Geometry and Auxiliar Parameters #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ VolumeOfTray as volume (Brief="Total Volume of the tray"); HeatSupply as heat_rate (Brief="Rate of heat supply"); PlateArea as area (Brief="Plate area = Atray - Adowncomer"); HolesArea as area (Brief="Total holes area"); WeirLength as length (Brief="Weir length"); WeirHeight as length (Brief="Weir height"); FeeheryCoeff as Real (Brief="Feeherys correlation coefficient", Unit='1/m^4', Default=1); ElgueCoeff as Real (Brief="Elgues correlation coefficient", Unit='kg/m/mol^2', Default=1); OlsenCoeff as Real (Brief="Olsens correlation coefficient", Default=1); TrayLiquidPasses as Real (Brief="Number of liquid passes in the tray", Default=1); V as volume (Brief="Total Volume of the tray",Hidden=true); Q as heat_rate (Brief="Rate of heat supply",Hidden=true); Ap as area (Brief="Plate area = Atray - Adowncomer",Hidden=true); Ah as area (Brief="Total holes area",Hidden=true); lw as length (Brief="Weir length",Hidden=true); hw as length (Brief="Weir height",Hidden=true); beta as fraction (Brief="Aeration fraction"); alfa as fraction (Brief="Dry pressure drop coefficient"); w as Real (Brief="Feeherys correlation coefficient", Unit='1/m^4', Default=1,Hidden=true); btray as Real (Brief="Elgues correlation coefficient", Unit='kg/m/mol^2', Default=1,Hidden=true); fw as Real (Brief="Olsens correlation coefficient", Default=1,Hidden=true); Np as Real (Brief="Number of liquid passes in the tray", Default=1,Hidden=true); VapourFlow as Switcher (Valid = ["on", "off"], Default = "on",Hidden=true); LiquidFlow as Switcher (Valid = ["on", "off"], Default = "on",Hidden=true); SET FeedTrayIndex(FeedTrayLocation) =1; VapSideTrayIndex(FeedTrayLocation) =1; LiqSideTrayIndex(FeedTrayLocation) =1; Mw = PP.MolecularWeight(); V=VolumeOfTray; Q=HeatSupply; Ap=PlateArea; Ah=HolesArea; lw=WeirLength; hw=WeirHeight ; w=FeeheryCoeff; btray=ElgueCoeff; fw=OlsenCoeff; Np=TrayLiquidPasses; VARIABLES #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Tray Initialization For the Whole Column Section #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ INITIALIZATION as InitializeSection (Brief = "Column Model Initialization"); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Control Ports #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ CONTROL as ControlSection (Brief = "Control"); out TCI as control_signal (Brief="Temperature Indicator", Protected = true, PosX=1, PosY=0.90); out PCI as control_signal (Brief="Pressure Indicator", Protected = true, PosX=1, PosY=0.80); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Feed - Side Stream Flow and Murphree Efficiency #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in FeedTray as stream (Brief="Feed stream", PosX=0, PosY=0.55); TRAYS(NumberOfTrays) as tray (Brief="Number of trays in the Column Section"); VapourDrawOffFlow as flow_mol (Brief="Stream Molar Flow Rate"); LiquidDrawOffFlow as flow_mol (Brief="Stream Molar Flow Rate"); MurphreeEff as Real (Brief="Murphree efficiency for All Trays"); CONNECTIONS #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Connecting Intermediate Trays #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ TRAYS([2:NumberOfTrays]).OutletVapour to TRAYS([1:NumberOfTrays-1]).InletVapour; TRAYS([1:NumberOfTrays-1]).OutletLiquid to TRAYS([2:NumberOfTrays]).InletLiquid; INITIAL #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Tray Initialization #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ for i in 1:NumberOfTrays do "The initial temperature of the TRAYS" TRAYS(i).OutletLiquid.T = INITIALIZATION.TopTemperature+(INITIALIZATION.BottomTemperature-INITIALIZATION.TopTemperature)*((i-1)/(NumberOfTrays-1)); "The initial Level of the TRAYS" TRAYS(i).Level = INITIALIZATION.LevelFraction*hw; end for i in 1:NComp-1 do for j in 1:NumberOfTrays do "The initial composition of the TRAYS - Normalized" TRAYS(j).OutletLiquid.z(i) = INITIALIZATION.TopComposition(i)/sum(INITIALIZATION.TopComposition) +(INITIALIZATION.BottomComposition(i)/sum(INITIALIZATION.BottomComposition)-INITIALIZATION.TopComposition(i)/sum(INITIALIZATION.TopComposition) )*((j-1)/(NumberOfTrays-1)); end end EQUATIONS #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Control Ports #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "Tray Temperature Indicator" #TCI*'K' = TRAYS(min([NumberOfTrays, CONTROL.Tindicator_TrayNumber])).OutletVapour.T; TCI*'K' = TRAYS(CONTROL.Tindicator_TrayNumber).OutletVapour.T; "Tray Pressure Indicator" #PCI*'atm' = TRAYS(min([NumberOfTrays, CONTROL.Pindicator_TrayNumber])).OutletVapour.P; PCI*'atm' = TRAYS(CONTROL.Pindicator_TrayNumber).OutletVapour.P; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Equating Feed Tray Variables to Trays Variables #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "Feed Tray Inlet Flow" FeedTray.F*FeedTrayIndex= TRAYS.Inlet.F; "Feed Tray Inlet Temperature" FeedTray.T = TRAYS.Inlet.T; "Feed Tray Inlet Pressure" FeedTray.P = TRAYS.Inlet.P; "Feed Tray Inlet Composition" FeedTray.z = TRAYS.Inlet.z; "Feed Tray Inlet Vapour Fraction" FeedTray.v = TRAYS.Inlet.v; "Feed Tray Inlet Enthalpy" FeedTray.h = TRAYS.Inlet.h; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Trays Equations #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ for i in [1:NumberOfTrays] do "Murphree Efficiency" TRAYS(i).OutletVapour.z = MurphreeEff * (TRAYS(i).yideal - TRAYS(i).InletVapour.z) + TRAYS(i).InletVapour.z; "Level of clear liquid over the weir" TRAYS(i).Level = TRAYS(i).ML*TRAYS(i).vL/Ap; "Geometry Constraint" V = TRAYS(i).ML* TRAYS(i).vL + TRAYS(i).MV*TRAYS(i).vV; "Energy Holdup" TRAYS(i).E = TRAYS(i).ML*TRAYS(i).OutletLiquid.h + TRAYS(i).MV*TRAYS(i).OutletVapour.h - TRAYS(i).OutletLiquid.P*V; "Energy Balance" diff(TRAYS(i).E) = ( TRAYS(i).Inlet.F*TRAYS(i).Inlet.h + TRAYS(i).InletLiquid.F*TRAYS(i).InletLiquid.h + TRAYS(i).InletVapour.F*TRAYS(i).InletVapour.h- TRAYS(i).OutletLiquid.F*TRAYS(i).OutletLiquid.h - TRAYS(i).OutletVapour.F*TRAYS(i).OutletVapour.h -TRAYS(i).VapourSideStream.F*TRAYS(i).VapourSideStream.h - TRAYS(i).LiquidSideStream.F*TRAYS(i).LiquidSideStream.h + Q ); switch LiquidFlow case "on": switch LiquidFlowModel case "default": "Francis Equation" TRAYS(i).OutletLiquid.F*TRAYS(i).vL = 1.84*'1/s'*lw*((TRAYS(i).Level-(beta*hw))/(beta))^2; case "Wang_Fl": TRAYS(i).OutletLiquid.F*TRAYS(i).vL = 1.84*'m^0.5/s'*lw*((TRAYS(i).Level-(beta*hw))/(beta))^1.5; case "Olsen": TRAYS(i).OutletLiquid.F / 'mol/s'= lw*Np*TRAYS(i).rhoL/sum(Mw*TRAYS(i).OutletVapour.z)/(0.665*fw)^1.5 * ((TRAYS(i).ML*sum(Mw*TRAYS(i).OutletLiquid.z)/TRAYS(i).rhoL/Ap)-hw)^1.5 * 'm^0.5/mol'; case "Feehery_Fl": TRAYS(i).OutletLiquid.F = lw*TRAYS(i).rhoL/sum(Mw*TRAYS(i).OutletLiquid.z) * ((TRAYS(i).Level-hw)/750/'mm')^1.5 * 'm^2/s'; case "Roffel_Fl": TRAYS(i).OutletLiquid.F = 2/3*TRAYS(i).rhoL/sum(Mw*TRAYS(i).OutletLiquid.z)*lw*(TRAYS(i).ML*sum(Mw*TRAYS(i).OutletLiquid.z)/(Ap*1.3)/TRAYS(i).rhoL)^1.5*sqrt(2*g/ (2*(1 - 0.3593/'Pa^0.0888545'*abs(TRAYS(i).OutletVapour.F*sum(Mw*TRAYS(i).OutletVapour.z)/(Ap*1.3)/sqrt(TRAYS(i).rhoV))^0.177709)-1)); #/'(kg/m)^0.0888545/s^0.177709'; end when TRAYS(i).Level < (beta *hw) switchto "off"; case "off": "Low level" TRAYS(i).OutletLiquid.F = 0 * 'mol/h'; when TRAYS(i).Level > (beta * hw) + 1e-6*'m' switchto "on"; end switch VapourFlow case "on": switch VapourFlowModel case "Reepmeyer": TRAYS(i).InletVapour.F*TRAYS(i).vV = sqrt((TRAYS(i).InletVapour.P - TRAYS(i).OutletVapour.P)/(TRAYS(i).rhoV*alfa))*Ah; case "Feehery_Fv": TRAYS(i).InletVapour.F = TRAYS(i).rhoV/Ap/w/sum(Mw*TRAYS(i).OutletVapour.z) * sqrt(((TRAYS(i).InletVapour.P - TRAYS(i).OutletVapour.P)-(TRAYS(i).rhoV*g*TRAYS(i).ML*TRAYS(i).vL/Ap))/TRAYS(i).rhoV); case "Roffel_Fv": TRAYS(i).InletVapour.F^1.08 * 0.0013 * 'kg/m/mol^1.08/s^0.92*1e5' = (TRAYS(i).InletVapour.P - TRAYS(i).OutletVapour.P)*1e5 - (beta*sum(TRAYS(i).M*Mw)/(Ap*1.3)*g*1e5) * (TRAYS(i).rhoV*Ah/sum(Mw*TRAYS(i).OutletVapour.z))^1.08 * 'm^1.08/mol^1.08'; case "Klingberg": TRAYS(i).InletVapour.F * TRAYS(i).vV = Ap * sqrt(((TRAYS(i).InletVapour.P - TRAYS(i).OutletVapour.P)-TRAYS(i).rhoL*g*TRAYS(i).Level)/TRAYS(i).rhoV); case "Wang_Fv": TRAYS(i).InletVapour.F * TRAYS(i).vV = Ap * sqrt(((TRAYS(i).InletVapour.P - TRAYS(i).OutletVapour.P)-TRAYS(i).rhoL*g*TRAYS(i).Level)/TRAYS(i).rhoV*alfa); case "Elgue": TRAYS(i).InletVapour.F = sqrt((TRAYS(i).InletVapour.P - TRAYS(i).OutletVapour.P)/btray); end when TRAYS(i).InletVapour.F < 1e-6 * 'kmol/h' switchto "off"; case "off": TRAYS(i).InletVapour.F = 0 * 'mol/s'; when TRAYS(i).InletVapour.P > TRAYS(i).OutletVapour.P + TRAYS(i).Level*g*TRAYS(i).rhoL + 1e-1 * 'atm' switchto "on"; end end end Model Section_Column ATTRIBUTES Pallete = true; Icon = "icon/SectionColumn"; Brief = "Model of a column section."; Info = "== Model of a column section containing == * NumberOfTrays TRAYS. == Specify == * the feed stream of each tray (Inlet); * the Murphree eficiency for each tray Emv; * the InletLiquid stream of the top tray; * the InletVapour stream of the bottom tray. == Initial Conditions == * the TRAYS temperature (OutletLiquid.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletLiquid.F); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray. "; PARAMETERS outer PP as Plugin (Brief="External Physical Properties", Type="PP"); outer NComp as Integer (Brief="Number of components"); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Section Column Feed Tray - Side Streams Location and Numbering #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NumberOfTrays as Integer (Brief="Number of trays", Default=8); FeedTrayIndex(NumberOfTrays) as Integer (Brief="Feed Tray Index", Default=0,Hidden=true); LiqSideTrayIndex(NumberOfTrays) as Integer (Brief="Liquid Side Tray Index", Default=0,Hidden=true); VapSideTrayIndex(NumberOfTrays) as Integer (Brief="Vapour Side Tray Index", Default=0,Hidden=true); FeedTrayLocation as Integer (Brief="Feed tray Location", Default=2); LiquidSideStreamLocation as Integer (Brief="Liquid Side Stream Location", Default=2); VapourSideStreamLocation as Integer (Brief="Vapour Side Stream Location", Default=2); g as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true); Mw(NComp) as molweight (Brief="Component Mol Weight",Hidden=true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Section Column Flow Model for Liquid and Vapour #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ VapourFlowModel as Switcher (Valid = ["Reepmeyer", "Feehery_Fv", "Roffel_Fv", "Klingberg", "Wang_Fv", "Elgue"], Default = "Reepmeyer"); LiquidFlowModel as Switcher (Valid = ["default", "Wang_Fl", "Olsen", "Feehery_Fl", "Roffel_Fl"], Default = "default"); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Section Column Tray Geometry and Auxiliar Parameters #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ VolumeOfTray as volume (Brief="Total Volume of the tray"); HeatSupply as heat_rate (Brief="Rate of heat supply"); PlateArea as area (Brief="Plate area = Atray - Adowncomer"); HolesArea as area (Brief="Total holes area"); WeirLength as length (Brief="Weir length"); WeirHeight as length (Brief="Weir height"); FeeheryCoeff as Real (Brief="Feeherys correlation coefficient", Unit='1/m^4', Default=1); ElgueCoeff as Real (Brief="Elgues correlation coefficient", Unit='kg/m/mol^2', Default=1); OlsenCoeff as Real (Brief="Olsens correlation coefficient", Default=1); TrayLiquidPasses as Real (Brief="Number of liquid passes in the tray", Default=1); V as volume (Brief="Total Volume of the tray",Hidden=true); Q as heat_rate (Brief="Rate of heat supply",Hidden=true); Ap as area (Brief="Plate area = Atray - Adowncomer",Hidden=true); Ah as area (Brief="Total holes area",Hidden=true); lw as length (Brief="Weir length",Hidden=true); hw as length (Brief="Weir height",Hidden=true); beta as fraction (Brief="Aeration fraction"); alfa as fraction (Brief="Dry pressure drop coefficient"); w as Real (Brief="Feeherys correlation coefficient", Unit='1/m^4', Default=1,Hidden=true); btray as Real (Brief="Elgues correlation coefficient", Unit='kg/m/mol^2', Default=1,Hidden=true); fw as Real (Brief="Olsens correlation coefficient", Default=1,Hidden=true); Np as Real (Brief="Number of liquid passes in the tray", Default=1,Hidden=true); VapourFlow as Switcher (Valid = ["on", "off"], Default = "on",Hidden=true); LiquidFlow as Switcher (Valid = ["on", "off"], Default = "on",Hidden=true); SET FeedTrayIndex(FeedTrayLocation) =1; VapSideTrayIndex(FeedTrayLocation) =1; LiqSideTrayIndex(FeedTrayLocation) =1; Mw = PP.MolecularWeight(); V=VolumeOfTray; Q=HeatSupply; Ap=PlateArea; Ah=HolesArea; lw=WeirLength; hw=WeirHeight ; w=FeeheryCoeff; btray=ElgueCoeff; fw=OlsenCoeff; Np=TrayLiquidPasses; VARIABLES #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Tray Initialization For the Whole Column Section #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ INITIALIZATION as InitializeSection (Brief = "Column Model Initialization"); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Control Ports #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ CONTROL as ControlSection (Brief = "Control"); out TCI as control_signal (Brief="Temperature Indicator", Protected = true, PosX=1, PosY=0.90); out PCI as control_signal (Brief="Pressure Indicator", Protected = true, PosX=1, PosY=0.80); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Section Inlet Liquid and Outlet Vapour Material Ports #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in LiquidInlet as stream (Brief="Liquid Inlet in the section", PosX=0.70, PosY=0); out VapourOutlet as vapour_stream (Brief="Vapour Outlet in the section", PosX=0.30, PosY=0); out VapourDrawOff as vapour_stream (Brief="Vapour Draw Off Port in the section", PosX=1, PosY=0.35,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Draw Off Port in the section", PosX=1, PosY=0.65,Protected = true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Feed - Side Stream Flow and Murphree Efficiency #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in FeedTray as stream (Brief="Feed stream", PosX=0, PosY=0.55); TRAYS(NumberOfTrays) as tray (Brief="Number of trays in the Column Section"); VapourDrawOffFlow as flow_mol (Brief="Stream Molar Flow Rate"); LiquidDrawOffFlow as flow_mol (Brief="Stream Molar Flow Rate"); MurphreeEff as positive (Brief="Murphree efficiency for All Trays"); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Section Inlet Vapour and Outlet Liquid Material Ports #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in VapourInlet as stream (Brief="Vapour Inlet in the section", PosX=0.30, PosY=1); out LiquidOutlet as liquid_stream (Brief="Liquid Outlet in the section", PosX=0.70, PosY=1); LiquidConnector as stream (Brief="Liquid connection in the middle TRAYS", PosX=0.75, PosY=1,Hidden=true); VapourConnector as stream (Brief="Vapour connection in the middle TRAYS", PosX=0.55, PosY=0,Hidden=true); CONNECTIONS #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Connecting Intermediate Trays #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ TRAYS([2:NumberOfTrays]).OutletVapour to TRAYS([1:NumberOfTrays-1]).InletVapour; TRAYS([1:NumberOfTrays-1]).OutletLiquid to TRAYS([2:NumberOfTrays]).InletLiquid; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Connecting Connectors #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ LiquidConnector to TRAYS(1).InletLiquid; VapourConnector to TRAYS(NumberOfTrays).InletVapour; INITIAL #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Tray Initialization #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ for i in 1:NumberOfTrays do "The initial temperature of the TRAYS" TRAYS(i).OutletLiquid.T = INITIALIZATION.TopTemperature+(INITIALIZATION.BottomTemperature-INITIALIZATION.TopTemperature)*((i-1)/(NumberOfTrays-1)); "The initial Level of the TRAYS" TRAYS(i).Level = INITIALIZATION.LevelFraction*hw; end for i in 1:NComp-1 do for j in 1:NumberOfTrays do "The initial composition of the TRAYS - Normalized" TRAYS(j).OutletLiquid.z(i) = INITIALIZATION.TopComposition(i)/sum(INITIALIZATION.TopComposition) +(INITIALIZATION.BottomComposition(i)/sum(INITIALIZATION.BottomComposition)-INITIALIZATION.TopComposition(i)/sum(INITIALIZATION.TopComposition) )*((j-1)/(NumberOfTrays-1)); end end EQUATIONS #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Control Ports #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "Tray Temperature Indicator" #TCI*'K' = TRAYS(min([NumberOfTrays, CONTROL.Tindicator_TrayNumber])).OutletVapour.T; TCI*'K' = TRAYS(CONTROL.Tindicator_TrayNumber).OutletVapour.T; "Tray Pressure Indicator" #PCI*'atm' = TRAYS(min([NumberOfTrays, CONTROL.Pindicator_TrayNumber])).OutletVapour.P; PCI*'atm' = TRAYS(CONTROL.Pindicator_TrayNumber).OutletVapour.P; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Equating Feed Tray Variables to Trays Variables #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "Feed Tray Inlet Flow" FeedTray.F*FeedTrayIndex= TRAYS.Inlet.F; "Feed Tray Inlet Temperature" FeedTray.T = TRAYS.Inlet.T; "Feed Tray Inlet Pressure" FeedTray.P = TRAYS.Inlet.P; "Feed Tray Inlet Composition" FeedTray.z = TRAYS.Inlet.z; "Feed Tray Inlet Vapour Fraction" FeedTray.v = TRAYS.Inlet.v; "Feed Tray Inlet Enthalpy" FeedTray.h = TRAYS.Inlet.h; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Trays Equations #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ for i in [1:NumberOfTrays] do "Murphree Efficiency" TRAYS(i).OutletVapour.z = MurphreeEff * (TRAYS(i).yideal - TRAYS(i).InletVapour.z) + TRAYS(i).InletVapour.z; "Level of clear liquid over the weir" TRAYS(i).Level = TRAYS(i).ML*TRAYS(i).vL/Ap; "Geometry Constraint" V = TRAYS(i).ML* TRAYS(i).vL + TRAYS(i).MV*TRAYS(i).vV; "Energy Holdup" TRAYS(i).E = TRAYS(i).ML*TRAYS(i).OutletLiquid.h + TRAYS(i).MV*TRAYS(i).OutletVapour.h - TRAYS(i).OutletLiquid.P*V; "Energy Balance" diff(TRAYS(i).E) = ( TRAYS(i).Inlet.F*TRAYS(i).Inlet.h + TRAYS(i).InletLiquid.F*TRAYS(i).InletLiquid.h + TRAYS(i).InletVapour.F*TRAYS(i).InletVapour.h- TRAYS(i).OutletLiquid.F*TRAYS(i).OutletLiquid.h - TRAYS(i).OutletVapour.F*TRAYS(i).OutletVapour.h -TRAYS(i).VapourSideStream.F*TRAYS(i).VapourSideStream.h - TRAYS(i).LiquidSideStream.F*TRAYS(i).LiquidSideStream.h + Q ); switch LiquidFlow case "on": switch LiquidFlowModel case "default": "Francis Equation" TRAYS(i).OutletLiquid.F*TRAYS(i).vL = 1.84*'1/s'*lw*((TRAYS(i).Level-(beta*hw))/(beta))^2; case "Wang_Fl": TRAYS(i).OutletLiquid.F*TRAYS(i).vL = 1.84*'m^0.5/s'*lw*((TRAYS(i).Level-(beta*hw))/(beta))^1.5; case "Olsen": TRAYS(i).OutletLiquid.F / 'mol/s'= lw*Np*TRAYS(i).rhoL/sum(Mw*TRAYS(i).OutletVapour.z)/(0.665*fw)^1.5 * ((TRAYS(i).ML*sum(Mw*TRAYS(i).OutletLiquid.z)/TRAYS(i).rhoL/Ap)-hw)^1.5 * 'm^0.5/mol'; case "Feehery_Fl": TRAYS(i).OutletLiquid.F = lw*TRAYS(i).rhoL/sum(Mw*TRAYS(i).OutletLiquid.z) * ((TRAYS(i).Level-hw)/750/'mm')^1.5 * 'm^2/s'; case "Roffel_Fl": TRAYS(i).OutletLiquid.F = 2/3*TRAYS(i).rhoL/sum(Mw*TRAYS(i).OutletLiquid.z)*lw*(TRAYS(i).ML*sum(Mw*TRAYS(i).OutletLiquid.z)/(Ap*1.3)/TRAYS(i).rhoL)^1.5*sqrt(2*g/ (2*(1 - 0.3593/'Pa^0.0888545'*abs(TRAYS(i).OutletVapour.F*sum(Mw*TRAYS(i).OutletVapour.z)/(Ap*1.3)/sqrt(TRAYS(i).rhoV))^0.177709)-1)); #/'(kg/m)^0.0888545/s^0.177709'; end when TRAYS(i).Level < (beta *hw) switchto "off"; case "off": "Low level" TRAYS(i).OutletLiquid.F = 0 * 'mol/h'; when TRAYS(i).Level > (beta * hw) + 1e-6*'m' switchto "on"; end switch VapourFlow case "on": switch VapourFlowModel case "Reepmeyer": TRAYS(i).InletVapour.F*TRAYS(i).vV = sqrt((TRAYS(i).InletVapour.P - TRAYS(i).OutletVapour.P)/(TRAYS(i).rhoV*alfa))*Ah; case "Feehery_Fv": TRAYS(i).InletVapour.F = TRAYS(i).rhoV/Ap/w/sum(Mw*TRAYS(i).OutletVapour.z) * sqrt(((TRAYS(i).InletVapour.P - TRAYS(i).OutletVapour.P)-(TRAYS(i).rhoV*g*TRAYS(i).ML*TRAYS(i).vL/Ap))/TRAYS(i).rhoV); case "Roffel_Fv": TRAYS(i).InletVapour.F^1.08 * 0.0013 * 'kg/m/mol^1.08/s^0.92*1e5' = (TRAYS(i).InletVapour.P - TRAYS(i).OutletVapour.P)*1e5 - (beta*sum(TRAYS(i).M*Mw)/(Ap*1.3)*g*1e5) * (TRAYS(i).rhoV*Ah/sum(Mw*TRAYS(i).OutletVapour.z))^1.08 * 'm^1.08/mol^1.08'; case "Klingberg": TRAYS(i).InletVapour.F * TRAYS(i).vV = Ap * sqrt(((TRAYS(i).InletVapour.P - TRAYS(i).OutletVapour.P)-TRAYS(i).rhoL*g*TRAYS(i).Level)/TRAYS(i).rhoV); case "Wang_Fv": TRAYS(i).InletVapour.F * TRAYS(i).vV = Ap * sqrt(((TRAYS(i).InletVapour.P - TRAYS(i).OutletVapour.P)-TRAYS(i).rhoL*g*TRAYS(i).Level)/TRAYS(i).rhoV*alfa); case "Elgue": TRAYS(i).InletVapour.F = sqrt((TRAYS(i).InletVapour.P - TRAYS(i).OutletVapour.P)/btray); end when TRAYS(i).InletVapour.F < 1e-6 * 'kmol/h' switchto "off"; case "off": TRAYS(i).InletVapour.F = 0 * 'mol/s'; when TRAYS(i).InletVapour.P > TRAYS(i).OutletVapour.P + TRAYS(i).Level*g*TRAYS(i).rhoL + 1e-1 * 'atm' switchto "on"; end end #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Equating Inlet Liquid Connector Variables #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "Liquid Inlet Flow" LiquidConnector.F = LiquidInlet.F; "Liquid Inlet Temperature" LiquidConnector.T = LiquidInlet.T; "Liquid Inlet Pressure" LiquidConnector.P = LiquidInlet.P; "Liquid Inlet Composition" LiquidConnector.z = LiquidInlet.z; "Liquid Inlet Vapour Fraction" LiquidConnector.v = LiquidInlet.v; "Liquid Inlet Enthalpy" LiquidConnector.h = LiquidInlet.h; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Equating Inlet Vapour Connector Variables #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "Vapour Inlet Flow" VapourConnector.F = VapourInlet.F; "Vapour Inlet Temperature" VapourConnector.T = VapourInlet.T; "Vapour Inlet Pressure" VapourConnector.P = VapourInlet.P; "Vapour Inlet Composition" VapourConnector.z = VapourInlet.z; "Vapour Inlet Vapour Fraction" VapourConnector.v = VapourInlet.v; "Vapour Inlet Enthalpy" VapourConnector.h = VapourInlet.h; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Equating Outlet Liquid Variables #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "Liquid Outlet Flow" LiquidOutlet.F = TRAYS(NumberOfTrays).OutletLiquid.F; "Liquid Outlet Temperature" LiquidOutlet.T = TRAYS(NumberOfTrays).OutletLiquid.T; "Liquid Outlet Pressure" LiquidOutlet.P = TRAYS(NumberOfTrays).OutletLiquid.P; "Liquid Outlet Composition" LiquidOutlet.z = TRAYS(NumberOfTrays).OutletLiquid.z; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Equating Outlet Vapour Variables #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "Vapour Outlet Flow" VapourOutlet.F = TRAYS(1).OutletVapour.F; "Vapour Outlet Temperature" VapourOutlet.T = TRAYS(1).OutletVapour.T; "Vapour Outlet Pressure" VapourOutlet.P = TRAYS(1).OutletVapour.P; "Vapour Outlet Composition" VapourOutlet.z = TRAYS(1).OutletVapour.z; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Equating Outlet Vapour Side Stream Variables #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "Vapour Draw Off Stream - Flow" VapourDrawOff.F*VapSideTrayIndex= TRAYS.VapourSideStream.F; "Vapour Draw Off Stream - Temperature" VapourDrawOff.T = TRAYS(VapourSideStreamLocation).VapourSideStream.T; "Vapour Draw Off Stream - Pressure" VapourDrawOff.P = TRAYS(VapourSideStreamLocation).VapourSideStream.P; "Vapour Draw Off Stream - Composition" VapourDrawOff.z = TRAYS(VapourSideStreamLocation).VapourSideStream.z; "Vapour Draw Off Stream" VapourDrawOffFlow = VapourDrawOff.F; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Equating Outlet Liquid Side Stream Variables #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "Liquid Draw Off Stream - Flow" LiquidDrawOff.F*LiqSideTrayIndex= TRAYS.LiquidSideStream.F; "Liquid Draw Off Stream - Temperature" LiquidDrawOff.T = TRAYS(LiquidSideStreamLocation).LiquidSideStream.T; "Liquid Draw Off Stream - Pressure" LiquidDrawOff.P = TRAYS(LiquidSideStreamLocation).LiquidSideStream.P; "Liquid Draw Off Stream - Composition" LiquidDrawOff.z = TRAYS(LiquidSideStreamLocation).LiquidSideStream.z; "Liquid Draw Off Stream" LiquidDrawOffFlow = LiquidDrawOff.F; end Model Distillation_kettle_cond as Section_ColumnBasic ATTRIBUTES Pallete = true; Icon = "icon/DistillationKettleCond"; Brief = "Model of a distillation column with dynamic condenser and dynamic reboiler."; Info = "== Specify == * the feed stream of each tray (Inlet); * the Murphree eficiency for each tray Emv; * the pump pressure difference; * the heat supllied in reboiler and condenser; * the condenser vapor outlet flow (OutletVapour.F); * the reboiler liquid outlet flow (OutletLiquid.F); * both splitter outlet flows OR one of the splitter outlet flows and the splitter frac. == Initial Conditions == * the TRAYS temperature (OutletLiquid.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletLiquid.F); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray; * the condenser temperature (OutletLiquid.T); * the condenser liquid level (Level); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions; * the reboiler temperature (OutletLiquid.T); * the reboiler liquid level (Level); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions. "; PARAMETERS CondenserVapourFlow as Switcher (Valid = ["on", "off"], Default = "on",Hidden=true); VARIABLES out VapourDrawOff as vapour_stream (Brief="Vapour Outlet in the section", PosX=1, PosY=0.375,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.42,Protected = true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Devices #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ CONDENSER as condenser; REBOILER as reboiler; SPLITTER as splitter2; PUMP as pump; alfaTopo as Real; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Heat Ports #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in HeatToReboiler as power (Brief="Heat supplied to Reboiler",Protected = true, PosX=1, PosY=0.90); in HeatToCondenser as power (Brief="Heat supplied to Condenser", Protected = true, PosX=1, PosY=0.034); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Connectors #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ConnectorHeatReboiler as power (Brief="Heat supplied to Reboiler", Hidden=true); ConnectorHeatCondenser as power (Brief="Heat supplied to Condenser", Hidden=true); in ConnectorCondenserVout as stream (Brief="Connector for Vapour outlet stream From Condenser", Hidden=true); in ConnectorReboilerLout as stream (Brief="Connector for Liquid outlet stream From Reboiler", Hidden=true); in ConnectorSplitterOut as stream (Brief="Connector for Liquid outlet stream From Top Splitter", Hidden=true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column products #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out VapourDistillate as vapour_stream (Brief="Vapour outlet stream From Condenser", PosX=0.66, PosY=0); out LiquidDistillate as liquid_stream (Brief="Liquid outlet stream From Top Splitter", PosX=1, PosY=0.20); out BottomProduct as liquid_stream (Brief="Liquid outlet stream From Reboiler", PosX=0.67, PosY=1); EQUATIONS switch CondenserVapourFlow case "on": CONDENSER.InletVapour.F*TRAYS(1).vV = alfaTopo *Ah * sqrt(2*(TRAYS(1).OutletVapour.P - CONDENSER.OutletLiquid.P + 1e-8 * 'atm') / (alfa*TRAYS(1).rhoV)); when CONDENSER.InletVapour.F < 1e-6 * 'kmol/h' switchto "off"; case "off": CONDENSER.InletVapour.F = 0 * 'mol/s'; when TRAYS(1).OutletVapour.P > CONDENSER.OutletLiquid.P + 1e-1 * 'atm' switchto "on"; end # Condenser Connector Equations ConnectorCondenserVout.T = VapourDistillate.T; ConnectorCondenserVout.P = VapourDistillate.P; ConnectorCondenserVout.F = VapourDistillate.F; ConnectorCondenserVout.z = VapourDistillate.z; # Splitter Connector Equations ConnectorSplitterOut.T = LiquidDistillate.T; ConnectorSplitterOut.P = LiquidDistillate.P; ConnectorSplitterOut.F = LiquidDistillate.F; ConnectorSplitterOut.z = LiquidDistillate.z; # Reboiler Connector Equations ConnectorReboilerLout.T = BottomProduct.T; ConnectorReboilerLout.P = BottomProduct.P; ConnectorReboilerLout.F = BottomProduct.F; ConnectorReboilerLout.z = BottomProduct.z; VapourDrawOff.F*VapSideTrayIndex= TRAYS.VapourSideStream.F; VapourDrawOff.T = TRAYS(VapourSideStreamLocation).VapourSideStream.T; VapourDrawOff.P = TRAYS(VapourSideStreamLocation).VapourSideStream.P; VapourDrawOff.z = TRAYS(VapourSideStreamLocation).VapourSideStream.z; LiquidDrawOff.F*LiqSideTrayIndex= TRAYS.LiquidSideStream.F; LiquidDrawOff.T = TRAYS(LiquidSideStreamLocation).LiquidSideStream.T; LiquidDrawOff.P = TRAYS(LiquidSideStreamLocation).LiquidSideStream.P; LiquidDrawOff.z = TRAYS(LiquidSideStreamLocation).LiquidSideStream.z; VapourDrawOffFlow = VapourDrawOff.F; LiquidDrawOffFlow = LiquidDrawOff.F; HeatToReboiler = ConnectorHeatReboiler; HeatToCondenser = ConnectorHeatCondenser; CONNECTIONS #vapor REBOILER.OutletVapour to TRAYS(NumberOfTrays).InletVapour; TRAYS(1).OutletVapour to CONDENSER.InletVapour; #liquid CONDENSER.OutletLiquid to SPLITTER.Inlet; SPLITTER.Outlet2 to PUMP.Inlet; PUMP.Outlet to TRAYS(1).InletLiquid; TRAYS(NumberOfTrays).OutletLiquid to REBOILER.InletLiquid; #Connectors CONDENSER.OutletVapour to ConnectorCondenserVout; SPLITTER.Outlet1 to ConnectorSplitterOut; REBOILER.OutletLiquid to ConnectorReboilerLout; ConnectorHeatReboiler to REBOILER.InletQ; ConnectorHeatCondenser to CONDENSER.InletQ; end Model Distillation_thermosyphon_subcooling as Section_ColumnBasic ATTRIBUTES Pallete = true; Icon = "icon/DistillationThermosyphonSubcooling"; Brief = "Model of a distillation column with steady condenser and steady reboiler."; Info = "== Specify == * the feed stream of each tray (Inlet); * the Murphree eficiency for each tray Emv; * the pump head; * the condenser pressure drop; * the heat supllied in top and bottom tanks; * the heat supllied in condenser and reboiler; * the Outlet1 flow in the bottom splitter (spbottom.Outlet1.F) that corresponds to the bottom product; * both top splitter outlet flows OR one of the splitter outlet flows and the splitter frac. == Initial Conditions == * the TRAYS temperature (OutletLiquid.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletLiquid.F); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray; * the top tank temperature (OutletLiquid.T); * the top tank liquid level (Level); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions; * the bottom tank temperature (OutletLiquid.T); * the bottom tank liquid level (Level); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions. "; PARAMETERS CondenserVapourFlow as Switcher(Valid = ["on", "off"], Hidden=true, Default = "on"); VARIABLES #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Vapour and Liquid Draw Sides #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out VapourDrawOff as vapour_stream (Brief="Vapour Outlet in the section", PosX=1, PosY=0.41,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.45,Protected = true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Devices #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ CONDENSER as condenserSteady (Brief="steady state condenser with subcooling"); ACCUMULATOR_TOP as tank_cylindrical (Brief="vessel drum (layed cilinder)"); SPLITTER_TOP as splitter2 (Brief="splitter which separate reflux and distillate"); PUMP as pump (Brief="pump in reflux stream"); REBOILER as reboilerSteady (Brief="steady state reboiler (thermosyphon)"); ACCUMULATOR_BOTTOM as tank (Brief="vessel in the bottom of column"); SPLITTER_BOTTOM as splitter2 (Brief="splitter who separate the bottom product and the stream to reboiler"); alfaTopo as Real; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Heat Ports #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in HeatToCondenser as power (Brief="Heat supplied to Condenser",PosX=1, PosY=0.065, Protected=true); in HeatToReboiler as power (Brief="Heat supplied to Reboiler", PosX=1, PosY=0.87,Protected=true); in HeatToBottomAccumulator as power (Brief="Heat supplied to Bottom Accumulator",PosX=0, PosY=0.925,Protected=true); in HeatToTopAccumulator as power (Brief="Heat supplied to Top Accumulator", PosX=1, PosY=0.19,Protected=true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Top and Bottom product #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out LiquidDistillate as liquid_stream (Brief="Liquid outlet stream From Top Splitter", PosX=1, PosY=0.24); out BottomProduct as liquid_stream (Brief="Liquid outlet stream From Bottom Splitter", PosX=0.18, PosY=1); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Model Connectors #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in ConnectorSplitterBottom as stream (Brief="Connector for Liquid outlet stream From Reboiler", Hidden=true); in ConnectorSplitterTop as stream (Brief="Connector for Liquid outlet stream From Top Splitter", Hidden=true); ConnectorHeatReboiler as power (Brief="Connector for Heat supplied to Reboiler", Hidden=true); ConnectorHeatCondenser as power (Brief="Connector for Heat supplied to Condenser", Hidden=true); ConnectorHeatTopAccumulator as power (Brief="Connector for Heat supplied to Top Accumulator", Hidden=true); ConnectorHeatBottomAccumulator as power (Brief="Connector for Heat supplied to Bottom Accumulator", Hidden=true); EQUATIONS # Heat Connector Equations HeatToCondenser = ConnectorHeatCondenser; HeatToReboiler = ConnectorHeatReboiler; HeatToBottomAccumulator = ConnectorHeatBottomAccumulator; HeatToTopAccumulator = ConnectorHeatTopAccumulator; # Top Splitter Connector Equations ConnectorSplitterTop.T = LiquidDistillate.T; ConnectorSplitterTop.P = LiquidDistillate.P; ConnectorSplitterTop.F = LiquidDistillate.F; ConnectorSplitterTop.z = LiquidDistillate.z; # Bottom Splitter Connector Equations ConnectorSplitterBottom.T = BottomProduct.T; ConnectorSplitterBottom.P = BottomProduct.P; ConnectorSplitterBottom.F = BottomProduct.F; ConnectorSplitterBottom.z = BottomProduct.z; VapourDrawOff.F*VapSideTrayIndex= TRAYS.VapourSideStream.F; VapourDrawOff.T = TRAYS(VapourSideStreamLocation).VapourSideStream.T; VapourDrawOff.P = TRAYS(VapourSideStreamLocation).VapourSideStream.P; VapourDrawOff.z = TRAYS(VapourSideStreamLocation).VapourSideStream.z; LiquidDrawOff.F*LiqSideTrayIndex= TRAYS.LiquidSideStream.F; LiquidDrawOff.T = TRAYS(LiquidSideStreamLocation).LiquidSideStream.T; LiquidDrawOff.P = TRAYS(LiquidSideStreamLocation).LiquidSideStream.P; LiquidDrawOff.z = TRAYS(LiquidSideStreamLocation).LiquidSideStream.z; VapourDrawOffFlow = VapourDrawOff.F; LiquidDrawOffFlow = LiquidDrawOff.F; switch CondenserVapourFlow case "on": CONDENSER.InletVapour.F*TRAYS(1).vV = alfaTopo * Ah * sqrt(2*(TRAYS(1).OutletVapour.P - CONDENSER.OutletLiquid.P + 1e-8 * 'atm') / (alfa*TRAYS(1).rhoV)); when CONDENSER.InletVapour.F < 1e-6 * 'kmol/h' switchto "off"; case "off": CONDENSER.InletVapour.F = 0 * 'mol/s'; when TRAYS(1).OutletVapour.P > CONDENSER.OutletLiquid.P + 1e-1 * 'atm' switchto "on"; end CONNECTIONS #vapor REBOILER.OutletVapour to TRAYS(NumberOfTrays).InletVapour; TRAYS(1).OutletVapour to CONDENSER.InletVapour; #liquid CONDENSER.OutletLiquid to ACCUMULATOR_TOP.Inlet; ACCUMULATOR_TOP.Outlet to SPLITTER_TOP.Inlet; SPLITTER_TOP.Outlet2 to PUMP.Inlet; PUMP.Outlet to TRAYS(1).InletLiquid; TRAYS(NumberOfTrays).OutletLiquid to ACCUMULATOR_BOTTOM.Inlet; ACCUMULATOR_BOTTOM.Outlet to SPLITTER_BOTTOM.Inlet; SPLITTER_BOTTOM.Outlet2 to REBOILER.InletLiquid; #Connectors ConnectorHeatCondenser to CONDENSER.InletQ; ConnectorHeatReboiler to REBOILER.InletQ; ConnectorHeatBottomAccumulator to ACCUMULATOR_BOTTOM.InletQ; ConnectorHeatTopAccumulator to ACCUMULATOR_TOP.InletQ; SPLITTER_TOP.Outlet1 to ConnectorSplitterTop; SPLITTER_BOTTOM.Outlet1 to ConnectorSplitterBottom; end Model Distillation_thermosyphon_cond as Section_ColumnBasic ATTRIBUTES Pallete = true; Icon = "icon/DistillationThermosyphonCond"; Brief = "Model of a distillation column with dynamic condenser and steady reboiler."; Info = "== Specify == * the feed stream of each tray (Inlet); * the Murphree eficiency for each tray Emv; * the pump head; * the condenser vapor outlet flow (OutletVapour.F); * the heat supllied in bottom tank; * the heat supllied in condenser and reboiler; * the Outlet1 flow in the bottom splitter (spbottom.Outlet1.F) that corresponds to the bottom product; == Initial Conditions == * the TRAYS temperature (OutletLiquid.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletLiquid.F); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray; * the condenser temperature (OutletLiquid.T); * the condenser liquid level (Level); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions; * the bottom tank temperature (OutletLiquid.T); * the bottom tank liquid level (Level); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions. "; PARAMETERS CondenserVapourFlow as Switcher (Valid = ["on", "off"], Default = "on",Hidden=true); VARIABLES #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Vapour and Liquid Draw Sides #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out VapourDrawOff as vapour_stream (Brief="Vapour Outlet in the section", PosX=1, PosY=0.379,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.425,Protected = true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Devices #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ CONDENSER as condenser (Brief="dynamic condenser without subcooling"); SPLITTER_TOP as splitter2 (Brief="splitter which separate reflux and distillate"); PUMP as pump (Brief="pump in reflux stream"); ACCUMULATOR_BOTTOM as tank (Brief="vessel in the bottom of column"); SPLITTER_BOTTOM as splitter2 (Brief="splitter who separate the bottom product and the stream to reboiler"); REBOILER as reboilerSteady (Brief="steady state reboiler (thermosyphon)"); alfaTopo as Real; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Heat Ports #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in HeatToCondenser as power (Brief="Heat supplied to Condenser",PosX=1, PosY=0.035, Protected=true); in HeatToReboiler as power (Brief="Heat supplied to Reboiler", PosX=1, PosY=0.865,Protected=true); in HeatToBottomAccumulator as power (Brief="Heat supplied to Bottom Accumulator",PosX=0, PosY=0.92,Protected=true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Top and Bottom product #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out VapourDistillate as vapour_stream (Brief="Vapour outlet stream From Top Condenser", PosX=0.665, PosY=0); out LiquidDistillate as liquid_stream (Brief="Liquid outlet stream From Top Splitter", PosX=1, PosY=0.20); out BottomProduct as liquid_stream (Brief="Liquid outlet stream From Bottom Splitter", PosX=0.18, PosY=1); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Model Connectors #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in ConnectorSplitterBottom as stream (Brief="Connector for Liquid outlet stream From Reboiler", Hidden=true); in ConnectorSplitterTop as stream (Brief="Connector for Liquid outlet stream From Top Splitter", Hidden=true); in ConnectorCondenserVout as stream (Brief="Connector for Vapour outlet stream From Top Condenser", Hidden=true); ConnectorHeatReboiler as power (Brief="Connector for Heat supplied to Reboiler", Hidden=true); ConnectorHeatCondenser as power (Brief="Connector for Heat supplied to Condenser", Hidden=true); ConnectorHeatBottomAccumulator as power (Brief="Connector for Heat supplied to Bottom Accumulator", Hidden=true); EQUATIONS # Heat Connector Equations HeatToCondenser = ConnectorHeatCondenser; HeatToReboiler = ConnectorHeatReboiler; HeatToBottomAccumulator = ConnectorHeatBottomAccumulator; # Condenser Connector Equations ConnectorCondenserVout.T = VapourDistillate.T; ConnectorCondenserVout.P = VapourDistillate.P; ConnectorCondenserVout.F = VapourDistillate.F; ConnectorCondenserVout.z = VapourDistillate.z; # Top Splitter Connector Equations ConnectorSplitterTop.T = LiquidDistillate.T; ConnectorSplitterTop.P = LiquidDistillate.P; ConnectorSplitterTop.F = LiquidDistillate.F; ConnectorSplitterTop.z = LiquidDistillate.z; # Bottom Splitter Connector Equations ConnectorSplitterBottom.T = BottomProduct.T; ConnectorSplitterBottom.P = BottomProduct.P; ConnectorSplitterBottom.F = BottomProduct.F; ConnectorSplitterBottom.z = BottomProduct.z; VapourDrawOff.F*VapSideTrayIndex= TRAYS.VapourSideStream.F; VapourDrawOff.T = TRAYS(VapourSideStreamLocation).VapourSideStream.T; VapourDrawOff.P = TRAYS(VapourSideStreamLocation).VapourSideStream.P; VapourDrawOff.z = TRAYS(VapourSideStreamLocation).VapourSideStream.z; LiquidDrawOff.F*LiqSideTrayIndex= TRAYS.LiquidSideStream.F; LiquidDrawOff.T = TRAYS(LiquidSideStreamLocation).LiquidSideStream.T; LiquidDrawOff.P = TRAYS(LiquidSideStreamLocation).LiquidSideStream.P; LiquidDrawOff.z = TRAYS(LiquidSideStreamLocation).LiquidSideStream.z; VapourDrawOffFlow = VapourDrawOff.F; LiquidDrawOffFlow = LiquidDrawOff.F; switch CondenserVapourFlow case "on": CONDENSER.InletVapour.F*TRAYS(1).vV = alfaTopo * Ah * sqrt(2*(TRAYS(1).OutletVapour.P - CONDENSER.OutletLiquid.P + 1e-8 * 'atm') / (alfa*TRAYS(1).rhoV)); when CONDENSER.InletVapour.F < 1e-6 * 'kmol/h' switchto "off"; case "off": CONDENSER.InletVapour.F = 0 * 'mol/s'; when TRAYS(1).OutletVapour.P > CONDENSER.OutletLiquid.P + 1e-1 * 'atm' switchto "on"; end CONNECTIONS #vapor REBOILER.OutletVapour to TRAYS(NumberOfTrays).InletVapour; TRAYS(1).OutletVapour to CONDENSER.InletVapour; #liquid CONDENSER.OutletLiquid to SPLITTER_TOP.Inlet; SPLITTER_TOP.Outlet2 to PUMP.Inlet; PUMP.Outlet to TRAYS(1).InletLiquid; TRAYS(NumberOfTrays).OutletLiquid to ACCUMULATOR_BOTTOM.Inlet; ACCUMULATOR_BOTTOM.Outlet to SPLITTER_BOTTOM.Inlet; SPLITTER_BOTTOM.Outlet2 to REBOILER.InletLiquid; #Connectors ConnectorHeatCondenser to CONDENSER.InletQ; ConnectorHeatReboiler to REBOILER.InletQ; ConnectorHeatBottomAccumulator to ACCUMULATOR_BOTTOM.InletQ; CONDENSER.OutletVapour to ConnectorCondenserVout; SPLITTER_TOP.Outlet1 to ConnectorSplitterTop; SPLITTER_BOTTOM.Outlet1 to ConnectorSplitterBottom; end Model Distillation_kettle_subcooling as Section_ColumnBasic ATTRIBUTES Pallete = true; Icon = "icon/DistillationKettleSubcooling"; Brief = "Model of a distillation column with steady condenser and dynamic reboiler."; Info = "== Specify == * the feed stream of each tray (Inlet); * the Murphree eficiency for each tray (Emv); * the pump pressure difference; * the heat supllied in reboiler and condenser; * the heat supllied in the top tank; * the condenser pressure drop; * the reboiler liquid outlet flow (OutletLiquid.F); * both splitter outlet flows OR one of the splitter outlet flows and the splitter frac. == Initial Conditions == * the TRAYS temperature (OutletLiquid.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletLiquid.F); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray; * the top tank temperature (OutletLiquid.T); * the top tank liquid level (Level); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions; * the reboiler temperature (OutletLiquid.T); * the reboiler liquid level (Level); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions. "; PARAMETERS CondenserVapourFlow as Switcher(Valid = ["on", "off"], Default = "on",Hidden=true); VARIABLES #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Vapour and Liquid Draw Sides #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out VapourDrawOff as vapour_stream (Brief="Vapour Outlet in the section", PosX=1, PosY=0.41,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.45,Protected = true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Devices #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ CONDENSER as condenserSteady (Brief="steady state condenser with subcooling"); ACCUMULATOR as tank_cylindrical (Brief="vessel drum (layed cilinder)"); SPLITTER as splitter2 (Brief="splitter which separate reflux and distillate"); PUMP as pump (Brief="pump in reflux stream"); REBOILER as reboiler (Brief="kettle reboiler"); alfaTopo as Real; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Heat Ports #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in HeatToCondenser as power (Brief="Heat supplied to Condenser", PosX=1, PosY=0.065, Protected=true); in HeatToReboiler as power (Brief="Heat supplied to Reboiler", PosX=1, PosY=0.905, Protected=true); in HeatToAccumulator as power (Brief="Heat supplied to Top Vessel", PosX=1, PosY=0.195, Protected=true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Model Connectors #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in ConnectorSplitterOut as stream (Brief="Connector for Liquid outlet stream From Top Splitter", Hidden=true); in ConnectorReboilerLout as stream (Brief="Connector for Liquid outlet stream From Reboiler", Hidden=true); ConnectorHeatReboiler as power (Brief="Connector for Heat supplied to Reboiler", Hidden=true); ConnectorHeatCondenser as power (Brief="Connector for Heat supplied to Condenser", Hidden=true); ConnectorHeatAccumulator as power (Brief="Connector for Heat supplied to TopVessel", Hidden=true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Top and Bottom product #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out LiquidDistillate as liquid_stream (Brief="Liquid outlet stream From Top Splitter", PosX=1, PosY=0.24); out BottomProduct as liquid_stream (Brief="Liquid outlet stream From Reboiler", PosX=0.67, PosY=1); EQUATIONS #Heat Connectors HeatToCondenser = ConnectorHeatCondenser; HeatToReboiler = ConnectorHeatReboiler; HeatToAccumulator = ConnectorHeatAccumulator; # Splitter Connector Equations ConnectorSplitterOut.T = LiquidDistillate.T; ConnectorSplitterOut.P = LiquidDistillate.P; ConnectorSplitterOut.F = LiquidDistillate.F; ConnectorSplitterOut.z = LiquidDistillate.z; # Reboiler Connector Equations ConnectorReboilerLout.T = BottomProduct.T; ConnectorReboilerLout.P = BottomProduct.P; ConnectorReboilerLout.F = BottomProduct.F; ConnectorReboilerLout.z = BottomProduct.z; VapourDrawOff.F*VapSideTrayIndex= TRAYS.VapourSideStream.F; VapourDrawOff.T = TRAYS(VapourSideStreamLocation).VapourSideStream.T; VapourDrawOff.P = TRAYS(VapourSideStreamLocation).VapourSideStream.P; VapourDrawOff.z = TRAYS(VapourSideStreamLocation).VapourSideStream.z; LiquidDrawOff.F*LiqSideTrayIndex= TRAYS.LiquidSideStream.F; LiquidDrawOff.T = TRAYS(LiquidSideStreamLocation).LiquidSideStream.T; LiquidDrawOff.P = TRAYS(LiquidSideStreamLocation).LiquidSideStream.P; LiquidDrawOff.z = TRAYS(LiquidSideStreamLocation).LiquidSideStream.z; VapourDrawOffFlow = VapourDrawOff.F; LiquidDrawOffFlow = LiquidDrawOff.F; switch CondenserVapourFlow case "on": CONDENSER.InletVapour.F*TRAYS(1).vV = alfaTopo * Ah * sqrt(2*(TRAYS(1).OutletVapour.P - CONDENSER.OutletLiquid.P + 1e-8 * 'atm') / (alfa*TRAYS(1).rhoV)); when CONDENSER.InletVapour.F < 1e-6 * 'kmol/h' switchto "off"; case "off": CONDENSER.InletVapour.F = 0 * 'mol/s'; when TRAYS(1).OutletVapour.P > CONDENSER.OutletLiquid.P + 1e-1 * 'atm' switchto "on"; end CONNECTIONS #vapor REBOILER.OutletVapour to TRAYS(NumberOfTrays).InletVapour; TRAYS(1).OutletVapour to CONDENSER.InletVapour; #liquid CONDENSER.OutletLiquid to ACCUMULATOR.Inlet; ACCUMULATOR.Outlet to SPLITTER.Inlet; SPLITTER.Outlet2 to PUMP.Inlet; PUMP.Outlet to TRAYS(1).InletLiquid; TRAYS(NumberOfTrays).OutletLiquid to REBOILER.InletLiquid; #Connectors ConnectorHeatCondenser to CONDENSER.InletQ; ConnectorHeatReboiler to REBOILER.InletQ; ConnectorHeatAccumulator to ACCUMULATOR.InletQ; SPLITTER.Outlet1 to ConnectorSplitterOut; REBOILER.OutletLiquid to ConnectorReboilerLout; end Model Rectifier as Section_ColumnBasic ATTRIBUTES Pallete = true; Icon = "icon/RefluxedCond"; Brief = "Model of a rectifier column with dynamic condenser."; Info = "== Specify == * the feed stream of each tray (Inlet); * the Murphree eficiency for each tray Emv; * the InletVapour stream of the bottom tray unless its flow; * the pump pressure difference; * the heat supllied in the condenser; * the condenser vapor outlet flow (OutletVapour.F); * both splitter outlet flows OR one of the splitter outlet flows and the splitter frac. == Initial Conditions == * the TRAYS temperature (OutletLiquid.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletLiquid.F); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray; * the condenser temperature (OutletLiquid.T); * the condenser liquid level (Level); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions; "; PARAMETERS CondenserVapourFlow as Switcher(Valid = ["on", "off"], Default = "on",Hidden=true); VARIABLES #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Vapour and Liquid Draw Sides #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out VapourDrawOff as vapour_stream (Brief="Vapour Outlet in the section", PosX=1, PosY=0.45,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.50,Protected = true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Devices #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ CONDENSER as condenser (Brief="dymamic condenser without subcooling"); SPLITTER as splitter2 (Brief="splitter which separate reflux and distillate"); PUMP as pump (Brief="pump in reflux stream"); alfaTopo as Real; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Top product #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out VapourDistillate as vapour_stream (Brief="Vapour outlet stream From Top Condenser", PosX=0.66, PosY=0); out LiquidDistillate as liquid_stream (Brief="Liquid outlet stream From Top Splitter", PosX=1, PosY=0.24); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Heat Port #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in HeatToCondenser as power (Brief="Heat supplied to Condenser",PosX=1, PosY=0.04, Protected = true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Bottom Outlets #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in VapourInlet as stream (Brief="Vapour Inlet in the section", PosX=0.07, PosY=1); out LiquidOutlet as liquid_stream (Brief="Liquid Outlet in the section", PosX=0.32, PosY=1); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Model Connectors #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in ConnectorSplitterOut as stream (Brief="Connector for Liquid outlet stream From Top Splitter", Hidden=true); in ConnectorCondenserVout as stream (Brief="Connector for Vapour outlet stream From Top Condenser", Hidden=true); VapourConnector as stream (Brief="Vapour connection at the middle TRAYS", PosX=0.55, PosY=0,Hidden=true); ConnectorHeatCondenser as power (Brief="Connector for Heat supplied to Condenser", Hidden=true); EQUATIONS switch CondenserVapourFlow case "on": CONDENSER.InletVapour.F*TRAYS(1).vV = alfaTopo * Ah * sqrt(2*(TRAYS(1).OutletVapour.P - CONDENSER.OutletLiquid.P + 1e-8 * 'atm') / (alfa*TRAYS(1).rhoV)); when CONDENSER.InletVapour.F < 1e-6 * 'kmol/h' switchto "off"; case "off": CONDENSER.InletVapour.F = 0 * 'mol/s'; when TRAYS(1).OutletVapour.P > CONDENSER.OutletLiquid.P + 1e-1 * 'atm' switchto "on"; end HeatToCondenser = ConnectorHeatCondenser; # Condenser Connector Equations ConnectorCondenserVout.T = VapourDistillate.T; ConnectorCondenserVout.P = VapourDistillate.P; ConnectorCondenserVout.F = VapourDistillate.F; ConnectorCondenserVout.z = VapourDistillate.z; # Splitter Connector Equations ConnectorSplitterOut.T = LiquidDistillate.T; ConnectorSplitterOut.P = LiquidDistillate.P; ConnectorSplitterOut.F = LiquidDistillate.F; ConnectorSplitterOut.z = LiquidDistillate.z; LiquidOutlet.F= TRAYS(NumberOfTrays).OutletLiquid.F; LiquidOutlet.T = TRAYS(NumberOfTrays).OutletLiquid.T; LiquidOutlet.P = TRAYS(NumberOfTrays).OutletLiquid.P; LiquidOutlet.z = TRAYS(NumberOfTrays).OutletLiquid.z; VapourConnector.F= VapourInlet.F; VapourConnector.T = VapourInlet.T; VapourConnector.P = VapourInlet.P; VapourConnector.z = VapourInlet.z; VapourConnector.v = VapourInlet.v; VapourConnector.h = VapourInlet.h; VapourDrawOff.F*VapSideTrayIndex= TRAYS.VapourSideStream.F; VapourDrawOff.T = TRAYS(VapourSideStreamLocation).VapourSideStream.T; VapourDrawOff.P = TRAYS(VapourSideStreamLocation).VapourSideStream.P; VapourDrawOff.z = TRAYS(VapourSideStreamLocation).VapourSideStream.z; LiquidDrawOff.F*LiqSideTrayIndex= TRAYS.LiquidSideStream.F; LiquidDrawOff.T = TRAYS(LiquidSideStreamLocation).LiquidSideStream.T; LiquidDrawOff.P = TRAYS(LiquidSideStreamLocation).LiquidSideStream.P; LiquidDrawOff.z = TRAYS(LiquidSideStreamLocation).LiquidSideStream.z; VapourDrawOffFlow = VapourDrawOff.F; LiquidDrawOffFlow = LiquidDrawOff.F; CONNECTIONS #vapor TRAYS(1).OutletVapour to CONDENSER.InletVapour; #liquid CONDENSER.OutletLiquid to SPLITTER.Inlet; SPLITTER.Outlet2 to PUMP.Inlet; PUMP.Outlet to TRAYS(1).InletLiquid; #Connectors ConnectorHeatCondenser to CONDENSER.InletQ; VapourConnector to TRAYS(NumberOfTrays).InletVapour; SPLITTER.Outlet1 to ConnectorSplitterOut; CONDENSER.OutletVapour to ConnectorCondenserVout; end Model Rectifier_subcooling as Section_ColumnBasic ATTRIBUTES Pallete = true; Icon = "icon/RefluxedSubcooling"; Brief = "Model of a rectifier column with steady condenser."; Info = "== Specify == * the feed stream of each tray (Inlet); * the Murphree eficiency for each tray Emv; * the InletVapour stream of the bottom tray unless its flow; * the pump head; * the condenser pressure drop; * the heat supllied in the top tank; * the heat supllied in condenser; * both top splitter outlet flows OR one of the splitter outlet flows and the splitter frac. == Initial Conditions == * the TRAYS temperature (OutletLiquid.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletLiquid.F); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray; * the top tank temperature (OutletLiquid.T); * the top tank liquid level (Level); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions; "; PARAMETERS CondenserVapourFlow as Switcher (Valid = ["on", "off"], Default = "on",Hidden=true); VARIABLES #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Vapour and Liquid Draw Sides #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out VapourDrawOff as vapour_stream (Brief="Vapour Outlet in the section", PosX=1, PosY=0.485,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.535,Protected = true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Devices #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ CONDENSER as condenserSteady (Brief="steady state condenser with subcooling"); ACCUMULATOR as tank_cylindrical (Brief="vessel drum (layed cilinder)"); SPLITTER as splitter2 (Brief="plitter which separate reflux and distillate"); PUMP as pump (Brief="pump in reflux stream"); alfaTopo as Real; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Bottom outlets #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in VapourInlet as stream (Brief="Vapour Inlet in the section", PosX=0.07, PosY=1); out LiquidOutlet as liquid_stream (Brief="Liquid Outlet in the section", PosX=0.32, PosY=1); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Heat Ports #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in HeatToCondenser as power (Brief="Heat supplied to Condenser", PosX=1, PosY=0.070, Protected=true); in HeatToAccumulator as power (Brief="Heat supplied to Top Accumulator", PosX=1, PosY=0.23, Protected=true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Top Product #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out LiquidDistillate as liquid_stream (Brief="Liquid outlet stream From Top Splitter", PosX=1, PosY=0.285); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Connectors #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in ConnectorSplitterTop as stream (Brief="Connector for Liquid outlet stream From Top Splitter", Hidden=true); VapourConnector as stream (Brief="Vapour connection at the middle TRAYS", PosX=0.55, PosY=0,Hidden=true); ConnectorHeatCondenser as power (Brief="Connector for Heat supplied to Condenser", Hidden=true); ConnectorHeatAccumulator as power (Brief="Connector for Heat supplied to Top Accumulator", Hidden=true); EQUATIONS #Heat Connectors HeatToCondenser = ConnectorHeatCondenser; HeatToAccumulator = ConnectorHeatAccumulator; LiquidOutlet.F= TRAYS(NumberOfTrays).OutletLiquid.F; LiquidOutlet.T = TRAYS(NumberOfTrays).OutletLiquid.T; LiquidOutlet.P = TRAYS(NumberOfTrays).OutletLiquid.P; LiquidOutlet.z = TRAYS(NumberOfTrays).OutletLiquid.z; VapourConnector.F= VapourInlet.F; VapourConnector.T = VapourInlet.T; VapourConnector.P = VapourInlet.P; VapourConnector.z = VapourInlet.z; VapourConnector.v = VapourInlet.v; VapourConnector.h = VapourInlet.h; # Splitter Connector Equations ConnectorSplitterTop.T = LiquidDistillate.T; ConnectorSplitterTop.P = LiquidDistillate.P; ConnectorSplitterTop.F = LiquidDistillate.F; ConnectorSplitterTop.z = LiquidDistillate.z; VapourDrawOff.F*VapSideTrayIndex= TRAYS.VapourSideStream.F; VapourDrawOff.T = TRAYS(VapourSideStreamLocation).VapourSideStream.T; VapourDrawOff.P = TRAYS(VapourSideStreamLocation).VapourSideStream.P; VapourDrawOff.z = TRAYS(VapourSideStreamLocation).VapourSideStream.z; LiquidDrawOff.F*LiqSideTrayIndex= TRAYS.LiquidSideStream.F; LiquidDrawOff.T = TRAYS(LiquidSideStreamLocation).LiquidSideStream.T; LiquidDrawOff.P = TRAYS(LiquidSideStreamLocation).LiquidSideStream.P; LiquidDrawOff.z = TRAYS(LiquidSideStreamLocation).LiquidSideStream.z; VapourDrawOffFlow = VapourDrawOff.F; LiquidDrawOffFlow = LiquidDrawOff.F; switch CondenserVapourFlow case "on": CONDENSER.InletVapour.F*TRAYS(1).vV = alfaTopo *Ah * sqrt(2*(TRAYS(1).OutletVapour.P - CONDENSER.OutletLiquid.P + 1e-8 * 'atm') / (alfa*TRAYS(1).rhoV)); when CONDENSER.InletVapour.F < 1e-6 * 'kmol/h' switchto "off"; case "off": CONDENSER.InletVapour.F = 0 * 'mol/s'; when TRAYS(1).OutletVapour.P > CONDENSER.OutletLiquid.P + 1e-1 * 'atm' switchto "on"; end CONNECTIONS #vapor TRAYS(1).OutletVapour to CONDENSER.InletVapour; #liquid CONDENSER.OutletLiquid to ACCUMULATOR.Inlet; ACCUMULATOR.Outlet to SPLITTER.Inlet; SPLITTER.Outlet2 to PUMP.Inlet; PUMP.Outlet to TRAYS(1).InletLiquid; #Connectors VapourConnector to TRAYS(NumberOfTrays).InletVapour; ConnectorHeatCondenser to CONDENSER.InletQ; SPLITTER.Outlet1 to ConnectorSplitterTop; ConnectorHeatAccumulator to ACCUMULATOR.InletQ; end Model Reboiled_Stripping_kettle as Section_ColumnBasic ATTRIBUTES Pallete = true; Icon = "icon/ReboiledKettle"; Brief = "Model of a reboiled stripping column with dynamic reboiler."; Info = "== Specify == * the feed stream of each tray (Inlet); * the Murphree eficiency for each tray Emv; * the vapour flow leaving the top of the column; * the InletLiquidiquid stream of the top tray; * the heat supllied in the reboiler; * the reboiler liquid outlet flow (OutletLiquid.F); == Initial Conditions == * the TRAYS temperature (OutletLiquid.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletLiquid.F); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray; * the reboiler temperature (OutletLiquid.T); * the reboiler liquid level (Level); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions. "; VARIABLES #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Vapour and Liquid Draw Sides #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out VapourDrawOff as vapour_stream (Brief="Vapour Outlet in the section", PosX=1, PosY=0.28,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.33,Protected = true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Devices #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ REBOILER as reboiler (Brief="Kettle Reboiler"); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Heat Port #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in HeatToReboiler as power (Brief="Heat supplied to Reboiler",PosX=1, PosY=0.865,Protected=true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Top Outlets #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in LiquidInlet as stream (Brief="Liquid Inlet in the section", PosX=0.30, PosY=0); out VapourOutlet as vapour_stream (Brief="Vapour Outlet in the section", PosX=0.07, PosY=0); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Bottom Product #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out BottomProduct as liquid_stream (Brief="Liquid outlet stream From Reboiler", PosX=0.68, PosY=1); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Connectors #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in ConnectorReboilerLout as stream (Brief="Connector for Liquid outlet stream From Reboiler", Hidden=true); LiquidConnector as stream (Brief="Liquid connection at the middle TRAYS", PosX=0.75, PosY=1,Hidden=true); ConnectorHeatReboiler as power (Brief="Connector for Heat supplied to Reboiler", Hidden=true); CONNECTIONS #vapor REBOILER.OutletVapour to TRAYS(NumberOfTrays).InletVapour; #liquid TRAYS(NumberOfTrays).OutletLiquid to REBOILER.InletLiquid; #Connectors REBOILER.OutletLiquid to ConnectorReboilerLout; LiquidConnector to TRAYS(1).InletLiquid; ConnectorHeatReboiler to REBOILER.InletQ; EQUATIONS #Heat Connectors HeatToReboiler = ConnectorHeatReboiler; LiquidConnector.F= LiquidInlet.F; LiquidConnector.T = LiquidInlet.T; LiquidConnector.P = LiquidInlet.P; LiquidConnector.z = LiquidInlet.z; LiquidConnector.v = LiquidInlet.v; LiquidConnector.h = LiquidInlet.h; VapourOutlet.F= TRAYS(1).OutletVapour.F; VapourOutlet.T = TRAYS(1).OutletVapour.T; VapourOutlet.P = TRAYS(1).OutletVapour.P; VapourOutlet.z = TRAYS(1).OutletVapour.z; # Reboiler Connector Equations ConnectorReboilerLout.T = BottomProduct.T; ConnectorReboilerLout.P = BottomProduct.P; ConnectorReboilerLout.F = BottomProduct.F; ConnectorReboilerLout.z = BottomProduct.z; VapourDrawOff.F*VapSideTrayIndex= TRAYS.VapourSideStream.F; VapourDrawOff.T = TRAYS(VapourSideStreamLocation).VapourSideStream.T; VapourDrawOff.P = TRAYS(VapourSideStreamLocation).VapourSideStream.P; VapourDrawOff.z = TRAYS(VapourSideStreamLocation).VapourSideStream.z; LiquidDrawOff.F*LiqSideTrayIndex= TRAYS.LiquidSideStream.F; LiquidDrawOff.T = TRAYS(LiquidSideStreamLocation).LiquidSideStream.T; LiquidDrawOff.P = TRAYS(LiquidSideStreamLocation).LiquidSideStream.P; LiquidDrawOff.z = TRAYS(LiquidSideStreamLocation).LiquidSideStream.z; VapourDrawOffFlow = VapourDrawOff.F; LiquidDrawOffFlow = LiquidDrawOff.F; end Model Reboiled_Stripping_thermosyphon as Section_ColumnBasic ATTRIBUTES Pallete = true; Icon = "icon/ReboiledThermosyphon"; Brief = "Model of a reboiled stripping column with steady reboiler."; Info = "== Specify == * the feed stream of each tray (Inlet); * the Murphree eficiency for each tray (Emv); * the vapour flow leaving the top of the column; * the InletLiquidiquid stream of the top tray; * the heat supllied in bottom tank; * the heat supllied in the reboiler; * the Outlet1 flow in the bottom splitter (spbottom.Outlet1.F) that corresponds to the bottom product; == Initial Conditions == * the TRAYS temperature (OutletLiquid.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletLiquid.F); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray; * the bottom tank temperature (OutletLiquid.T); * the bottom tank liquid level (Level); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions. "; VARIABLES #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Vapour and Liquid Draw Sides #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out VapourDrawOff as vapour_stream (Brief="Vapour Outlet in the section", PosX=1, PosY=0.28,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.33,Protected = true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Devices #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ REBOILER as reboilerSteady (Brief="steady state reboiler (thermosyphon)"); SPLITTER as splitter2 (Brief="splitter which separate the bottom product and the stream to reboiler"); ACCUMULATOR as tank (Brief="vessel in the bottom of column"); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Heat Ports #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in HeatToReboiler as power (Brief="Heat supplied to Reboiler",PosX=1, PosY=0.84,Protected=true); in HeatToAccumulator as power (Brief="Heat supplied to Bottom Vessel",PosX=0, PosY=0.91,Protected=true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Top Outlets #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in LiquidInlet as stream (Brief="Liquid Inlet in the section", PosX=0.32, PosY=0); out VapourOutlet as vapour_stream (Brief="Vapour Outlet in the section", PosX=0.07, PosY=0); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Bottom Product #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out BottomProduct as liquid_stream (Brief="Liquid outlet stream From Reboiler", PosX=0.19, PosY=1); LiquidConnector as stream (Brief="Liquid connection at the middle TRAYS", PosX=0.75, PosY=1,Hidden=true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Connectors #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in ConnectorSplitterBottom as stream (Brief="Connector for Liquid outlet stream From Reboiler", Hidden=true); ConnectorHeatReboiler as power (Brief="Connector for Heat supplied to Reboiler", Hidden=true); ConnectorHeatAccumulator as power (Brief="Connector for Heat supplied to Bottom Accumulator", Hidden=true); CONNECTIONS #vapor REBOILER.OutletVapour to TRAYS(NumberOfTrays).InletVapour; #liquid TRAYS(NumberOfTrays).OutletLiquid to ACCUMULATOR.Inlet; ACCUMULATOR.Outlet to SPLITTER.Inlet; SPLITTER.Outlet2 to REBOILER.InletLiquid; #Connectors LiquidConnector to TRAYS(1).InletLiquid; ConnectorHeatReboiler to REBOILER.InletQ; ConnectorHeatAccumulator to ACCUMULATOR.InletQ; SPLITTER.Outlet1 to ConnectorSplitterBottom; EQUATIONS #Heat Connectors HeatToReboiler = ConnectorHeatReboiler; HeatToAccumulator = ConnectorHeatAccumulator; ConnectorSplitterBottom.T = BottomProduct.T; ConnectorSplitterBottom.P = BottomProduct.P; ConnectorSplitterBottom.F = BottomProduct.F; ConnectorSplitterBottom.z = BottomProduct.z; LiquidConnector.F= LiquidInlet.F; LiquidConnector.T = LiquidInlet.T; LiquidConnector.P = LiquidInlet.P; LiquidConnector.z = LiquidInlet.z; LiquidConnector.v = LiquidInlet.v; LiquidConnector.h = LiquidInlet.h; VapourOutlet.F= TRAYS(1).OutletVapour.F; VapourOutlet.T = TRAYS(1).OutletVapour.T; VapourOutlet.P = TRAYS(1).OutletVapour.P; VapourOutlet.z = TRAYS(1).OutletVapour.z; VapourDrawOff.F*VapSideTrayIndex= TRAYS.VapourSideStream.F; VapourDrawOff.T = TRAYS(VapourSideStreamLocation).VapourSideStream.T; VapourDrawOff.P = TRAYS(VapourSideStreamLocation).VapourSideStream.P; VapourDrawOff.z = TRAYS(VapourSideStreamLocation).VapourSideStream.z; LiquidDrawOff.F*LiqSideTrayIndex= TRAYS.LiquidSideStream.F; LiquidDrawOff.T = TRAYS(LiquidSideStreamLocation).LiquidSideStream.T; LiquidDrawOff.P = TRAYS(LiquidSideStreamLocation).LiquidSideStream.P; LiquidDrawOff.z = TRAYS(LiquidSideStreamLocation).LiquidSideStream.z; VapourDrawOffFlow = VapourDrawOff.F; LiquidDrawOffFlow = LiquidDrawOff.F; end Model ReactiveDistillation ATTRIBUTES Pallete = true; Icon = "icon/DistillationReac"; Brief = "Model of a reactive distillation column with dynamic condenser and reboiler."; Info = "== Specify == * the reaction related variables for each tray, condenser and reboiler; * the feed stream of each tray (Inlet); * the Murphree eficiency for each tray Emv; * the pump pressure difference; * the heat supllied in reboiler and condenser; * the condenser vapor outlet flow (OutletVapour.F); * the reboiler liquid outlet flow (OutletLiquid.F); * both splitter outlet flows OR one of the splitter outlet flows and the splitter frac. == Initial Conditions == * the TRAYS temperature (OutletLiquid.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletLiquid.F); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray; * the condenser temperature (OutletLiquid.T); * the condenser liquid level (Level); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions; * the reboiler temperature (OutletLiquid.T); * the reboiler liquid level (Level); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions. "; PARAMETERS outer PP as Plugin (Type="PP"); outer NComp as Integer (Brief="Number of Components"); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Section Column Feed Tray - Side Streams Location and Numbering #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NumberOfTrays as Integer (Brief="Number of TRAYS", Default=2); FeedTrayIndex(NumberOfTrays) as Integer (Brief="Feed Tray Index", Default=0,Hidden=true); LiqSideTrayIndex(NumberOfTrays) as Integer (Brief="Liquid Side Tray Index", Default=0,Hidden=true); VapSideTrayIndex(NumberOfTrays) as Integer (Brief="Vapour Side Tray Index", Default=0,Hidden=true); FeedTrayLocation as Integer (Brief="Feed tray Location", Default=2); LiquidSideStreamLocation as Integer (Brief="Liquid Side Stream Location", Default=2); VapourSideStreamLocation as Integer (Brief="Vapour Side Stream Location", Default=2); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Section Column Flow Model for Liquid and Vapour #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ VapourFlow as Switcher (Valid = ["on", "off"], Default = "off",Hidden=true); TrayVapourFlow as Switcher (Valid = ["on", "off"], Default = "off",Hidden=true); TrayLiquidFlow as Switcher (Valid = ["on", "off"], Default = "off",Hidden=true); alfacond as Real; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Section Column Tray Geometry and Auxiliar Parameters #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ V as volume (Brief="Total Volume of the tray",Hidden=true); Q as power (Brief="Rate of heat supply",Hidden=true); Ap as area (Brief="Plate area = Atray - Adowncomer",Hidden=true); Ah as area (Brief="Total holes area",Hidden=true); lw as length (Brief="Weir length",Hidden=true); g as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true); hw as length (Brief="Weir height",Hidden=true); beta as fraction (Brief="Aeration fraction"); alfa as fraction (Brief="Dry pressure drop coefficient"); VolumeOfTray as volume (Brief="Total Volume of the tray"); HeatSupply as heat_rate (Brief="Rate of heat supply"); PlateArea as area (Brief="Plate area = Atray - Adowncomer"); HolesArea as area (Brief="Total holes area"); WeirLength as length (Brief="Weir length"); WeirHeight as length (Brief="Weir height"); stoic(NComp) as Real(Brief="Stoichiometric matrix"); Hr as energy_mol; SET FeedTrayIndex(FeedTrayLocation) =1; VapSideTrayIndex(FeedTrayLocation) =1; LiqSideTrayIndex(FeedTrayLocation) =1; V=VolumeOfTray; Q=HeatSupply; Ap=PlateArea; Ah=HolesArea; lw=WeirLength; hw=WeirHeight ; VARIABLES #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Tray Initialization For the Whole Column Section #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ INITIALIZATION as InitializeSection (Brief = "Column Model Initialization"); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Feed - Side Stream Flow and Murphree Efficiency #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in FeedTray as stream (Brief="Feed stream", PosX=0, PosY=0.55); VapourDrawOffFlow as flow_mol (Brief = "Stream Molar Flow Rate"); LiquidDrawOffFlow as flow_mol (Brief = "Stream Molar Flow Rate"); MurphreeEff as Real (Brief = "Murphree efficiency"); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Vapour and Liquid Draw Sides #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out VapourDrawOff as vapour_stream (Brief="Vapour Outlet in the section", PosX=1, PosY=0.395,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.44,Protected = true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Heat Ports #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in HeatToReboiler as power (Brief="Heat supplied to Reboiler", PosX=1, PosY=0.89); in HeatToCondenser as power (Brief="Heat supplied to Condenser", PosX=1, PosY=0.07); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Devices #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ TRAYS(NumberOfTrays) as trayReac; CONDENSER as condenserReact; REBOILER as reboilerReact; SPLITTER as splitter2; PUMP as pump; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Outlets #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out VapourDistillate as vapour_stream (Brief="Vapour outlet stream From Condenser", PosX=0.59, PosY=0); out LiquidDistillate as liquid_stream (Brief="Liquid outlet stream From Splitter", PosX=1, PosY=0.23); out BottomProduct as liquid_stream (Brief="Liquid outlet stream From Reboiler", PosX=0.67, PosY=1); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Connectors #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in ConnectorCondenserVout as stream (Brief="Connector for Vapour outlet stream From Top Condenser", Hidden=true); in ConnectorSplitterOut as stream (Brief="Connector for Liquid outlet stream From Top Splitter", Hidden=true); in ConnectorReboilerLout as stream (Brief="Connector for Liquid outlet stream From Reboiler", Hidden=true); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Control Ports #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out TRI as control_signal (Brief="Temperature of Reboiler Indicator", PosX=1, PosY=0.83); out LRI as control_signal (Brief="Level of Reboiler Indicator", PosX=1, PosY=0.855); out TCI as control_signal (Brief="Temperature of Condenser Indicator", PosX=1, PosY=0.01); out LCI as control_signal (Brief="Level of Condenser Indicator", PosX=1, PosY=0.04); CONNECTIONS #vapor REBOILER.OutletVapour to TRAYS(NumberOfTrays).InletVapour; TRAYS(1).OutletVapour to CONDENSER.InletVapour; TRAYS([2:NumberOfTrays]).OutletVapour to TRAYS([1:NumberOfTrays-1]).InletVapour; #liquid CONDENSER.OutletLiquid to SPLITTER.Inlet; SPLITTER.Outlet2 to PUMP.Inlet; PUMP.Outlet to TRAYS(1).InletLiquid; TRAYS([1:NumberOfTrays-1]).OutletLiquid to TRAYS([2:NumberOfTrays]).InletLiquid; TRAYS(NumberOfTrays).OutletLiquid to REBOILER.InletLiquid; #Connectors CONDENSER.OutletVapour to ConnectorCondenserVout; SPLITTER.Outlet1 to ConnectorSplitterOut; REBOILER.OutletLiquid to ConnectorReboilerLout; INITIAL #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Tray Initialization #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ for i in 1:NumberOfTrays do "The initial temperature of the TRAYS" TRAYS(i).OutletLiquid.T = INITIALIZATION.TopTemperature+(INITIALIZATION.BottomTemperature-INITIALIZATION.TopTemperature)*((i-1)/(NumberOfTrays-1)); "The initial Level of the TRAYS" TRAYS(i).Level = INITIALIZATION.LevelFraction*hw; end for i in 1:NComp-1 do for j in 1:NumberOfTrays do "The initial composition of the TRAYS - Normalized" TRAYS(j).OutletLiquid.z(i) = INITIALIZATION.TopComposition(i)/sum(INITIALIZATION.TopComposition) +(INITIALIZATION.BottomComposition(i)/sum(INITIALIZATION.BottomComposition)-INITIALIZATION.TopComposition(i)/sum(INITIALIZATION.TopComposition) )*((j-1)/(NumberOfTrays-1)); end end EQUATIONS for i in [1:NumberOfTrays] do "Murphree Efficiency" TRAYS(i).OutletVapour.z = MurphreeEff * (TRAYS(i).yideal - TRAYS(i).InletVapour.z) + TRAYS(i).InletVapour.z; "Energy Holdup" TRAYS(i).E = TRAYS(i).ML*TRAYS(i).OutletLiquid.h + TRAYS(i).MV*TRAYS(i).OutletVapour.h - TRAYS(i).OutletLiquid.P*V; "Component Molar Balance" diff(TRAYS(i).M)=TRAYS(i).Inlet.F*TRAYS(i).Inlet.z + TRAYS(i).InletLiquid.F*TRAYS(i).InletLiquid.z + TRAYS(i).InletVapour.F*TRAYS(i).InletVapour.z- TRAYS(i).OutletLiquid.F*TRAYS(i).OutletLiquid.z - TRAYS(i).OutletVapour.F*TRAYS(i).OutletVapour.z- TRAYS(i).LiquidSideStream.F*TRAYS(i).LiquidSideStream.z-TRAYS(i).VapourSideStream.F*TRAYS(i).VapourSideStream.z + stoic*TRAYS(i).r3*TRAYS(i).ML*TRAYS(i).vL; "Energy Balance" diff(TRAYS(i).E) = ( TRAYS(i).Inlet.F*TRAYS(i).Inlet.h + TRAYS(i).InletLiquid.F*TRAYS(i).InletLiquid.h + TRAYS(i).InletVapour.F*TRAYS(i).InletVapour.h- TRAYS(i).OutletLiquid.F*TRAYS(i).OutletLiquid.h - TRAYS(i).OutletVapour.F*TRAYS(i).OutletVapour.h -TRAYS(i).VapourSideStream.F*TRAYS(i).VapourSideStream.h - TRAYS(i).LiquidSideStream.F*TRAYS(i).LiquidSideStream.h + Q ) + Hr * TRAYS(i).r3 *TRAYS(i). vL*TRAYS(i).ML; "Level of clear liquid over the weir" TRAYS(i).Level = TRAYS(i).ML*TRAYS(i).vL/Ap; "Geometry Constraint" V = TRAYS(i).ML* TRAYS(i).vL + TRAYS(i).MV*TRAYS(i).vV; end switch VapourFlow case "on": "Pressure Drop through the condenser" CONDENSER.InletVapour.F*TRAYS(1).vV / 'm^2' = sqrt((TRAYS(1).OutletVapour.P - CONDENSER.OutletLiquid.P + 1e-8 * 'atm')/(TRAYS(1).rhoV*alfacond)); when TRAYS(1).OutletVapour.P < CONDENSER.OutletLiquid.P switchto "off"; case "off": "Prato selado" CONDENSER.InletVapour.F = 0.0 * 'mol/s'; when TRAYS(1).OutletVapour.P > CONDENSER.OutletLiquid.P + 1e-3 * 'atm' switchto "on"; end for i in [1:NumberOfTrays] do switch TrayLiquidFlow case "on": "Francis Equation" TRAYS(i).OutletLiquid.F*TRAYS(i).vL = 1.84*'1/s'*lw*((TRAYS(i).Level-(beta*hw)+1e-6*'m')/(beta))^2; when TRAYS(i).Level < (beta * hw) switchto "off"; case "off": "Low level" TRAYS(i).OutletLiquid.F = 0 * 'mol/h'; when TRAYS(i).Level > (beta * hw) + 1e-6*'m' switchto "on"; end switch TrayVapourFlow case "on": TRAYS(i).InletVapour.F*TRAYS(i).vV = sqrt((TRAYS(i).InletVapour.P - TRAYS(i).OutletVapour.P - TRAYS(i).Level*g*TRAYS(i).rhoL + 1e-8 * 'atm')/(TRAYS(i).rhoV*alfa))*Ah; when TRAYS(i).InletVapour.P < TRAYS(i).OutletVapour.P + TRAYS(i).Level*g*TRAYS(i).rhoL switchto "off"; case "off": TRAYS(i).InletVapour.F = 0 * 'mol/s'; when TRAYS(i).InletVapour.P > TRAYS(i).OutletVapour.P + TRAYS(i).Level*g*TRAYS(i).rhoL + 3e-2 * 'atm' switchto "on"; end end # Connecting Trays FeedTray.F*FeedTrayIndex= TRAYS.Inlet.F; FeedTray.T = TRAYS.Inlet.T; FeedTray.P = TRAYS.Inlet.P; FeedTray.z = TRAYS.Inlet.z; FeedTray.v = TRAYS.Inlet.v; FeedTray.h = TRAYS.Inlet.h; HeatToReboiler = REBOILER.InletQ; HeatToCondenser = CONDENSER.InletQ; "Reboiler Temperature indicator" TRI * 'K' = REBOILER.OutletLiquid.T; "Reboiler Level indicator" LRI*REBOILER.V = REBOILER.Level*REBOILER.Across; "Condenser Temperature indicator" TCI * 'K' = CONDENSER.OutletLiquid.T; "Condenser Level indicator" LCI*CONDENSER.V = CONDENSER.Level*CONDENSER.Across; # Condenser Connector Equations ConnectorCondenserVout.T = VapourDistillate.T; ConnectorCondenserVout.P = VapourDistillate.P; ConnectorCondenserVout.F = VapourDistillate.F; ConnectorCondenserVout.z = VapourDistillate.z; # Splitter Connector Equations ConnectorSplitterOut.T = LiquidDistillate.T; ConnectorSplitterOut.P = LiquidDistillate.P; ConnectorSplitterOut.F = LiquidDistillate.F; ConnectorSplitterOut.z = LiquidDistillate.z; # Reboiler Connector Equations ConnectorReboilerLout.T = BottomProduct.T; ConnectorReboilerLout.P = BottomProduct.P; ConnectorReboilerLout.F = BottomProduct.F; ConnectorReboilerLout.z = BottomProduct.z; VapourDrawOff.F*VapSideTrayIndex= TRAYS.VapourSideStream.F; VapourDrawOff.T = TRAYS(VapourSideStreamLocation).VapourSideStream.T; VapourDrawOff.P = TRAYS(VapourSideStreamLocation).VapourSideStream.P; VapourDrawOff.z = TRAYS(VapourSideStreamLocation).VapourSideStream.z; LiquidDrawOff.F*LiqSideTrayIndex= TRAYS.LiquidSideStream.F; LiquidDrawOff.T = TRAYS(LiquidSideStreamLocation).LiquidSideStream.T; LiquidDrawOff.P = TRAYS(LiquidSideStreamLocation).LiquidSideStream.P; LiquidDrawOff.z = TRAYS(LiquidSideStreamLocation).LiquidSideStream.z; VapourDrawOffFlow = VapourDrawOff.F; LiquidDrawOffFlow = LiquidDrawOff.F; end Model Packed_Section_ColumnBasic ATTRIBUTES Pallete = false; Icon = "icon/PackedSectionColumn"; Brief = "Model of a packed column section."; Info = "== Model of a packed column section containing == * NStages theoretical stages. == Specify == * the feed stream of each tray (Inlet); * the InletLiquid stream of the top tray; * the InletVapour stream of the bottom tray; * the total pressure drop (dP) of the section. == Initial Conditions == * the stages temperature (OutletLiquid.T); * the stages liquid holdup; * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray. "; PARAMETERS outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); outer NComp as Integer; NumberOfStages as Integer (Brief="Number of Stages", Default=3); FeedStageIndex(NumberOfStages) as Integer (Brief="Number of Stages", Default=0,Hidden=true); FeedStageLocation as Integer (Brief="Feed Stage Location", Default=2); PackingHeight as length (Brief="Height of packing"); HeatSupply as heat_rate (Brief="Rate of heat supply"); ColumnDiameter as length (Brief="Column diameter"); VoidFraction as Real (Brief="Void fraction of packing, m^3/m^3"); ResistanceCoeff as positive (Brief="Resistance coefficient on the liquid load", Default=1); AreaPerPackingVol as Real (Brief="surface area per packing volume", Unit='m^2/m^3'); V as volume (Brief="Total Volume of the tray",Hidden=true); g as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true); hs as length (Brief="Height of the packing stage",Hidden=true); ColumnArea as area (Brief="Column Sectional Cross Area",Hidden=true); VARIABLES #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Stages Initialization For the Whole Column Section #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ INITIALIZATION as InitializeStage (Brief = "Column Model Initialization"); in FeedStage as stream (Brief="Feed stream", PosX=0, PosY=0.55); STAGES(NumberOfStages) as packedStage; PressureDrop as pressure; SET FeedStageIndex(FeedStageLocation) =1; ColumnArea = ColumnDiameter^2*3.14159*0.25; hs =PackingHeight/NumberOfStages; V = hs * ColumnArea; CONNECTIONS STAGES([2:NumberOfStages]).OutletVapour to STAGES([1:NumberOfStages-1]).InletVapour; STAGES([1:NumberOfStages-1]).OutletLiquid to STAGES([2:NumberOfStages]).InletLiquid; EQUATIONS # Connecting STAGES FeedStage.F*FeedStageIndex= STAGES.Inlet.F; FeedStage.T = STAGES.Inlet.T; FeedStage.P = STAGES.Inlet.P; FeedStage.z = STAGES.Inlet.z; FeedStage.v = STAGES.Inlet.v; FeedStage.h = STAGES.Inlet.h; STAGES.deltaP = PressureDrop/NumberOfStages; for i in [1:NumberOfStages] do "Energy Balance" diff(STAGES(i).E) = ( STAGES(i).Inlet.F*STAGES(i).Inlet.h + STAGES(i).InletLiquid.F*STAGES(i).InletLiquid.h + STAGES(i).InletVapour.F*STAGES(i).InletVapour.h- STAGES(i).OutletLiquid.F*STAGES(i).OutletLiquid.h - STAGES(i).OutletVapour.F*STAGES(i).OutletVapour.h + HeatSupply ); "Energy Holdup" STAGES(i).E = STAGES(i).ML*STAGES(i).OutletLiquid.h + STAGES(i).MV*STAGES(i).OutletVapour.h - STAGES(i).OutletLiquid.P*V; "Geometry Constraint" V*VoidFraction= STAGES(i).ML*STAGES(i).vL + STAGES(i).MV*STAGES(i).vV; "Volume flow rate of vapor, m^3/m^2/s" STAGES(i).uV * ((ColumnArea)*VoidFraction - STAGES(i).Al) = STAGES(i).OutletVapour.F * STAGES(i).vV; "Liquid holdup" STAGES(i).hl = STAGES(i).ML*STAGES(i).vL/V/VoidFraction; "Particle diameter" STAGES(i).dp = 6 * (1-VoidFraction)/AreaPerPackingVol; "Wall Factor" STAGES(i).invK = (1 + (2*STAGES(i).dp/(3*ColumnDiameter*(1-VoidFraction)))); "Reynolds number of the vapor stream" STAGES(i).Rev*STAGES(i).invK = STAGES(i).dp*STAGES(i).uV*STAGES(i).rhoV / (STAGES(i).miV*(1-VoidFraction)); "Pressure drop and Vapor flow" STAGES(i).deltaP/hs = ResistanceCoeff*AreaPerPackingVol*STAGES(i).uV^2*STAGES(i).rhoV*STAGES(i).invK / (2*(VoidFraction-STAGES(i).hl)^3); "Liquid holdup" STAGES(i).hl = (12*STAGES(i).miL*AreaPerPackingVol^2*STAGES(i).uL/STAGES(i).rhoL/g)^1/3; "Area occupied by the liquid" STAGES(i).Al = STAGES(i).ML*STAGES(i).vL/hs; end INITIAL for i in 1:NumberOfStages do "The initial temperature of the STAGES" STAGES(i).OutletLiquid.T = INITIALIZATION.TopStageTemperature+(INITIALIZATION.BottomStageTemperature-INITIALIZATION.TopStageTemperature)*((i-1)/(NumberOfStages-1)); "The Liquid Holdup of the STAGES" STAGES(i).ML = INITIALIZATION.LiquidMolarHoldup; end for i in 1:NComp-1 do for j in 1:NumberOfStages do "The initial composition of the TRAYS" STAGES(j).OutletLiquid.z(i) = INITIALIZATION.TopStageComposition(i)/sum(INITIALIZATION.TopStageComposition) +(INITIALIZATION.BottomStageComposition(i)/sum(INITIALIZATION.BottomStageComposition)-INITIALIZATION.TopStageComposition(i)/sum(INITIALIZATION.TopStageComposition) )*((j-1)/(NumberOfStages-1)); end end end Model Packed_Section_Column as Packed_Section_ColumnBasic ATTRIBUTES Pallete = true; Icon = "icon/PackedSectionColumn"; Brief = "Model of a packed column section."; Info = "== Model of a packed column section containing == * NStages theoretical stages. == Specify == * the feed stream of each tray (Inlet); * the InletLiquid stream of the top tray; * the InletVapour stream of the bottom tray; * the total pressure drop (dP) of the section. == Initial Conditions == * the stages temperature (OutletLiquid.T); * the stages liquid holdup; * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray. "; VARIABLES in LiquidInlet as stream (Brief="Liquid Inlet in the section", PosX=0.70, PosY=0); out VapourOutlet as vapour_stream (Brief="Vapour Outlet in the section", PosX=0.30, PosY=0); in VapourInlet as stream (Brief="Vapour Inlet in the section", PosX=0.30, PosY=1); out LiquidOutlet as liquid_stream (Brief="Liquid Outlet in the section", PosX=0.70, PosY=1); LiquidConnector as stream (Brief="Liquid connection at the middle STAGES", PosX=0.75, PosY=1,Hidden=true); VapourConnector as stream (Brief="Vapour connection at the middle STAGES", PosX=0.55, PosY=0,Hidden=true); CONNECTIONS LiquidConnector to STAGES(1).InletLiquid; VapourConnector to STAGES(NumberOfStages).InletVapour; EQUATIONS LiquidConnector.F= LiquidInlet.F; LiquidConnector.T = LiquidInlet.T; LiquidConnector.P = LiquidInlet.P; LiquidConnector.z = LiquidInlet.z; LiquidConnector.v = LiquidInlet.v; LiquidConnector.h = LiquidInlet.h; VapourConnector.F= VapourInlet.F; VapourConnector.T = VapourInlet.T; VapourConnector.P = VapourInlet.P; VapourConnector.z = VapourInlet.z; VapourConnector.v = VapourInlet.v; VapourConnector.h = VapourInlet.h; LiquidOutlet.F= STAGES(NumberOfStages).OutletLiquid.F; LiquidOutlet.T = STAGES(NumberOfStages).OutletLiquid.T; LiquidOutlet.P = STAGES(NumberOfStages).OutletLiquid.P; LiquidOutlet.z = STAGES(NumberOfStages).OutletLiquid.z; VapourOutlet.F= STAGES(1).OutletVapour.F; VapourOutlet.T = STAGES(1).OutletVapour.T; VapourOutlet.P = STAGES(1).OutletVapour.P; VapourOutlet.z = STAGES(1).OutletVapour.z; end Model PackedDistillation_kettle_cond as Packed_Section_ColumnBasic ATTRIBUTES Pallete = true; Icon = "icon/PackedDistillationKettleCond"; Brief = "Model of a distillation column with dynamic condenser and dynamic reboiler."; Info = "== Specify == * the feed stream of each tray (Inlet); * the pump pressure difference; * the total pressure drop (dP) of the packing; * the heat supllied in reboiler and condenser; * the condenser vapor outlet flow (OutletVapour.F); * the reboiler liquid outlet flow (OutletLiquid.F); * both splitter outlet flows OR one of the splitter outlet flows and the splitter frac. == Initial Conditions == * the stages temperature (OutletLiquid.T); * the stages initial molar holdup; * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each stage; * the condenser temperature (OutletLiquid.T); * the condenser liquid level (Level); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions; * the reboiler temperature (OutletLiquid.T); * the reboiler liquid level (Level); * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions. "; PARAMETERS VapourFlow as Switcher (Valid = ["on", "off"], Hidden = true ,Default = "on"); VARIABLES #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Devices #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ CONDENSER as condenser (Brief="dymamic condenser"); REBOILER as reboiler (Brief="kettle reboiler"); SPLITTER as splitter2 (Brief="splitter which separate reflux and distillate"); PUMP as pump (Brief="pump in reflux stream"); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Heat Ports #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in HeatToReboiler as power (Brief="Heat supplied to Reboiler",Protected = true, PosX=1, PosY=0.885); in HeatToCondenser as power (Brief="Heat supplied to Condenser", Protected = true, PosX=1, PosY=0.034); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Products #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ out VapourDistillate as vapour_stream (Brief="Vapour outlet stream From Top Condenser", PosX=0.66, PosY=0); out LiquidDistillate as liquid_stream (Brief="Liquid outlet stream From Top Splitter", PosX=1, PosY=0.20); out BottomProduct as liquid_stream (Brief="Liquid outlet stream From Reboiler", PosX=0.68, PosY=1); #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Column Connectors #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ in ConnectorCondenserVout as stream (Brief="Connector for Vapour outlet stream From Top Condenser", Hidden=true); in ConnectorSplitterOut as stream (Brief="Connector for Liquid outlet stream From Top Splitter", Hidden=true); in ConnectorReboilerLout as stream (Brief="Connector for Liquid outlet stream From Reboiler", Hidden=true); ConnectorHeatReboiler as power (Brief="Heat supplied to Reboiler", Hidden=true); ConnectorHeatCondenser as power (Brief="Heat supplied to Condenser", Hidden=true); CONNECTIONS #vapor REBOILER.OutletVapour to STAGES(NumberOfStages).InletVapour; STAGES(1).OutletVapour to CONDENSER.InletVapour; #liquid CONDENSER.OutletLiquid to SPLITTER.Inlet; SPLITTER.Outlet2 to PUMP.Inlet; PUMP.Outlet to STAGES(1).InletLiquid; STAGES(NumberOfStages).OutletLiquid to REBOILER.InletLiquid; #Connectors ConnectorHeatReboiler to REBOILER.InletQ; ConnectorHeatCondenser to CONDENSER.InletQ; CONDENSER.OutletVapour to ConnectorCondenserVout; SPLITTER.Outlet1 to ConnectorSplitterOut; REBOILER.OutletLiquid to ConnectorReboilerLout; EQUATIONS HeatToReboiler = ConnectorHeatReboiler; HeatToCondenser = ConnectorHeatCondenser; # Condenser Connector Equations ConnectorCondenserVout.T = VapourDistillate.T; ConnectorCondenserVout.P = VapourDistillate.P; ConnectorCondenserVout.F = VapourDistillate.F; ConnectorCondenserVout.z = VapourDistillate.z; # Splitter Connector Equations ConnectorSplitterOut.T = LiquidDistillate.T; ConnectorSplitterOut.P = LiquidDistillate.P; ConnectorSplitterOut.F = LiquidDistillate.F; ConnectorSplitterOut.z = LiquidDistillate.z; # Reboiler Connector Equations ConnectorReboilerLout.T = BottomProduct.T; ConnectorReboilerLout.P = BottomProduct.P; ConnectorReboilerLout.F = BottomProduct.F; ConnectorReboilerLout.z = BottomProduct.z; switch VapourFlow case "on": STAGES(NumberOfStages).InletVapour.F*STAGES(NumberOfStages).vV = sqrt((REBOILER.OutletVapour.P - STAGES(NumberOfStages).OutletVapour.P)/ (STAGES(NumberOfStages).rhoV*ResistanceCoeff*20))*(ColumnArea*VoidFraction - STAGES(NumberOfStages).Al); when STAGES(NumberOfStages).InletVapour.F < 1e-6 * 'kmol/h' switchto "off"; case "off": STAGES(NumberOfStages).InletVapour.F = 0 * 'mol/s'; when REBOILER.OutletVapour.P > STAGES(NumberOfStages).OutletVapour.P + 1e-1 * 'atm' switchto "on"; end end