# Metamodelling for Design of Mechatronic and Cyber-Physical Systems
## 2 Modelling Mechatronic Systems
### Model-Based Design Paradigm  
In Reference [7], the nine-box model of immersion in the _Model-Based Design_ process of control algorithm development is presented (Figure 1). The companies with the highest degree of immersion (Figure 1 MBD-9) employ a fully model-based approach during the research and development phase. The bare minimum, however, is to use a graphical representation of the developed control system components (Figure 1 MBD-1).  
The following benefits can be attributed to the MBD approach:  
1. Final product's conformity to the specified requirements,
2. Reduction of software errors,  
Figure 1: The nine-box model for implementation of _Model-Based Design_ concepts [7].  
Verification of the project's goals without building a physical prototype,  
4 Development of test-case scenarios and their validation in a simulation environment,  
5 Easier management of complex projects.  
Two important areas of mechatronic and cyber-physical systems design are represented in Figure 1 by columns and rows. These are respectively:  
1. Implementation and adoption of verification and validation procedures: * (I) Control algorithm modelling (open loop)--no validation support; specifications include only operational level information; * (II) System design simulation (closed loop)--closed loop simulations are used to provide feedback data for designers; real-time testing before moving the control system to a target platform allows to eliminate most errors from the final product without the risk of damaging its physical components (e.g., sensors, actuators); * (III) Requirements-based development--requirements management is ingrained in the system design process;
2. Implementation of automatic code generation procedures: * (1) Simulation--code generation supports only system and dynamic simulation calculations; no real-time code is generated; * (2) Real-time testing--real-time tests are additionally supported by automatic code generation procedures; * (3) Production code--this highest level of software development is achieved by utilizing toolchains that support code generation for the final product directly out of the system's specifications.  
**Implementation and adoption of verification and validation procedures** (Figure 1) results in a better integration of business goals within system design procedures.  
**Implementation of automatic code generation procedures** (Figure 1) improves the process of software development; the development time is reduced and less errors are present in the final product's source code.  
Fully adopting the _Model-Based Design_ principles is a time-consuming process. Migrating from the process loosely based on models, most likely only used for documenting and organizing the software aspect of the solution (Figure 1. MBD-1), towards one that is interlaced with them on all levels (e.g., law legislation, software and hardware aspects of the solution, business requirements) demands vast investment in both human and material resources.  
For most of the companies, adopting the MBD-4 level results in a significant increase in efficiency. It also reduces the risks present during new product development. Higher levels of adoption are a proof that the company is aware of intricacies present in research and development processes and chooses a systemic approach to pursue them.  
At the highest level of immersion (represented in Figure 1 by states from MBD-7 to MBD-9), the ability to intertwine the requirements set for a product with the ability to validate and verify them in simulations closely resembling the end-product's working conditions is an unparalleled advantage. This results in a faster development of new product versions, adding features to the existing ones is easier, finally, the adaptation to the ever-changing market conditions (e.g., new legislation) is more straightforward. Therefore, employing such measures gives a cutting edge over competition.  
In the following subsections all levels of the _Model-Based Design_ adoption presented in Figure 1 are described.