OpenMBD.com currently provides two important tools to enable Rapid Control Prototyping (RCP): HANcoder and HANtune. The combination of these tools provides an efficient workflow for generating executable code and visualizing and tuning your control system.
HANcoder can be used to model, simulate and build your control algorithm. In order to make it as convenient as possible to set up a new project, a simple demo project is presented as a starting point to start developing your own control algorithm. The demo project contains a simple blinking LED which can be built and flashed right away into the controller to see if everything works as it should. All that is left for you to do is add functionality.
To add functionality, HANcoder provides a set of easy to use blocks with the most common functionalities, on top of the standard Simulink toolbox. Adding CAN support for example is as easy as to drag-and-drop a CAN block.
Automated code generation
The HANsuite workflow is highly automated. During the Simulink build-process the necessary files are automatically generated. Two of them are relevant for flashing the controller and tuning your application:
- .srec or .hex file (to run on Olimex STM32 or Rexroth controllers, respectively)
- .a2l file (also called ASAP2 file, used by HANtune)
After the build process has finished, these files are automatically generated and the flash tool will automatically be started. All that is required to flash the software (.hex or .srec) onto the controller is a controller-reset. Software can be flashed using MicroBoot, which is provided with the HANsuite. Microboot supports flashing over USB, Ethernet and CAN.
The .a2l file has to be loaded in HANtune. It’s a descriptive file containing info about all parameters and signals which could be used to monitor and calibrate the controller via HANtune.
When the .a2l file is loaded in HANtune you can drag and drop those parameters and signals into tabs. After connecting to the controller signals can be visualized and parameters can be altered in real-time.
- Step 1: The control algorithm is defined in Simulink, using functional blocks: This does not require a software engineer. Algorithms can be defined by persons with knowledge of the application
- Step 2: By using special Simulink blocks from the HANcoder library, hardware specific inputs and outputs can be connected to the algorithm. Blocks for the necessary system configurations are available as
- Step 3: Via the click of a button, C-code is generated, automatically followed by a compilation process, resulting in a number of files, from which 2 are the most important:
- The hex file (or srec file), to be loaded in the controller
- The ASAP2 file, an industry standard database describing all signals (variables) and parameters (constants) of the executable program
- Step 4: The hex file is loaded in the controller
- Step 5: The ASAP2 file is loaded in HANtune. Subsequently HANtune can connect to the controller, visualize/log all signals and tune all parameters form the controller in real-time. The user can define and store screen layouts with various numerical and graphical viewers and editors in a flexible way
- Step 6: CAN bus traffic can be monitored and manipulated using industry standard CANdb files (*.dbc). This can be done in parallel with connection to the controller. HANtune can also act as a standalone graphical CAN dashboard
The HAN software tools provide the following advantages for control system development:
Less personnel requirements
- The model based ‘programming’ is done using graphical blocks, understood by all engineers
- They can now program the systems themselves: No need for separate software engineers
Less communication challenges
- The block-based models serve as specification, documentation and implementation
- Engineers of different disciplines can all understand each other using the blocks
- The blocks can be used to discuss functionality and requirements with customers
Faster and more high-performance development
- System modelling becomes possible, enabling concurrent engineering using simulations
- Model based programming using blocks is faster compared to traditional programming
- System modelling gains provides insight for better algorithm performance and enables automated testing