453 ICI Bucharest © Copyright 2012-2019. All rights reserved ISSN: 1220-1766 eISSN: 1841-429X 1. Introduction Moving from a controller design to its real-time implementation is time-consuming and requires knowledge in various areas. To implement a real time controller, it has to be programmed using C language, compiled and executed in a micro- controller (MCU). For a complex control strategy, this task can be time-consuming and error-prone. Fixing errors in the program takes additional time and effort (How, 2019). These factors slow down small companies in developing products that involve controllers. In education environments cause students and professors prefer to make a computer simulation instead of a laboratory experiment or a physical application for testing control strategies (How, 2018). For decades, many efforts have been made in order to ease the process of translating a control law into its real-time implementation (Hull, et al., 2004). There are software systems like DSpace (Chini, et al., 2017) MATLAB (Banerjee, et al., 2004; Zarrad, et al., 2019) and LabVIEW (Beck, et al., 2006; Chacon, et al., 2015), aimed to assisting and simplifying the different stages of a control application. These are very powerful tools, convenient for a well-established business. However, they have certain characteristics that inhibit their wider use, particularly in education environments and small technology-oriented companies: a) They are closed systems that can hide valuable information about how the translation is made. b) They are expensive. In an educational setting such characteristics inhibit collaboration among professors and students, and reduce the flexibility that is necessary for experimentation. Furthermore, a hidden process may not facilitate the students` understanding of the process. Controllers for dynamical systems are dynamical themselves. The static cases can be seen as particular instances of dynamical systems with no states. Hence to implement real-time controllers is tantamount to making a digital system to emulate a dynamical system. Hereafter real-time controller implementation and emulation of dynamical systems by digital systems are treated interchangeably. The previously mentioned existing tools are based on a domain-specifc language in which the dynamical equations are easily expressed (e.g. Simulink in case of MATLAB) and on a processor of such language whose purpose is to generate code which can be executed by a piece of hardware. The hardware can be manufactured by the provider company (e.g. LabVIEW, DSpace) or by a third party (e.g. MATLAB). Studies in Informatics and Control, 28(4) 453-461, December 2019 https://doi.org/10.24846/v28i4y201909 A Domain-specifc Language for Real-time Dynamical Systems Emulation on a Microcontroller Francisco-David HERNANDEZ 1 *, Domingo CORTES 1 , Marco A. RAMIREZ-SALINAS 2 , Jorge RESA 1 1 Instituto Politécnico Nacional, ESIME Culhuacán, Av. Santa Ana 1000 Ciudad de México, 04440, México fcod.hdez@gmail.com (*Corresponding author), domingo.cortes@gmail.com, jrtipn@gmail.com 2 Instituto Politécnico Nacional, CIC, Av. Juan de Dios Bátiz S/N, Ciudad de México, 07738, México mars@cic.ipn.mx Abstract: Translating a control law to code so that it can be executed in real time by a microcontroller is time-consuming and requires knowledge in diverse areas. There are powerful tools like Matlab and DSpace, that can ease the process, however, these tools are expensive and hide the way the translation is actually made. These two factors greatly diminish the use of these tools in education and small business. This paper presents SystDynam, a high-level language designed for describing static and dynamical systems and hence, controllers. The language was purposely created to be easy to process in order to obtain a C code by using free software tools. Therefore, a senior student or a control engineer with a short training in language processors can understand how the translation is made. The necessary code for translation is described here and is freely available. Having the controller described by C code, it can be compiled to be executed as the main task in a real-time operating systems, thereby obtaining the real-time controller. The complete process can also be used for emulating dynamical systems, thereby enabling the use of hardware in the loop simulations and low-cost rapid prototyping and providing an auxiliary tool for teaching some engineering courses. Keywords: Control applications, Controllers, Rapid prototyping, Embedded systems, Control languages.