Main Content

Stepper Motor

Stepper motor suitable for whole-, half- and micro-stepping representation

  • Stepper Motor block

Libraries:
Simscape / Electrical / Electromechanical / Reluctance & Stepper

Description

The Stepper Motor block represents a stepper motor. It uses the input pulse trains, A and B, to control the mechanical output according to the following equations:

eA=Kmωsin(Nrθ)

eB=Kmωcos(Nrθ)

diAdt=(vARiAeA)/L

diBdt=(vBRiBeB)/L

Jdωdt+Bω=Te

Te=Km(iAeARm)sin(Nrθ)+Km(iBeBRm)cos(Nrθ)Tdsin(4Nrθ)

dθdt=ω

where:

  • eA and eB are the back electromotive forces (emfs) induced in the A and B phase windings, respectively.

  • iA and iB are the A and B phase winding currents.

  • vA and vB are the A and B phase winding voltages.

  • Km is the motor torque constant.

  • Nr is the number of teeth on each of the two rotor poles. The Full step size parameter is (π/2)/Nr.

  • R is the winding resistance.

  • L is the winding inductance.

  • Rm is the magnetizing resistance.

  • B is the rotational damping.

  • J is the inertia.

  • ω is the rotor speed.

  • Θ is the rotor angle.

  • Td is the detent torque amplitude.

  • Te is the electrical torque.

If the initial rotor is zero or some multiple of (π/2)/Nr, the rotor is aligned with the phase winding of pulse A. This happens when there is a positive current flowing from the A+ to the A- ports and there is no current flowing from the B+ to the B- ports.

Use the Stepper Motor Driver block to create the pulse trains for the Stepper Motor block.

The Stepper Motor block produces a positive torque acting from the mechanical C to R ports when the phase of pulse A leads the phase of pulse B.

Averaged Mode

If you set the Simulation mode parameter to Averaged, both for a Stepper Motor block and for the Stepper Motor Driver block that controls it, then the individual steps are not simulated. This can be a good way to speed up simulation. In Averaged mode, under nonslipping conditions, the motor and driver are represented by a second-order linear system that tracks the specified step rate. The demanded step rate is determined directly from voltage across A+ and A-. So, for example, a voltage of +10 V across the A+ and A- terminals is interpreted as a step rate demand of 10 steps per second. See the Stepper Motor Driver block reference page for more information on how to connect the driver block to your step angle controller.

Averaged mode includes a slip estimator to predict whether the stepper motor would have slipped if running in Stepping simulation mode. Slip is predicted if the motor torque exceeds the Vector of maximum torque values parameter value for longer than one step period, the step period being determined from the current step rate demand. Upon detecting slip, the simulation will proceed or stop with an error, according to the Action on slipping parameter value. If you choose the action that lets the simulation continue, note that simulation results may be incorrect. When slipping occurs, the torque generated by the motor is not generally the maximum available torque; the maximum torque is only achieved if the stepper controller detects slip and adjusts the step rate command accordingly.

The dynamics of the equivalent second-order system are determined from the values that you specify for the Approximate total load inertia and Maximum step rate command parameters. It is important that you set as accurate values as possible for these parameters, so that the step rate command is tracked, and the block does not generate false slipping warnings or errors.

If you run the motor in Averaged mode with the optional thermal ports exposed (see Model Thermal Effects), then heat is added to the thermal ports, assuming that the windings are always powered even when the step rate command is zero. The block makes adjustments for half stepping and for reduced torque (and winding currents) at higher speeds. For these adjustments to be correct, the Vector of maximum torque parameter values must be correct. For half stepping, at zero speed the heat generated by the block is the average of that generated when stopped at a half step and at a full step.

To validate Averaged mode model configurations where you predict slip to occur, compare results with the same simulation performed in stepping mode.

Model Thermal Effects

You can expose thermal ports to model the effects of losses that convert power to heat. To expose the thermal ports, set the Modeling option parameter to either:

  • No thermal port — The block does not contain thermal ports.

  • Show thermal port — The block contains multiple thermal conserving ports.

For more information about using thermal ports in actuator blocks, see Simulating Thermal Effects in Rotational and Translational Actuators.

If you expose these ports, winding resistance is assumed linearly dependent on temperature, and is given by:

R = R0 (1 + α (TT0 ))(1)

where:

  • R is the resistance at temperature T.

  • R0 is the resistance at the measurement (or reference) temperature T0. Specify the reference temperature using the Measurement temperature parameter.

  • α is the resistance temperature coefficient, which you specify with the Resistance temperature coefficients, [alpha_A alpha_B] parameter. A typical value for copper is 0.00393/K.

The block calculates temperature of each of the windings and the rotor by

MdTdt=Q

where

  • M is the thermal mass. Specify this value for the windings using the Winding thermal masses, [M_A M_B] parameter, and for the rotor using the Rotor thermal mass parameter.

  • T is the temperature. Specify the initial values for the windings using the Winding initial temperatures, [T_A T_B] parameter, and for the rotor using the Rotor initial temperature parameter.

  • Q is the heat flow, which is calculated from the iron losses of the windings:

    QA=ia2RA(1ρm/100)QB=iB2RB(1ρm/100)QR=QA(ρm/100)+QB(ρm/100)

    where ρm is the percentage of magnetizing resistance associated with the rotor. Specify this percentage using the Percentage of magnetizing resistance associated with the rotor parameter.

Predefined Parameterization

There are multiple available built-in parameterizations for the Stepper Motor block.

This pre-parameterization data allows you to set up the block to represent a specific supplier component. To load a predefined parameterization, double-click the Stepper Motor block, click the <click to select> hyperlink of the Selected part parameter and, in the Block Parameterization Manager window, select the part you want to use from the list of available components.

Note

The predefined parameterizations of Simscape™ components use available data sources for the parameter values. Engineering judgement and simplifying assumptions are used to fill in for missing data. As a result, expect deviations between simulated and actual physical behavior. To ensure accuracy, validate the simulated behavior against experimental data and refine component models as necessary.

For more information about pre-parameterization and for a list of the available components, see List of Pre-Parameterized Components.

Assumptions and Limitations

The model is based on the following assumptions:

  • This model neglects magnetic saturation effects and any magnetic coupling between phases.

  • When you select the Start simulation from steady state check box in the Simscape Solver Configuration block, this block will not initialize an Initial rotor angle value between –π and π.

  • To use Averaged mode, the Stepper Motor block must be directly connected to a Stepper Motor Driver block also running in Averaged mode.

  • The Averaged mode is an approximation, and exact step tracking compared to the Stepping mode should not be expected.

  • Slip detection in Averaged mode is approximate, and depends on a good estimate for load inertia and maximum step rate. Incorrect values may result in false slip detection.

  • When simulating slip in Averaged mode, it is assumed that the stepper motor controller adjusts the step rate command so as to achieve maximum possible torque.

Ports

Conserving

expand all

Electrical conserving port associated with the A-phase positive terminal.

Electrical conserving port associated with the A-phase negative terminal.

Electrical conserving port associated with the B-phase positive terminal.

Electrical conserving port associated with the B-phase negative terminal.

Mechanical rotational conserving port connected to the motor case.

Mechanical rotational conserving port connected to the rotor.

Thermal conserving port associated with the thermal mass of winding A.

Dependencies

To enable this port, set Modeling option to Show thermal port.

Thermal conserving port associated with the thermal mass of winding B.

Dependencies

To enable this port, set Modeling option to Show thermal port.

Thermal conserving port associated with the thermal mass of the rotor.

Dependencies

To enable this port, set Modeling option to Show thermal port.

Parameters

expand all

Option to parameterize the block to represent components by specific suppliers. Click the <click to select> hyperlink to open the Block Parameterization Manager window. For more information about the Block Parameterization Manager, see Load Predefined Parameterizations.

Whether to enable the thermal ports of the block and model the effects of losses that convert power to heat.

Electrical Torque

Use Averaged only if the block is connected directly to a Stepper Motor Driver block also running in Averaged mode.

Vector of rotational speeds at which to define maximum torque values, for slip prediction.

Dependencies

To enable this parameter, set Simulation mode to Averaged.

Vector of maximum torque values, to be used for slip prediction with the Vector of rotational speeds parameter. These values are often given on a datasheet, and correspond to the supply voltage and stepping type (half step or full step) specified in the driver.

Dependencies

To enable this parameter, set Simulation mode to Averaged.

Select the action for the block to perform during simulation upon detecting slip:

  • none — Continue simulation, limiting the load torque according to the Vector of maximum torque values.

  • warn — Continue simulation, limiting the load torque according to the Vector of maximum torque values, and generate a warning that the rotor is slipping.

  • error — Stop the simulation and generate an error message that the rotor is slipping.

If you choose an action that lets the simulation continue, simulation results might be incorrect. When slipping occurs, the motor does not always generate maximum torque. The maximum torque is only achieved if the stepper controller detects slip and adjusts the step rate command accordingly.

Dependencies

To enable this parameter, set Simulation mode to Averaged.

Approximate total load inertia, including the rotor inertia. This value is used to help predict slip due to rapid acceleration demands.

Dependencies

To enable this parameter, set Simulation mode to Averaged.

Maximum commanded step rate of the system. It is used to determine a suitable bandwidth for the second order system approximation to the stepper motor and driver.

Dependencies

To enable this parameter, set Simulation mode to Averaged.

Resistance of the A and B phase windings.

Dependencies

To enable this parameter, set Simulation mode to Stepping.

Inductance of the A and B phase windings.

Dependencies

To enable this parameter, set Simulation mode to Stepping.

Motor torque constant, Km.

Dependencies

To enable this parameter, set Simulation mode to Stepping.

Amplitude of the sinusoidal torque variation observed when rotating the shaft of the unpowered motor.

Dependencies

To enable this parameter, set Simulation mode to Stepping.

Total magnetizing resistance seen from each of the phase windings. The value must be greater than zero. The default value is Inf, which implies that there are no iron losses.

Dependencies

To enable this parameter, set Simulation mode to Stepping.

Step size when changing the polarity of either the A or B phase current.

Mechanical

Conservative force resisting rotor acceleration.

Dissipative force resisting rotor speed.

Speed of the rotor at the start of the simulation.

Angle of the rotor at the start of the simulation.

Temperature Dependence

To enable these parameters, set Modeling option to Show thermal port.

Two-element row vector defining the coefficient α in the equation relating resistance to temperature, as described in Model Thermal Effects. The first element corresponds to winding A, and the second to winding B. The default value is for copper.

Temperature for which motor parameters are defined.

Thermal Port

To enable these parameters, set Modeling option to Show thermal port.

Two-element row vector defining the thermal mass for the A and B windings. The thermal mass is the energy required to raise the temperature by one degree.

Two-element row vector defining the temperature of the A and B thermal ports at the start of simulation.

Thermal mass of the rotor, that is, the energy required to raise the temperature of the rotor by one degree.

Temperature of the rotor at the start of simulation.

Percentage of the magnetizing resistance associated with the magnetic path through the rotor. It determines how much of the iron loss heating is attributed to the rotor thermal port, HR, and winding thermal ports, HA and HB.

References

[1] M. Bodson, J. N. Chiasson, R. T. Novotnak and R. B. Rekowski. “High-Performance Nonlinear Feedback Control of a Permanent Magnet Stepper Motor.” IEEE Transactions on Control Systems Technology, Vol. 1, No. 1, March 1993.

[2] P. P. Acarnley. Stepping Motors: A Guide to Modern Theory and Practice. New York: Peregrinus, 1982.

[3] S.E. Lyshevski. Electromechanical Systems, Electric Machines, and Applied Mechatronics. CRC, 1999.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2008a