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.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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 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, Simulink® Editor hides the block names in the model diagram. To display hidden block names, select Display and clear the Hide Automatic Names check box.

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. Double-clicking the Open Simscape Library block opens the main Simscape library.

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

ssc_new('hydraulic_actuator','hydraulic')

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.

For electrical models, you can also use the Creating A New Circuit example as a template for a new model. This example creates a new electrical model and opens an Electrical Starter Palette, which contains links to the most often used electrical components. Open the example by typing ssc_new_elec in the MATLAB Command Window and use File > Save As to save it under the desired model name. Then delete the unwanted components and add new ones from the Electrical Starter Palette and from Simscape libraries.

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