Main Content

Typical Simscape Language Tasks

Simscape™ block libraries contain a comprehensive selection of blocks that represent engineering components such as valves, resistors, springs, and so on. These prebuilt blocks, however, may not be sufficient to address your particular engineering needs. When you need to extend the existing block libraries, use the Simscape language to define customized components, or even new physical domains, as textual files. Then convert your textual components into libraries of additional Simscape blocks that you can use in your model diagrams.

This table lists typical tasks along with links to background information and examples.

TaskBackground InformationExamples
Create a custom component model based on equations

Creating Custom Components

Declaring Domains and Components

Defining Component Equations

Model Linear Resistor in Simscape Language

Declare a Spring Component

Mechanical Component — Spring

Electrical Component — Ideal Capacitor

No-Flow Component — Voltage Sensor

Grounding Component — Electrical Reference

Create a custom component model constructed of other components

About Composite Components

Declaring Member Components

Parameterizing Composite Components

Specifying Component Connections

Composite Component — DC Motor

Generate a custom block from a Simscape component file

Selecting Component File Directly from Block

Customizing the Block Name and Appearance

Deploy a Component File in Block Diagram

Customize Block Display

Add a custom block library to Simscape libraries

Building Custom Block Libraries

Using Source Protection for Simscape Files

Customizing the Library Name and Appearance

Customizing the Block Name and Appearance

Create a Custom Block Library

Customize Block Display

Define a new domain, with associated Through and Across variables, and then use it in custom components

When to Define a New Physical Domain

Declaring Domains and Components

Declare a Mechanical Rotational Domain

Propagation of Domain Parameters

Create a component that supplies domain-wide parameters (such as fluid temperature) to the rest of the model

Working with Domain Parameters

Custom Library with Propagation of Domain Parameters

Create a component characterized by a discrete set of distinct operating modes, such as a car clutch

Mode Chart Modeling

Switch with Hysteresis