#*------------------------------------------------------------------- * 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"); ColumnHoldup as positive (Brief = "Column holdup", Default=0.1); end Model SectionColumnBasic 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"); NumberOfFeeds as Integer (Brief="Number of Feed Trays",Default=3,Protected=true); FeedTrayLocation(NumberOfFeeds) as Integer (Brief="Feed tray Location",Default=2); NumberOfTrays as Integer (Brief="Number of trays", Default=8); 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); LiquidSideStreamLocation as Integer (Brief="Liquid Side Stream Location", Default=2); VapourSideStreamLocation as Integer (Brief="Vapour Side Stream Location", Default=2); VapourFlowModel as Switcher (Valid = ["Reepmeyer", "Feehery_Fv", "Roffel_Fv", "Klingberg", "Wang_Fv", "Elgue"], Default = "Reepmeyer"); LiquidFlowModel as Switcher (Valid = ["Francis", "Wang_Fl", "Olsen", "Feehery_Fl", "Roffel_Fl"], Default = "Francis"); TrayDiameter as length (Brief="Tray Diameter",Default=1.600); TraySpacing as length (Brief="Tray Spacing",Default=0.600); Fraction_HoleArea as fraction (Brief="Fraction of the active area that is occupied by the holes with respect to the total tray area",Default=0.10); Fraction_DowncomerArea as fraction (Brief="Fraction of the downcomer area with respect to the total tray area",Default=0.20); WeirLength as length (Brief="Weir length", Default = 1); WeirHeight as length (Brief="Weir height", Default= 0.05); TrayLiquidPasses as positive (Brief="Number of liquid passes in the tray", Lower = 1,Default=1); HeatSupply as heat_rate (Brief="Rate of heat supply",Default = 0); AerationFraction as Real (Brief="Aeration fraction", Default = 1); DryPdropCoeff as Real (Brief="Dry pressure drop coefficient", Default= 0.60); MurphreeEff as Real (Brief="Murphree efficiency for All Trays", Default= 1); VARIABLES INITIALIZATION as InitializeSection (Brief="Column Model Initialization"); CONTROL as ControlSection (Brief="Column Model Control"); out TCI as control_signal (Brief="Temperature Indicator", Protected = true, PosX=1, PosY=0.73); out PCI as control_signal (Brief="Pressure Indicator", Protected = true, PosX=0, PosY=0.24); 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); TRAYS(NumberOfTrays) as tray (Brief="Number of trays in the Column Section",Protected=true); VapourDrawOffFlow as flow_mol (Brief="Vapour Draw Off Stream Molar Flow Rate"); LiquidDrawOffFlow as flow_mol (Brief="Vapour Draw Off Stream Molar Flow Rate"); 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); SET VapSideTrayIndex(VapourSideStreamLocation) =1; LiqSideTrayIndex(LiquidSideStreamLocation) =1; TRAYS.TrayDiameter_ = TrayDiameter; TRAYS.TraySpacing_ = TraySpacing; TRAYS.Fraction_HoleArea_ = Fraction_HoleArea; TRAYS.Fraction_DowncomerArea_ = Fraction_DowncomerArea; TRAYS.WeirLength_ = WeirLength; TRAYS.WeirHeight_ = WeirHeight; TRAYS.TrayLiquidPasses_ = TrayLiquidPasses; TRAYS.HeatSupply_ = HeatSupply; TRAYS.AerationFraction_ = AerationFraction; TRAYS.DryPdropCoeff_ = DryPdropCoeff; TRAYS.MurphreeEff_ = MurphreeEff; CONNECTIONS TRAYS([2:NumberOfTrays]).OutletVapour to TRAYS([1:NumberOfTrays-1]).InletVapour; TRAYS([1:NumberOfTrays-1]).OutletLiquid to TRAYS([2:NumberOfTrays]).InletLiquid; LiquidConnector to TRAYS(1).InletLiquid; VapourConnector to TRAYS(NumberOfTrays).InletVapour; INITIAL 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*WeirHeight; 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 "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; switch LiquidFlowModel case "Francis": TRAYS.LFlowModel = 1; case "Wang_Fl": TRAYS.LFlowModel = 2; case "Olsen": TRAYS.LFlowModel = 3; case "Feehery_Fl": TRAYS.LFlowModel = 4; case "Roffel_Fl": TRAYS.LFlowModel = 5; end switch VapourFlowModel case "Reepmeyer": TRAYS.VFlowModel = 1; case "Feehery_Fv": TRAYS.VFlowModel = 2; case "Roffel_Fv": TRAYS.VFlowModel = 3; case "Klingberg": TRAYS.VFlowModel = 4; case "Wang_Fv": TRAYS.VFlowModel = 5; case "Elgue": TRAYS.VFlowModel = 6; end "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; "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; "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; "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; "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; "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 Section_Column as SectionColumnBasic ATTRIBUTES Pallete = true; Icon = "icon/SectionColumn"; Brief = "Model of a column section."; Info = "== Model of a column section containing == * NumberOfTrays TRAYS. * One Feed Inlet. == 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. "; SET NumberOfFeeds = 1; VARIABLES in FeedTray as stream (Brief="Feed stream", PosX=0, PosY=0.55); EQUATIONS #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Equating Feed Tray Variables to Trays Variables #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ for i in 1:NumberOfTrays do if i equal FeedTrayLocation(1) then "FeedTrayTop Inlet Flow" FeedTray.F= TRAYS(i).Inlet.F; "FeedTrayTop Inlet Temperature" FeedTray.T = TRAYS(i).Inlet.T; "FeedTrayTop Inlet Pressure" FeedTray.P = TRAYS(i).Inlet.P; "FeedTrayTop Inlet Composition" FeedTray.z = TRAYS(i).Inlet.z; "FeedTrayTop Inlet Vapour Fraction" FeedTray.v = TRAYS(i).Inlet.v; "FeedTrayTop Inlet Enthalpy" FeedTray.h = TRAYS(i).Inlet.h; else "Inlet Tray - Flow Sealed" 0*'mol/h'= TRAYS(i).Inlet.F; "Inlet Tray - Temperature" 300*'K' = TRAYS(i).Inlet.T; "Inlet Tray - Pressure" 1*'atm' = TRAYS(i).Inlet.P; "Inlet Tray - Composition" 0.1 = TRAYS(i).Inlet.z; "Inlet Tray - Vapour Fraction" 0 = TRAYS(i).Inlet.v; "Inlet Tray - Enthalpy" 0*'J/mol' = TRAYS(i).Inlet.h; end end end Model Section_Column2 as SectionColumnBasic ATTRIBUTES Pallete = true; Icon = "icon/SectionColumn"; Brief = "Model of a column section."; Info = "== Model of a column section containing == * NumberOfTrays TRAYS. * Two Feed Inlets. == 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. "; SET NumberOfFeeds = 2; VARIABLES in FeedTrayOne as stream (Brief="Feed stream", PosX=0, PosY=0.45); in FeedTrayTwo as stream (Brief="Feed stream", PosX=0, PosY=0.65); EQUATIONS for i in 1:NumberOfTrays do if i equal FeedTrayLocation(1) then "FeedTrayTop Inlet Flow" FeedTrayOne.F= TRAYS(i).Inlet.F; "FeedTrayTop Inlet Temperature" FeedTrayOne.T = TRAYS(i).Inlet.T; "FeedTrayTop Inlet Pressure" FeedTrayOne.P = TRAYS(i).Inlet.P; "FeedTrayTop Inlet Composition" FeedTrayOne.z = TRAYS(i).Inlet.z; "FeedTrayTop Inlet Vapour Fraction" FeedTrayOne.v = TRAYS(i).Inlet.v; "FeedTrayTop Inlet Enthalpy" FeedTrayOne.h = TRAYS(i).Inlet.h; else if i equal FeedTrayLocation(2) then "FeedTrayBottom Inlet Flow" FeedTrayTwo.F= TRAYS(i).Inlet.F; "FeedTrayBottom Inlet Temperature" FeedTrayTwo.T = TRAYS(i).Inlet.T; "FeedTrayBottom Inlet Pressure" FeedTrayTwo.P = TRAYS(i).Inlet.P; "FeedTrayBottom Inlet Composition" FeedTrayTwo.z = TRAYS(i).Inlet.z; "FeedTrayBottom Inlet Vapour Fraction" FeedTrayTwo.v = TRAYS(i).Inlet.v; "FeedTrayBottom Inlet Enthalpy" FeedTrayTwo.h = TRAYS(i).Inlet.h; else "Inlet Tray - Flow Sealed" 0*'mol/h'= TRAYS(i).Inlet.F; "Inlet Tray - Temperature" 300*'K' = TRAYS(i).Inlet.T; "Inlet Tray - Pressure" 1*'atm' = TRAYS(i).Inlet.P; "Inlet Tray - Composition" 0.1 = TRAYS(i).Inlet.z; "Inlet Tray - Vapour Fraction" 0 = TRAYS(i).Inlet.v; "Inlet Tray - Enthalpy" 0*'J/mol' = TRAYS(i).Inlet.h; end end end end Model Section_Column3 as SectionColumnBasic ATTRIBUTES Pallete = true; Icon = "icon/SectionColumn"; Brief = "Model of a column section."; Info = "== Model of a column section containing == * NumberOfTrays TRAYS. * Three Feed Inlets. == 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. "; SET NumberOfFeeds = 3; VARIABLES in FeedTrayOne as stream (Brief="Feed stream", PosX=0, PosY=0.45); in FeedTrayTwo as stream (Brief="Feed stream", PosX=0, PosY=0.65); in FeedTrayThree as stream (Brief="Feed stream", PosX=0, PosY=0.85); EQUATIONS for i in 1:NumberOfTrays do if i equal FeedTrayLocation(1) then "FeedTrayTop Inlet Flow" FeedTrayOne.F= TRAYS(i).Inlet.F; "FeedTrayTop Inlet Temperature" FeedTrayOne.T = TRAYS(i).Inlet.T; "FeedTrayTop Inlet Pressure" FeedTrayOne.P = TRAYS(i).Inlet.P; "FeedTrayTop Inlet Composition" FeedTrayOne.z = TRAYS(i).Inlet.z; "FeedTrayTop Inlet Vapour Fraction" FeedTrayOne.v = TRAYS(i).Inlet.v; "FeedTrayTop Inlet Enthalpy" FeedTrayOne.h = TRAYS(i).Inlet.h; else if i equal FeedTrayLocation(2) then "FeedTrayBottom Inlet Flow" FeedTrayTwo.F= TRAYS(i).Inlet.F; "FeedTrayBottom Inlet Temperature" FeedTrayTwo.T = TRAYS(i).Inlet.T; "FeedTrayBottom Inlet Pressure" FeedTrayTwo.P = TRAYS(i).Inlet.P; "FeedTrayBottom Inlet Composition" FeedTrayTwo.z = TRAYS(i).Inlet.z; "FeedTrayBottom Inlet Vapour Fraction" FeedTrayTwo.v = TRAYS(i).Inlet.v; "FeedTrayBottom Inlet Enthalpy" FeedTrayTwo.h = TRAYS(i).Inlet.h; else if i equal FeedTrayLocation(3) then "FeedTrayBottom Inlet Flow" FeedTrayThree.F= TRAYS(i).Inlet.F; "FeedTrayBottom Inlet Temperature" FeedTrayThree.T = TRAYS(i).Inlet.T; "FeedTrayBottom Inlet Pressure" FeedTrayThree.P = TRAYS(i).Inlet.P; "FeedTrayBottom Inlet Composition" FeedTrayThree.z = TRAYS(i).Inlet.z; "FeedTrayBottom Inlet Vapour Fraction" FeedTrayThree.v = TRAYS(i).Inlet.v; "FeedTrayBottom Inlet Enthalpy" FeedTrayThree.h = TRAYS(i).Inlet.h; else "Inlet Tray - Flow Sealed" 0*'mol/h'= TRAYS(i).Inlet.F; "Inlet Tray - Temperature" 300*'K' = TRAYS(i).Inlet.T; "Inlet Tray - Pressure" 1*'atm' = TRAYS(i).Inlet.P; "Inlet Tray - Composition" 0.1 = TRAYS(i).Inlet.z; "Inlet Tray - Vapour Fraction" 0 = TRAYS(i).Inlet.v; "Inlet Tray - Enthalpy" 0*'J/mol' = TRAYS(i).Inlet.h; end end end end 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 (Brief="Number of components",Protected=true); NumberOfFeeds as Integer (Brief="Number of Feed Stages",Default=3,Protected=true); NumberOfStages as Integer (Brief="Number of Stages", Default=3); FeedStageLocation(NumberOfFeeds) 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 void space/m^3 packed bed)"); 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'); HETP as length (Brief="The Height Equivalent to a Theoretical Plate",Protected=true); VARIABLES INITIALIZATION as InitializeStage (Brief = "Column Model Initialization"); CONTROL as ControlSection (Brief="Column Model Control"); out TCI as control_signal (Brief="Temperature Indicator", Protected = true, PosX=1, PosY=0.73); out PCI as control_signal (Brief="Pressure Indicator", Protected = true, PosX=0, PosY=0.24); in LiquidInlet as stream (Brief="Liquid Inlet in the section", PosX=0.70, PosY=0,Protected=true); out VapourOutlet as vapour_stream (Brief="Vapour Outlet in the section", PosX=0.30, PosY=0,Protected=true); in VapourInlet as stream (Brief="Vapour Inlet in the section", PosX=0.30, PosY=1,Protected=true); out LiquidOutlet as liquid_stream (Brief="Liquid Outlet in the section", PosX=0.70, PosY=1,Protected=true); 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); STAGES(NumberOfStages) as packedStage (Brief="Column Stages",Protected=true); PressureDrop as pressure (Brief="Column Pressure Drop", Protected=true); SET STAGES.Number_Stages = NumberOfStages; STAGES.HeightOfPacking = PackingHeight; STAGES.HeatOnStage = HeatSupply; STAGES.ColumnInternalDiameter = ColumnDiameter; STAGES.PackingVoidFraction = VoidFraction; STAGES.LiquidResistanceCoeff = ResistanceCoeff ; STAGES.AreaPerPackingVolume = AreaPerPackingVol; HETP = PackingHeight/NumberOfStages; CONNECTIONS STAGES([2:NumberOfStages]).OutletVapour to STAGES([1:NumberOfStages-1]).InletVapour; STAGES([1:NumberOfStages-1]).OutletLiquid to STAGES([2:NumberOfStages]).InletLiquid; 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; "Tray Temperature Indicator" #TCI*'K' = TRAYS(min([NumberOfTrays, CONTROL.Tindicator_TrayNumber])).OutletVapour.T; TCI*'K' = STAGES(CONTROL.Tindicator_TrayNumber).OutletVapour.T; "Tray Pressure Indicator" #PCI*'atm' = TRAYS(min([NumberOfTrays, CONTROL.Pindicator_TrayNumber])).OutletVapour.P; PCI*'atm' = STAGES(CONTROL.Pindicator_TrayNumber).OutletVapour.P; "PressureDrop" PressureDrop = STAGES(NumberOfStages).OutletLiquid.P - STAGES(1).OutletLiquid.P; 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 Column Holdup of the STAGES" STAGES(i).hl = INITIALIZATION.ColumnHoldup; 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. "; SET NumberOfFeeds = 1; VARIABLES in FeedStage as stream (Brief="Feed stream", PosX=0, PosY=0.55); EQUATIONS #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Equating Feed Tray Variables to Trays Variables #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ for i in 1:NumberOfStages do if i equal FeedStageLocation(1) then "FeedTrayTop Inlet Flow" FeedStage.F= STAGES(i).Inlet.F; "FeedTrayTop Inlet Temperature" FeedStage.T = STAGES(i).Inlet.T; "FeedTrayTop Inlet Pressure" FeedStage.P = STAGES(i).Inlet.P; "FeedTrayTop Inlet Composition" FeedStage.z = STAGES(i).Inlet.z; "FeedTrayTop Inlet Vapour Fraction" FeedStage.v = STAGES(i).Inlet.v; "FeedTrayTop Inlet Enthalpy" FeedStage.h = STAGES(i).Inlet.h; else "Inlet Tray - Flow Sealed" 0*'mol/h'= STAGES(i).Inlet.F; "Inlet Tray - Temperature" 300*'K' = STAGES(i).Inlet.T; "Inlet Tray - Pressure" 1*'atm' = STAGES(i).Inlet.P; "Inlet Tray - Composition" 0.1 = STAGES(i).Inlet.z; "Inlet Tray - Vapour Fraction" 0 = STAGES(i).Inlet.v; "Inlet Tray - Enthalpy" 0*'J/mol' = STAGES(i).Inlet.h; end end end Model Packed_Section_Column2 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. "; SET NumberOfFeeds = 2; VARIABLES in FeedStageOne as stream (Brief="Feed stream", PosX=0, PosY=0.45); in FeedStageTwo as stream (Brief="Feed stream", PosX=0, PosY=0.65); EQUATIONS #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Equating Feed Stage Variables to Stages Variables #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ for i in 1:NumberOfStages do if i equal FeedStageLocation(1) then "FeedTrayTop Inlet Flow" FeedStageOne.F= STAGES(i).Inlet.F; "FeedTrayTop Inlet Temperature" FeedStageOne.T = STAGES(i).Inlet.T; "FeedTrayTop Inlet Pressure" FeedStageOne.P = STAGES(i).Inlet.P; "FeedTrayTop Inlet Composition" FeedStageOne.z = STAGES(i).Inlet.z; "FeedTrayTop Inlet Vapour Fraction" FeedStageOne.v = STAGES(i).Inlet.v; "FeedTrayTop Inlet Enthalpy" FeedStageOne.h = STAGES(i).Inlet.h; else if i equal FeedStageLocation(2) then "FeedTrayBottom Inlet Flow" FeedStageTwo.F= STAGES(i).Inlet.F; "FeedTrayBottom Inlet Temperature" FeedStageTwo.T = STAGES(i).Inlet.T; "FeedTrayBottom Inlet Pressure" FeedStageTwo.P = STAGES(i).Inlet.P; "FeedTrayBottom Inlet Composition" FeedStageTwo.z = STAGES(i).Inlet.z; "FeedTrayBottom Inlet Vapour Fraction" FeedStageTwo.v = STAGES(i).Inlet.v; "FeedTrayBottom Inlet Enthalpy" FeedStageTwo.h = STAGES(i).Inlet.h; else "Inlet Tray - Flow Sealed" 0*'mol/h'= STAGES(i).Inlet.F; "Inlet Tray - Temperature" 300*'K' = STAGES(i).Inlet.T; "Inlet Tray - Pressure" 1*'atm' = STAGES(i).Inlet.P; "Inlet Tray - Composition" 0.1 = STAGES(i).Inlet.z; "Inlet Tray - Vapour Fraction" 0 = STAGES(i).Inlet.v; "Inlet Tray - Enthalpy" 0*'J/mol' = STAGES(i).Inlet.h; end end end end