Main Content

Creating a New Simscape Model

Domain Types and Recommended Blocks

Simscape™ models require certain blocks to be present in the model configuration, such as a Solver Configuration block, or domain-specific reference blocks. Other blocks, although not required, are highly likely to be needed, such as Simulink-PS Converter and PS-Simulink Converter blocks. An easy way to start a new Simscape model is by using the ssc_new function.

When you type ssc_new at the MATLAB® Command prompt, the software creates a new model prepopulated with certain blocks.

By default, the model name is not specified, the model contains a Solver Configuration block, a Simulink-PS Converter block, and a PS-Simulink Converter block connected to a Scope block. The default solver is VariableStepAuto. The resources section at the bottom of the model window provides links to the relevant block libraries and documentation topics.

You can use the ssc_new function arguments to specify the model name and add domain-specific blocks. See the ssc_new reference page for details. For example, typing


creates the following model.

After using ssc_new, continue developing your model by copying the blocks, as needed, and adding other blocks from the Simscape libraries.

Solver Settings for New Model

When you create a new model using ssc_new, the model has the following settings:

  • SolverVariableStepAuto

  • Relative tolerance1e-3

  • Absolute tolerance1e-3

  • Auto scale absolute tolerance off

For more information, see Simulating with Variable Time Step and Choose a Solver.

Data Logging Settings for New Model

Using data logging is a best practice for Simscape models because it provides access to important simulation and analysis tools. Therefore, the ssc_new function automatically turns on data logging for the whole model. It uses the default workspace variable name simlog to store simulation data, and limits the data to the last 10000 points to avoid slowing down simulation. At the same time, it raises MaxDataPoints to 10000, so that Simulink® data logging history matches Simscape data logging history.

When you create a new model using ssc_new, the model has the following data logging configuration:

  • Log simulation dataAll.

  • Log simulation statistics — Off.

  • Record data in Simulation Data Inspector — Off.

  • Open viewer after simulation — Off.

  • Workspace variable namesimlog.

  • Decimation1.

  • Limit data points — On.

  • Data history (last N steps)10000.

For information on what these settings mean and how to change them, see Data Logging Options.

See Also

Related Topics