User:AkashSinghal
Akash Deep Singhal is a GSOC2015 student pursuing B.Tech + M.Tech from Department of Chemical Engineering, Indian Institute of Technology, Bombay (IN). He is working on the development of Chemical engineering specific models and integration of flash/thermodynamic libraries in ASCEND. To know more, visit his webpage
GSOC 2015
Weekly Progress Report
During this semester (Before May 6)
- Got familiar with the codebase and coding style in ASCEND
- Developed a reactor model in ASCEND and worked on its thermodynamic properties in the reactor using SRK-EOS
- File can be fetched from here:-
- [Balance for the components]https://github.com/akigupta131/ascend-steam-reformation/blob/master/steam_reformation.a4c
- [Modification of SRK to get fugacity of components]https://github.com/akigupta131/ascend-steam-reformation/blob/master/akash_eos.a4c
- File can be fetched from here:-
- Collected 'Chemical processes' reports required/needed in the development
May 6 – May 12: Discussion
- Finalized the Chemical processes to be worked on:-
- Steam methane reforming
- Ammonia synthesis (Haber-Bosch)
- Methanol production from syngas or methane
- Found component properties and working pressures/temperatures
- Block diagram (simplified)designed for modelling
May 12 – May 19: Literature Survey & Conceptual Flow-Sheet Development
- Identified the reactor type
- Wrote equations for various unit operations (Reactor, mixer etc.)
- Also wrote equations for connecting all the units to complete flowsheet
May 19 – May 26: Paper work
- Remaining equations written
- Went through some of the pre-existing flowsheet models
May 26 – June 5: Methane Reformation modelling
- Methane reformation flowsheet coding done (WGSR not included)
- Still not converging though
June 5 – June 14: Ammonia Production Equations
- Basic flowsheet made for Haber-Bosch process
- Wrote equations for various unit operations (Reactor, mixer etc.)
- Flowsheets (Complete block diagram and simplified version of the same) can be seen at https://drive.google.com/folderview?id=0B4mRUUHQkzwmbzIxcURha09oRVE&usp=sharing
June 14 – June 24: Ammonia Formation Modelling
- Wrote models for various unit-operations in ASCEND
- Wired the models in one model(flowsheet)
- Documentation made for Ammonia formation model.
- Working model can be seen at https://github.com/akigupta131/ascend-gcoc15/blob/master/ammonia/ammonia_flowsheet.a4c
June 25 - June 28: Break
June 29 - July 12: Importing DWSIM DTL
- Reading about DLL and COM-Callable interface
- Register the DLL using .NET RegAsm (creating batch file)
C: cd C:\Windows\Microsoft.NET\Framework\v4.0.30319 regasm.exe /u D:\DTLSource\DTLSource\DTL-master\DWSIM\bin\Debug\DTL.dll \tlb:D:\DTLSource\DTLSource\DTL-master\DWSIM\bin\Debug\DTL.tlb regasm.exe D:\DTLSource\DTLSource\DTL-master\DWSIM\bin\Debug\DTL.dll /codebase /tlb:D:\DTLSource\DTLSource\DTL-master\DWSIM\bin\Debug\DTL.tlb pause
- Registered as DTL.Thermodynamic.Calculator module
- Using win32com client
>>>> import win32com.client
>>>> dtlc.Initialize()
>>>> dtlc = win32com.client.Dispatch('DTL.Thermodynamics.Calculator')
>>>> dtlc.GetCompoundConstPropList()
(u'molecularweight', u'criticaltemperature', u'criticalpressure', u'criticalvolume', u'criticalcompressibilityfactor', u'acentricfactor', u'normalboilingpoint', u'idealgasgibbsfreeenergyofformationat25c', u'idealgasenthalpyofformationat25c', u'casregistrynumber', u'chemicalformula')
>>>> dtlc.GetCompoundConstProp("Water","criticalvolume")
u'0.05595'
>>> dtlc.GetCompoundConstProp('Benzene','normalboilingpoint')
u'353.24'
July 12 - July 19: Python functions for interfacing
- Created python functions for interfacing with registered DWSIM DTL
- Python file to be directly imported into a4c file
- Sample:-
def CompProperty(Comp,Prop): #comp is the component and prop is the required property
"""This function calls the DWSIM Thermodynamics DTL and gives the required component property"""
import win32com.client
dtlc = win32com.client.Dispatch("DTL.Thermodynamics.Calculator")
dtlc.Initialize()
print Comp
print Prop
PROP_VALUE = dtlc.GetCompoundConstProp('Water','molecularweight')
# pv = float(PROP_VALUE)
print PROP_VALUE
return PROP_VALUE
- When the above function in run:-
>>> CompProperty('Benzene','normalboilingpoint')
u'353.24'
- All the values match with the values from DWSIM software (Verified!)
- GetPropPackList, GetCompoundList, GetPropList, GetCompoundConstPropList, GetCompoundTDepPropList, GetCompoundPDepPropList and GetPhaseList are some of the functions which can be called from the library
July 20 - July 24
- Semester starts; Busy in that
July 25 - August 1:
Connecting Ascend with Python file- NOT POSSIBLE- Looked up for import options
- Connection with DTL being possible only through C-wrapper accessible from ASCEND ref. http://ascend4.org/Writing_ASCEND_external_relations_in_C
-
Importing DLL file in mono
- Working on running the complete system on Linux/Unix - Using mono ref. http://www.mono-project.com/docs/advanced/embedding/
August 2 - August 9
- Writing C wrapper for calling COM-Callable DWSIM Dynamic Thermodynamic Library, to make it accessible from a4c/a4l files
- Working on connecting above using mono for completing the loop in Linux platform
August 10 - August 17
- Continue C-wrapper for the connection
- Final Documentation
- Wrapping up
- Method :-
- Registration function
- This function is the entry point for the shared library you are creating
- Does the job of telling ASCEND what external relations you are going to be providing to it
- Forrmat of Registration
- Forward Declaration
- Registration function
ExtBBoxInitFunc dtltest_compprop_prepare; ExtBBoxFunc dtltest_compprop_calc;
- Registration function for the DTLTEST shared library
- Problems :-
After scons is run and dtltest.a4c is loaded, It shows error: IMPORT of 'johnpye/extfn/extfntest' failed
-
IMPORT of dtltest failed
Abstract
Currently, ASCEND has a small number of processes specific models but pertaining to the vast area of Chemical Engineering, there are lots of processes which are required by users. And this makes ASCEND quite less useful as a modelling environment. There are various quite basic but very important processes which need to be modelled which can be used by the user.
Proposed Plan
- During this semester (Before May 3)
- Understand some basic concepts e.g. learning extensively about Mathematical modelling of a Chemical Process, design some basic process flowsheets to get familiar with the ascend modelling environment, recollect various relevant Chemical Engineering concept learnt in last four years
- Try to get some experience in the relevant portions of the codebase, get familiarize with coding styles and version management in ASCEND
- Develop a sample flow sheet for Steam reforming and provide complete documentation.
- Collect (as many as possible) complete project material from various groups working separately on various processes, e.g. Group X is working on complete industrial level manufacture of some process P. This will give us around 25 complete working-process-flowsheets simulated on AspenPlus.
- May 3 – May 5: Discussion
- Detailed discussion of project methodology and implementation with mentors, community members
- Finalize the processes and flash algorithms to be worked on
- May 5 – May 12: Literature Survey
- Identify different reaction paths
- Find component and mixture properties, working temperatures and pressures
- Design basic block diagrams
- May 12 – May 19: Conceptual Flow-Sheet Development
- Writing and solving process equations
- Check for kinetics, thermodynamics
- Identify separation and reaction techniques required in different reaction paths
- Select feasible route from the flow sheets developed. Selection of appropriate reactor, Heat exchanger, separator etc.
- May 19 – May 26: Paper Work
- Perform manual Mass balance for each equipment
- Steady state simulation on ASPEN. Get a converged file with recycle
- Check for the heat duty
- Equipment sizing for various equipments (manually or Aspen{preferable})
- Heat Integration : Combine Heat Exchanger Network to minimize the energy consumption
- Detailed discussion would be needed with mentors and Prof. Kannan, (I intend to do that while the above part goes on)
- Reporting with extensive documentation
- May 26 – June 2: Begin Coding
- Choose one process out of the selected ones | Finalize on the basis of ease
- Code the model
- June 2 – June 9: First process ready
- By this time, a basic ascend model should be ready and running. In this week, I intend to test it for various parameters and check whether the model is converging or not.
- Grasp the crunch of this model and start working on the further models
- June 9 – June 20: Keep on writing processes (12 days)
- Repeat the work done above for single process.
- Validate models for reusability
- June 21 – June 24: Break
- I wish to take some break. Go out trekking or for some adventure. Relax a bit.
- Enjoy first showers of rain after hot and humid summers in Mumbai (One of my favorite time of the year)
- Would help me for efficient working
- June 24 – July 1: Get back to work
- Learn extensively about Flash Algorithms
- DWSIM includes various equilibrium flash algorithms for VLE and even for more complicated SLE etc.
- Getting info on how to import libraries from DWSIM since the major issue in the integration is that DWSIM core libraries are written in .NET while ASCEND libraries are written in C/C++
- For the integration Inter-language unification need to be done. Check for its feasibility
- Nested Loops(default), Gibbs Minimization, Inside-out (for 2-3 phases) are some of flash algorithms used in DWSIM
- July 1 – July 8: Writing Flash Algorithms
- In case, direct integration of DWSIM package is not feasible or if new flash algorithms are needed to be developed, work on it
- By the time, mentors guidance period starts on July 4 according to GSOC timeline
- Get help in the issues I have been facing (though this will already be happening so does not make much sense)
- July 8 – July 15:
- Come back to models which needed these flash algorithms
- Make changes accordingly and validate the models
- Fix any issue that occurs
- July 15 – July 22: Wrap up
- Final Documentation to be made
- Complete testing - Check for any bug and troubleshooting in that case
- Merging my project branch with trunk
- July 22 – Aug 17:
- Semester will start so will take this time as buffer for any leftovers due to glitches or some bugs
- Extension for ARM devices: According to current scenario, tech-world is shifting from Laptops to Tablets and Phablets, in short ARM based devices. If time permits, I intend to get this whole package working on netbook, an ARM based laptop for on-the-go-development (an initiative by FOSSEE, IIT Bombay).
- Aug 21: Final Submission of the code to google
