What is MBD
Model Based Development
Does this sound complex to you? Well, it is not! It is actually programming for engineers. Instead of code, you use simple, intuitive blocks. In our case, we use MATLAB/Simulink®. So: the old fashioned way of writing complex code becomes connecting blocks with lines, which can be understood quickly, by any engineer.
Development of a control algorithm is as simple as this set of stepsDrag and drop the blocks in your project
- Configure the blocks and connect them together
- Connect your algorithm to physical inputs and outputs using our HANcoder library blocks
- Press ‘build’ and the code for your control system will be generated automatically
- If you desire so, the generated code can be automatically flashed into the control system
The connected blocks are the model.
Using blocks instead of code serves multiple purposes. The blocks are the algorithm’s:
- Specification: The model, consisting of the blocks is actually a specification of the algorithm. You can easily discuss about the algorithm with fellow engineers of your customer. They will understand the blocks quickly.
- Documentation: The blocks are very intuitive. You can add markup with text and images, so your algorithm will become self-documenting.
- Implementation: The greatest part! Using HANcoder together with MATLAB/Simulink, your blocks can be automatically transformed (‘autocoded’) into a running program on your microcontroller. So, the blocks are also the final implementation.
Besides this simple step of programming using blocks, there’s more to Model Based Development. Several techniques exist to take more advantage of using MBD.
It starts with modelling the behaviour of your system using the same blocks in a so-called ‘plant model’. This will unleash the full power of model based development. It enables you to simulate your system and to develop your control algorithm using these simulations. Besides simulation, more techniques are available. The following figure shows an overview of the most common MBD techniques:
On the top left, simulation is used for the first design and development of your algorithm. In the simulation, you connect your control algorithm to your plant model. This provides deeper understanding of system and controller behaviour and allows you to develop and refine your control strategies in a very early stage. Due to the gained knowledge in detailed system behaviour, this step can also be used to refine requirements.
Since models are the key element in Model Based Development the automatic generation of code from these models can significantly enhance the efficiency and effectiveness of this development process. It enables the 3 central steps in the abovementioned V-cycle:
- Rapid control prototyping (RCP), where code from the control algorithm model is automatically generated for a control system. This is actually the ‘programming for engineers’ step. Use this is you want to quickly try your algorithm in practice. Note: Many hobby and research project do not go beyond this step! It is everything you need to create a working control system
- Implementation, where code is also automatically generated from the control algorithm model. In this case the code is generated for the series production system. This requires additional work on your algorithm like robustness and diagnostics, but you can still use the same tools for generating the code
- Hardware In the Loop (HIL) testing, where code is generated from plant models and executed on a computer system capable of running the models in real-time: a HIL simulator. With the correct input and output interfacing, a HIL simulator can electrically simulate a system to the level that control system can be connected to the HIL simulator as it is connected to a real world system. This enables reproducible, 24/7 conductible automated testing and validation of the control system behaviour
As a last step, in the top right of the figure, you optimise your function. If your code is running in the control system, you want to be able to visualise measured and calculated signals of the system. You may also want to tune the settings (called parameters) in your control algorithm to optimise its performance. For this, you can make use of HANtune. With HANtune you can create your own dashboard layouts to visualise and tune your control system in real-time. HANtune connects to the control system via various protocols.