# Stepper Motor

Implement stepper motor model

Libraries:
Simscape / Electrical / Specialized Power Systems / Electrical Machines

## Description

The Stepper Motor (STM) block implements a generic model that represents two most popular families of stepper motors:

• Variable-reluctance stepper motors

• Permanent-magnet or hybrid stepper motors

The Stepper Motor model consists of electrical and mechanical sections. The electrical section is represented by an equivalent circuit, configuration of which depends on the motor type. The equivalent circuits assume that the magnetic circuit is linear (no saturation) and the mutual inductance between phases is negligible. The mechanical section is represented by a state-space model based on inertia moment and viscous friction coefficient.

This figure shows the equivalent circuit for one phase in a variable-reluctance stepper motor.

In this model, Ra and La(θ), respectively, represent the resistance and the inductance of phase A winding. The winding inductance varies as a function of the rotor position:

 La(θ) = L0 + L1cos(Nrθ), (1)

where,

• L0 is the average inductance.

• L1 is the maximum inductance variation.

• Nr is the rotor teeth number.

At the reference position (θ = 0), the rotor tooth is fully aligned with the A-axis pole to achieve the maximum A-phase winding inductance.

The total electromagnetic torque produced by the motor is the sum of the torques produced by the motor phases:

`${T}_{e}=\sum _{x=1}^{m}0.5{i}_{x}^{2}\frac{d{L}_{x}}{d\theta },$`

where,

• m is the number of phases.

• ix is the winding current in phase x.

• Lx is the inductance function of phase x winding.

This figure shows the equivalent circuit for one phase in a permanent-magnet (PM) or hybrid stepper motor.

In this model, Ra and La, respectively, represent the resistance and inductance of A-phase winding. Due to the large value of the air gap introduced by the magnets, the winding inductance of the PM or hybrid stepper motor can be considered to be independent of the rotor position. The voltage source ea(θ) represents the motor back electromotive force (EMF), which is a sinusoidal function of the rotor position:

`${e}_{a}\left(\theta \right)=-p{\psi }_{m}\mathrm{sin}\left(p\theta \right)\frac{d\theta }{dt},$`

where,

• p is the number of pole pairs. The number of pole pairs p is given by p = Nr/2.

• ψm is the motor maximum magnetic flux.

Note that at the reference position (θ = 0), the north pole on the rotor is fully aligned with the A-axis pole to achieve zero value of the A-phase back EMF.

The electromagnetic torque produced by a two-phase PM or hybrid stepper motor is equal to the sum of the torque resulting from the interaction of the phase currents and magnetic fluxes created by the magnets and the detent torque, which results from the saliency of the rotor:

 Te = –pψmiasin(pθ) – pψmibsin(pθ – π/2) – Tdmsin(mNrθ). (2)

where,

• m is the number of phase (m=2) of the motor.

• Nr the number of teeth on the rotor (Nr = 2*p).

### How to Get Stepper Motor Parameters

The parameters used in the stepper model are usually obtained from the manufacturer data sheets. In case the parameters are not available, you can determine them from experimental measurements.

Variable-Reluctance Stepper Motor Parameters

The parameters provided by manufacturer data sheets are usually: number of phases, holding torque, step angle, voltage per phase, current per phase, winding resistance, Ra, maximum inductance, Lmax, average inductance, L0, and rotor inertia, J.

Permanent-Magnet/Hybrid Stepper Motor Parameters

The parameters provided by manufacturer data sheets are usually:

• number of phases

• holding torque

• step angle

• voltage per phase

• current per phase

• winding resistance, Ra

• winding inductance, La

• rotor inertia, J

The maximum detent torque, Tdm, is not always specified. This parameter can be assumed to be equal to 1-10% of the maximum holding torque.

The maximum flux linkage, ψm, is not always specified. This parameter can be obtained experimentally by driving the motor to a constant speed, N, in rpm, and by measuring the maximum open-circuit winding voltage, Em, in V.

The parameter ψm is then computed by the following relation:

 ψm = (30/pπ)(Em/N), (3)

where p is the number of pole pairs given by p =360 / (2m·step). Here m = phase number, step = step angle in degrees.

### Examples

The `power_steppermotor` example illustrates the operation of a stepper motor drive using a two-phase hybrid stepper motor model.

## Ports

### Input

expand all

Mechanical load torque, in N.m. `TL` is positive in motor operation and negative in generator operation.

### Output

expand all

The Simulink® output of the block is a vector containing five signals. You can demultiplex these signals by using the Bus Selector block provided in the Simulink library.

Signal

Definition

Units

Symbol

1

Phase voltage

V

Vph

2

Phase current

A

Iph

3

Electromagnetic torque

N.m

Te

4

Rotor speed

w

5

Rotor position

Theta

### Conserving

expand all

Specialized electrical conserving port associated with the positive terminal of phase A.

Specialized electrical conserving port associated with the negative terminal of phase A.

Specialized electrical conserving port associated with the positive terminal of phase B.

Specialized electrical conserving port associated with the negative terminal of phase B.

Specialized electrical conserving port associated with the positive terminal of phase C.

#### Dependencies

To enable this port, set the Motor type parameter to `Variable reluctance` and the Number of phases parameter to `3`, `4`, or `5`.

Specialized electrical conserving port associated with the negative terminal of phase C.

#### Dependencies

To enable this port, set the Motor type parameter to `Variable reluctance` and the Number of phases parameter to `3`, `4`, or `5`.

Specialized electrical conserving port associated with the positive terminal of phase D.

#### Dependencies

To enable this port, set the Motor type parameter to `Variable reluctance` and the Number of phases parameter to `4` or `5`.

Specialized electrical conserving port associated with the negative terminal of phase D.

#### Dependencies

To enable this port, set the Motor type parameter to `Variable reluctance` and the Number of phases parameter to `4` or `5`.

Specialized electrical conserving port associated with the positive terminal of phase E.

#### Dependencies

To enable this port, set the Motor type parameter to `Variable reluctance` and the Number of phases parameter to `5`.

Specialized electrical conserving port associated with the negative terminal of phase E.

#### Dependencies

To enable this port, set the Motor type parameter to `Variable reluctance` and the Number of phases parameter to `5`.

## Parameters

expand all

To edit block parameters interactively, use the Property Inspector. From the Simulink Toolstrip, on the Simulation tab, in the Prepare gallery, select .

Option to implement a permanent-magnet/hybrid stepper motor or a variable-reluctance stepper motor.

Number of phases to model. If you set Motor type to `Permanent-magnet / Hybrid`, you can set this parameter only to `2` and `4`. If you set Motor type to ```Permanent-magnet / Hybrid```, you can set this parameter only to `3`, `4`, and `5`.

Maximum inductance, Lmax, in H, of each phase winding.

#### Dependencies

To enable this parameter, set Motor type to `Variable reluctance`.

Inductance, in H, of each phase winding.

#### Dependencies

To enable this parameter, set Motor type to `Permanent-magnet / Hybrid`.

Minimum inductance, Lmin, in H, of each phase winding.

#### Dependencies

To enable this parameter, set Motor type to `Variable reluctance`.

Resistance, Ra, in ohms, of each phase winding.

Maximum flux linkage, ψm, in V.s, produced by the magnets

#### Dependencies

To enable this parameter, set Motor type to `Permanent-magnet / Hybrid`.

Maximum detent torque, Tdm, in N.m, resulting from the saliency of the rotor.

#### Dependencies

To enable this parameter, set Motor type to `Permanent-magnet / Hybrid`.

Step angle, in degrees, of the rotor movement.

Total inertia momentum, J, in kg.m2, of the motor and the load.

Total viscous friction coefficient, B, in N.m.s, of the motor and the load.

Initial rotation speed, ω0, in rad/s.

Initial rotor position, Θ0, in degrees.

Stepper motor sample time, in s. Specify `–1` to inherit the sample time of the powergui block in your model.

## References

[1] T. Kenjo, A. Sugawara, Stepping Motors and Their Microprocessor Controls, 2nd Edition, Oxford University Press, Oxford, 2003.

[2] P. Acarnley, Stepping Motors - A guide to theory and practice, 4th Edition, The Institution of Electrical Engineers, London, 2002.

## Version History

Introduced in R2008a