Sunday, May 19, 2024
HomeMatlabWhat’s New in Simulink R2024a? » Man on Simulink

What’s New in Simulink R2024a? » Man on Simulink

MATLAB R2024a is now obtainable, and quite a lot of new necessary options have been added to Simulink. Listed below are my high 5.

Simulation object

Utilizing the Simulation object, you’ll be able to programmatically run a simulation step-by-step. You may execute the simulation one step at a time, for a specified variety of steps or as much as a particular time. Right here is an instance the place I simulate the mannequin as much as t=18.5 seconds, then I alter the worth of variable okay and proceed the simulation till the cease time:

% Run the primary a part of the simulation with okay=0.2

% Run the second half with okay=1.5

Design Research

The brand new Design Research API gives a layer on high of parsim and batchsim to enhance scalability. As a substitute of making an array of Simulink.SimulationInput objects, you specify arrays of values to be simulated, and the way they need to be mixed. Right here is a straightforward instance the place I simulate a mass-spring-damper system for various mass and damping values.

I specify 5 mass values and 5 damping values, and simulate an exhaustive mixture for a complete of 25 simulation

kVar = simulink.multisim.Variable(‘c’,1:5);

cVar = simulink.multisim.Variable(‘m’,1:5);

fullSpace = simulink.multisim.Exhaustive([kVar cVar]);

myDesignStudy = simulink.multisim.DesignStudy(mdl, fullSpace);

outH = parsim(myDesignStudy,‘ShowProgress’,‘Off’,‘UseFastRestart’,‘on’);

out = fetchOutputs(outH);

Specifying Variant Configurations utilizing a SimulationInput object

A brand new VariantConfiguration property has been added to the Simulink.SimulationInput object. Right here is an instance code the place I get the variant configuration information for a mannequin and run one simulation per obtainable configuration:

mdl = ‘sldemo_variant_subsystems’;

load(‘variantConfigs.mat’); % load pre-saved variant configuration information

vcd = Simulink.VariantManager.getConfigurationData(mdl);

N = size(vcd.Configurations);

in(1:N) = Simulink.SimulationInput(mdl);

in(i) = in(i).setVariantConfiguration(vcd.Configurations(i).Identify);

out = sim(in,‘ShowProgress’,‘off’);

Simplified Mechanism to entry Information Dictionaries

Earlier than R2024a, in the event you needed to programmatically change the worth of a parameter saved in a knowledge dictionary, you needed to write code like this:

myDictionaryObj =‘simplesystemDD.sldd’);

dDataSectObj = getSection(myDictionaryObj,‘Design Information’);

kObj = getEntry(dDataSectObj,‘okay’);

In R2024a, you’ll be able to easy join to an information dictionary and work together with it utilizing the dot operator.

h = Simulink.information.join(‘simplesystemDD.sldd’);

Protect alignment when shifting and resizing blocks

Let’s shut this listing with a easy quality-of-life modifying enchancment. This isn’t a game-changer like a number of the earlier highlights however will hopefully enhance your modifying expertise.

When deciding on a block, you may discover a light-weight inexperienced highlighting on connections and blocks round it. Which means now we have detected that these connections and blocks ought to doubtless transfer with the blocks.


Similar works with resizing:

Now it is your flip



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments