Conference article

A MATLAB to Modelica Translator

Mohammad Jahanzeb
Department of Computer and Information Science, Linköping University, Linköping, Sweden

Arunkumar Palanisamy
Department of Computer and Information Science, Linköping University, Linköping, Sweden

Martin Sjölund
Department of Computer and Information Science, Linköping University, Linköping, Sweden

Peter Fritzson
Department of Computer and Information Science, Linköping University, Linköping, Sweden

Download articlehttp://dx.doi.org/10.3384/ecp140961285

Published in: Proceedings of the 10th International Modelica Conference; March 10-12; 2014; Lund; Sweden

Linköping Electronic Conference Proceedings 96:137, p. 1285-1294

Show more +

Published: 2014-03-10

ISBN: 978-91-7519-380-9

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

Abstract

Matlab is a proprietary; interactive; dynamically-typed language for technical computing. It is widely used for prototyping algorithms and applications of scientific computations. Since it is a dynamically typed language; the execution of programs has to be analyzed and interpreted which results in lower computational performance. In order to increase the performance and integrate with Modelica applications it is useful to be able to translate Matlab programs to statically typed Modelica programs.

This paper presents the design and implementation of Matlab to Modelica translator. The Lexical and Syntax analysis is done with the help of the OMCCp (OpenModelica Compiler Compiler parser generator) tool which generates the Matlab AST; which is later used by the translator for generating readable and reusable Modelica code.

Keywords

Modelica; MetaModelica; Matlab; OMCCp; translation

References

[1] Edgar Alonso Lopez-Rojas. OMCCp: A Meta-Modelica based parser generator applied to Modelica. Master’s-Thesis, Linköping University, Department of Computer and Information Science, PELAB- Programming Environment Laboratory, ISRN:LIU-IDA/LITH-EX-A--11/019--SE, May 2011.

[2] Arunkumar Palanisamy. Extended MetaModelica based Integrated Compiler generator. Master’s-Thesis, Linköping University, Department of Computer and Information Science, PELABProgramming Environment Laboratory, ISRN:LIU-IDA/LITH-EX-A--12/058--SE, October 2012.

[3] Peter Fritzson. Principles of Object-oriented modeling and simulation with Modelica 2.1. Wiley-IEEE Press, 2004.

[4] Peter Fritzson, Adrian Pop and Martin Sjölund. Towards Modelica4 Meta-Programming and Language Modeling with MetaModelica 2.0, Technical reports Computer and Information Science Linköping University Electronic Press, ISSN:1654-7233; 2011:10

[5] Peter Fritzson and Adrian Pop. Meta- Programming and Language Modeling with MetaModelica 1.0. Technical reports Computer and Information Science Linköping University Electronic Press, ISSN: 1654-7233. 2011:9.

[6] Alfred Aho, Monica Lam, Ravi Sethi, Jeffrey Ullman. Compilers Principles, Techniques, and Tools, Second Edition. Addison-Wesley, 2006.

[7] Peter Fritzson et al. Compiler Construction laboratory assignments. Compendium, Bokakademin, Linköping University, Department of Computer and Information Science, 2011.

[8] Michael Burke and G.A. Fisher Jr. A practical method for syntactic diagnosis and recovery. In Proceedings of the 1982 SIGPLAN symposium on Compiler Construction, 1982.

[9] Open Source Modelica Consortium. OpenModelica System Documentation Version 1.6, November 2010. http://www.openmodelica.org

[10] TheMathWorks,Inc.MATLAB http://www.mathworks.se/

[11] Luiz De Rose and David Padua. Techniques for the Translation of MATLAB Programs into Fortran 90, ACM Transactions on Programming Languages and Systems, Vol 21, March 1999.

[12] Luiz De Rose and David Padua. A MATLAB to Fortran 90 Translator and its Effectiveness. ISBN:0-89791-803-7, 1996.

[13] Pramod G. Joisha, Abhay Kanhere, Prithviraj Banerjee, U. Nagaraj Shenoy, Alok Choudhary. The Design and Implementation of a Parser and Scanner for the MATLAB Language in the MATCH Compiler, 1999.

[14] Pramod G. Joisha, U. Nagaraj Shenoy, Prithviraj Banerjee. An Approach to Array Shape Determination in MATLAB. Technical report no. CPDC– TR–2000–10–010, Oct 2010.

[15] Anton Dubrau and Laurie Hendren. Taming Matlab, Sable Technical Report No. sable-2011-04. McGill University, School of Computer Science, April, 2011.

[16] Jun Li. MCFOR: A MATLAB TO FORTRAN 95 COMPILER. McGill University, School of Computer Science, August, 2009.

Citations in Crossref