## 1 Introduction  
Economic model predictive control (MPC) in smart grids and microgrids is a topical field of research, and many successful applications have already been demonstrated, even if often only in simulation studies. One of these applications is unit commitment, dispatch, and demand-side optimisation in microgrids, based on dynamic pricing at the electricity exchange [1]. In this application, the optimal energy or power scheduling of microgrid components is computed based on predictions of weather, electrical, or thermal load, electricity prices, etc. The optimal schedule is used as the setpoint for the microgrid components. This optimisation of the schedule is repeated periodically with a receding horizon. The implementation of such optimisation methods on embedded hardware for industrial control is a still developing but expanding research field [2; 3; 4]. A critical requirement of MPC implementations is the availability of accurate and detailed mathematical models of the controlled systems. The high modelling effort can pose a significant hurdle to a widespread application of MPC in microgrids due to the time and qualification needed for the generation and identification of suitable control-oriented models [5]. A large number of models for a variety of systems are described in the literature, but they are usually designed for one specific system to be controlled, major effort is spent on the implementation of these unique models, and often, they are implemented in desktop software such as Simulink or Modelica [6]. Depending on the grid regulatory framework, the cost of the modeling effort and control implementation may exceed the potential benefits from implementing MPC in microgrids. As stated by [PERSON] et al. [7], \"many industries do not necessarily need better [MPC] algorithms, but rather improved usability of existing technologies to allow a limited workforce of varying expertise to easily commission, use, and maintain these valued applications\". The goal of this work is to reduce the modelling effort that is required to implement MPC in a class of microgrids with various configurations and to enable rapid commissioning of MPC on field-typical hardware. The focus is on commercial microgrids in small and medium enterprises (SMEs), using industrial information and communication technology (ICT). One approach to rapidly implement MPC on embedded hardware is to develop the control solution in desktop software such as Matlab or Modelica and then use automatic code generation for the real-time implementation on the target embedded hardware, as presented by [PERSON] et al. [3]. While providing comfortable high-level engineering tools, this approach also has disadvantages. The engineering process still requires personnel who have in-depth knowledge of MPC and microgrid modelling. The automatically generated code can cause a major effort for long-term maintenance or even the need for redesign when the system architecture changes, e.g., when new components such as photovoltaic power plants or electric vehicles are put into operation. The difficulties of rapid development of MPC solutions were also addressed by [PERSON] et al. [8], who reduced the effort of going from simulation to an online application by providing a modular software system with standardised interfaces for simulator, model, estimator, and optimiser. An experimental validation was conducted on a laboratory reactor, where optimal control was computed on a desktop computer, and hardware was interfaced with laboratory communication equipment. [PERSON] et al. [9] presented a software package for model predictive control, avoiding a separate code generation phase for prototyping and embedded applications and trying to reduce the high price to pay in flexibility, maintainability, and extensibility of code generation. Validation was conducted numerically with an inverted pendulum model on a notebook computer.