Difference between revisions of "DWSIM/C3/Custom-Unit-Operation-using-Scilab/English"
Nancyvarkey (Talk | contribs) |
|||
(One intermediate revision by one other user not shown) | |||
Line 87: | Line 87: | ||
− | '''Molar flow rate '''and '''Molar enthalpy '''from a '''Mixer''' | + | '''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 | + | || Here we give '''Inlet Stream Conditions''' of the '''product stream'''. |
Line 222: | 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 | + | ||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 431: | 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'''. |
|- | |- | ||
Line 545: | 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.''' | + | |
|- | |- | ||
Line 583: | Line 581: | ||
− | This is to read the '''molar flow rate''' of the '''compounds''' from the '''inlet material ''' | + | 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 ''' | + | 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 ''' | + | ||'''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 619: | Line 617: | ||
− | This is to read the '''molar enthalpy''' of the '''inlet ''' | + | 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 | + | 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 ''' | + | It indicate that '''molar enthalpy''' of '''material streams''' has to be stored in '''h1, h2''' and '''h3'''. |
|- | |- | ||
Line 643: | Line 641: | ||
− | This is to read the '''pressure''' of the '''inlet''' | + | 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 ''' | + | 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''' | + | It indicates that the '''pressure''' of '''material streams''' has to be stored in the variables''' p1, p2''' and '''p3'''. |
|- | |- | ||
Line 664: | Line 662: | ||
− | For this let us consider the '''outlet pressure''' to be '''average pressure''' of all the '''3 inlet ''' | + | For this let us consider the '''outlet pressure''' to be '''average pressure''' of all the '''3 inlet streams'''. |
|- | |- | ||
Line 670: | Line 668: | ||
||Now, type this code. | ||Now, type this code. | ||
− | '''Outlet pressure''' is calculated and stored in the | + | '''Outlet pressure''' is calculated and stored in the '''variable p.''' |
|- | |- | ||
|| | || | ||
− | ||Now we will calculate the '''molar flow rate''' of the compounds in the '''output ''' | + | ||Now we will calculate the '''molar flow rate''' of the compounds in the '''output stream'''. |
|- | |- | ||
Line 681: | Line 679: | ||
− | '''Molar flow rate''' of '''compounds''' in the '''product ''' | + | '''Molar flow rate''' of '''compounds''' in the '''product stream''' is calculated. |
− | It is stored in the | + | It is stored in the '''variable f''' in form of an '''array'''. |
|- | |- | ||
|| | || | ||
− | ||Now we will calculate the total '''molar flow rate''' of the '''product ''' | + | ||Now we will calculate the total '''molar flow rate''' of the '''product stream'''. |
|- | |- | ||
Line 695: | Line 693: | ||
− | '''Molar flow rate '''of '''product ''' | + | '''Molar flow rate '''of '''product stream''' is calculated and stored in the '''variable totF'''. |
|- | |- | ||
|| | || | ||
− | ||Now we will calculate the '''enthalpy''' of the '''product | + | ||Now we will calculate the '''enthalpy''' of the '''product stream'''. |
|- | |- | ||
Line 706: | Line 704: | ||
− | '''Enthalpy''' of the '''product''' | + | '''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 ''' | + | ||Now we will pass the '''calculated variables''' to the '''Mixed Product material stream'''. |
|- | |- | ||
Line 717: | 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'''. |
|- | |- | ||
Line 725: | Line 723: | ||
|- | |- | ||
||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 748: | Line 746: | ||
Hover mouse at '''Input Data''' | Hover mouse at '''Input Data''' | ||
− | ||Under '''Stream Conditions,''' check '''Temperature | + | ||Under '''Stream Conditions,''' check '''Temperature, Pressure, Molar Flow'''. |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
|| | || | ||
Line 870: | Line 794: | ||
− | Create a custom model for a '''heater''' to heat the given mixture of compounds. | + | Create a custom '''model''' for a '''heater''' to heat the given mixture of compounds. |
Line 876: | Line 800: | ||
− | For different Inlet stream conditions. | + | 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:
|
Slide Number 3
System Requirements |
To record this tutorial, I am using
But, this process is identical in Linux, Mac OS X or FOSSEE OS on ARM. |
Slide Number 4
|
To practice this tutorial, you should know to-
|
Slide Number 5
|
The prerequisite tutorials are available on our website.
Spoken-tutorial.org.
|
Slide Number 6
|
First let us learn what is Scilab CAPE-OPEN Unit Operation.
More information on this is given in the Additional reading material link of this tutorial. |
Slide Number 7
|
We will develop a flowsheet to determine the product stream Temperature, Pressure,
|
Slide Number 8
Temperature: 300 K Pressure: 100000 Pa Mass flow: 10 kg/s
Temperature: 305 K Pressure: 150000 Pa Mass flow: 15 kg/s
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
|
To open DWSIM, go to the Desktop.
|
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
|
In the Compounds search tab, type Water.
|
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
|
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).
|
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.
|
Basis >> Mole Fractions | Choose the Basis as Mole Fractions, if not already selected.
|
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.
|
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.
|
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.
|
From the displayed list, select SciLab Unit Operation.
|
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.
|
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
|
Next, click on the drop-down against Feed 2 and select Methanol. |
Click on drop down arrow against Feed 3
|
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
|
Click on the drop-down against Product 1 and select Mixed Product. |
Point to all the connections. | All the connections now are completed.
|
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.
|
Type:
f2=getFeedProp(2,"flow") f3=getFeedProp(3,"flow") |
Type this code in the Script tab.
|
Cursor to f1, f2 and f3 variables. | Here, f1, f2 and f3 are the variables.
|
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.
|
Type:
h2=getFeedProp(2,"enthalpy") h3=getFeedProp(3,"enthalpy") |
Type this code in the Script tab.
|
Cursor to enthalpy keyword | enthalpy is the keyword.
|
Type:
p2=getFeedProp(2,"pressure") p3=getFeedProp(3,"pressure") |
Next, type this code.
|
Cursor to pressure keyword | pressure is the keyword.
|
Now we will code the calculation routine | |
First we will calculate the outlet pressure.
| |
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.
|
Now we will calculate the total molar flow rate of the product stream. | |
totF=sum(f) | Type this code in the Script tab.
|
Now we will calculate the enthalpy of the product stream. | |
h=((h1*f1)+(h2*f2)+(h3*f3))/f | Type this code.
|
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.
|
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
|
Under Stream Conditions, check Temperature, Pressure, Molar Flow. |
Let's summarize. | |
Slide Number 9
|
In this tutorial, we have learnt to
|
Slide Number 10
Water – 100 kmol/h Methanol – 100 kmol/h
Temperature Difference: 350 K Pressure Drop: 1.1 atm |
As an assignment,
For different Inlet stream conditions. |
Slide Number 11
About the Spoken Tutorial Project |
Watch the video available at following link.
It summarizes the Spoken Tutorial project. |
Slide Number 12
Spoken Tutorial Workshops |
The Spoken Tutorial Project Team
|
Slide Number 13
Please visit this site
|
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.
|
Slide Number 16
Lab Migration Project |
The FOSSEE team helps migrate commercial simulator labs to DWSIM.
|
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. |