Conference article

Development of a Thermodynamic Engine in OpenModelica

Rahul Jain
Dept. of Chemical Engineering, Indian Institute of Technology Bombay, India

Kannan M. Moudgalya
Dept. of Chemical Engineering, Indian Institute of Technology Bombay, India

Peter Fritzson
Dept. Computer and Information Sciences, Linköping University, Sweden

Adrian Pop
Dept. Computer and Information Sciences, Linköping University, Sweden

Download article

Published in: Proceedings of the 12th International Modelica Conference, Prague, Czech Republic, May 15-17, 2017

Linköping Electronic Conference Proceedings 132:9, p. 89-99

Show more +

Published: 2017-07-04

ISBN: 978-91-7685-575-1

ISSN: 1650-3686 (print), 1650-3740 (online)


OpenModelica, an open source equation oriented modeling environment for steady state and dynamic simulation, lacks good chemical engineering support. This problem is addressed by making available in different ways the thermodynamic library Chemsep that comes with DWSIM, an open source sequential modular steady state simulator. Only slow speeds could be achieved through a Python-C API based interface connecting OpenModelica with the thermodynamic library. A socket programming based interface helps achieve faster speeds. Best results have been achieved by porting the thermodynamic library and the calculation routines to OpenModelica, due to two reasons: (1) thermodynamic equations are solved simultaneously with mass and energy balances (2) overheads in calling the external routines of DWSIM are eliminated. Performances of the above mentioned three approaches have been validated with steady state and dynamic simulations. Benzene - toluene separation, methanol - ethanol – water distillation, and steam distillation of an n-octane – n-decane mixture, have been carried out through these simulations. This work makes available a powerful simulation platform to the chemical engineering.


OpenModelica, DWSIM, Chemsep, thermodynamics, modeling, simulation, chemical engineering, Python-C API, socket programming, media


Adeel Asgharand, Sonia Tariq, Mohsen Torabzadeh-Tariand, Peter Fritzson, Adrian Pop, Martin Sjolund, Parham Vasaiely, and Wladimir Schamai. An open source modelica graphic editor integrated with electronic notebooks and interactive simulation. Proc. of the 8th International Modelica Conference 2011, pp, pages 739–747, 2011.

Aspentech. Aspen plus., 2017. Last seen on 1 April 2017.

R. D. Braatz. Scilab textbook companions. IEEE Control Systems Magazine, page 76, June 2014.

DWSIM-Team-FOSSEE-Project. Dwsim flowsheets., 2017. Last seen on 1 Aprtil 2017.

Peter Fritzson. Principles of Object Oriented Modeling and Simulation with Modelica 3.3: A Cyber-Physical Approach. Second edition, 2014. ISBN 9781118989166. doi: 10.1002/9781118989166.

Jürgen Gmehling, Jochen Menke, Jörg Krafczyk, and Kai Fischer. A data bank for azeotropic data - status and applications. Fluid Phase Equilibria, 103(1):51–76, 1995. ISSN 03783812. doi: 10.1016/0378-3812(94)02569-M.

H.A. Kooijman and R. Taylor. The ChemSep Book. Books on Demand, Norderstedt, Germany, 2001.

Daniel Medeiros. Dwsim technical document. Technical report, 2015.

Modelica Association. ModelicaTM - A Unified Object-Oriented Language for Physical Systems Modeling: Language Specification. ReVision, 2000. ISSN 09284869. doi: 10.1016/S0928-4869(97)84257-7.

Ding-Yu Peng and Donald B. Robinson. A New Two-Constant Equation of State. Industrial & Engineering Chemistry Fundamentals, 15(1):59–64, 1976. ISSN 0196-4313. doi: 10.1021/i160057a011. URL

Peter Piela, Roy McKelvey, and Arthur Westerberg. An introduction to the ascend modeling system: Its language and interactive environment. Journal of Management Information Systems, 9(3):91–121, 1992.

Henri Renon and J. M. Prausnitz. Local compositions in thermodynamic excess functions for liquid mixtures. AIChE Journal, 14(1):135–144, 1968. ISSN 15475905. doi: 10.1002/aic.690140124.

Brandon Rhodes and John Goerzen. Foundations of Python Network Programming, 2010. ISSN 1098-6596. URL{%}5Cn

M. Shacham, M. B. Cutlip, and M. Elly. Semi-Batch Steam Distillation Of a Binary Organic Mixture: a Demonstration of Advanced Problem-Solving Techniques and Tools. Chemical Engineering Education, 46(3):173–181, Summer 2012.

J M Smith, H C Van Ness, and M M Abbott. Introduction to Chemical Engineering Thermodynamics, volume 27. McGraw Hill Education, 2005. ISBN 0072402962. doi: 10.1021/ed027p584.3.

G. Soave. Equilibrium constants from a modified redlich-kwong equation of state. Chemical Engineering Science, 27(6): 1197–1203, 1972.

A.W. Westerberg, H.P. Hutchison, R.L. Motard, and P. Winter. Process Flowsheeting. Cambridge University Press, Cambridge, 1979.

Citations in Crossref