#*------------------------------------------------------------------- * 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 of a column section with: * - NumberOfTrays = number of trays. * *---------------------------------------------------------------------*# Model Section_ColumnBasic ATTRIBUTES Pallete = false; 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 InletL stream of the top tray; * the InletV stream of the bottom tray. == Initial Conditions == * the trays temperature (OutletL.T); * the trays liquid level (Level) OR the trays liquid flow (OutletL.F); * (NoComps - 1) OutletL (OR OutletV) compositions for each tray. "; PARAMETERS outer PP as Plugin (Brief="External Physical Properties", Type="PP"); outer NComp as Integer (Brief="Number of components"); NumberOfTrays as Integer (Brief="Number of trays", Default=8); FeedTrayIndex(NumberOfTrays) as Integer (Brief="Number of trays", Default=0,Hidden=true); LiqSideTrayIndex(NumberOfTrays) as Integer (Brief="Number of trays", Default=0,Hidden=true); VapSideTrayIndex(NumberOfTrays) as Integer (Brief="Number of trays", 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); 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"); 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); TopTemperature as temperature; TbottomTemperature as temperature; LevelFraction as fraction (Brief = "Level Fraction"); TopComposition(NComp) as fraction (Brief = "Component Molar Fraction at Top"); BottomComposition(NComp) as fraction (Brief = "Component Molar Fraction at Bottom"); 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 in FeedTray as stream (Brief="Feed stream", PosX=0, PosY=0.55); TRAYS(NumberOfTrays) as tray (Brief="Number of trays"); VapourDrawOffFlow as flow_mol (Brief = "Stream Molar Flow Rate"); LiquidDrawOffFlow as flow_mol (Brief = "Stream Molar Flow Rate"); MurphreeEff as Real (Brief = "Murphree efficiency"); CONNECTIONS TRAYS([2:NumberOfTrays]).OutletV to TRAYS([1:NumberOfTrays-1]).InletV; TRAYS([1:NumberOfTrays-1]).OutletL to TRAYS([2:NumberOfTrays]).InletL; EQUATIONS # 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; for i in [1:NumberOfTrays] do "Murphree Efficiency" TRAYS(i).OutletV.z = MurphreeEff * (TRAYS(i).yideal - TRAYS(i).InletV.z) + TRAYS(i).InletV.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).OutletL.h + TRAYS(i).MV*TRAYS(i).OutletV.h - TRAYS(i).OutletL.P*V; "Energy Balance" diff(TRAYS(i).E) = ( TRAYS(i).Inlet.F*TRAYS(i).Inlet.h + TRAYS(i).InletL.F*TRAYS(i).InletL.h + TRAYS(i).InletV.F*TRAYS(i).InletV.h- TRAYS(i).OutletL.F*TRAYS(i).OutletL.h - TRAYS(i).OutletV.F*TRAYS(i).OutletV.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).OutletL.F*TRAYS(i).vL = 1.84*'1/s'*lw*((TRAYS(i).Level-(beta*hw))/(beta))^2; case "Wang_Fl": TRAYS(i).OutletL.F*TRAYS(i).vL = 1.84*'m^0.5/s'*lw*((TRAYS(i).Level-(beta*hw))/(beta))^1.5; case "Olsen": TRAYS(i).OutletL.F / 'mol/s'= lw*Np*TRAYS(i).rhoL/sum(Mw*TRAYS(i).OutletV.z)/(0.665*fw)^1.5 * ((TRAYS(i).ML*sum(Mw*TRAYS(i).OutletL.z)/TRAYS(i).rhoL/Ap)-hw)^1.5 * 'm^0.5/mol'; case "Feehery_Fl": TRAYS(i).OutletL.F = lw*TRAYS(i).rhoL/sum(Mw*TRAYS(i).OutletL.z) * ((TRAYS(i).Level-hw)/750/'mm')^1.5 * 'm^2/s'; case "Roffel_Fl": TRAYS(i).OutletL.F = 2/3*sqrt(2*g)*TRAYS(i).rhoL/sum(Mw*TRAYS(i).OutletL.z)*lw*(2*TRAYS(i).btemp-1)*(TRAYS(i).ML*sum(Mw*TRAYS(i).OutletL.z)/(Ap*1.3)/TRAYS(i).rhoL/(2*TRAYS(i).btemp-1))^1.5; end when TRAYS(i).Level < (beta *hw) switchto "off"; case "off": "Low level" TRAYS(i).OutletL.F = 0 * 'mol/h'; when TRAYS(i).Level > (beta * hw) + 1e-6*'m' switchto "on"; end TRAYS(i).btemp = 1 - 0.3593/'Pa^0.0888545'*abs(TRAYS(i).OutletV.F*sum(Mw*TRAYS(i).OutletV.z)/(Ap*1.3)/sqrt(TRAYS(i).rhoV))^0.177709; #/'(kg/m)^0.0888545/s^0.177709'; switch VapourFlow case "on": switch VapourFlowModel case "Reepmeyer": TRAYS(i).InletV.F*TRAYS(i).vV = sqrt((TRAYS(i).InletV.P - TRAYS(i).OutletV.P)/(TRAYS(i).rhoV*alfa))*Ah; case "Feehery_Fv": TRAYS(i).InletV.F = TRAYS(i).rhoV/Ap/w/sum(Mw*TRAYS(i).OutletV.z) * sqrt(((TRAYS(i).InletV.P - TRAYS(i).OutletV.P)-(TRAYS(i).rhoV*g*TRAYS(i).ML*TRAYS(i).vL/Ap))/TRAYS(i).rhoV); case "Roffel_Fv": TRAYS(i).InletV.F^1.08 * 0.0013 * 'kg/m/mol^1.08/s^0.92*1e5' = (TRAYS(i).InletV.P - TRAYS(i).OutletV.P)*1e5 - (beta*sum(TRAYS(i).M*Mw)/(Ap*1.3)*g*1e5) * (TRAYS(i).rhoV*Ah/sum(Mw*TRAYS(i).OutletV.z))^1.08 * 'm^1.08/mol^1.08'; case "Klingberg": TRAYS(i).InletV.F * TRAYS(i).vV = Ap * sqrt(((TRAYS(i).InletV.P - TRAYS(i).OutletV.P)-TRAYS(i).rhoL*g*TRAYS(i).Level)/TRAYS(i).rhoV); case "Wang_Fv": TRAYS(i).InletV.F * TRAYS(i).vV = Ap * sqrt(((TRAYS(i).InletV.P - TRAYS(i).OutletV.P)-TRAYS(i).rhoL*g*TRAYS(i).Level)/TRAYS(i).rhoV*alfa); case "Elgue": TRAYS(i).InletV.F = sqrt((TRAYS(i).InletV.P - TRAYS(i).OutletV.P)/btray); end when TRAYS(i).InletV.F < 1e-6 * 'kmol/h' switchto "off"; case "off": TRAYS(i).InletV.F = 0 * 'mol/s'; when TRAYS(i).InletV.P > TRAYS(i).OutletV.P + TRAYS(i).Level*g*TRAYS(i).rhoL + 1e-1 * 'atm' switchto "on"; end end INITIAL for i in 1:NumberOfTrays do "The initial temperature of the TRAYS" TRAYS(i).OutletL.T = TopTemperature+(TbottomTemperature-TopTemperature)*((i-1)/(NumberOfTrays-1)); "The initial Level of the TRAYS" TRAYS(i).Level = LevelFraction*hw; end for i in 1:NComp-1 do for j in 1:NumberOfTrays do "The initial composition of the TRAYS" TRAYS(j).OutletL.z(i) = TopComposition(i) +(BottomComposition(i)-TopComposition(i) )*((j-1)/(NumberOfTrays-1)); end end end Model Section_Column as Section_ColumnBasic 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 InletL stream of the top tray; * the InletV stream of the bottom tray. == Initial Conditions == * the TRAYS temperature (OutletL.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletL.F); * (NoComps - 1) OutletL (OR OutletV) compositions for each tray. "; VARIABLES out VapourDrawOff as vapour_stream (Brief="Vapour Outlet in the section", PosX=1, PosY=0.35,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.65,Protected = true); 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 TRAYS", PosX=0.75, PosY=1,Hidden=true); VapourConnector as stream (Brief="Vapour connection at the middle TRAYS", PosX=0.55, PosY=0,Hidden=true); CONNECTIONS LiquidConnector to TRAYS(1).InletL; VapourConnector to TRAYS(NumberOfTrays).InletV; 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= TRAYS(NumberOfTrays).OutletL.F; LiquidOutlet.T = TRAYS(NumberOfTrays).OutletL.T; LiquidOutlet.P = TRAYS(NumberOfTrays).OutletL.P; LiquidOutlet.z = TRAYS(NumberOfTrays).OutletL.z; VapourOutlet.F= TRAYS(1).OutletV.F; VapourOutlet.T = TRAYS(1).OutletV.T; VapourOutlet.P = TRAYS(1).OutletV.P; VapourOutlet.z = TRAYS(1).OutletV.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 of a distillation column containing: * - NumberOfTrays like tray; * - a kettle reboiler; * - dynamic condenser; * - a splitter which separate reflux and distillate; * - a pump in reflux stream; *--------------------------------------------------------------------- *# 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 (OutletV.F); * the reboiler liquid outlet flow (OutletL.F); * both splitter outlet flows OR one of the splitter outlet flows and the splitter frac. == Initial Conditions == * the TRAYS temperature (OutletL.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletL.F); * (NoComps - 1) OutletL (OR OutletV) compositions for each tray; * the condenser temperature (OutletL.T); * the condenser liquid level (Level); * (NoComps - 1) OutletL (OR OutletV) compositions; * the reboiler temperature (OutletL.T); * the reboiler liquid level (Level); * (NoComps - 1) OutletL (OR OutletV) 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.46,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.58,Protected = true); CONDENSER as condenser; REBOILER as reboiler; SPLITTERtop as splitter; PUMP as pump; alfaTopo as Real; out HeatToReboiler as power (Brief="Heat supplied to Reboiler",Hidden=true); out HeatToCondenser as power (Brief="Heat supplied to Condenser",Hidden=true); RebNoFlow as sourceNoFlow (Brief="No Inlet Flow to Reboiler",Hidden=true); out VapourDistillate as vapour_stream (Brief="Vapour outlet stream From Top Condenser", PosX=0.67, PosY=0); in ConnectorCondenserVout as stream (Brief="Connector for Vapour outlet stream From Top Condenser", Hidden=true); out LiquidDistillate as liquid_stream (Brief="Liquid outlet stream From Top Splitter", PosX=1, PosY=0.33); in ConnectorSplitterOut as stream (Brief="Connector for Liquid outlet stream From Top Splitter", Hidden=true); out BottomProduct as liquid_stream (Brief="Liquid outlet stream From Reboiler", PosX=1, PosY=0.99); in ConnectorReboilerLout as stream (Brief="Connector for Liquid outlet stream From Reboiler", Hidden=true); EQUATIONS switch CondenserVapourFlow case "on": CONDENSER.InletV.F*TRAYS(1).vV = alfaTopo *Ah * sqrt(2*(TRAYS(1).OutletV.P - CONDENSER.OutletL.P + 1e-8 * 'atm') / (alfa*TRAYS(1).rhoV)); when CONDENSER.InletV.F < 1e-6 * 'kmol/h' switchto "off"; case "off": CONDENSER.InletV.F = 0 * 'mol/s'; when TRAYS(1).OutletV.P > CONDENSER.OutletL.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; CONNECTIONS #vapor REBOILER.OutletV to TRAYS(NumberOfTrays).InletV; TRAYS(1).OutletV to CONDENSER.InletV; #liquid CONDENSER.OutletL to SPLITTERtop.Inlet; SPLITTERtop.Outlet2 to PUMP.Inlet; PUMP.Outlet to TRAYS(1).InletL; TRAYS(NumberOfTrays).OutletL to REBOILER.InletL; #Connectors HeatToReboiler to REBOILER.InletQ; HeatToCondenser to CONDENSER.InletQ; RebNoFlow.Outlet to REBOILER.Inlet; CONDENSER.OutletV to ConnectorCondenserVout; SPLITTERtop.Outlet1 to ConnectorSplitterOut; REBOILER.OutletL to ConnectorReboilerLout; end #* ------------------------------------------------------------------- * Distillation Column model with: * * - NumberOfTrays like tray; * - a vessel in the bottom of column; * - a splitter who separate the bottom product and the stream to reboiler; * - steady state reboiler (thermosyphon); * - a steady state condenser with subcooling; * - a vessel drum (layed cilinder); * - a splitter which separate reflux and distillate; * - a pump in reflux stream. * * ------------------------------------------------------------------*# 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 (OutletL.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletL.F); * (NoComps - 1) OutletL (OR OutletV) compositions for each tray; * the top tank temperature (OutletL.T); * the top tank liquid level (Level); * (NoComps - 1) OutletL (OR OutletV) compositions; * the bottom tank temperature (OutletL.T); * the bottom tank liquid level (Level); * (NoComps - 1) OutletL (OR OutletV) compositions. "; PARAMETERS CondenserVapourFlow as Switcher(Valid = ["on", "off"], Hidden=true, Default = "on"); VARIABLES 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.515,Protected = true); CONDENSER as condenserSteady; TANKtop as tank_cylindrical; SPLITTERtop as splitter; PUMP as pump; REBOILER as reboilerSteady; TANKbottom as tank; SPLITTERbottom as splitter; alfaTopo as Real; out HeatToCondenser as power (Brief="Heat supplied to Condenser",Hidden=true); out HeatToReboiler as power (Brief="Heat supplied to Reboiler",Hidden=true); out HeatToBottomVessel as power (Brief="Heat supplied to Bottom Vessel",Hidden=true); out HeatToTopVessel as power (Brief="Heat supplied to Top Vessel",Hidden=true); out LiquidDistillate as liquid_stream (Brief="Liquid outlet stream From Top Splitter", PosX=1, PosY=0.30); in ConnectorSplitterTop as stream (Brief="Connector for Liquid outlet stream From Top Splitter", Hidden=true); out BottomProduct as liquid_stream (Brief="Liquid outlet stream From Bottom Splitter", PosX=1, PosY=0.99); in ConnectorSplitterBottom as stream (Brief="Connector for Liquid outlet stream From Reboiler", Hidden=true); EQUATIONS # 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.InletV.F*TRAYS(1).vV = alfaTopo * Ah * sqrt(2*(TRAYS(1).OutletV.P - CONDENSER.OutletL.P + 1e-8 * 'atm') / (alfa*TRAYS(1).rhoV)); when CONDENSER.InletV.F < 1e-6 * 'kmol/h' switchto "off"; case "off": CONDENSER.InletV.F = 0 * 'mol/s'; when TRAYS(1).OutletV.P > CONDENSER.OutletL.P + 1e-1 * 'atm' switchto "on"; end CONNECTIONS #vapor REBOILER.OutletV to TRAYS(NumberOfTrays).InletV; TRAYS(1).OutletV to CONDENSER.InletV; #liquid CONDENSER.OutletL to TANKtop.Inlet; TANKtop.Outlet to SPLITTERtop.Inlet; SPLITTERtop.Outlet2 to PUMP.Inlet; PUMP.Outlet to TRAYS(1).InletL; TRAYS(NumberOfTrays).OutletL to TANKbottom.Inlet; TANKbottom.Outlet to SPLITTERbottom.Inlet; SPLITTERbottom.Outlet2 to REBOILER.InletL; #Connectors HeatToCondenser to CONDENSER.InletQ; HeatToReboiler to REBOILER.InletQ; HeatToBottomVessel to TANKbottom.InletQ; HeatToTopVessel to TANKtop.InletQ; SPLITTERtop.Outlet1 to ConnectorSplitterTop; SPLITTERbottom.Outlet1 to ConnectorSplitterBottom; end #* ------------------------------------------------------------------- * Distillation Column model with: * * - NumberOfTrays like tray; * - a vessel in the bottom of column; * - a splitter who separate the bottom product and the stream to reboiler; * - steady state reboiler (thermosyphon); * - a dynamic condenser without subcooling; * - a splitter which separate reflux and distillate; * - a pump in reflux stream. * * ------------------------------------------------------------------*# 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 (OutletV.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 (OutletL.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletL.F); * (NoComps - 1) OutletL (OR OutletV) compositions for each tray; * the condenser temperature (OutletL.T); * the condenser liquid level (Level); * (NoComps - 1) OutletL (OR OutletV) compositions; * the bottom tank temperature (OutletL.T); * the bottom tank liquid level (Level); * (NoComps - 1) OutletL (OR OutletV) 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.41,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.515,Protected = true); CONDENSER as condenser; SPLITTERtop as splitter; PUMP as pump; TANKbottom as tank; SPLITTERbottom as splitter; REBOILER as reboilerSteady; alfaTopo as Real; out HeatToCondenser as power (Brief="Heat supplied to Condenser",Hidden=true); out HeatToReboiler as power (Brief="Heat supplied to Reboiler",Hidden=true); out HeatToBottomVessel as power (Brief="Heat supplied to Bottom Vessel",Hidden=true); out VapourDistillate as vapour_stream (Brief="Vapour outlet stream From Top Condenser", PosX=0.74, PosY=0); in ConnectorCondenserVout as stream (Brief="Connector for Vapour outlet stream From Top Condenser", Hidden=true); out LiquidDistillate as liquid_stream (Brief="Liquid outlet stream From Top Splitter", PosX=1, PosY=0.30); in ConnectorSplitterTop as stream (Brief="Connector for Liquid outlet stream From Top Splitter", Hidden=true); out BottomProduct as liquid_stream (Brief="Liquid outlet stream From Bottom Splitter", PosX=1, PosY=0.999); in ConnectorSplitterBottom as stream (Brief="Connector for Liquid outlet stream From Reboiler", Hidden=true); EQUATIONS # 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.InletV.F*TRAYS(1).vV = alfaTopo * Ah * sqrt(2*(TRAYS(1).OutletV.P - CONDENSER.OutletL.P + 1e-8 * 'atm') / (alfa*TRAYS(1).rhoV)); when CONDENSER.InletV.F < 1e-6 * 'kmol/h' switchto "off"; case "off": CONDENSER.InletV.F = 0 * 'mol/s'; when TRAYS(1).OutletV.P > CONDENSER.OutletL.P + 1e-1 * 'atm' switchto "on"; end CONNECTIONS #vapor REBOILER.OutletV to TRAYS(NumberOfTrays).InletV; TRAYS(1).OutletV to CONDENSER.InletV; #liquid CONDENSER.OutletL to SPLITTERtop.Inlet; SPLITTERtop.Outlet2 to PUMP.Inlet; PUMP.Outlet to TRAYS(1).InletL; TRAYS(NumberOfTrays).OutletL to TANKbottom.Inlet; TANKbottom.Outlet to SPLITTERbottom.Inlet; SPLITTERbottom.Outlet2 to REBOILER.InletL; #Connectors HeatToCondenser to CONDENSER.InletQ; HeatToReboiler to REBOILER.InletQ; HeatToBottomVessel to TANKbottom.InletQ; CONDENSER.OutletV to ConnectorCondenserVout; SPLITTERtop.Outlet1 to ConnectorSplitterTop; SPLITTERbottom.Outlet1 to ConnectorSplitterBottom; end #* ------------------------------------------------------------------- * Distillation Column model with: * * - NumberOfTrays like tray; * - a kettle reboiler; * - a steady state condenser with subcooling; * - a vessel drum (layed cilinder); * - a splitter which separate reflux and distillate; * - a pump in reflux stream. * * ------------------------------------------------------------------*# 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 (OutletL.F); * both splitter outlet flows OR one of the splitter outlet flows and the splitter frac. == Initial Conditions == * the TRAYS temperature (OutletL.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletL.F); * (NoComps - 1) OutletL (OR OutletV) compositions for each tray; * the top tank temperature (OutletL.T); * the top tank liquid level (Level); * (NoComps - 1) OutletL (OR OutletV) compositions; * the reboiler temperature (OutletL.T); * the reboiler liquid level (Level); * (NoComps - 1) OutletL (OR OutletV) 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.46,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.58,Protected = true); CONDENSER as condenserSteady; TANKtop as tank_cylindrical; SPLITTERtop as splitter; PUMP as pump; REBOILER as reboiler; alfaTopo as Real; out HeatToCondenser as power (Brief="Heat supplied to Condenser",Hidden=true); out HeatToReboiler as power (Brief="Heat supplied to Reboiler",Hidden=true); out HeatToTopVessel as power (Brief="Heat supplied to Top Vessel",Hidden=true); out LiquidDistillate as liquid_stream (Brief="Liquid outlet stream From Top Splitter", PosX=1, PosY=0.33); in ConnectorSplitterOut as stream (Brief="Connector for Liquid outlet stream From Top Splitter", Hidden=true); out BottomProduct as liquid_stream (Brief="Liquid outlet stream From Reboiler", PosX=1, PosY=1); in ConnectorReboilerLout as stream (Brief="Connector for Liquid outlet stream From Reboiler", Hidden=true); RebNoFlow as sourceNoFlow (Brief="No Inlet Flow to Reboiler",Hidden=true); EQUATIONS # 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.InletV.F*TRAYS(1).vV = alfaTopo * Ah * sqrt(2*(TRAYS(1).OutletV.P - CONDENSER.OutletL.P + 1e-8 * 'atm') / (alfa*TRAYS(1).rhoV)); when CONDENSER.InletV.F < 1e-6 * 'kmol/h' switchto "off"; case "off": CONDENSER.InletV.F = 0 * 'mol/s'; when TRAYS(1).OutletV.P > CONDENSER.OutletL.P + 1e-1 * 'atm' switchto "on"; end CONNECTIONS #vapor REBOILER.OutletV to TRAYS(NumberOfTrays).InletV; TRAYS(1).OutletV to CONDENSER.InletV; #liquid CONDENSER.OutletL to TANKtop.Inlet; TANKtop.Outlet to SPLITTERtop.Inlet; SPLITTERtop.Outlet2 to PUMP.Inlet; PUMP.Outlet to TRAYS(1).InletL; TRAYS(NumberOfTrays).OutletL to REBOILER.InletL; #Connectors HeatToCondenser to CONDENSER.InletQ; HeatToReboiler to REBOILER.InletQ; HeatToTopVessel to TANKtop.InletQ; RebNoFlow.Outlet to REBOILER.Inlet; SPLITTERtop.Outlet1 to ConnectorSplitterOut; REBOILER.OutletL to ConnectorReboilerLout; end #*---------------------------------------------------------------------- * Model of a rectifier containing: * - NumberOfTrays like tray; * - dymamic condenser without subcooling; * - a splitter which separate reflux and distillate; * - a pump in reflux stream; *---------------------------------------------------------------------*# 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 InletV stream of the bottom tray unless its flow; * the pump pressure difference; * the heat supllied in the condenser; * the condenser vapor outlet flow (OutletV.F); * both splitter outlet flows OR one of the splitter outlet flows and the splitter frac. == Initial Conditions == * the TRAYS temperature (OutletL.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletL.F); * (NoComps - 1) OutletL (OR OutletV) compositions for each tray; * the condenser temperature (OutletL.T); * the condenser liquid level (Level); * (NoComps - 1) OutletL (OR OutletV) 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.46,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.58,Protected = true); CONDENSER as condenser; SPLITTERtop as splitter; PUMP as pump; alfaTopo as Real; out VapourDistillate as vapour_stream (Brief="Vapour outlet stream From Top Condenser", PosX=0.67, PosY=0); in ConnectorCondenserVout as stream (Brief="Connector for Vapour outlet stream From Top Condenser", Hidden=true); 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.20, PosY=1); out LiquidDistillate as liquid_stream (Brief="Liquid outlet stream From Top Splitter", PosX=1, PosY=0.33); out HeatToCondenser as power (Brief="Heat supplied to Condenser",Hidden=true); in ConnectorSplitterOut 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); EQUATIONS switch CondenserVapourFlow case "on": CONDENSER.InletV.F*TRAYS(1).vV = alfaTopo * Ah * sqrt(2*(TRAYS(1).OutletV.P - CONDENSER.OutletL.P + 1e-8 * 'atm') / (alfa*TRAYS(1).rhoV)); when CONDENSER.InletV.F < 1e-6 * 'kmol/h' switchto "off"; case "off": CONDENSER.InletV.F = 0 * 'mol/s'; when TRAYS(1).OutletV.P > CONDENSER.OutletL.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; LiquidOutlet.F= TRAYS(NumberOfTrays).OutletL.F; LiquidOutlet.T = TRAYS(NumberOfTrays).OutletL.T; LiquidOutlet.P = TRAYS(NumberOfTrays).OutletL.P; LiquidOutlet.z = TRAYS(NumberOfTrays).OutletL.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).OutletV to CONDENSER.InletV; #liquid CONDENSER.OutletL to SPLITTERtop.Inlet; SPLITTERtop.Outlet2 to PUMP.Inlet; PUMP.Outlet to TRAYS(1).InletL; #Connectors HeatToCondenser to CONDENSER.InletQ; VapourConnector to TRAYS(NumberOfTrays).InletV; SPLITTERtop.Outlet1 to ConnectorSplitterOut; CONDENSER.OutletV to ConnectorCondenserVout; end #* ------------------------------------------------------------------- * Rectifier Column with: * * - NumberOfTrays like tray; * - a steady state condenser with subcooling; * - a vessel drum (layed cilinder); * - a splitter which separate reflux and distillate; * - a pump in reflux stream. * * ------------------------------------------------------------------*# 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 InletV 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 (OutletL.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletL.F); * (NoComps - 1) OutletL (OR OutletV) compositions for each tray; * the top tank temperature (OutletL.T); * the top tank liquid level (Level); * (NoComps - 1) OutletL (OR OutletV) compositions; "; PARAMETERS CondenserVapourFlow as Switcher (Valid = ["on", "off"], Default = "on",Hidden=true); VARIABLES CONDENSER as condenserSteady; TANKtop as tank_cylindrical; SPLITTERtop as splitter; PUMP as pump; alfaTopo as Real; in VapourInlet as stream (Brief="Vapour Inlet in the section", PosX=0.18, PosY=1); out LiquidOutlet as liquid_stream (Brief="Liquid Outlet in the section", PosX=0.25, PosY=1); out HeatToCondenser as power (Brief="Heat supplied to Condenser",Hidden=true); out LiquidDistillate as liquid_stream (Brief="Liquid outlet stream From Top Splitter", PosX=1, PosY=0.47); in ConnectorSplitterTop as stream (Brief="Connector for Liquid outlet stream From Top Splitter", Hidden=true); out HeatToTopVessel as power (Brief="Heat supplied to Top Vessel",Hidden=true); VapourConnector as stream (Brief="Vapour connection at the middle TRAYS", PosX=0.55, PosY=0,Hidden=true); EQUATIONS LiquidOutlet.F= TRAYS(NumberOfTrays).OutletL.F; LiquidOutlet.T = TRAYS(NumberOfTrays).OutletL.T; LiquidOutlet.P = TRAYS(NumberOfTrays).OutletL.P; LiquidOutlet.z = TRAYS(NumberOfTrays).OutletL.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; switch CondenserVapourFlow case "on": CONDENSER.InletV.F*TRAYS(1).vV = alfaTopo *Ah * sqrt(2*(TRAYS(1).OutletV.P - CONDENSER.OutletL.P + 1e-8 * 'atm') / (alfa*TRAYS(1).rhoV)); when CONDENSER.InletV.F < 1e-6 * 'kmol/h' switchto "off"; case "off": CONDENSER.InletV.F = 0 * 'mol/s'; when TRAYS(1).OutletV.P > CONDENSER.OutletL.P + 1e-1 * 'atm' switchto "on"; end CONNECTIONS #vapor TRAYS(1).OutletV to CONDENSER.InletV; #liquid CONDENSER.OutletL to TANKtop.Inlet; TANKtop.Outlet to SPLITTERtop.Inlet; SPLITTERtop.Outlet2 to PUMP.Inlet; PUMP.Outlet to TRAYS(1).InletL; #Connectors VapourConnector to TRAYS(NumberOfTrays).InletV; HeatToCondenser to CONDENSER.InletQ; SPLITTERtop.Outlet1 to ConnectorSplitterTop; HeatToTopVessel to TANKtop.InletQ; end #* ------------------------------------------------------------------- * Reboiled Stripping Column model with: * * - NumberOfTrays like tray; * - a kettle reboiler; * * ------------------------------------------------------------------*# 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 InletL stream of the top tray; * the heat supllied in the reboiler; * the reboiler liquid outlet flow (OutletL.F); == Initial Conditions == * the TRAYS temperature (OutletL.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletL.F); * (NoComps - 1) OutletL (OR OutletV) compositions for each tray; * the reboiler temperature (OutletL.T); * the reboiler liquid level (Level); * (NoComps - 1) OutletL (OR OutletV) compositions. "; VARIABLES out VapourDrawOff as vapour_stream (Brief="Vapour Outlet in the section", PosX=1, PosY=0.34,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.49,Protected = true); in LiquidInlet as stream (Brief="Liquid Inlet in the section", PosX=0.20, PosY=0); out VapourOutlet as vapour_stream (Brief="Vapour Outlet in the section", PosX=0.05, PosY=0); out BottomProduct as liquid_stream (Brief="Liquid outlet stream From Reboiler", PosX=1, PosY=1); in ConnectorReboilerLout as stream (Brief="Connector for Liquid outlet stream From Reboiler", Hidden=true); out HeatToReboiler as power (Brief="Heat supplied to Reboiler",Hidden=true); LiquidConnector as stream (Brief="Liquid connection at the middle TRAYS", PosX=0.75, PosY=1,Hidden=true); RebNoFlow as sourceNoFlow (Brief="No Inlet Flow to Reboiler",Hidden=true); REBOILER as reboiler; CONNECTIONS #vapor REBOILER.OutletV to TRAYS(NumberOfTrays).InletV; #liquid TRAYS(NumberOfTrays).OutletL to REBOILER.InletL; #Connectors REBOILER.OutletL to ConnectorReboilerLout; LiquidConnector to TRAYS(1).InletL; RebNoFlow.Outlet to REBOILER.Inlet; HeatToReboiler to REBOILER.InletQ; 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; VapourOutlet.F= TRAYS(1).OutletV.F; VapourOutlet.T = TRAYS(1).OutletV.T; VapourOutlet.P = TRAYS(1).OutletV.P; VapourOutlet.z = TRAYS(1).OutletV.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 #* ------------------------------------------------------------------- * Reboiled Stripping Column model with: * * - NumberOfTrays like tray; * - a vessel in the bottom of column; * - a splitter which separate the bottom product and the stream to reboiler; * - steady state reboiler (thermosyphon); * * ------------------------------------------------------------------*# 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 InletL 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 (OutletL.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletL.F); * (NoComps - 1) OutletL (OR OutletV) compositions for each tray; * the bottom tank temperature (OutletL.T); * the bottom tank liquid level (Level); * (NoComps - 1) OutletL (OR OutletV) compositions. "; VARIABLES out VapourDrawOff as vapour_stream (Brief="Vapour Outlet in the section", PosX=1, PosY=0.32,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.44,Protected = true); 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.20, PosY=0); out BottomProduct as liquid_stream (Brief="Liquid outlet stream From Reboiler", PosX=1, PosY=1); LiquidConnector as stream (Brief="Liquid connection at the middle TRAYS", PosX=0.75, PosY=1,Hidden=true); out HeatToReboiler as power (Brief="Heat supplied to Reboiler",Hidden=true); out HeatToTANKbottom as power (Brief="Heat supplied to Bottom Vessel",Hidden=true); in ConnectorSplitterBottom as stream (Brief="Connector for Liquid outlet stream From Reboiler", Hidden=true); REBOILER as reboilerSteady; SPLITTERbottom as splitter; TANKbottom as tank; CONNECTIONS #vapor REBOILER.OutletV to TRAYS(NumberOfTrays).InletV; #liquid TRAYS(NumberOfTrays).OutletL to TANKbottom.Inlet; TANKbottom.Outlet to SPLITTERbottom.Inlet; SPLITTERbottom.Outlet2 to REBOILER.InletL; #Connectors LiquidConnector to TRAYS(1).InletL; HeatToReboiler to REBOILER.InletQ; HeatToTANKbottom to TANKbottom.InletQ; SPLITTERbottom.Outlet1 to ConnectorSplitterBottom; EQUATIONS 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).OutletV.F; VapourOutlet.T = TRAYS(1).OutletV.T; VapourOutlet.P = TRAYS(1).OutletV.P; VapourOutlet.z = TRAYS(1).OutletV.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 #* ------------------------------------------------------------------- * Reactive Distillation Column * * ------------------------------------------------------------------*# 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 (OutletV.F); * the reboiler liquid outlet flow (OutletL.F); * both splitter outlet flows OR one of the splitter outlet flows and the splitter frac. == Initial Conditions == * the TRAYS temperature (OutletL.T); * the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletL.F); * (NoComps - 1) OutletL (OR OutletV) compositions for each tray; * the condenser temperature (OutletL.T); * the condenser liquid level (Level); * (NoComps - 1) OutletL (OR OutletV) compositions; * the reboiler temperature (OutletL.T); * the reboiler liquid level (Level); * (NoComps - 1) OutletL (OR OutletV) compositions. "; PARAMETERS outer PP as Plugin(Type="PP"); outer NComp as Integer; NumberOfTrays as Integer(Brief="Number of TRAYS", Default=2); FeedTrayIndex(NumberOfTrays) as Integer (Brief="Number of trays", Default=0,Hidden=true); LiqSideTrayIndex(NumberOfTrays) as Integer (Brief="Number of trays", Default=0,Hidden=true); VapSideTrayIndex(NumberOfTrays) as Integer (Brief="Number of trays", 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); alfacond as Real; 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); 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"); SET FeedTrayIndex(FeedTrayLocation) =1; VapSideTrayIndex(FeedTrayLocation) =1; LiqSideTrayIndex(FeedTrayLocation) =1; V=VolumeOfTray; Q=HeatSupply; Ap=PlateArea; Ah=HolesArea; lw=WeirLength; hw=WeirHeight ; VARIABLES 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"); out VapourDrawOff as vapour_stream (Brief="Vapour Outlet in the section", PosX=1, PosY=0.46,Protected = true); out LiquidDrawOff as liquid_stream (Brief="Liquid Outlet in the section", PosX=1, PosY=0.58,Protected = true); RebNoFlow as sourceNoFlow (Brief="No Inlet Flow to Reboiler",Hidden=true); in HeatToReboiler as power (Brief="Heat supplied to Reboiler", PosX=1, PosY=0.93); in HeatToCondenser as power (Brief="Heat supplied to Condenser", PosX=1, PosY=0.10); TRAYS(NumberOfTrays) as trayReac; CONDENSER as condenserReact; REBOILER as reboilerReact; SPLITTER as splitter; PUMP as pump; out VapourDistillate as vapour_stream (Brief="Vapour outlet stream From Top Condenser", PosX=0.67, PosY=0); in ConnectorCondenserVout as stream (Brief="Connector for Vapour outlet stream From Top Condenser", Hidden=true); out LiquidDistillate as liquid_stream (Brief="Liquid outlet stream From Top Splitter", PosX=1, PosY=0.33); in ConnectorSplitterOut as stream (Brief="Connector for Liquid outlet stream From Top Splitter", Hidden=true); out BottomProduct as liquid_stream (Brief="Liquid outlet stream From Reboiler", PosX=1, PosY=0.99); in ConnectorReboilerLout as stream (Brief="Connector for Liquid outlet stream From Reboiler", Hidden=true); CONNECTIONS #vapor REBOILER.OutletV to TRAYS(NumberOfTrays).InletV; TRAYS(1).OutletV to CONDENSER.InletV; TRAYS([2:NumberOfTrays]).OutletV to TRAYS([1:NumberOfTrays-1]).InletV; #liquid CONDENSER.OutletL to SPLITTER.Inlet; SPLITTER.Outlet2 to PUMP.Inlet; PUMP.Outlet to TRAYS(1).InletL; TRAYS([1:NumberOfTrays-1]).OutletL to TRAYS([2:NumberOfTrays]).InletL; TRAYS(NumberOfTrays).OutletL to REBOILER.InletL; #Connectors RebNoFlow.Outlet to REBOILER.Inlet; CONDENSER.OutletV to ConnectorCondenserVout; SPLITTER.Outlet1 to ConnectorSplitterOut; REBOILER.OutletL to ConnectorReboilerLout; EQUATIONS for i in [1:NumberOfTrays] do "Energy Holdup" TRAYS(i).E = TRAYS(i).ML*TRAYS(i).OutletL.h + TRAYS(i).MV*TRAYS(i).OutletV.h - TRAYS(i).OutletL.P*V; "Energy Balance" diff(TRAYS(i).E) = ( TRAYS(i).Inlet.F*TRAYS(i).Inlet.h + TRAYS(i).InletL.F*TRAYS(i).InletL.h + TRAYS(i).InletV.F*TRAYS(i).InletV.h- TRAYS(i).OutletL.F*TRAYS(i).OutletL.h - TRAYS(i).OutletV.F*TRAYS(i).OutletV.h -TRAYS(i).VapourSideStream.F*TRAYS(i).VapourSideStream.h - TRAYS(i).LiquidSideStream.F*TRAYS(i).LiquidSideStream.h + Q ) + TRAYS(i).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.InletV.F*TRAYS(1).vV / 'm^2' = sqrt((TRAYS(1).OutletV.P - CONDENSER.OutletL.P + 1e-8 * 'atm')/(TRAYS(1).rhoV*alfacond)); when TRAYS(1).OutletV.P < CONDENSER.OutletL.P switchto "off"; case "off": "Prato selado" CONDENSER.InletV.F = 0.0 * 'mol/s'; when TRAYS(1).OutletV.P > CONDENSER.OutletL.P + 1e-3 * 'atm' switchto "on"; end for i in [1:NumberOfTrays] do switch TrayLiquidFlow case "on": "Francis Equation" TRAYS(i).OutletL.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).OutletL.F = 0 * 'mol/h'; when TRAYS(i).Level > (beta * hw) + 1e-6*'m' switchto "on"; end switch TrayVapourFlow case "on": TRAYS(i).InletV.F*TRAYS(i).vV = sqrt((TRAYS(i).InletV.P - TRAYS(i).OutletV.P - TRAYS(i).Level*g*TRAYS(i).rhoL + 1e-8 * 'atm')/(TRAYS(i).rhoV*alfa))*Ah; when TRAYS(i).InletV.P < TRAYS(i).OutletV.P + TRAYS(i).Level*g*TRAYS(i).rhoL switchto "off"; case "off": TRAYS(i).InletV.F = 0 * 'mol/s'; when TRAYS(i).InletV.P > TRAYS(i).OutletV.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; end #*---------------------------------------------------------------------- * Model of a packed column section with: * - NStages = theoretical number of equilibrium stages. * *---------------------------------------------------------------------* Model Packed_Section_ColumnTeste 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 InletL stream of the top tray; * the InletV stream of the bottom tray; * the total pressure drop (dP) of the section. == Initial Conditions == * the stages temperature (OutletL.T); * the stages liquid holdup; * (NoComps - 1) OutletL (OR OutletV) compositions for each tray. "; PARAMETERS outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); outer NComp as Integer; NStages as Integer(Brief="Number of TRAYS", Default=2); topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1); top as Integer(Brief="Number of top tray"); bot as Integer(Brief="Number of bottom tray"); H as length (Brief="Height of packing"); VARIABLES stage(NStages) as packedStageTeste; dP as pressure; SET top = (NStages-1)*(1-topdown)/2+1; bot = NStages/top; stage.hs = H/NStages; stage.V = stage.hs * stage.d^2*3.14159/4; EQUATIONS stage.deltaP = dP/NStages; CONNECTIONS stage([top+topdown:topdown:bot]).OutletV to stage([top:topdown:bot-topdown]).InletV; stage([top:topdown:bot-topdown]).OutletL to stage([top+topdown:topdown:bot]).InletL; end #*---------------------------------------------------------------------- * Model of a packed distillation column containing: * - a section with NStages theoretical stages; * - a kettle reboiler; * - dymamic condenser; * - a splitter which separate reflux and distillate; * - a pump in reflux stream; *---------------------------------------------------------------------* Model PackedDistillation_kettle_cond as Packed_Section_ColumnTeste 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 (OutletV.F); * the reboiler liquid outlet flow (OutletL.F); * both splitter outlet flows OR one of the splitter outlet flows and the splitter frac. == Initial Conditions == * the stages temperature (OutletL.T); * the stages initial molar holdup; * (NoComps - 1) OutletL (OR OutletV) compositions for each stage; * the condenser temperature (OutletL.T); * the condenser liquid level (Level); * (NoComps - 1) OutletL (OR OutletV) compositions; * the reboiler temperature (OutletL.T); * the reboiler liquid level (Level); * (NoComps - 1) OutletL (OR OutletV) compositions. "; PARAMETERS VapourFlow as Switcher(Valid = ["on", "off"], Default = "on"); VARIABLES cond as condenser; reb as reboiler; sptop as splitter; pump1 as pump; CONNECTIONS #vapor reb.OutletV to stage(bot).InletV; stage(top).OutletV to cond.InletV; #liquid cond.OutletL to sptop.Inlet; sptop.Outlet2 to pump1.Inlet; pump1.Outlet to stage(top).InletL; stage(bot).OutletL to reb.InletL; EQUATIONS switch VapourFlow case "on": stage(bot).InletV.F*stage(bot).vV = sqrt((reb.OutletV.P - stage(bot).OutletV.P)/ (stage(bot).rhoV*stage(bot).Qsil*20))*(stage(bot).d^2*3.14159/4*stage(bot).e - stage(bot).Al); when stage(bot).InletV.F < 1e-6 * 'kmol/h' switchto "off"; case "off": stage(bot).InletV.F = 0 * 'mol/s'; when reb.OutletV.P > stage(bot).OutletV.P + 1e-1 * 'atm' switchto "on"; end end *#