EMAB 2016

A few weeks back, Mathworks hosted their annual EMAB (European MATLAB Advisory Board). The EMAB is a set of seminars stretching over three days, with the purpose of presenting news from the current MATLAB release, presenting planned features of future releases, and get feedback from customers on issues and/or desired functionality. Intended mainly for the industry, Combine is an exception as being the only consulting company invited to participate (at the Nordic site at least). This post is not intended as marketing for Mathworks products, but since most you use MATLAB/Simulink  at least to some extent, I thought this might be of interest.

Much of the contents from the seminars are confidential and cannot be published in this context, however, I would like to highlight a few features from the current release:

  • Initialize/Terminate Function block
  • Just-in-Time (JIT) Acceleration builds

Initialize/Terminate Function

init_function_blocks
New Initialize/Terminate Function blocks.

The Initialize/Terminate Function block is a new function, allowing the user to specify model behaviour at initialization and/or termination. A corresponding built-in feature has not been available before, often resulting in quite complex models for what should be an easy task. Also, these workaround solutions results in two separate initialize/terminate functions in the generated code (implicit and explicit).

 

init_function_block_contents
Contents of Initialize/Terminate Function.

The new blocks contain an Event Listener and a State Reader/Writer block that links (not only in a code context, but also with a hyperlink for improved model readability) to states in the model. The event listener can in fact be set to Reset as well as Initialize and Terminate, allowing the user to create proper reset behaviours. There are sevel benefits to using the new built-in function blocks. From a modeling perspective, the work needed to create initialize/reset/terminate functions is reduced while the model readability is improved due to the reduced wiring and blocks necessary. From a code perspective, the generated code for the blocks are included in the initialize()/reset()/terminate() methods. An added benefit to this is when working with components, since the code is aggregated automatically. This means that even though the model may contain multiple function blocks distributed over several sublevels, one single function initialize()/reset()/terminate() is created, within which the code for all sublevels are ordered (lowest level of hierarchy first). The result is a more efficient code that is much easier to read in my opinion.

For a brief introduction to the new blocks, have a look at this video.

 

Just-in-Time (JIT) Acceleration

Just-in-Time (JIT) compilation has been used in MATLAB code for more than a decade (though according to Mathworks, greatly improved between R2015a/2015b releases) and was introduced in Simulink in release R2015a. With JIT compilation, rather than generating C code or MEX files, an execution engine is generated in memory. This allows for faster simulation startups and rebuilds, while removing the need for a C compiler. New for R2016b is the use of JIT acceleration in the Acceleration simulation mode (not only for Normal mode, as in the last few releases). This will in fact be the default setting when using accelerator mode, so if you upgrade and  require the classic accelerator mode, be sure to revert (set_param(0, ‘GlobalUseClassicAccelMode’, ‘on’);).

When using JIT for the accelerator mode, execution speed will be maintained compared to the classic accelerator mode, but the initialization time will be reduced. Also, with the classic accelerator mode, it is possible to monitor signals during simulation using the Signal & Scope Manager and adding test points to signals. Unfortunately, this requires the model to be recompiled when adding test point. With the new JIT accelerator mode, test points can be added without recompilation.

For more information on the new accelerator mode, have a look at the video from Mathworks or the acceleration mode reference page.

Finally…

For more information, check out the introduction to new features or the full release notes list. Also, if you have any questions at all, please let me know. I am of course very interested if there are features you are not happy with, features you are missing, or comments in general. EMAB is our best chance to have an impact on future releases of MATLAB/Simulink – let’s make the most of this opportunity!

Kommentera

Fyll i dina uppgifter nedan eller klicka på en ikon för att logga in:

WordPress.com Logo

Du kommenterar med ditt WordPress.com-konto. Logga ut / Ändra )

Twitter-bild

Du kommenterar med ditt Twitter-konto. Logga ut / Ändra )

Facebook-foto

Du kommenterar med ditt Facebook-konto. Logga ut / Ändra )

Google+ photo

Du kommenterar med ditt Google+-konto. Logga ut / Ändra )

Ansluter till %s