Products & Services Solutions Academia Support User Community Company

Learn more about Simscape   

Working with a Simscape Demo Model

About This Tutorial

This tutorial provides you with hands-on experience of using Simscape software. You will open a demo model, examine how it is built, and run the simulation. You will then perform simple modifications of the demo and view their effect on the simulation results.

The Permanent Magnet DC Motor demo shows how Simscape models can simulate systems that span electrical and mechanical domains. In this demo, you learn how to model physical components with Simscape blocks, connect them into a realistic model, use Simulink blocks as well, and then simulate and modify a motor model.

The model is based on a Faulhaber Series 0615 DC-Micromotor. For the 1.5V variant, equivalent circuit parameters are given as:

Rotor resistance R=3.9 Ohms
Rotor inductance L=12mH
Back emf constant K=0.072mV/rpm
Rotor inertia J=0.01gcm^2
Friction torque Mr=0.02mNm

The model uses these parameters to verify manufacturer-quoted no-load speed, no-load current, and stall torque, which are:

No-load speed = 19,100rpm
No-load current = 0.03A
Stall torque = 0.24mNm

You can use the model to assess motor performance in a given application by adding the requisite mechanical load model.

Exploring the Model

  1. To open the Permanent Magnet DC Motor demo, type ssc_dcmotor in the MATLAB Command Window.

    Main Model Window

    The main model window contains a DC Motor subsystem with two electrical and two mechanical rotational ports.

    The electrical ports connect to the electrical circuit, which consists of an Electrical Reference block, representing an electrical ground, a 1.5 V DC voltage source, and a current sensor. The current sensor connects, through a PS-Simulink Converter block, to a Simulink scope labeled Motor Current.

    On the mechanical side, a Mechanical Rotational Reference block represents a reference point for the other elements. An ideal rotational motion sensor connects, through a PS-Simulink Converter block, to a Simulink scope labeled RPM.

    The motor load is represented by an Ideal Torque Source block, which on one side connects to a Mechanical Rotational Reference block, and on the other side to the motor shaft. A regular Simulink Step source provides the control signal. A Simulink-PS Converter block converts the control signal into a physical signal and applies it to the control port of the Ideal Torque Source block.

    The diagram also contains a Solver Configuration block, which is required in any Simscape model. It contains parameters relevant to numerical algorithms for Simscape simulations.

  2. Double-click the DC Motor subsystem to open it.

    DC Motor Subsystem

    The motor consists of an electrical circuit and a mechanical circuit, connected by the Rotational Electromechanical Converter block. The electrical circuit consists of a Rotor Resistance block and an Inductance block L. It contains two electrical ports, corresponding to the V+ and V- electric terminals of the motor. The mechanical circuit contains a Rotational Friction block, Motor Inertia J, and two mechanical rotational ports, C and R, corresponding to the motor case and rotor, respectively. Notice how the C and R ports of the Friction block and the Rotational Electromechanical Converter block are connected to the C and R ports of the motor, to preserve the correct direction of variables in the Physical Network.

Running the Model

After you have reviewed the block diagram of the demo model, you can run the simulation.

  1. Double-click the Motor Current and RPM scopes to open them. During simulation, these windows display the motor current and shaft speed, respectively, as functions of time.

  2. In the toolbar of the model window, click to start the simulation. The Simscape solver evaluates the model, calculates the initial conditions, and runs the simulation. This process might take a few seconds. The message in the bottom-left corner of the model window provides the status.

  3. Examine the simulation results in the Motor Current and RPM scope windows.

    For the first 0.1 seconds, the motor has no external load, and the speed builds up to the no-load value. Then at 0.1 seconds, the stall torque is applied as a load to the motor shaft. Zooming in on the RPM and Motor Current scopes shows that the model matches the manufacturer parameters for no-load speed, no-load current, and stall torque.

Modifying the Model

After running the initial simulation, you can experiment with adjusting various inputs and block parameters. Try the following adjustments:

  1. Change the supply voltage.

  2. Change the motor load.

Changing the Supply Voltage

Reduce the supply voltage to 1.25 volts (to simulate the battery running down) and vary the load torque to find the maximum torque at this reduced voltage.

  1. Double-click the 1.5V DC Voltage Source block. Set Constant voltage to 1.25 V.

  2. Run the simulation. Note the effect of reduced voltage on the no-load speed.

  3. Try varying the load torque to find the maximum torque at this reduced voltage. Double-click the Step source block, enter different final values for the input signal, and rerun the simulation.

    The next illustration shows the simulation results for Final value set to -0.2e-3, which corresponds to (1.25/1.5)*0.24mNm, as the magnitude of the torque-speed curve is proportional to voltage for a DC motor.

Changing the Motor Load

Replace the torque source with a simple mechanical load, for example, a fan, for which the torque is defined by alpha*speed^2, where alpha is -1e-10 Nm/(rad/s)^2.

  1. Delete the Step source and the Simulink-PS Converter block from the model.

  2. In the Simscape block library, open Foundation Library > Physical Signals > Functions.

  3. Drag the PS Product block and the PS Gain block to the model window.

  4. Connect the blocks as shown in the following illustration. To rotate a block, select it and press Ctrl+R.

  5. Double-click the Gain block to open its dialog box. Enter Gain value of -1e-10 and click OK.

  6. Run the simulation and assess motor performance with the new load.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2010- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS