Difference between revisions of "DWSIM/C3/Custom-Unit-Operation-using-Scilab/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with " {|border=1 ||'''Visual Cue''' ||'''Narration''' |- ||'''Slide Number 1''' Title Slide''' ||Welcome to this tutorial on simulating a '''Custom Unit Operation''' using '''...")
 
 
(2 intermediate revisions by one other user not shown)
Line 87: Line 87:
  
  
'''Molar flow rate '''and '''Molar enthalpy '''from a '''Mixer''' model created using '''Scilab'''.  
+
'''Molar flow rate '''and '''Molar enthalpy '''from a '''Mixer model''' created using '''Scilab'''.  
 
|-  
 
|-  
 
|| '''Slide Number 8'''  
 
|| '''Slide Number 8'''  
Line 126: Line 126:
  
 
Mass flow: 20 kg/s  
 
Mass flow: 20 kg/s  
|| Here we give '''Inlet Stream Conditions''' of the product stream'''.'''  
+
|| Here we give '''Inlet Stream Conditions''' of the '''product stream'''.
  
  
Line 142: Line 142:
  
 
Right-click on '''DWSIM (Classic UI)''' and click '''Run as Administrator.'''  
 
Right-click on '''DWSIM (Classic UI)''' and click '''Run as Administrator.'''  
 
|-
 
||'''User Control Window >> Yes '''
 
||Click '''Yes''' on '''User Access Control''' window.
 
 
   
 
   
 
|-  
 
|-  
 
|| Point to '''Welcome to DWSIM''' window  
 
|| Point to '''Welcome to DWSIM''' window  
 
|| '''Welcome to DWSIM''' window opens.  
 
|| '''Welcome to DWSIM''' window opens.  
 
  
 
Close this window.  
 
Close this window.  
Line 198: Line 193:
  
 
Double click on '''Raoult’s Law '''  
 
Double click on '''Raoult’s Law '''  
||From '''Available Property Package''' list, double-click on '''Raoult’s Law.'''  
+
||From '''Available Property Packages''' list, double-click on '''Raoult’s Law.'''  
  
 
|-  
 
|-  
 
||Click on '''Next.'''  
 
||Click on '''Next.'''  
||Then click on the '''Next '''button.  
+
||Then click on the '''Next '''button at the bottom.  
  
 
|-  
 
|-  
Line 218: Line 213:
 
|-  
 
|-  
 
||Click on '''Maximize''' button.  
 
||Click on '''Maximize''' button.  
||Let us now maximize the simulation window.  
+
||Let us maximize the simulation window.  
  
 
|-  
 
|-  
Line 227: Line 222:
 
|-  
 
|-  
 
||Point to '''Streams.'''  
 
||Point to '''Streams.'''  
||Go to '''Streams '''tab, at the bottom of the main simulation.  
+
||Go to '''Streams '''tab, at the bottom of the '''main simulation'''.  
  
 
|-  
 
|-  
||Click and drag '''Material '''Streams''' '''to the flowsheet  
+
||Click and drag '''Material Streams''' to the flowsheet  
 
||From the displayed list, drag and drop three '''Material Streams''' to the '''Flowsheet'''.  
 
||From the displayed list, drag and drop three '''Material Streams''' to the '''Flowsheet'''.  
  
 
|-  
 
|-  
 
||Click '''MSTR-000'''  
 
||Click '''MSTR-000'''  
||Click on the first material stream named as '''MSTR-000'''  
+
||Click on the first '''material stream''' named as '''MSTR-000'''  
  
 
|-  
 
|-  
Line 302: Line 297:
 
|-  
 
|-  
 
||Click '''Accept Changes '''button  
 
||Click '''Accept Changes '''button  
||On the right, click on '''Accept Changes''' button.  
+
||On the right, click on the '''Accept Changes''' button.  
  
 
|-  
 
|-  
Line 367: Line 362:
 
|-  
 
|-  
 
||Click '''Accept Changes '''button.  
 
||Click '''Accept Changes '''button.  
||On the right, click on '''Accept Changes''' button.  
+
||On the right, click on the '''Accept Changes''' button.  
  
 
|-  
 
|-  
Line 428: Line 423:
 
|-  
 
|-  
 
||Click '''Accept Changes '''button.  
 
||Click '''Accept Changes '''button.  
||On the right side, click on '''Accept Changes''' button.  
+
||On the right side, click on the '''Accept Changes''' button.  
  
 
|-  
 
|-  
Line 436: Line 431:
 
|-  
 
|-  
 
||Click and Drag '''Material Stream '''to the flowsheet  
 
||Click and Drag '''Material Stream '''to the flowsheet  
||To do that, let us drag one '''material stream '''to the flowsheet.  
+
||To do that, let us drag one '''material stream '''to the '''flowsheet'''.  
  
 
|-  
 
|-  
 
||  
 
||  
||Let us arrange the '''streams'''.  
+
||Let us arrange the '''stream'''.  
  
 
|-  
 
|-  
Line 513: Line 508:
 
|-  
 
|-  
 
||Click on '''Close '''button.  
 
||Click on '''Close '''button.  
||Click on '''Close '''button at the bottom.  
+
||Click on the '''Close '''button at the bottom.  
  
 
|-  
 
|-  
 
||Point to '''Property Editor Window'''  
 
||Point to '''Property Editor Window'''  
||Go to the '''Property Editor Window'''.  
+
||Go to '''Property Editor Window'''.  
  
 
|-  
 
|-  
Line 550: Line 545:
  
 
Select '''Mixed Product.'''  
 
Select '''Mixed Product.'''  
||Click on the drop-down against '''Product 1 '''and  
+
||Click on the drop-down against '''Product 1 '''and select '''Mixed Product.'''  
 
+
select '''Mixed Product.'''  
+
  
 
|-  
 
|-  
 
||Point to all the connections.  
 
||Point to all the connections.  
||All the connections now are complete.  
+
||All the connections now are completed.  
  
  
Line 588: Line 581:
  
  
This is to read the '''molar flow rate''' of the '''compounds''' from the '''inlet material '''streams.  
+
This is to read the '''molar flow rate''' of the '''compounds''' from the '''inlet material streams'''.  
  
 
|-  
 
|-  
 
||Cursor to '''f1, f2''' and '''f3 '''variables.  
 
||Cursor to '''f1, f2''' and '''f3 '''variables.  
||Here,''' f1, f2''' and '''f3 '''are the variables.  
+
||Here,''' f1, f2''' and '''f3 '''are the '''variables'''.  
  
  
They store '''molar flow rate''' of the '''compounds''' from the '''input material''' streams.  
+
They store '''molar flow rate''' of the '''compounds''' from the '''inlet material streams'''.  
  
 
|-  
 
|-  
 
||Cursor to '''getFeedProp '''command  
 
||Cursor to '''getFeedProp '''command  
||'''getFeedProp''' is the command used to read the specified '''feed property'''.  
+
||'''getFeedProp''' is the '''command''' used to read the specified '''feed property'''.  
  
 
|-  
 
|-  
 
||Cursor to '''1, 2''' and '''3''' feed port numbers  
 
||Cursor to '''1, 2''' and '''3''' feed port numbers  
||'''1, 2''' and '''3''' are the '''feed port numbers''' in '''SciLab''' to which the '''material '''streams in '''DWSIM''' is connected.  
+
||'''1, 2''' and '''3''' are the '''feed port numbers''' in '''SciLab''' to which the '''material streams''' in '''DWSIM''' is connected.  
  
 
|-  
 
|-  
 
||Cursor to '''flow''' keyword  
 
||Cursor to '''flow''' keyword  
||'''flow''' is the keyword.  
+
||'''flow''' is the '''keyword'''.  
  
  
'''flow''' indicates that '''components''' in the streams, has to be stored in''' f1,f2,f3''' in form of an '''array'''.  
+
'''flow''' indicates that '''components''' in the '''streams''', has to be stored in''' f1,f2,f3''' in form of an '''array'''.  
  
 
|-  
 
|-  
Line 624: Line 617:
  
  
This is to read the '''molar enthalpy''' of the '''inlet '''streams from the added '''inlet material '''stream.  
+
This is to read the '''molar enthalpy''' of the '''inlet streams''' from the added '''inlet material stream'''.  
  
  
Here, variables''' h1, h2''' and '''h3''' store the '''molar enthalpy''' of the added '''input material''' streams'''.'''
+
Here, variables''' h1, h2''' and '''h3''' store the '''molar enthalpy''' of the added '''input material streams'''.  
  
 
|-  
 
|-  
 
||Cursor to '''enthalpy''' keyword  
 
||Cursor to '''enthalpy''' keyword  
||'''enthalpy''' is the keyword.  
+
||'''enthalpy''' is the '''keyword'''.  
  
  
It indicate that '''molar enthalpy''' of '''material '''streams has to be stored in '''h1, h2''' and '''h3'''.  
+
It indicate that '''molar enthalpy''' of '''material streams''' has to be stored in '''h1, h2''' and '''h3'''.  
  
 
|-  
 
|-  
Line 648: Line 641:
  
  
This is to read the '''pressure''' of the '''inlet''' streams from the added '''inlet material '''stream.  
+
This is to read the '''pressure''' of the '''inlet streams''' from the added '''inlet material stream'''.  
  
  
Here, variables''' p1, p2''' and '''p3''' store the '''pressures''' of '''Water, Methanol''' and '''Ethanol '''streams.  
+
Here, variables''' p1, p2''' and '''p3''' store the '''pressures''' of '''Water, Methanol''' and '''Ethanol streams'''.  
  
 
|-  
 
|-  
 
||Cursor to '''pressure''' keyword  
 
||Cursor to '''pressure''' keyword  
||'''pressure''' is the keyword.  
+
||'''pressure''' is the '''keyword'''.  
  
  
It indicates that the '''pressure''' of '''material''' streams has to be stored in the variables''' p1, p2''' and '''p3'''.  
+
It indicates that the '''pressure''' of '''material streams''' has to be stored in the variables''' p1, p2''' and '''p3'''.  
  
 
|-  
 
|-  
Line 669: Line 662:
  
  
For this let us consider the '''outlet pressure''' to be '''average pressure''' of all the '''3 inlet '''streams.  
+
For this let us consider the '''outlet pressure''' to be '''average pressure''' of all the '''3 inlet streams'''.  
  
 
|-  
 
|-  
Line 675: Line 668:
 
||Now, type this code.  
 
||Now, type this code.  
  
'''Outlet pressure''' is calculated and stored in the variable''' p.'''  
+
'''Outlet pressure''' is calculated and stored in the '''variable p.'''  
  
 
|-  
 
|-  
 
||  
 
||  
||Now we will calculate the '''molar flow rate''' of the compounds in the '''output '''stream.  
+
||Now we will calculate the '''molar flow rate''' of the compounds in the '''output stream'''.  
  
 
|-  
 
|-  
Line 686: Line 679:
  
  
'''Molar flow rate''' of '''compounds''' in the '''product '''stream is calculated.  
+
'''Molar flow rate''' of '''compounds''' in the '''product stream''' is calculated.  
  
  
It is stored in the variable''' f''' in form of an '''array'''.  
+
It is stored in the '''variable f''' in form of an '''array'''.  
  
 
|-  
 
|-  
 
||  
 
||  
||Now we will calculate the total '''molar flow rate''' of the '''product '''stream.  
+
||Now we will calculate the total '''molar flow rate''' of the '''product stream'''.  
  
 
|-  
 
|-  
Line 700: Line 693:
  
  
'''Molar flow rate '''of '''product '''stream is calculated and stored in the variable''' totF'''.  
+
'''Molar flow rate '''of '''product stream''' is calculated and stored in the '''variable totF'''.  
  
 
|-  
 
|-  
 
||  
 
||  
||Now we will calculate the '''enthalpy''' of the '''product '''stream'''.'''
+
||Now we will calculate the '''enthalpy''' of the '''product stream'''.  
  
 
|-  
 
|-  
Line 711: Line 704:
  
  
'''Enthalpy''' of the '''product''' stream is calculated and stored in the variable''' h'''.  
+
'''Enthalpy''' of the '''product stream''' is calculated and stored in the '''variable h'''.  
  
 
|-  
 
|-  
 
||  
 
||  
||Now we will pass the '''calculated variables''' to the '''Mixed Product material '''stream.  
+
||Now we will pass the '''calculated variables''' to the '''Mixed Product material stream'''.  
  
 
|-  
 
|-  
Line 722: Line 715:
  
  
'''setProduct''' indicates that, variables in the braces are to be passed to the stream in the '''product'''.  
+
'''setProduct''' indicates that, '''variables''' in the braces are to be passed to the '''stream''' in the '''product'''.  
  
 
|-  
 
|-  
 
||Click '''Test'''  
 
||Click '''Test'''  
 
||At the bottom, click '''Test.'''  
 
||At the bottom, click '''Test.'''  
 
|-
 
||Point to the '''Output''' window
 
||Wait for a few seconds for '''Scilab script''' to be executed and display the results in the '''Output''' tab.
 
  
 
|-  
 
|-  
 
||Point to the tabs.  
 
||Point to the tabs.  
||'''Values''' stored and calculated in all the variables are displayed in the '''Output''' tab.  
+
||'''Values''' stored and calculated in all the '''variables''', are displayed in the '''Output''' tab.  
  
 
|-  
 
|-  
Line 757: Line 746:
  
 
Hover mouse at '''Input Data'''  
 
Hover mouse at '''Input Data'''  
||Under '''Stream Conditions,''' check '''Temperature''', '''Pressure''', '''Molar Flow'''.  
+
||Under '''Stream Conditions,''' check '''Temperature, Pressure, Molar Flow'''.  
 
+
|-
+
||'''Insert >> Master Property Table'''
+
||Now, go to '''Insert''' menu and select '''Master Property Table.'''
+
 
+
|-
+
||Double click on '''Master Property Table'''
+
||Double-click on the '''Master Property Table.'''
+
 
+
|-
+
||Point to '''Configure Master Property Table'''
+
||'''Configure Master Property Table''' window opens.
+
 
+
|-
+
||Type '''Stream Wise Results – Custom Mixer.'''
+
||Enter '''Name''' as '''Stream Wise Results – Custom Mixer.'''
+
 
+
|-
+
||Type '''Material Stream'''
+
||Enter '''Object Type''' as '''Material Stream'''.
+
 
+
 
+
By default, '''Material Stream''' is already selected.
+
 
+
 
+
So we will not change it.
+
 
+
|-
+
||'''Object >> Liquid Product, Vapour Product '''and '''Feed'''
+
||Under '''Properties to display''', select '''Object''' as '''Water''', '''Methanol''', '''Ethanol '''and '''Mixed Product.'''
+
 
+
|-
+
||'''Configure Master Property Table>> Property'''
+
||Under '''Property, '''scroll down to see all the parameters.
+
 
+
 
+
Now select the properties as:
+
 
+
'''Temperature'''
+
 
+
'''Pressure'''
+
 
+
'''Mass Flow'''
+
 
+
'''Molar Flow'''
+
 
+
'''Vapor Phase Molar Fraction'''
+
 
+
'''Molar Fraction (Mixture) / Water'''
+
 
+
'''Molar Flow (Mixture) / Water'''
+
 
+
'''Molar Fraction (Mixture) / Methanol'''
+
 
+
'''Molar Flow (Mixture) / Methanol'''
+
 
+
'''Molar Fraction (Mixture) / Ethanol'''
+
 
+
'''Molar Flow (Mixture) / Ethanol'''
+
 
+
|-
+
||Close '''Configure Master Property Table''' window.
+
||Let’s close this window.
+
 
+
|-
+
||Point to the '''Master Property Table'''
+
 
+
 
+
Point to '''Liquid Product''' stream
+
||Move the '''Master Property Table''' for better visibility.
+
 
+
 
+
Here we can see the corresponding results for '''Water, Methanol, Ethanol''' and '''Mixed Product.'''
+
 
+
 
|-  
 
|-  
 
||  
 
||  
Line 877: Line 792:
  
  
Create a custom model for a '''heater''' to heat the given mixture of compounds.
 
  
  
Calculate the amount of heat required for heating.  
+
Create a custom '''model''' for a '''heater''' to heat the given mixture of compounds.  
 +
 
 +
 
 +
 
  
  
Compare the results with in-built '''heater''' unit operation available.  
+
For different '''Inlet stream conditions'''.
  
 
|-  
 
|-  

Latest revision as of 09:21, 10 May 2019


Visual Cue Narration
Slide Number 1

Title Slide

Welcome to this tutorial on simulating a Custom Unit Operation using Scilab.
Slide Number 2

Learning Objective

In this tutorial, we will learn to:


  • Create a custom unit operation using Scilab
  • Calculate the Outlet pressure of product stream
  • Calculate Molar flow rate and Enthalpy
Slide Number 3

System Requirements

To record this tutorial, I am using


  • DWSIM 5. 6 update 8 (Classic UI) and
  • Windows 10

But, this process is identical in Linux, Mac OS X or FOSSEE OS on ARM.

Slide Number 4


Pre-requisites

To practice this tutorial, you should know to-


  • Add components to a flowsheet
  • Select thermodynamic packages
  • Add material streams and specify their properties
Slide Number 5


Prerequisite Tutorials and Files


The prerequisite tutorials are available on our website.

Spoken-tutorial.org.


You can access these tutorials and all the associated files from this site.


You should also have Scilab 5.02 (or higher) installed on your system.

Slide Number 6


Scilab CAPE-OPEN Unit Operation

First let us learn what is Scilab CAPE-OPEN Unit Operation.


It is an unit operation implementation for which the calculations can be entered in Scilab.

More information on this is given in the Additional reading material link of this tutorial.

Slide Number 7


Components: Water, methanol and Ethanol


Property Package: Raoult’s Law


Outlet Pressure: Average of Inlet Stream

We will develop a flowsheet to determine the product stream Temperature, Pressure,


Molar flow rate and Molar enthalpy from a Mixer model created using Scilab.

Slide Number 8


Inlet Stream 1:


Component: Pure Water

Temperature: 300 K

Pressure: 100000 Pa

Mass flow: 10 kg/s


Inlet Stream 2:


Component: Pure Methanol

Temperature: 305 K

Pressure: 150000 Pa

Mass flow: 15 kg/s


Inlet Stream 3:


Component: Pure Ethanol

Temperature: 310 K

Pressure: 200000 Pa

Mass flow: 20 kg/s

Here we give Inlet Stream Conditions of the product stream.


Now let me open DWSIM (Classic UI).
Cursor to Desktop


DWSIM (Classic UI) >> Run as Administrator.

To open DWSIM, go to the Desktop.


Right-click on DWSIM (Classic UI) and click Run as Administrator.

Point to Welcome to DWSIM window Welcome to DWSIM window opens.

Close this window.

File >> New Steady-state Simulation. Now go to the File menu and select New Steady-state Simulation.
Point to Simulation Configuration Wizard window. Simulation Configuration Wizard window appears.
Click on Next button. At the bottom, click on the Next button.
Type Water in the Search tab


ChemSep database >> Water

In the Compounds search tab, type Water.


Select Water from the ChemSep database.

Type Methanol in the Search tab Similarly, add Methanol.
Type Ethanol in the Search tab Followed by Ethanol.
Click on Next. And then click on the Next button at the bottom.
Point to Property Packages The Property Packages window opens.
Property Packages >> Available Property Package


Double click on Raoult’s Law

From Available Property Packages list, double-click on Raoult’s Law.
Click on Next. Then click on the Next button at the bottom.
Point to System of Units The next option after this, is System of Units.
System of Units >> SI Under System of Units, select SI.
Click on Finish. Click on the Finish button at the bottom.
Click on Maximize button. Let us maximize the simulation window.
Cursor on the simulation window. Let’s insert the feed streams that enter the Custom Mixer.
Point to Streams. Go to Streams tab, at the bottom of the main simulation.
Click and drag Material Streams to the flowsheet From the displayed list, drag and drop three Material Streams to the Flowsheet.
Click MSTR-000 Click on the first material stream named as MSTR-000
Type Water Let’s change the name of this stream to Water.
Now we will specify the Water stream properties.
Point to input data. Go to Input Data.
Stream Conditions >> Flash Spec >> Temperature and Pressure (TP) Under Stream Conditions tab, select Flash Spec as Temperature and Pressure (TP).


By default, Temperature and Pressure should already be selected as Flash Spec.

Stream Conditions >>Temperature >> 300 K

Press Enter

Change Temperature to 300 K and press Enter.
Stream Conditions >> Pressure >> 100000 Pa

Press Enter

Change Pressure to 100000 Pa and press Enter.
Stream Conditions >> Mass Flow >> 10 kg/s

Press Enter

Change Mass Flow to 10 kg/s and press Enter.
Input Data >> Compound Amounts Now let us specify the Water stream compositions.


For this, click on Compound Amounts tab under Input Data.

Basis >> Mole Fractions Choose the Basis as Mole Fractions, if not already selected.


By default, Mole Fractions is already selected as Basis.

Water: 1 Now for Water, enter the Amount as 1 and press Enter.
Methanol: 0 For Methanol, enter 0 and press Enter.
Ethanol: 0 For Ethanol, enter 0 and press Enter.
Click Accept Changes button On the right, click on the Accept Changes button.
Similarly, we will define the other two material streams.
Click MSTR-001 Click on the second material stream named MSTR-001.
Type Methanol Let’s change the name of this stream to Methanol.
Now we will specify the Methanol stream properties.
Stream Conditions >> Flash Spec >> Temperature and Pressure (TP) Go to Input Data.


Under Stream Conditions tab, select Flash Spec as Temperature and Pressure (TP).

Stream Conditions >>Temperature >> 305 K

Press Enter

Change Temperature to 305 K and press Enter.
Stream Conditions >> Pressure >> 150000 Pa

Press Enter

Change Pressure to 150000 Pa and press Enter.
Stream Conditions >> Mass Flow >> 15 kg/s

Press Enter

Change Mass Flow to 15 kg/s and press Enter.
Input Data >> Compound Amounts Now click on the Compound Amounts tab under Input Data.
Basis >> Mole Fractions Choose Basis as Mole Fractions.
Water: 0 Now for Water, enter the Amount as 0 and press Enter.
Methanol: 1 For Methanol, enter 1 and press Enter.
Ethanol: 0 For Ethanol, enter 0 and press Enter.
Click Accept Changes button. On the right, click on the Accept Changes button.
Click MSTR-002 Now, click on the third material stream named as MSTR-002.
Type Ethanol Let’s change the name of this stream to Ethanol.
Now we will specify the Ethanol stream properties.
Stream Conditions >> Flash Spec >> Temperature and Pressure (TP) Go to Input Data.


Under Stream Conditions tab, select Flash Spec as Temperature and Pressure (TP)

Stream Conditions >>Temperature >> 310 K

Press Enter

Change Temperature to 310 K and press Enter.
Stream Conditions >> Pressure >> 200000 Pa

Press Enter

Change Pressure to 200000 Pa and press Enter.
Stream Conditions >> Mass Flow >> 20 kg/s

Press Enter

Change Mass Flow to 20 kg/s and press Enter.
Input Data >> Compound Amounts Then under Input Data click on Compound Amounts tab.
Basis >> Mole Fractions Choose Basis as Mole Fractions.
Water: 0 For Water, enter the Amount as 0 and press Enter.
Methanol: 0 For Methanol, enter 0 and press Enter.
Ethanol: 1 For Ethanol, enter 1 and press Enter.
Click Accept Changes button. On the right side, click on the Accept Changes button.
Now, let us insert another material stream that exits the custom mixer.
Click and Drag Material Stream to the flowsheet To do that, let us drag one material stream to the flowsheet.
Let us arrange the stream.
We will leave that stream as unspecified.
Type Mixed Product Then we will change the name of this stream to Mixed Product.
Cursor to CAPE-OPEN tab At the bottom of the main simulation window, go to CAPE-OPEN tab.
Click and drag CAPE-OPEN Unit Operation to the flowsheet Drag and drop CAPE-OPEN Unit Operation to the flowsheet area.
Cursor to CAPE-OPEN Unit Operation window Add CAPE-OPEN Unit Operation window opens.
Point to SciLab Unit Operation.


Click on OK

From the displayed list, select SciLab Unit Operation.


Click on OK at the bottom.

Type Custom Mixer. Let us change the name of this Unit Operation to Custom Mixer.
Now, we will create the inlet and outlet connection ports for the Custom Mixer.
Click Custom Mixer For this, click on Custom Mixer.
Click Open CAPE-OPEN Object Editor From Property Editor window, click on Open CAPE-OPEN Object Editor.
Point to Scilab CAPE-OPEN Unit Operation window Scilab CAPE-OPEN Unit Operation window opens.
Click on Ports tab. Click on Ports tab.
Feed ports >> Add Under Feed ports, there is an Add button at the bottom.
Click on the Add button Click on Add button thrice to create three inlet ports for the three input material streams.
Product ports >> Add Under Product ports, click on Add button at the bottom.


This will create an outlet port for the output material stream.

Click on Close button. Click on the Close button at the bottom.
Point to Property Editor Window Go to Property Editor Window.
Go to Connections. Under Connections, go to inlet tab.
Click on drop down arrow against Feed 1 Select Water. Click on the drop-down against Feed 1 and select Water.
Click on drop down arrow against Feed 2


Select Methanol.

Next, click on the drop-down against Feed 2 and select Methanol.
Click on drop down arrow against Feed 3


Select Ethanol.

Next, click on the drop-down against Feed 3 and select Ethanol.
Click on the Outlet tab. Now click on the Outlet tab.
Click on drop down arrow against Product 1


Select Mixed Product.

Click on the drop-down against Product 1 and select Mixed Product.
Point to all the connections. All the connections now are completed.


Now we will write the code to perform the computation.

Click on Open CAPE-OPEN Object Editor Click on Open CAPE-OPEN Object Editor.
Click on SciLab tab. Click on SciLab tab.
Cursor on the interface. First we will get the feed properties of the material streams.


Then we will write the calculation routines.

Type:


f1=getFeedProp(1,"flow")

f2=getFeedProp(2,"flow")

f3=getFeedProp(3,"flow")

Type this code in the Script tab.


This is to read the molar flow rate of the compounds from the inlet material streams.

Cursor to f1, f2 and f3 variables. Here, f1, f2 and f3 are the variables.


They store molar flow rate of the compounds from the inlet material streams.

Cursor to getFeedProp command getFeedProp is the command used to read the specified feed property.
Cursor to 1, 2 and 3 feed port numbers 1, 2 and 3 are the feed port numbers in SciLab to which the material streams in DWSIM is connected.
Cursor to flow keyword flow is the keyword.


flow indicates that components in the streams, has to be stored in f1,f2,f3 in form of an array.

Type:


h1=getFeedProp(1,"enthalpy")

h2=getFeedProp(2,"enthalpy")

h3=getFeedProp(3,"enthalpy")

Type this code in the Script tab.


This is to read the molar enthalpy of the inlet streams from the added inlet material stream.


Here, variables h1, h2 and h3 store the molar enthalpy of the added input material streams.

Cursor to enthalpy keyword enthalpy is the keyword.


It indicate that molar enthalpy of material streams has to be stored in h1, h2 and h3.

Type:


p1=getFeedProp(1,"pressure")

p2=getFeedProp(2,"pressure")

p3=getFeedProp(3,"pressure")

Next, type this code.


This is to read the pressure of the inlet streams from the added inlet material stream.


Here, variables p1, p2 and p3 store the pressures of Water, Methanol and Ethanol streams.

Cursor to pressure keyword pressure is the keyword.


It indicates that the pressure of material streams has to be stored in the variables p1, p2 and p3.

Now we will code the calculation routine
First we will calculate the outlet pressure.


For this let us consider the outlet pressure to be average pressure of all the 3 inlet streams.

p=(p1+p2+p3)/3 Now, type this code.

Outlet pressure is calculated and stored in the variable p.

Now we will calculate the molar flow rate of the compounds in the output stream.
f=f1+f2+f3 Type this code in the Script tab.


Molar flow rate of compounds in the product stream is calculated.


It is stored in the variable f in form of an array.

Now we will calculate the total molar flow rate of the product stream.
totF=sum(f) Type this code in the Script tab.


Molar flow rate of product stream is calculated and stored in the variable totF.

Now we will calculate the enthalpy of the product stream.
h=((h1*f1)+(h2*f2)+(h3*f3))/f Type this code.


Enthalpy of the product stream is calculated and stored in the variable h.

Now we will pass the calculated variables to the Mixed Product material stream.
setProduct(1,totF,f/totF,"pressure",p,"enthalpy",h) Type this code.


setProduct indicates that, variables in the braces are to be passed to the stream in the product.

Click Test At the bottom, click Test.
Point to the tabs. Values stored and calculated in all the variables, are displayed in the Output tab.
Click Close button. Click Close button at the bottom.
Now we will run the simulation.
Click Solve Flowsheet So, from the toolbar, click on Solve Flowsheet button.
Click Mixed Product When the calculations are completed, click on the Mixed Product in the flowsheet.
Point to Property Editor Window


Hover mouse at Input Data

Under Stream Conditions, check Temperature, Pressure, Molar Flow.
Let's summarize.
Slide Number 9


Summary

In this tutorial, we have learnt to


  • Create a custom unit operation using Scilab
  • Calculate the Outlet pressure of product stream
  • Calculate Molar flow rate and Enthalpy
Slide Number 10


Assignment


Compounds:

Water – 100 kmol/h

Methanol – 100 kmol/h


Pressure – 1.25 atm


Property Package: Raoult’s Law


Inlet Stream Temperature: 300 K

Temperature Difference: 350 K

Pressure Drop: 1.1 atm

As an assignment,



Create a custom model for a heater to heat the given mixture of compounds.



For different Inlet stream conditions.

Slide Number 11

About the Spoken Tutorial Project

Watch the video available at following link.

http://spoken-tutorial.org/

It summarizes the Spoken Tutorial project.

Slide Number 12

Spoken Tutorial Workshops

The Spoken Tutorial Project Team
  • Conducts workshops and
  • Gives certificates.
  • For more details, please write to us.
Slide Number 13


Forum Slide


Do you have questions in this Spoken Tutorial?

Please visit this site


Choose the minute and second where you have the question.


Explain your question briefly.


Someone from the FOSSEE team will answer them.

Please post your times queries in this forum.
Slide Number 14

DWSIM Flowsheeting Project

The FOSSEE team coordinates conversion of existing flow sheets into DWSIM.

We give honorarium and certificates.

For more details, please visit this site.

Slide Number 15

TextBook Companion Project

The FOSSEE team coordinates coding of solved examples of popular books.


We give honorarium and certificates.


For more details, please visit this site.

Slide Number 16

Lab Migration Project

The FOSSEE team helps migrate commercial simulator labs to DWSIM.


We give honorarium and certificates.


For more details, please visit this site.

Slide Number 17

Acknowledgements

Spoken Tutorial and FOSSEE projects are funded by NMEICT, MHRD, Government of India.
Slide Number 18

Thanks

This tutorial is contributed by Kaushik Datta and Priyam Nayak. Thanks for joining.

Contributors and Content Editors

Kaushik Datta, Nancyvarkey