R2024a

New Features, Bug Fixes, Compatibility Considerations

Simscape Language

 N-Dimensional Physical Signals and Variables: Support N-D arrays throughout modeling and simulation

Prior to R2024a, Simscape™ language supported N-D arrays of components and nodes and N-D parameters, as well as 3-D and 4-D lookup tables, but for many aspects of modeling and simulation, array support was limited to two dimensions only. This limitation has now been lifted.

You can now declare variables, inputs, outputs, and intermediates as N-D arrays. The Simscape modeling and simulation tools support these N-D quantities:

  • Data logging — Simscape Results Explorer indicates N-D data in the legend when plotting. The simscape.logging.Series.values method has new options for shaping N-D data. The default behavior is the same as prior to R2024a.

  • Selective logging (introduced in R2024a) — Block instrumentation supports N-D data.

  • Simulation Data Inspector supports N-D Simscape data and displays it like any other N-D quantity.

  • Probe block — The block outputs a Simulink® signal of the same dimensions as the quantity being probed.

  • Variable initialization — You can set targets for N-D variables in the block dialogs or Property Inspector. Variable Viewer supports N-D variables and shows whether the targets have been satisfied. For higher-dimensional targets and values, the Variable Viewer cells display only the data dimensions, followed by the word double. This display is consistent with the Workspace Browser.

  • Operating point — simscape.Value, simscape.op.Target, and simscape.op.OperatingPoint objects support N-D quantities.

Variable Scaling Analyzer and Statistics Viewer support N-D quantities but use linear indexing to display the results.

movsum and cumsum Functions: Calculate moving or cumulative sums in equations

You can now use these functions in the equations section:

  • movsum — Calculate the moving sum.

  • cumsum — Calculate the cumulative sum.

For a complete list of functions supported in the equations section, see Supported Functions.

Foundation Library

Network Coupler Library Enhancements: Support arrays of electrical nodes

These Network Coupler blocks now support arrays of electrical nodes and three-phase connections:

  • Network Coupler (Inductor)

  • Network Coupler (Capacitor)

  • Network Coupler (Voltage-Current)

  • Network Coupler (Current-Voltage)

  • Network Coupler (Voltage-Voltage)

Both the Port 1 Interface and Port 2 Interface subsystems of these blocks now have a new mask parameter, Electrical node array size. The default value, 1, corresponds to regular electrical connections. Entering a different parameter value switches to an array of electrical nodes. The new Use three-phase electrical connections check box provides an easy way for you to specify a three-phase electrical port instead.

When breaking connections between two arrays of electrical nodes, set the Electrical node array size parameter to match the size of the two arrays. Because the top-level subsystem is unmasked, you must set this parameter to the same value for both the Port 1 Interface and Port 2 Interface blocks. Similarly, for three-phase electrical ports, you must select the Use three-phase electrical connections check box for both the Port 1 Interface and Port 2 Interface blocks.

If you look under the mask, the Port 1 Interface and Port 2 Interface subsystems contain custom blocks, such as the Controlled Voltage Source or Current Sensor blocks. These custom blocks are based on the equivalent Foundation library blocks but are modified to support vectorized and three-phase electrical nodes.

Graph Importer Tool: Import datasheet graphs into MATLAB data files for use in block parameterization

You can use the new Graph Importer tool to import graphs from part datasheet PDFs, modify the point data, if needed, and then export selected data as MATLAB® data files. You can later use these data files for block parameterization.

To open the tool, at the MATLAB command prompt, enter graphImporter.

Local Restriction (2P) Block Enhancement: Use Bernoulli equation to compute pressure losses

The Local Restriction (2P) block has a new parameter, Pressure loss model:

  • Bernoulli — The block uses the Bernoulli equation, which assumes uniform density from inlet to outlet. This option is sometimes less accurate than the Control volume method, but it is more robust and provides faster simulation.

  • Control volume — The block uses the control volume analysis without assuming uniform density. It models the flow from the inlet to the restriction as a flow contraction and the flow from the restriction to the outlet as a flow expansion. This functionality is the same as prior to R2024a.

Use the Bernoulli option when:

  • The local restriction is operating in a fully subcooled liquid regime. The fluid is approximately incompressible and the uniform density assumption is appropriate.

  • The local restriction is used as an expansion valve in a refrigeration cycle. The fluid at the inlet is a subcooled liquid coming out of the condenser, therefore the uniform density assumption is appropriate.

  • The local restriction is operating in a fully superheated vapor regime, but the flow velocity is low subsonic, which is typically the case in HVAC systems. In this case, the density also does not change much and the uniform density assumption is appropriate.

For all other situations, you can also use the Bernoulli option to trade accuracy for a faster and more robust simulation.

This change has no compatibility impact. The Bernoulli option is the default setting for new blocks, but when you open an existing model, the Local Restriction (2P) blocks in it automatically have the Pressure loss model parameter set to Control volume.

Spectrum Analyzer enhancements

The Spectrum Analyzer block has the following enhancements:

  • To customize the spectrum analyzer status bar, you can now click the Customize status bar icon (Three vertical dots) on the right side of the status bar.

  • The Analyzer tab has been renamed to the Scope tab.

 Compact display of simscape.Value and simscape.Unit objects

When you place simscape.Value and simscape.Unit objects in table, cell, or structure arrays, or in MATLAB classes, the Command Window now displays the values and units of these objects explicitly. For example:

y.fieldArray = simscape.Value([1.23, 1.234, 1.23456],'m')
y = 

  struct with fields:

    fieldArray: [1.2300 1.2340 1.2346] (m)
struct2table(y)
ans =

  table

             fieldArray         
    ____________________________

    1.23     1.234    1.2346 (m)

Prior to R2024a, you could see only the member object dimensions and type when displaying the cell, structure, or table array, and needed to display the object members individually to see their values and units.

For row vectors greater than maximum width, empty vectors, and for single line display of matrices and row vectors, you can still see only the member dimensions and type. For example:

y.fieldArray = simscape.Value(zeros(0,3),'m')
y = 

  struct with fields:

    fieldArray: [0×3 simscape.Value] (m)

This display is consistent with the compact display of other object and data types in the Command Window.

 Compatibility Considerations

Prior to R2024a, the value and unit in a simscape.Value object were separated by a colon. Now, the Command Window displays the unit in parentheses after the value.

simscape.Value ObjectOld DisplayNew Display
T = simscape.Value(10, 'degC')
T = 

    10 : degC
T = 

    10 (degC)
V = simscape.Value([1 10 5], 'm')
V = 

     1    10     5

    : m
V = 

     1    10     5

    (m)

If you use programmatic data postprocessing that relies on the simscape.Value object display format, you must update your code.

 Default Transparent Background for Simscape Blocks

Prior to R2024a, Simscape blocks had a default white background color. If you changed the color of the canvas, this white background stood out and could clash with the overall color scheme of the canvas. Starting in R2024a, Simscape blocks have a transparent background by default, allowing the canvas color to fill in the background of the block.

In a Simscape block context menu, the Format > Background Color > Automatic option is selected by default, which enables background transparency. If you change the background color to any other color, only closed shapes in the block icon are filled with that color.

The Graphical Icon Editor has new options that allow modifications to transparency of a block background. For more information, see Graphical Icon Editor Overview.

 Compatibility Considerations

If you open a model created using a previous version of Simulink that contains Simscape blocks on a colored canvas in R2024a, then the backgrounds of all Simscape blocks turn transparent. Additionally, the Format > Background Color > Automatic option is automatically selected in the context menu of these Simscape blocks.

If you save and open such a model created in R2024a in an older version of Simulink, Simscape blocks will acquire a white background.

Constant Aspect Ratio on Block Resize

Starting in R2024a, Simscape blocks preserve the block aspect ratio, by default, on resizing.

For blocks that have line connections from ports to the block icon, such as the NPN Bipolar Transistor block, block resizing is constrained to maintain the aspect ratio. To freely resize such blocks, hold down the Shift key while dragging the block boundary to the new position.

 Functionality being removed or changed

Hydraulic library has been removed from Library Browser

Still runs

The Hydraulic library has been removed from the Library Browser. The hydraulic domain definition is still provided with the software, and all the hydraulic blocks in your legacy models continue to work as before. However, these blocks no longer receive full production support and can be removed in a future release.

 Compatibility Considerations

Use the Isothermal Liquid library and domain to model hydraulic systems where the working fluid temperature remains constant during simulation. For information on upgrading your legacy hydraulic models, see Upgrading Hydraulic Models to Use Isothermal Liquid Blocks.

Numerical improvement for low-flow computation in pipes

Behavior change

To improve accuracy for pressure drop inside the pipe at low-speed flows, the momentum balance computations in the Pipe (G), Pipe (MA), and Pipe (2P) blocks have been changed slightly.

 Compatibility Considerations

There may be slight differences in simulation results compared to releases prior to R2024a, especially when Mach number is low.

Control runtime regularization independently of fixed-cost simulation

Behavior change

The Resolve indeterminate equations check box in the Solver Configuration block, which applies runtime regularization to solve statically indeterminate systems, has been renamed to Resolve indeterminate equations at runtime and moved to a different section of the dialog box. Previously, you needed to select the Use fixed-cost runtime consistency iterations check box to enable it. Now, to enable the Resolve indeterminate equations at runtime check box, you need to select the Use local solver check box and set Solver type to either Backward Euler or Trapezoidal Rule. Unless your model contains lossless parallel flow paths, such as ideal parallel clutches or switches, you can now clear the Resolve indeterminate equations at runtime check box and speed up simulation whenever you use these types of local solver, independently of whether the simulation is fixed-cost or not.

 Compatibility Considerations

You can no longer turn off runtime regularization for global solvers.

Simulation

 Selective Logging: Log individual block variables

You can now log individual Simscape block variables to the logsout workspace variable. Simscape logs the variables to a Simulink.SimulationData.Dataset object, so you can combine block data with other Simulink logged data and view the results in the Simulation Data Inspector. To learn more, see About Selective Logging and Log Selected Block Variables.

You can also manage selective logging instrumentation programmatically. To learn more, see Log Selected Variables Programmatically.

Some Simscape data logging buttons and menu options have been rearranged on the Simscape Block tab, but their behavior is unchanged from prior releases.

simscape.logging.getSimulationLog Function: Identify the latest simulation log for a model

Use the new function simscape.logging.getSimulationLog to identify the latest Simscape simulation log for a model. This function is helpful when you work with several models within a session and have multiple simulation log variables in your workspace. Provide the model name as an argument, and the function returns the latest simulation log associated with the model.

Variable Viewer: Identify targets applied by an operating point

If a model is initialized from an operating point, the new Target Source column in the Variable Viewer helps identify the source of variable targets.

For variables that have their target set by the operating point, this column displays Operating Point. For other variables, targets come either from block-level initialization or from the underlying component file, and the column remains empty.

Multithreaded Compilation: Additional performance improvements

Multithreaded compilation has been implemented for additional portions of model compilation. This change further improves compilation performance and applies both to reusable and nonreusable components.

Multithreaded compilation is now always enabled by default, regardless of whether component reuse is on or off. For more information, see How to Enable or Disable Multithreaded Compilation.

Reduced stack size in code generation

Code generation is improved to use fewer local variables. This enhancement results in reduced stack size in the generated C code.

Simscape-to-HDL Enhancements

When using Simscape-to-HDL code generation, you can now modify the run-time parameter values in the generated FPGA bitstream for your Simscape models.

You can also automatically replace the common Simscape switches and converter blocks with their linearized equivalent from the SimscapeFPGAHIL_lib library. To run automatic replacement on a model or Simscape network, use the sschdl.generateOptimizedModel function. You can specify a model or the Solver Configuration block path for a Simscape network. For example, to linearize a model stored to the variable input, enter:

linearizedMdl = sschdl.generateOptimizedModel(input);
The output argument, linearizedMdl, is the linearized version of input.

To learn more about R2024a Simscape-to-HDL features, see Release Notes for HDL Coder (HDL Coder).

Test harness creation enhancement for Simscape models

If you have a Simulink Test™ license and your component under test contains Simscape blocks, the test harness now displays a help area that links to commonly used blocks for each of the associated Simscape domains. This help area facilitates harness creation for these domains. For more information, see Create a Test Harness (Simulink Test).

New examples

Examples introduced in this version include:

Additionally, the Heat Conduction Through Iron Rod example has been significantly expanded to teach fundamental heat transfer concepts.

 Functionality being removed or changed

HDF5 (H5) file format for exporting logged simulation data has been removed

Errors

HDF5 (H5) is a legacy file format for exporting logged simulation data when streaming to disk. The default file format has been changed to MLDATX in R2020b. In R2024a, this functionality has been removed.

 Compatibility Considerations

Use MLDATX file format for exporting logged simulation data.

Sparkline plots of logged simulation data have been removed

Prior to R2024a, you could display sparkline plots of logged simulation data directly on the model canvas. In R2024a, this functionality has been removed.

 Compatibility Considerations

Use the Simscape Results Explorer or Simulation Data Inspector to view logged simulation data.

Run-time scaling of algebraic equations

Behavior change

Certain solver optimizations, such as equations scaling, now include run-time parameters. Prior to R2024a, equations were scaled at compile time. This enhancement results in improved solver performance for models with run-time parameters.

 Compatibility Considerations

There may be slight differences in simulation results, especially for models with run-time parameters. For example, the solver can take a different number of time steps than in R2023b.