diff --git a/Simulator/Examples/Absorption.mo b/Simulator/Examples/Absorption.mo index 901a9c8..a34a48c 100644 --- a/Simulator/Examples/Absorption.mo +++ b/Simulator/Examples/Absorption.mo @@ -63,4 +63,4 @@ package Absorption "Example of Simulating an Absorption Column" end AbsorptionSimulation; annotation( Documentation(info = "
Following problem statement is simulated in this Absorption Column example:


Problem Statement:

Component System: Air, Water, Acetone
Thermodynamics: Raoult's Law

Material Stream Information

Feed Stream 1 (Solvent)
Molar Flow Rate: 30 mol/s
Mole Fraction (Water): 1
Pressure: 101325 Pa
Temperature: 325 K

Feed Stream 2 (Gas Mixture)
Molar Flow Rate: 30 mol/s
Mole Fraction (Air): 0.5
Mole Fraction (Acetone): 0.5
Pressure: 101325 Pa
Temperature: 335 K


Simulate an absorption column with 10 stages where the solvent enters from the top and gas mixture enters from bottom to remove acetone from air.


This package is created to demnostrate the simualtion of an Absorption Column. Following models are created inside the package:
  1. MS (Non-executable model): created to extend the material stream along with the necessary thermodynamic package.
  2. Tray (Non-executable model): created to extend the tray along with the necessary thermodynamic package.
  3. AbsColumn (Non-executable model): created to extend the Absorption Column along with the necessary thermodynamic package.
  4. AbsorptionSimulation (Executable model): All the components are defined, material stream & Absorption Column specifications are declared, model instances are connected to make the file executable.
")); -end Absorption; +end Absorption; \ No newline at end of file diff --git a/Simulator/Examples/CompositeMS.mo b/Simulator/Examples/CompositeMS.mo index 6f70299..91c5cdc 100644 --- a/Simulator/Examples/CompositeMS.mo +++ b/Simulator/Examples/CompositeMS.mo @@ -28,4 +28,4 @@ package CompositeMS "Example of Simulating a Material Stream" end MatStreamSimulation; annotation( Documentation(info = "
Following problem statement is simulated in this Material Stream example

Component System: Benzene, Toluene
Thermodynamics: Raoult's Law

Material Stream Information

Molar Flow Rate: 100 mol/s
Mole Fraction (Benzene): 0.5
Mole Fraction (Toluene): 0.5
Pressure: 101325 Pa
Temperature: 368 K

Simulate a material stream to compute all its thermo-physical properties at conditions mentioned above.

This package is created to demnostrate the simualtion of a Material Stream. Following models are created inside the package:
  1. MS (Non-executable model): created to extend the material stream along with the necessary thermodynamic package
  2. MatStreamSimulation (Executable model): All the components are defined, material stream specifications are declared to make the file executable.
")); -end CompositeMS; +end CompositeMS; \ No newline at end of file diff --git a/Simulator/Examples/Compressor.mo b/Simulator/Examples/Compressor.mo index 2f40a8d..c5df3c6 100644 --- a/Simulator/Examples/Compressor.mo +++ b/Simulator/Examples/Compressor.mo @@ -48,4 +48,4 @@ package Compressor "Example of Simulating an Adiabatic Compressor" end CompressorSimulation; annotation( Documentation(info = "
Following problem statement is simulated in this Adiabatic Compressor example

Component System: Benzene, Toulene
Thermodynamics: Raoult's Law

Material Stream Information

Molar Flow Rate: 100 mol/s
Mole Fraction (Benzene): 0.5
Mole Fraction (Toluene): 0.5
Pressure: 202650 Pa
Temperature: 372 K

Simulate an adiabatic compressor to reduce the pressure of a vapor material stream such that the pressure increase is 10000 Pa. Assume the compressor to be operated at efficiency of 75%.

This package is created to demnostrate the simualtion of an Adiabatic Compressor. Following models are created inside the package:
  1. MS (Non-executable model): created to extend the material stream along with the necessary thermodynamic package
  2. AdiabComp (Non-executable model): created to extend the adiabatic compressor along with the necessary thermodynamic package.
  3. CompressorSimulation (Executable model): All the components are defined, material stream & compressor specifications are declared, model instances are connected to make the file executable.
")); -end Compressor; +end Compressor; \ No newline at end of file diff --git a/Simulator/Examples/ConversionReactor.mo b/Simulator/Examples/ConversionReactor.mo index 214cce9..f02d5d1 100644 --- a/Simulator/Examples/ConversionReactor.mo +++ b/Simulator/Examples/ConversionReactor.mo @@ -16,9 +16,6 @@ package ConversionReactor "Example of Simulating a Conversion Reactor" annotation( Documentation(info = "This is a non-executable model is created inside the package CR to extend the ConversionReactor model along with the necessary reaction from Reaction Manager which is ConversionReaction in this case.

It will be instantiated in the ConvReactSimulation model to create the required number of instances of the adiabatic expander model.
")); end ConvReactor; - annotation( - Documentation(info = "
Following problem statement is simulated in this Conversion Reactor example

Component System: Ethyl Acetate, Water, Acetic Acid, Ethanol
Thermodynamics: NRTL

Material Stream Information

Molar Flow Rate: 100 mol/s
Mole Fraction (Ethyl Acetate): 0
Mole Fraction (Water): 0
Mole Fraction (Acetic Acid): 0.4
Mole Fraction (Ethanol): 0.6
Pressure: 101325 Pa
Temperature: 300 K

Simulate a conversion reactor where Acetic Acid reacts with Ethanol to form Ethyl Acetate and Water. The conversion of acetic acid is 60%. Assume the reactor to be operated isothermally.

This package is created to demnostrate the simualtion of a Conversion Reactor. Following models are created inside the package:
  1. MS (Non-executable model): created to extend the material stream along with the necessary thermodynamic package.
  2. ConvReactor (Non-executable model): created to extend the conversion reactor along with the reaction manager.
  3. ConvReactSimulation (Executable model): All the components are defined, material stream & conversion reactor specifications are declared, model instances are connected to make the file executable.
")); - model ConvReactSimulation "Calculation of mole flows at outlet from given reaction conversion during production of Ethyl acetate by reacting Ethanol and Acetic Acid in a Conversion Reactor" extends Modelica.Icons.Example; @@ -52,8 +49,10 @@ package ConversionReactor "Example of Simulating a Conversion Reactor" S1.T = 300; S1.x_pc[1, :] = {0, 0, 0.4, 0.6}; S1.F_p[1] = 100; - annotation( + annotation( Documentation(info = "This is an executable model to simualate the CR example where all the components are defined, material stream, conversion reactor & conversion reaction specifications are declared, model instances are connected.

Material Stream Information

Molar Flow Rate: 100 mol/s
Mole Fraction (Ethyl Acetate): 0
Mole Fraction (Water): 0
Mole Fraction (Acetic Acid): 0.4
Mole Fraction (Ethanol): 0.6
Pressure: 101325 Pa
Temperature: 300 K

Reaction
Acetic Acid + Ethanol ----> Ethyl Acetate + Water

Conversion Reactor Specification: Conversion of Acetic Acid: 30%
         Operation Mode: isothermal
")); - end ConvReactSimulation; + end ConvReactSimulation; + annotation( + Documentation(info = "
Following problem statement is simulated in this Conversion Reactor example

Component System: Ethyl Acetate, Water, Acetic Acid, Ethanol
Thermodynamics: NRTL

Material Stream Information

Molar Flow Rate: 100 mol/s
Mole Fraction (Ethyl Acetate): 0
Mole Fraction (Water): 0
Mole Fraction (Acetic Acid): 0.4
Mole Fraction (Ethanol): 0.6
Pressure: 101325 Pa
Temperature: 300 K

Simulate a conversion reactor where Acetic Acid reacts with Ethanol to form Ethyl Acetate and Water. The conversion of acetic acid is 60%. Assume the reactor to be operated isothermally.

This package is created to demnostrate the simualtion of a Conversion Reactor. Following models are created inside the package:
  1. MS (Non-executable model): created to extend the material stream along with the necessary thermodynamic package.
  2. ConvReactor (Non-executable model): created to extend the conversion reactor along with the reaction manager.
  3. ConvReactSimulation (Executable model): All the components are defined, material stream & conversion reactor specifications are declared, model instances are connected to make the file executable.
")); -end ConversionReactor; +end ConversionReactor; \ No newline at end of file diff --git a/Simulator/Examples/Distillation.mo b/Simulator/Examples/Distillation.mo index 1afa644..72d7491 100644 --- a/Simulator/Examples/Distillation.mo +++ b/Simulator/Examples/Distillation.mo @@ -260,4 +260,4 @@ package Distillation "Example of Simulating a Distillation Column" end DistillationSimulation_Ex5; annotation( Documentation(info = "
Following five problem statement are simulated in this Distillation Column example:

Problem Statement 1:

Component System: Benzene, Toluene
Thermodynamics: Raoult's Law

Material Stream Information

Molar Flow Rate: 100 mol/s
Mole Fraction (Benzene): 0.5
Mole Fraction (Toluene): 0.5
Pressure: 101325 Pa
Temperature: 298.15 K

Simulate a distillation column with 4 stages (excluding condenser and reboiler) where the feed is entering the 3rd stage. The column is operated at uniform pressure of 101325 Pa and with a partial condenser. The column is specified to have reflux ratio of 2 and bottoms flow rate of 50 mol/s.


Problem Statement 2:

Component System: Benzene, Toluene
Thermodynamics: Raoult's Law

Material Stream Information

Molar Flow Rate: 100 mol/s
Mole Fraction (Benzene): 0.5
Mole Fraction (Toluene): 0.5
Pressure: 101325 Pa
Temperature: 298.15 K

Simulate a distillation column with 12 stages (excluding condenser and reboiler) where the feed is entering the 7th stage. The column is operated at uniform pressure of 101325 Pa and with a total condenser. The column is specified to have reflux ratio of 2 and bottoms flow rate of 50 mol/s.


Problem Statement 3:

Component System: Benzene, Toluene
Thermodynamics: Raoult's Law

Material Stream Information

Molar Flow Rate: 100 mol/s
Mole Fraction (Benzene): 0.3
Mole Fraction (Toluene): 0.7
Pressure: 101325 Pa
Temperature: 298.15 K

Simulate a distillation column with 22 stages (excluding condenser and reboiler) where the feed is entering the 10th stage. The column is operated at uniform pressure of 101325 Pa and with a total condenser. The column is specified to have reflux ratio of 1.5 and bottoms flow rate of 70 mol/s.


Problem Statement 4:

Component System: Benzene, Toluene
Thermodynamics: Raoult's Law

Material Stream Information

Molar Flow Rate: 96.8 mol/s
Mole Fraction (Benzene): 0.3
Mole Fraction (Toluene): 0.7
Pressure: 101325 Pa
Temperature: 298.15 K

Simulate a distillation column with 22 stages (excluding condenser and reboiler) where the feed is entering the 10th stage. The column is operated at top pressure of 151325 Pa and with a total condenser. The bottom pressure of the column is 101325 Pa. The column is specified to have reflux ratio of 1.5 and bottoms flow rate of 70 mol/s.


Problem Statement 5:

Component System: Benzene, Toluene
Thermodynamics: Raoult's Law

Material Stream Information

Feed Stream 1
Molar Flow Rate: 100 mol/s
Mole Fraction (Benzene): 0.5
Mole Fraction (Toluene): 0.5
Pressure: 101325 Pa
Temperature: 298.15 K

Feed Stream 2
Molar Flow Rate: 100 mol/s
Mole Fraction (Benzene): 0.5
Mole Fraction (Toluene): 0.5
Pressure: 101325 Pa
Temperature: 298.15 K

Simulate a distillation column with 5 stages (excluding condenser and reboiler) where the feed streams are entering the 3rd and 4th stage. The column is operated at uniform pressure of 101325 Pa and with a partial condenser. The column is specified to have reflux ratio of 2 and bottoms flow rate of 50 mol/s.


This package is created to demnostrate the simualtion of Distillation Column. Following models are created inside the package:
  1. Condenser (Non-executable model): created to extend the condenser along with the necessary thermodynamic package.
  2. Tray (Non-executable model): created to extend the tray along with the necessary thermodynamic package.
  3. Reboiler (Non-executable model): created to extend the reboiler along with the necessary thermodynamic package.
  4. DistColumn (Non-executable model): created to extend the Distillation Column along with the necessary thermodynamic package.
  5. MS (Non-executable model): created to extend the material stream along with the necessary thermodynamic package.
  6. DistillationSimulation_Ex1 (Executable model for Problem Statement 1): All the components are defined, material stream & Distillation Column specifications are declared, model instances are connected to make the file executable.
  7. DistillationSimulation_Ex2 (Executable model for Problem Statement 2): All the components are defined, material stream & Distillation Column specifications are declared, model instances are connected to make the file executable.
  8. DistillationSimulation_Ex3 (Executable model for Problem Statement 3): All the components are defined, material stream & Distillation Column specifications are declared, model instances are connected to make the file executable.
  9. DistillationSimulation_Ex4 (Executable model for Problem Statement 4): All the components are defined, material stream & Distillation Column specifications are declared, model instances are connected to make the file executable.
  10. DistillationSimulation_Ex5 (Executable model for Problem Statement 5): All the components are defined, material stream & Distillation Column specifications are declared, model instances are connected to make the file executable.
")); -end Distillation; +end Distillation; \ No newline at end of file diff --git a/Simulator/Examples/Expander.mo b/Simulator/Examples/Expander.mo index aae24c6..197c2b8 100644 --- a/Simulator/Examples/Expander.mo +++ b/Simulator/Examples/Expander.mo @@ -36,16 +36,16 @@ package Expander "Example of Simulating an Adiabatic Expander" Simulator.Streams.EnergyStream E1 annotation( Placement(visible = true, transformation(origin = {-30, -60}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); equation -//================================================================ -//Connections + //================================================================ + //Connections connect(E1.Out, B1.En) annotation( Line(points = {{-20, -60}, {-2, -60}, {-2, -16}, {-2, -16}}, color = {255, 0, 0})); connect(B1.Out, S2.In) annotation( Line(points = {{20, 0}, {52, 0}, {52, 0}, {52, 0}}, color = {0, 70, 70})); connect(S1.Out, B1.In) annotation( Line(points = {{-72, 0}, {-26, 0}, {-26, 0}, {-26, 0}}, color = {0, 70, 70})); -//================================================================ -//Inputs and Specifications + //================================================================ + //Inputs and Specifications S1.x_pc[1, :] = {0.5, 0.5}; S1.P = 131325; S1.T = 372; @@ -56,4 +56,4 @@ package Expander "Example of Simulating an Adiabatic Expander" end ExpanderSimulation; annotation( Documentation(info = "
Following problem statement is simulated in this Adiabatic Expander example

Component System: Benzene, Toulene
Thermodynamics: Raoult's Law

Material Stream Information

Molar Flow Rate: 100 mol/s
Mole Fraction (Benzene): 0.5
Mole Fraction (Toluene): 0.5
Pressure: 131325 Pa
Temperature: 372 K

Simulate an adiabatic expander to reduce the pressure of a vapor material stream such that the pressure drop is 10000 Pa. Assume the expander to be operated at efficiency of 75%.

This package is created to demnostrate the simualtion of an Adiabatic Expander. Following models are created inside the package:
  1. MS (Non-executable model): created to extend the material stream along with the necessary thermodynamic package.
  2. AdiabExp (Non-executable model): created to extend the adiabatic expander along with the necessary thermodynamic package.
  3. ExpanderSimulation (Executable model): All the components are defined, material stream & expander specifications are declared, model instances are connected to make the file executable.
")); -end Expander; +end Expander; \ No newline at end of file diff --git a/Simulator/Examples/Flash.mo b/Simulator/Examples/Flash.mo index 33ab4ec..c0906d5 100644 --- a/Simulator/Examples/Flash.mo +++ b/Simulator/Examples/Flash.mo @@ -57,4 +57,4 @@ package Flash "Example of Simulating a Flash Separator" annotation( Documentation(info = "
Following problem statement is simulated in this Flash Column example

Component System: Benzene, Toluene
Thermodynamics: Raoult's Law

Material Stream Information

Molar Flow Rate: 100 mol/s
Mole Fraction (Benzene): 0.5
Mole Fraction (Toluene): 0.5
Pressure: 101325 Pa
Temperature: 368 K

Simulate a flash column operating at the feed temperature and pressure.

This package is created to demnostrate the simualtion of a Flash Column. Following models are created inside the package:
  1. MS (Non-executable model): created to extend the material stream along with the necessary thermodynamic package.
  2. FlashSep (Non-executable model): created to extend the flash column along with the necessary thermodynamic package.
  3. FlashSimulation (Executable model): All the components are defined, material stream & flash column specifications are declared, model instances are connected to make the file executable.
")); -end Flash; +end Flash; \ No newline at end of file diff --git a/Simulator/Examples/HeatExchanger.mo b/Simulator/Examples/HeatExchanger.mo index 35df6f6..26d42dc 100644 --- a/Simulator/Examples/HeatExchanger.mo +++ b/Simulator/Examples/HeatExchanger.mo @@ -1,12 +1,13 @@ within Simulator.Examples; - + package HeatExchanger "Example of Simulating Heat Exchanger" //================================================================================================================ extends Modelica.Icons.ExamplesPackage; + model MS "Extension of Material Stream with Raoult's Law" extends Simulator.Streams.MaterialStream; extends Simulator.Files.ThermodynamicPackages.RaoultsLaw; - annotation( + annotation( Documentation(info = "This is a non-executable model is created inside the package Cooler to extend the MaterialStream model along with the necessary property method from ThermodynamicPackages which is RaoultsLaw in this case.

It will be instantiated in the HXSimulation and ShellnTubeHXSimulation model to create the required number of instances of the material stream model.
")); end MS; @@ -51,18 +52,15 @@ package HeatExchanger "Example of Simulating Heat Exchanger" end HXSimulation; model ShellnTubeHXSimulation "Calculating outlet temperatures of material stream by specifying the shell and tube side properties in a Heat Exchanger" - extends Modelica.Icons.Example; - import data = Simulator.Files.ChemsepDatabase; - + extends Modelica.Icons.Example; + import data = Simulator.Files.ChemsepDatabase; parameter data.Water wat; parameter data.Noctane oct; parameter data.Nnonane non; parameter data.Ndecane dec; - parameter Integer Nc = 4; - parameter data.GeneralProperties C[Nc] = {wat,oct,non,dec}; - - Simulator.UnitOperations.HeatExchanger B1( C = C,Cmode = "Design", Mode = "CounterCurrent", Nc = Nc, Pdelc = 0, Pdelh = 0, Qloss = 0) annotation( + parameter data.GeneralProperties C[Nc] = {wat, oct, non, dec}; + Simulator.UnitOperations.HeatExchanger B1(C = C, Cmode = "Design", Mode = "CounterCurrent", Nc = Nc, Pdelc = 0, Pdelh = 0, Qloss = 0) annotation( Placement(visible = true, transformation(origin = {-16, -2}, extent = {{-22, -22}, {22, 22}}, rotation = 0))); Simulator.Examples.HeatExchanger.MS S1(Nc = Nc, C = C) annotation( Placement(visible = true, transformation(origin = {-86, 38}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); @@ -72,27 +70,26 @@ package HeatExchanger "Example of Simulating Heat Exchanger" Placement(visible = true, transformation(origin = {-22, 64}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); Simulator.Examples.HeatExchanger.MS S4(Nc = Nc, C = C) annotation( Placement(visible = true, transformation(origin = {46, -48}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); - equation - connect(S1.Out, B1.In_Hot) annotation( + connect(S1.Out, B1.In_Hot) annotation( Line(points = {{-76, 38}, {-76, -2}, {-38, -2}})); - connect(B1.Out_Hot, S3.In) annotation( + connect(B1.Out_Hot, S3.In) annotation( Line(points = {{6, -2}, {6, 45}, {58, 45}, {58, 70}})); - connect(B1.Out_Cold, S4.In) annotation( + connect(B1.Out_Cold, S4.In) annotation( Line(points = {{-16, -24}, {-16, -48}, {36, -48}})); - connect(S2.Out, B1.In_Cold) annotation( + connect(S2.Out, B1.In_Cold) annotation( Line(points = {{-12, 64}, {-12, 38}, {-16, 38}, {-16, 20}})); - S1.x_pc[1, :] = {0, 0, 0.1, 0.9}; - S2.x_pc[1, :] = {1, 0, 0, 0}; - S1.F_p[1] = 212.94371; - S2.F_p[1] = 3077.38424; - S1.T = 377.03889; - S2.T = 304.26111; - S1.P = 1116948.66173; - S2.P = 606737.54464; - annotation( + S1.x_pc[1, :] = {0, 0, 0.1, 0.9}; + S2.x_pc[1, :] = {1, 0, 0, 0}; + S1.F_p[1] = 212.94371; + S2.F_p[1] = 3077.38424; + S1.T = 377.03889; + S2.T = 304.26111; + S1.P = 1116948.66173; + S2.P = 606737.54464; + annotation( Documentation(info = "This is an executable model to simualate the Heat Exchanger example where all the components are defined, material stream & heat exchanger specifications are declared, model instances are connected. Heat Exchanger model from the UnitOperations package has been instantiated here.

Material Stream Information

Hot Stream
Molar Flow Rate: 212.94371 mol/s
Mole Fraction (Water): 0
Mole Fraction (N-Octane): 0
Mole Fraction (N-Nonane): 0.1
Mole Fraction (N-Decane): 0.9
Pressure: 1116948.66 Pa
Temperature: 377.03889 K


Cold Stream
Molar Flow Rate: 3077.38424 mol/s
Mole Fraction (Water): 1
Mole Fraction (N-Octane): 0
Mole Fraction (N-Nonane): 1
Mole Fraction (N-Decane): 0
Pressure: 606737.54464 Pa
Temperature: 304.26111 K
")); - end ShellnTubeHXSimulation; + end ShellnTubeHXSimulation; annotation( Documentation(info = "
Following two problem statement are simulated in this Heat Exchanger example:

Problem Statement 1:

Component System: Styrene and Toluene
Thermodynamics: Raoult's Law

Material Stream Information

Hot Stream
Molar Flow Rate: 181.46776 mol/s
Mole Fraction (Styrene): 1
Mole Fraction (Toluene): 0
Pressure: 344737.24 Pa
Temperature: 422.03 K


Cold Stream
Molar Flow Rate: 170.93 mol/s
Mole Fraction (Styrene): 0
Mole Fraction (Toluene): 1
Pressure: 620527.03 Pa
Temperature: 310.93 K

Simulate a Heat Exchanger with above mentioned material streams as inlet streams. Find the outlet temperatures such that the overall heat transfer coefficient is 300 W/[m2.K] and amount of heat exchanged in 2.7 MW.


Problem Statement 2:

Component System: Water, N-Octane, N-Nonane and N-Decane
Thermodynamics: Raoult's Law

Material Stream Information

Hot Stream
Molar Flow Rate: 212.94371 mol/s
Mole Fraction (Water): 0
Mole Fraction (N-Octane): 0
Mole Fraction (N-Nonane): 0.1
Mole Fraction (N-Decane): 0.9
Pressure: 1116948.66 Pa
Temperature: 377.03889 K


Cold Stream
Molar Flow Rate: 3077.38424 mol/s
Mole Fraction (Water): 1
Mole Fraction (N-Octane): 0
Mole Fraction (N-Nonane): 1
Mole Fraction (N-Decane): 0
Pressure: 606737.54464 Pa
Temperature: 304.26111 K

Simulate a Heat Exchanger with above mentioned material streams as inlet streams. Find the outlet temperatures with the given shell and tube heat exchanger configuration.


This package is created to demnostrate the simualtion of a Heat Exchanger. Following models are created inside the package:
  1. MS (Non-executable model): created to extend the material stream along with the necessary thermodynamic package.
  2. HXSimulation (Executable model for Problem Statement 1): All the components are defined, material stream & Heat Exchanger specifications are declared, model instances are connected to make the file executable.
  3. ShellnTubeHXSimulation (Executable model for Problem Statement 2): All the components are defined, material stream & Shell and Tube Heat Exchanger specifications are declared, model instances are connected to make the file executable.
")); -end HeatExchanger; +end HeatExchanger; \ No newline at end of file diff --git a/Simulator/Examples/Mixer.mo b/Simulator/Examples/Mixer.mo index cc87efa..402366a 100644 --- a/Simulator/Examples/Mixer.mo +++ b/Simulator/Examples/Mixer.mo @@ -155,4 +155,4 @@ package Mixer "Example of Simulating a Mixer" Simulate a Mixer to mix the above six material streams into a single output material stream where the pressure of the outlet stream is calculated as average of the inlet streams.

This package is created to demnostrate the simualtion of a Mixer. Following models are created inside the package:
  1. ms (Non-executable model): created to extend the material stream along with the necessary thermodynamic package.
  2. mix (Executable model): All the components are defined, material stream & mixer specifications are declared, model instances are connected to make the file executable.

 

")); -end Mixer; +end Mixer; \ No newline at end of file diff --git a/Simulator/Examples/PFR.mo b/Simulator/Examples/PFR.mo index 61ab4c9..eed0d2b 100644 --- a/Simulator/Examples/PFR.mo +++ b/Simulator/Examples/PFR.mo @@ -51,4 +51,4 @@ package PFR "Example of Simulating a PFR" end PFRSimulation; annotation( Documentation(info = "
Following problem statement is simulated in this Plug Flow Reactor example

Component System: Ethylene Oxide, Water, Ethylene Glycol
Thermodynamics: Raoult's Law

Material Stream Information

Molar Flow Rate: 100 mol/s
Mole Fraction (Ethylene Oxide): 0.2
Mole Fraction (Water): 0.8
Mole Fraction (Ethylene Glycol): 0
Pressure: 100000 Pa
Temperature: 360 K

Simulate a plug flow reactor where Ethylene Oxide reacts with Water to form Ethylene Glycol. The conversion of ethylene oxide is 9.91%. Assume the reactor to be operated isothermally. Pressure drop across the PFR is 90.56 Pa.

This package is created to demnostrate the simualtion of a Plug Flow Reactor. Following models are created inside the package:
  1. MS (Non-executable model): created to extend the material stream along with the necessary thermodynamic package.
  2. PFRSimulation (Executable model): All the components are defined, material stream & plug flow reactor specifications are declared, model instances are connected to make the file executable.
")); -end PFR; +end PFR; \ No newline at end of file diff --git a/Simulator/Examples/ShortcutColumn.mo b/Simulator/Examples/ShortcutColumn.mo index cf7c219..84ad94f 100644 --- a/Simulator/Examples/ShortcutColumn.mo +++ b/Simulator/Examples/ShortcutColumn.mo @@ -71,4 +71,4 @@ package ShortcutColumn "Example of Simulating a Shortcut Column" annotation( Documentation(info = "
Following problem statement is simulated in this Shortcut Column example

Component System: Benzene, Toluene
Thermodynamics: Raoult's Law

Material Stream Information

Molar Flow Rate: 100 mol/s
Mole Fraction (Benzene): 0.5
Mole Fraction (Toluene): 0.5
Pressure: 101325 Pa
Temperature: 370 K

Simulate a shortcut column such that benzene mole fraction at bottoms is 0.01 and toluene mole fraction at distillate is 0.01. The column is operated at 101325 Pa. Use Reflux ratio of 2.

This package is created to demnostrate the simualtion of a Flash Column. Following models are created inside the package:
  1. MS (Non-executable model): created to extend the material stream along with the necessary thermodynamic package
  2. Shortcut (Non-executable model): created to extend the shortcut column along with the necessary thermodynamic package
  3. ShortcutSimulation (Executable model): All the components are defined, material stream & shortcut column specifications are declared, model instances are connected to make the file executable.
")); -end ShortcutColumn; +end ShortcutColumn; \ No newline at end of file diff --git a/Simulator/Files/ChemsepDatabase/Benzene.mo b/Simulator/Files/ChemsepDatabase/Benzene.mo index 73a5082..5c40a07 100644 --- a/Simulator/Files/ChemsepDatabase/Benzene.mo +++ b/Simulator/Files/ChemsepDatabase/Benzene.mo @@ -1,6 +1,6 @@ within Simulator.Files.ChemsepDatabase; -model Benzene +record Benzene extends Modelica.Icons.Record; extends GeneralProperties(SN = 125, name = "Benzene", CAS = "71-43-2", Tc = 562.05, Pc = 4895000, Vc = 0.256, Cc = 0.268, Tb = 353.24, Tm = 278.68, TT = 278.68, TP = 4764.22, MW = 78.114, LVB = 0.08941, AF = 0.209, SP = 18700, DM = 0, SH = -168070000.0, IGHF = 8.288E+07, GEF = 1.296E+08, AS = 269300, HFMP = 9866000, HOC = -3.136E+09, LiqDen = {105, 0.99938, 0.26348, 562.05, 0.27856, 0}, VP = {101, 88.368, -6712.9, -10.022, 0.000007694, 2}, LiqCp = {16, 111460, -1854.3, 22.399, -0.028936, 0.000028991}, HOV = {106, 4.881E+07, 0.61066, -0.25882, 0.032238, 0.022475}, VapCp = {16, 34010.24, -588.0978, 12.81777, -0.000197306, 5.142899E-08}, LiqVis = {101, -24.61, 1576.5, 2.1698, -0.0000051366, 2}, VapVis = {102, 3.1366E-08, 0.9675, 8.0285, -35.629, 0}, LiqK = {16, 0.049539, -177.97, 0.19475, -0.0073805, 0.0000027938}, VapK = {102, 0.0000049549, 1.4519, 154.14, 26202, 0}, Racketparam = 0.2696, UniquacR = 3.1878, UniquacQ = 2.4, ChaoSeadAF = 0.213, ChaoSeadSP = 18736.78, ChaoSeadLV = 0.0894); end Benzene; diff --git a/Simulator/Files/ChemsepDatabase/GeneralProperties.mo b/Simulator/Files/ChemsepDatabase/GeneralProperties.mo index 4e0f1c2..a249eeb 100644 --- a/Simulator/Files/ChemsepDatabase/GeneralProperties.mo +++ b/Simulator/Files/ChemsepDatabase/GeneralProperties.mo @@ -1,6 +1,6 @@ within Simulator.Files.ChemsepDatabase; -model GeneralProperties "Model to declare the variables for thermophysical properties" +record GeneralProperties "Model to declare the variables for thermophysical properties" extends Modelica.Icons.Record; parameter Integer SN "Serial Number"; parameter String name "Compound Name"; @@ -31,8 +31,8 @@ model GeneralProperties "Model to declare the variables for thermophysical prope parameter Real LiqCp[6] (each unit="J/kmol/K") "Liquid Heat Capacity Coefficients"; parameter Real HOV[6] (each unit="J/kmol") "Heat of Vaporization Coefficients"; parameter Real VapCp[6] (each unit="J/kmol/K") "Ideal Gas Heat Capacity Coefficients"; - parameter Real LiqVis[6] (each unit="Pa s") "Liquid Viscosity Coefficients"; - parameter Real VapVis[6] (each unit="Pa s") "Vapor Viscosity Coefficients"; + parameter Real LiqVis[6] (each unit="Pa.s") "Liquid Viscosity Coefficients"; + parameter Real VapVis[6] (each unit="Pa.s") "Vapor Viscosity Coefficients"; parameter Real LiqK[6] (each unit="W/m/K") "Liquid Thermal Conductivity Coefficients"; parameter Real VapK[6] (each unit="W/m/K") "Vapor Thermal Conductivity Coefficients"; parameter Real Racketparam (unit="-") "Racket Parameter"; diff --git a/Simulator/Files/ChemsepDatabase/Toluene.mo b/Simulator/Files/ChemsepDatabase/Toluene.mo index b70b061..731b65d 100644 --- a/Simulator/Files/ChemsepDatabase/Toluene.mo +++ b/Simulator/Files/ChemsepDatabase/Toluene.mo @@ -1,6 +1,6 @@ within Simulator.Files.ChemsepDatabase; -model Toluene +record Toluene extends Modelica.Icons.Record; extends GeneralProperties(SN = 140, name = "Toluene", CAS = "108-88-3", Tc = 591.75, Pc = 4108000, Vc = 0.316, Cc = 0.264, Tb = 383.79, Tm = 178.18, TT = 178.18, TP = 0.0475285, MW = 92.141, LVB = 0.10687, AF = 0.264, SP = 18250, DM = 1.2E-30, SH = -168070000.0, IGHF = 5.017E+07, GEF = 1.222E+08, AS = 320990, HFMP = 6636000, HOC = -3.734E+09, LiqDen = {105, 0.89799, 0.27359, 591.75, 0.30006, 0}, VP = {101, 32.89891, -5013.81, -1.348918, -1.869928E-06, 2}, LiqCp = {16, 28291, 48.171, 10.912, 0.0020542, 8.7875E-07}, HOV = {106, 5.3752E+07, 0.50341, 0.24755, -0.72898, 0.37794}, VapCp = {16, 47225, -565.85, 12.856, 0.000005535, -1.998E-08}, LiqVis = {101, -152.84, 5644.6, 22.826, -0.000040987, 2}, VapVis = {102, 8.5581E-07, 0.49514, 307.82, 1891.6, 0}, LiqK = {16, -0.072922, -23.153, -1.0277, -0.0017074, 3.6787E-07}, VapK = {102, 0.000006541, 1.4227, 190.97, 21890, 0}, Racketparam = 0.2646, UniquacR = 3.9228, UniquacQ = 2.968, ChaoSeadAF = 0.2591, ChaoSeadSP = 18245.86, ChaoSeadLV = 0.1068); end Toluene; diff --git a/Simulator/Files/Interfaces/enConn.mo b/Simulator/Files/Interfaces/enConn.mo index 64087be..c9168f0 100644 --- a/Simulator/Files/Interfaces/enConn.mo +++ b/Simulator/Files/Interfaces/enConn.mo @@ -2,6 +2,7 @@ within Simulator.Files.Interfaces; connector enConn "Connector to connect energy stream with unit operation" Real Q; + Integer Nc; annotation( Icon(coordinateSystem(initialScale = 0.1), graphics = {Rectangle(lineColor = {255, 0, 0}, fillColor = {255, 0, 0}, fillPattern = FillPattern.Solid, extent = {{-50, 50}, {50, -50}})})); end enConn; diff --git a/Simulator/Files/Models/Flash.mo b/Simulator/Files/Models/Flash.mo index c548260..955cf26 100644 --- a/Simulator/Files/Models/Flash.mo +++ b/Simulator/Files/Models/Flash.mo @@ -12,6 +12,14 @@ within Simulator.Files.Models; Real T(min = 0, start = Tg); Real Pbubl(start = Pmin, min = 0)"Bubble point pressure"; Real Pdew(start = Pmax, min = 0)"dew point pressure"; + Real gmabubl_c[Nc]; + Real philiqbubl_c[Nc]; + Real gmadew_c[Nc]; + Real phivapdew_c[Nc]; + Real K_c[Nc]; + Real Cpres_p[Nc]; + Real Hres_p[Nc]; + Real Sres_p[Nc]; extends GuessModels.InitialGuess; diff --git a/Simulator/Files/Models/ReactionManager/ConversionReaction.mo b/Simulator/Files/Models/ReactionManager/ConversionReaction.mo index d11f4f8..a87b3a7 100644 --- a/Simulator/Files/Models/ReactionManager/ConversionReaction.mo +++ b/Simulator/Files/Models/ReactionManager/ConversionReaction.mo @@ -5,6 +5,8 @@ within Simulator.Files.Models.ReactionManager; import Simulator.Files.*; import data = Simulator.Files.Chemsep_Database; //Number of Reactions involved in the process + parameter ChemsepDatabase.GeneralProperties C[Nc] "Component instances array" annotation(Dialog(tab = "Flash Specifications", group = "Component Parameters")); + parameter Integer Nc "Number of components" annotation(Dialog(tab = "Flash Specifications", group = "Component Parameters")); parameter Integer Nr "Number of reactions" annotation( Dialog(tab = "Reactions", group = "Conversion Reaction Parameters")); parameter Integer BC_r[Nr] "Base component in the reactions" annotation( diff --git a/Simulator/Files/Models/ReactionManager/EquilibriumReaction.mo b/Simulator/Files/Models/ReactionManager/EquilibriumReaction.mo index 8fa80c7..c271d04 100644 --- a/Simulator/Files/Models/ReactionManager/EquilibriumReaction.mo +++ b/Simulator/Files/Models/ReactionManager/EquilibriumReaction.mo @@ -23,10 +23,10 @@ model EquilibriumReaction "Model of an equilibrium reaction used in equilibrium //Returns whether the specified stoichiometry is correct Real Hf_c[Nc]; Real Hr_r[Nr]; - + Integer BC_r[Nr]; //Equilibrium Constant - Real K[Nr](start=xliqg); + Real K[Nr](each start=xliqg); Real N[Nr](each start= Fg),D[Nr](each start=Fg); extends Simulator.GuessModels.InitialGuess; diff --git a/Simulator/Files/Models/ReactionManager/KineticReaction.mo b/Simulator/Files/Models/ReactionManager/KineticReaction.mo index 628e86d..6d6fb38 100644 --- a/Simulator/Files/Models/ReactionManager/KineticReaction.mo +++ b/Simulator/Files/Models/ReactionManager/KineticReaction.mo @@ -4,8 +4,8 @@ within Simulator.Files.Models.ReactionManager; //=================================================================================================== import Simulator.Files.*; import data = Simulator.Files.Chemsep_Database; - // parameter ChemsepDatabase.GeneralProperties C[Nc]; - // parameter Integer Nc; + parameter ChemsepDatabase.GeneralProperties C[Nc]; + parameter Integer Nc; parameter Integer Nr "Number of reactions" annotation (Dialog(tab = "Reactions", group = "Kinetic Reaction Parameters")); parameter Integer BC_r[Nr] "Base component of reactions" annotation(Dialog(tab = "Reactions", group = "Kinetic Reaction Parameters")); // parameter Integer Comp annotation( diff --git a/Simulator/Files/ThermodynamicFunctions/DensityRacket.mo b/Simulator/Files/ThermodynamicFunctions/DensityRacket.mo index 15a2c77..0ce1473 100644 --- a/Simulator/Files/ThermodynamicFunctions/DensityRacket.mo +++ b/Simulator/Files/ThermodynamicFunctions/DensityRacket.mo @@ -2,7 +2,6 @@ within Simulator.Files.ThermodynamicFunctions; function DensityRacket extends Modelica.Icons.Function; - input Integer Nc; input Real T; input Real P; input Real Pc_c[Nc]; @@ -12,8 +11,9 @@ within Simulator.Files.ThermodynamicFunctions; input Real MW_c[Nc]; input Real Psat[Nc]; output Real rho_c[Nc]; - parameter Real R = 83.14; protected + parameter Real R = 83.14; + parameter Integer Nc; Real Tr_c[Nc], Pcbar_c[Nc], temp[Nc], Tcor_c[Nc], a, b, c_c[Nc], d, e_c[Nc], Beta_c[Nc], f, g, h, j, k, RPnew_c[Nc]; algorithm for i in 1:Nc loop diff --git a/Simulator/Files/ThermodynamicFunctions/PoyntingCF.mo b/Simulator/Files/ThermodynamicFunctions/PoyntingCF.mo index d59e3fa..c85a460 100644 --- a/Simulator/Files/ThermodynamicFunctions/PoyntingCF.mo +++ b/Simulator/Files/ThermodynamicFunctions/PoyntingCF.mo @@ -2,7 +2,7 @@ within Simulator.Files.ThermodynamicFunctions; function PoyntingCF "Function to compute the Poynting Correction Factor" extends Modelica.Icons.Function; - import Simulator.Files.Thermodynamic_Functions.*; + import Simulator.Files.ThermodynamicFunctions.*; input Integer Nc; input Real Pc, Tc, RP, AF, MW; input Real T, P; diff --git a/Simulator/Files/ThermodynamicPackages/GraysonStreed.mo b/Simulator/Files/ThermodynamicPackages/GraysonStreed.mo index 5fbc14b..e646bc0 100644 --- a/Simulator/Files/ThermodynamicPackages/GraysonStreed.mo +++ b/Simulator/Files/ThermodynamicPackages/GraysonStreed.mo @@ -4,7 +4,7 @@ within Simulator.Files.ThermodynamicPackages; //==================================================================== //Header Files and Parameters - import Simulator.Files.Thermodynamic_Functions.*; + import Simulator.Files.ThermodynamicFunctions.*; parameter Real R = 8.314; parameter Real u = 1; import Simulator.Files.*; diff --git a/Simulator/Files/ThermodynamicPackages/NRTL.mo b/Simulator/Files/ThermodynamicPackages/NRTL.mo index cf4eba1..b50c348 100644 --- a/Simulator/Files/ThermodynamicPackages/NRTL.mo +++ b/Simulator/Files/ThermodynamicPackages/NRTL.mo @@ -1,7 +1,15 @@ within Simulator.Files.ThermodynamicPackages; model NRTL - import Simulator.Files.Thermodynamic_Functions.*; + import Simulator.Files.ThermodynamicFunctions.*; + import data = Simulator.Files.ChemsepDatabase; + + parameter Integer Nc; + parameter Simulator.Files.ChemsepDatabase.GeneralProperties C[Nc]; + + Real x_pc[Nc, Nc], Pdew; + Real T(unit = "K"), P; + Simulator.Files.Models.gammaNRTL Gma(Nc = Nc, C = C, x_c = x_pc[2, :], T = T), GmaDew(Nc = Nc, C = C, x_c = xliqdew_c, T = T), GmaBubl(Nc = Nc, C = C, x_c = x_pc[1, :], T = T); Real xliqdew_c[Nc], rho_c[Nc]; Real Cpres_p[3] "residual specific heat", Hres_p[3] "residual enthalpy", Sres_p[3] "residual Entropy", K_c[Nc], gma_c[Nc](each start = 1), gmabubl_c[Nc](each start = 1), gmadew_c[Nc](each start = 1); diff --git a/Simulator/Files/ThermodynamicPackages/RaoultsLaw.mo b/Simulator/Files/ThermodynamicPackages/RaoultsLaw.mo index ff3d394..6132535 100644 --- a/Simulator/Files/ThermodynamicPackages/RaoultsLaw.mo +++ b/Simulator/Files/ThermodynamicPackages/RaoultsLaw.mo @@ -1,10 +1,14 @@ within Simulator.Files.ThermodynamicPackages; model RaoultsLaw - import Simulator.Files.Thermodynamic_Functions.*; + import Simulator.Files.ThermodynamicFunctions.*; + import data = Simulator.Files.ChemsepDatabase; + parameter Integer Nc; + parameter Simulator.Files.ChemsepDatabase.GeneralProperties C[Nc]; Real K_c[Nc](each min = 0), Cpres_p[3], Hres_p[3], Sres_p[3]; Real gma_c[Nc], gmabubl_c[Nc], gmadew_c[Nc]; Real philiqbubl_c[Nc], phivapdew_c[Nc], Pvap_c[Nc]; + Real T(unit = "K"), P; equation for i in 1:Nc loop gma_c[i] = 1; @@ -19,7 +23,7 @@ within Simulator.Files.ThermodynamicPackages; for j in 1:Nc loop K_c[j] = Pvap_c[j] / P; end for; - Cpres_p[:] = zeros(3); - Hres_p[:] = zeros(3); - Sres_p[:] = zeros(3); + Cpres_p[:] = fill(0.0, 3); + Hres_p[:] = fill(0.0, 3); + Sres_p[:] = fill(0.0, 3); end RaoultsLaw; diff --git a/Simulator/GuessModels/InitialGuess.mo b/Simulator/GuessModels/InitialGuess.mo index a52288b..ee0c81c 100644 --- a/Simulator/GuessModels/InitialGuess.mo +++ b/Simulator/GuessModels/InitialGuess.mo @@ -3,11 +3,13 @@ within Simulator.GuessModels; model InitialGuess //Inputs Required to generate Guess Values - extends GuessInput; - //========================================================================================== - //Guess variables for Pressures and Temperatures + extends GuessInput; + + import data = Simulator.Files.ChemsepDatabase; + parameter input Integer Nc; + parameter data.GeneralProperties C[Nc]; protected - parameter Real xguess[Nc](each fixed = false); + parameter Real xguess[Nc](each fixed = false); parameter Real Tg(fixed = false); parameter Real Temp(fixed = false, start = 300); parameter Real Pxc[Nc](each fixed = false), Pxm[Nc](each fixed = false); @@ -82,8 +84,8 @@ model InitialGuess end if; Alpha = 1 - Beta; for i in 1:Nc loop - if xguess[i] <> 0 then - if Beta > 0 and Beta <> 1 then + if xguess[i] < 0 and xguess[i] > 0 then + if Beta > 0 and Beta < 1 and Beta > 1 then ymol[i] = xguess[i] * K_guess[i] / ((K_guess[i] - 1) * xvapg + 1); elseif Beta == 1 then ymol[i] = xguess[i]; diff --git a/Simulator/Streams/MaterialStream.mo b/Simulator/Streams/MaterialStream.mo index a781907..94db2d9 100644 --- a/Simulator/Streams/MaterialStream.mo +++ b/Simulator/Streams/MaterialStream.mo @@ -4,8 +4,9 @@ model MaterialStream "Model representing Material Stream" //1 - Mixture, 2 - Liquid phase, 3 - Gas Phase extends Simulator.Files.Icons.MaterialStream; import Simulator.Files.*; - parameter Integer Nc "Number of components" annotation( - Dialog(tab = "Stream Specifications", group = "Component Parameters")); + parameter Real Cpres_p[3], Hres_p[3], Sres_p[3], gmabubl_c[Nc], philiqbubl_c[Nc], gmadew_c[Nc], phivapdew_c[Nc], K_c[Nc]; + /*parameter Integer Nc "Number of components" annotation( + Dialog(tab = "Stream Specifications", group = "Component Parameters"));*/ parameter Simulator.Files.ChemsepDatabase.GeneralProperties C[Nc] "Component instances array" annotation( Dialog(tab = "Stream Specifications", group = "Component Parameters")); Real P(unit = "Pa", min = 0, start = Pg) "Pressure"; @@ -23,12 +24,12 @@ model MaterialStream "Model representing Material Stream" Real xm_pc[3, Nc](each unit ="-", start={xguess,xg,yg}, each min = 0, each max = 1) "Component mass fraction in phase"; Real F_pc[3, Nc](each unit = "mol/s", each start = Fg, each min = 0) "Component molar flow in phase"; Real Fm_pc[3, Nc](each unit = "kg/s", each min = 0, each start = Fg) "Component mass flow in phase"; - Real Cp_p[3](each unit = "kJ/[kmol.K]",start={Hmixg,Hliqg,Hvapg}) "Phase molar specific heat"; - Real Cp_pc[3, Nc](each unit = "kJ/[kmol.K]") "Component molar specific heat in phase"; + Real Cp_p[3](each unit = "kJ/kmol.K",start={Hmixg,Hliqg,Hvapg}) "Phase molar specific heat"; + Real Cp_pc[3, Nc](each unit = "kJ/kmol.K") "Component molar specific heat in phase"; Real H_p[3](each unit = "kJ/kmol",start={Hmixg,Hliqg,Hvapg}) "Phase molar enthalpy"; Real H_pc[3, Nc](each unit = "kJ/kmol") "Component molar enthalpy in phase"; - Real S_p[3](each unit = "kJ/[kmol.K]") "Phase molar entropy"; - Real S_pc[3, Nc](each unit = "kJ/[kmol.K]") "Component molar entropy in phase"; + Real S_p[3](each unit = "kJ/kmol.K") "Phase molar entropy"; + Real S_pc[3, Nc](each unit = "kJ/kmol.K") "Component molar entropy in phase"; Simulator.Files.Interfaces.matConn In(Nc = Nc) annotation( Placement(visible = true, transformation(origin = {-100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); Simulator.Files.Interfaces.matConn Out(Nc = Nc) annotation( diff --git a/Simulator/UnitOperations/AbsorptionColumn/AbsCol.mo b/Simulator/UnitOperations/AbsorptionColumn/AbsCol.mo index 48142e5..6e60313 100644 --- a/Simulator/UnitOperations/AbsorptionColumn/AbsCol.mo +++ b/Simulator/UnitOperations/AbsorptionColumn/AbsCol.mo @@ -18,6 +18,7 @@ model AbsCol "Model of an absorption column representing fractionating towers wh Placement(visible = true, transformation(origin = {100, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {250, 300}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); Simulator.Files.Interfaces.matConn Out_Bot(Nc = Nc) annotation( Placement(visible = true, transformation(origin = {100, -80}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {250, -300}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + Simulator.Examples.Absorption.Tray tray[Nt]; equation //connector equation tray[1].Fliq_s[1] = In_Top.F; diff --git a/Simulator/UnitOperations/AbsorptionColumn/AbsTray.mo b/Simulator/UnitOperations/AbsorptionColumn/AbsTray.mo index dcdf2bf..d63150e 100644 --- a/Simulator/UnitOperations/AbsorptionColumn/AbsTray.mo +++ b/Simulator/UnitOperations/AbsorptionColumn/AbsTray.mo @@ -8,12 +8,18 @@ model AbsTray "Model of a tray used in absorption column" Real T(min = 0, start = Tg); Real Fvap_s[2](each min = 0, start={Fg,Fg}); Real Fliq_s[2](each min = 0, start={Fliqg,Fliqg}); - Real xvap_sc[2, Nc](each min = 0, each max = 1, start=xvapg); - Real xliq_sc[2, Nc](each min = 0, each max = 1, start=xliqg); + Real xvap_sc[2, Nc](each min = 0, each max = 1, each start=xvapg); + Real xliq_sc[2, Nc](each min = 0, each max = 1, each start=xliqg); Real Hvap_s[2](start={Hvapg,Hvapg}), Hliq_s[2](start={Hliqg,Hliqg}), Hvapout_c[Nc], Hliqout_c[Nc]; - Real x_pc[3, Nc](each min =0, each max = 0,start=xliqg); + Real x_pc[3, Nc](each min =0, each max = 0, each start=xliqg); Real Pdew(min = 0, start =Pmax); Real Pbubl(min = 0, start =Pmin); + Real gmabubl_c[Nc]; + Real philiqbubl_c[Nc]; + Real gmadew_c[Nc]; + Real phivapdew_c[Nc]; + Real K_c[Nc]; + Real Hres_p[Nc]; Simulator.Files.Interfaces.trayConn In_Liq(Nc = Nc) annotation( Placement(visible = true, transformation(origin = {-50, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-50, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); diff --git a/Simulator/UnitOperations/ConversionReactor.mo b/Simulator/UnitOperations/ConversionReactor.mo index 1381147..9150311 100644 --- a/Simulator/UnitOperations/ConversionReactor.mo +++ b/Simulator/UnitOperations/ConversionReactor.mo @@ -9,6 +9,7 @@ model ConversionReactor "Model of a conversion reactor to calculate the outlet s Dialog(tab = "Reactor Specifications", group = "Component Parameters")); parameter Integer Nc "Number of components" annotation( Dialog(tab = "Reactor Specifications", group = "Component Parameters")); + parameter Integer Nr "Number of Reactions"; parameter String CalcMode = "Isothermal" "Required mode of operation: ''Isothermal'', ''Define_Out_Temperature'', ''Adiabatic''" annotation( Dialog(tab = "Reactor Specifications", group = "Calculation Parameters")); parameter Real Tdef(unit = "K") = 300 "Defined outlet temperature, applicable if Define_Out_Temperature mode is chosen" annotation( @@ -31,6 +32,10 @@ model ConversionReactor "Model of a conversion reactor to calculate the outlet s Real Pout(unit = "Pa", min = 0, start =Pg) "Outlet stream pressure"; Real Tout(unit = "K", min = 0, start = Tg) "Outlet stream temperature"; Real Fout_cr[Nc, Nr](each unit = "mol/s") "Molar flor rate of components after each reaction"; + + Real Coef_cr[Nc, Nr]; + Integer BC_r[Nr]; + Real Hr_r[Nr]; //============================================================================= //Instanstiation of Connectors Simulator.Files.Interfaces.matConn In(Nc = Nc) annotation( diff --git a/Simulator/UnitOperations/DistillationColumn/DistCol.mo b/Simulator/UnitOperations/DistillationColumn/DistCol.mo index 106c2bd..8d834ad 100644 --- a/Simulator/UnitOperations/DistillationColumn/DistCol.mo +++ b/Simulator/UnitOperations/DistillationColumn/DistCol.mo @@ -22,6 +22,7 @@ within Simulator.UnitOperations.DistillationColumn; parameter String Ctype = "Total" "Condenser type: ''Total'' or ''Partial''" annotation( Dialog(tab = "Column Specifications", group = "Calculation Parameters")); + Simulator.Examples.Distillation.Condenser condenser; Real RR(min = 0); Simulator.Files.Interfaces.matConn In_s[Ni](each Nc = Nc) annotation( Placement(visible = true, transformation(origin = {-248, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-250, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); diff --git a/Simulator/UnitOperations/Flash.mo b/Simulator/UnitOperations/Flash.mo index 9a527c8..b2f9bbf 100644 --- a/Simulator/UnitOperations/Flash.mo +++ b/Simulator/UnitOperations/Flash.mo @@ -33,6 +33,15 @@ model Flash "Model of a flash column to separate vapor and liquid phases from a Real S_p[3](each unit = "kJ/[kmol.K]") "Molar entropy in phase"; Real xliq(unit = "-", min = 0, max = 1, start = xliqg)"Liquid phase mole fraction"; Real xvap(unit = "-", min = 0, max = 1, start = xvapg) "Vapor phase mole fraction"; + + Real gmabubl_c[Nc]; + Real philiqbubl_c[Nc]; + Real gmadew_c[Nc]; + Real phivapdew_c[Nc]; + Real K_c[Nc]; + Real Cpres_p[Nc]; + Real Hres_p[Nc]; + Real Sres_p[Nc]; //=============================================================================== //Instantiation of Connectors Simulator.Files.Interfaces.matConn In(Nc = Nc) annotation( diff --git a/Simulator/UnitOperations/HeatExchanger.mo b/Simulator/UnitOperations/HeatExchanger.mo index e60093e..73ed776 100644 --- a/Simulator/UnitOperations/HeatExchanger.mo +++ b/Simulator/UnitOperations/HeatExchanger.mo @@ -1,9 +1,10 @@ within Simulator.UnitOperations; model HeatExchanger "Model of a heat exchanger used for two streams heat exchange" - extends Simulator.Files.Icons.HeatExchanger; + extends Simulator.Files.Icons.HeatExchanger; + extends GuessModels.InitialGuess; import Simulator.Files.*; - import Simulator.Files.Thermodynamic_Functions.*; + import Simulator.Files.ThermodynamicFunctions.*; parameter Simulator.Files.ChemsepDatabase.GeneralProperties C[Nc] "Component instances array" annotation( Dialog(tab = "Heat Exchanger Specifications", group = "Component Parameters")); parameter Integer Nc "Number of components" annotation( @@ -50,16 +51,16 @@ model HeatExchanger "Model of a heat exchanger used for two streams heat exchang //Cold Stream Inlet Real Pcin(unit = "Pa", start=Pg) "Cold inlet stream pressure"; Real Tcin(unit = "K", start=Tg) "Cold inlet stream temperature"; - Real Fcin[1](unit = "mol/s", start=Fg) "Cold inlet stream molar flow rate"; + Real Fcin[1](each unit = "mol/s", each start=Fg) "Cold inlet stream molar flow rate"; Real Hcin(unit = "kJ/kmol", start=Htotg) "Cold inlet stream molar enthalpy"; Real Scin(unit = "kJ/[kmol.K]") "Cold inlet stream molar entropy"; - Real xcin_pc[2, Nc](unit = "-") "Cold inlet stream component mole fraction"; + Real xcin_pc[2, Nc](each unit = "-") "Cold inlet stream component mole fraction"; Real xvapcin(unit = "-", start=xvapg) "Cold inlet stream vapor phase mole fraction"; //Cold Stream Outlet Real Pcout(unit = "Pa", start=Pg) "Cold outlet stream pressure"; Real Tcout(unit = "K", start=Tg)"Cold outlet stream temperature"; Real couttT(unit = "K", start=Tg) ; - Real Fcout[1](unit = "mol/s", start=Fg) "Cold outlet stream molar flow rate"; + Real Fcout[1](each unit = "mol/s", each start=Fg) "Cold outlet stream molar flow rate"; Real Hcout(unit = "kJ/kmol", start=Htotg) "Cold outlet stream molar enthalpy"; Real Scout(unit = "kJ/kmol.K") "Cold outlet stream molar entropy"; Real xcout_pc[2, Nc](each unit = "-", start={xg,xg}) "Cold outlet stream component mole fraction"; @@ -277,7 +278,6 @@ model HeatExchanger "Model of a heat exchanger used for two streams heat exchang parameter Real F =0.9828; parameter Real m = 0.96; //=========================================================================================================== - extends GuessModels.InitialGuess; equation //Hot Stream Inlet In_Hot.P = Phin; @@ -724,7 +724,7 @@ Cph_pc[2, i] = ThermodynamicFunctions.LiqCpId(C[i].LiqCp, Thin); Cph_pc[3, i] = ThermodynamicFunctions.VapCpId(C[i].VapCp, Thin); end for; //================================================================================================== - for i in 2:3 loop + for i in 1:2 loop Cph_p[i] = sum(xhin_pc[i, :] .* Cph_pc[i, :]); end for; Cph_p[1] = (1-xvaphin) * Cph_p[2] + xvaphin * Cph_p[3]; @@ -737,7 +737,7 @@ Cpc_pc[2, i] = ThermodynamicFunctions.LiqCpId(C[i].LiqCp, Tcin); Cpc_pc[3, i] = ThermodynamicFunctions.VapCpId(C[i].VapCp, Tcin); end for; - for i in 2:3 loop + for i in 1:2 loop Cpc_p[i] = sum(xcin_pc[i, :] .* Cpc_pc[i, :]); end for; Cpc_p[1] = (1-xvapcin) * Cpc_p[2] + xvapcin * Cpc_p[3]; diff --git a/Simulator/UnitOperations/Mixer.mo b/Simulator/UnitOperations/Mixer.mo index 7f52dc8..ba22095 100644 --- a/Simulator/UnitOperations/Mixer.mo +++ b/Simulator/UnitOperations/Mixer.mo @@ -10,7 +10,7 @@ model Mixer "Model of a mixer to mix multiple material streams" parameter Integer NI = 6 "Number of inlet streams" annotation( Dialog(tab = "Mixer Specifications", group = "Calculation Parameters")); - Real Pin[NI](unit = "Pa", min = 0, start = Pg) "Inlet stream pressure"; + Real Pin[NI](each unit = "Pa", each min = 0, each start = Pg) "Inlet stream pressure"; Real xin_sc[NI, Nc](each unit = "-", each min = 0, each max = 1) "Inlet stream component mol fraction"; Real Fin_s[NI](each unit = "mol/s", each min = 0, each start = Fg) "Inlet stream Molar Flow"; Real Hin_s[NI](each unit = "kJ/kmol") "Inlet stream molar enthalpy"; diff --git a/Simulator/UnitOperations/PFR/Integral.mo b/Simulator/UnitOperations/PFR/Integral.mo index 8868634..74617df 100644 --- a/Simulator/UnitOperations/PFR/Integral.mo +++ b/Simulator/UnitOperations/PFR/Integral.mo @@ -3,8 +3,7 @@ within Simulator.UnitOperations.PFR; function Integral "Function to define the integral part used in the performance equation of a plug floiw reactor" extends Modelica.Math.Nonlinear.Interfaces.partialScalarFunction; - input Integer Nc; - input Integer Nr; + input Integer Base_comp; input Real Co_dummy[Nc - 1]; input Real DO_dummy[Nc - 1, Nr]; @@ -17,7 +16,10 @@ within Simulator.UnitOperations.PFR; input Real Bc[Nr]; input Real Fao; input Real k; + protected Real Rate; + parameter Integer Nc; + parameter Integer Nr; algorithm Rate := 1; for i in 2:Nc loop diff --git a/Simulator/UnitOperations/ShortcutColumn.mo b/Simulator/UnitOperations/ShortcutColumn.mo index d841d1d..9aa39e0 100644 --- a/Simulator/UnitOperations/ShortcutColumn.mo +++ b/Simulator/UnitOperations/ShortcutColumn.mo @@ -28,7 +28,7 @@ model ShortcutColumn "Model of a shortcut column to calculate minimum reflux in Real Ntmin(unit = "-", min = 0, start = 10) "Minimum Number of trays"; Real RRmin(unit = "-", start = 1) "Minimum Reflux Ratio"; - Real alpha_c[Nc](unit = "-") "Relative Volatility"; + Real alpha_c[Nc](each unit = "-") "Relative Volatility"; Real theta(unit = "-", start = 1) "Fraction"; Real T(start=Tg) "Thermodynamic Adjustment", P(start=Pg) "Thermodynamic Adjustment"; Real Tcond(unit = "K", start = max(C[:].Tb), min = 0)"Condenser temperature"; @@ -42,6 +42,13 @@ model ShortcutColumn "Model of a shortcut column to calculate minimum reflux in Real Hliqcond_c[Nc](each unit = "kJ/kmol") "Component enthalpy of vapor in condenser"; Real xliqcond_c[Nc](each unit = "-", each min = 0, each max = 1, start = xg)"Component mole fraction in liquid phase in condenser"; Real xvapcond_c[Nc](each unit = "-", each min = 0, each max = 1, start = yg)"Component mole fraction in vapor phase in condenser"; + Real K_c[Nc]; + Real gmabubl_c[Nc]; + Real philiqbubl_c[Nc]; + Real gmadew_c[Nc]; + Real phivapdew_c[Nc]; + Real gma_c[Nc]; + Real K[Nc]; Real Pdew(unit = "Pa", min = 0, start = Pmax)"Dew point pressure"; Real Pbubl(unit = "Pa", min = 0, start = Pmin)"Bubble point pressure"; diff --git a/Simulator/UnitOperations/Splitter.mo b/Simulator/UnitOperations/Splitter.mo index e4e623c..853052e 100644 --- a/Simulator/UnitOperations/Splitter.mo +++ b/Simulator/UnitOperations/Splitter.mo @@ -26,8 +26,8 @@ model Splitter "Model of a splitter to split one material stream into multiple o Real Pout_s[No](each unit = "Pa", each min = 0, each start = Pg) "Outlet Pressure"; Real Tout_s[No](each unit = "K", each min = 0, each start = Tg) "Outlet Temperature"; Real xout_sc[No, Nc](each unit = "-", each min = 0, each max = 1) "Outlet Mixture Molar Fraction"; - Real Fout_c[No](each unit = "mol/s", each min = 0, start = Fg) "Outlet Mixture Molar Flow"; - Real Fmout_c[No](each unit = "kg/s", each min = 0, start = Fg) "Outlet Mixture Mass Flow"; + Real Fout_c[No](each unit = "mol/s", each min = 0, each start = Fg) "Outlet Mixture Molar Flow"; + Real Fmout_c[No](each unit = "kg/s", each min = 0, each start = Fg) "Outlet Mixture Mass Flow"; //============================================================================== //Instantiation of Connectors Simulator.Files.Interfaces.matConn In(Nc = Nc) annotation(