File Exchange Pick of the Week

Our best user submissions

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Manage Simulink Data Variations with simulinkParser 1

Posted by Guest Picker,

Greg’s pick this week is simulinkParser by Tigran Mkhoyan.

How do you manage different simulation scenarios in your Simulink models?

Tigran provides a simple semantic language to describe how specific blocks in a Simulink model are to be configured, and apply the configuration to the model.

Contents

Define and Apply a Configuration Description

Define block parameters:

Reference this configuration from a “setConfig” block added to the model

And “Apply” the configuration to the model.

Why Is This Configuration Technique Useful?

This technique enables you to:

  • Manage block and model parameters
  • Have multiple configurations for the same model
  • Save the applied configuration to the model directly

This means the model can still execute simulation without the configuration file being present.

There is a school of thought that the values for block parameters should be explict numeric values, and not a reference to a variable in some other workspace. That is, the design in the Simulink model should be defined entirely within that model file.

This certainly simplifies interpretation of an algorithm, and increases the repeatability of simulation results. The drawback is typically the hinderance to scaling the number of simulation scenarios for which a given model might be used is more difficult to manage with “hard-coded” values.

This approach bridges that divide somewhat. It provides the robustness of explicit numeric parameter values and the flexibiliy to define several configurations that can be applied to a Simulink model

Why did I select Tigran’s Simulink Data Management Tool?

Managing data variations in Simulink isn’t something that has been addressed explicity as part of Simulink. There are several methods of associating a particular data set to a model, but not much in the way of configuring what data values should be applied in specific scenarios. While scripting in MATLAB gets you a long way, it still requires effort on the part of the user to develop a data variation management strategy.

Tigran’s entry provides a nice little framework for data variation management for common simulation use cases.

What Should We Add to Simulink for Data Variation Management?

Let us know here.

Get the MATLAB code

Published with MATLAB® R2018a

Note

Comments are closed.

1 CommentsOldest to Newest

Tigran Mkhoyan replied on : 1 of 1

Thanks for picking my entry! I made a recent update of simulinkParser based on my other entry configParser that allows to set constants using basic math operations. e.g. define k1 = @ 0.02/2 , k2 = @ k1 + 0.02^2. Set (covariance parameter of noise block) Cov = @ k2. See example v21. Nested relationships are also allowed.