Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This block implements a permanent magnet synchronous machine.

...

The PMSM block implements a three-phase Permanent Magnet Synchronous Motors (PMSM) model with resolvers and encoders. 

Equations & Characteristics

General PMSM Solver Equation

The equation of the PMSM model can be expressed as follows:

Mathblock
alignmentleft
I_{a b c}=\left[L_{a b c}(\theta)\right]^{-1}\left[\int\left(V_{a b c}-R I_{a b c}\right) d t-\psi_{a b c}\right]

where Labc is the time-varying inductance matrix (global inductance for DQ and VDQ models), Iabc is the stator current inside the winding, R is the stator resistance and Vabc is the voltage across the stator windings. As for ψabc, it defines the magnet flux linked into the stator windings (for DQ and VDQ models), or the total flux (for the SH model),

Standard DQ Motor Characteristics

In normal conditions, the ideal sinusoidal stator voltages of the PMSM, back-EMFs, and inductances all have sinusoidal shapes. One can transform the equation using the Park transformation with a referential locked on the rotor position θ using (2a) and (2b).

...

alignmentleft

This block implements a permanent magnet synchronous machine.

...

The PMSM block implements a three-phase Permanent Magnet Synchronous Motors (PMSM) model with resolvers and encoders. 

Equations & Characteristics

General PMSM Solver Equation

The equation of the PMSM model can be expressed as follows:

Mathblock
alignmentleft
I_{a b c}=\left[L_{a b c}(\theta)\right]^{-1}\left[\int\left(V_{a b c}-R I_{a b c}\right) d t-\psi_{a b c}\right]

where Labc is the time-varying inductance matrix (global inductance for DQ and VDQ models), Iabc is the stator current inside the winding, R is the stator resistance and Vabc is the voltage across the stator windings. As for ψabc, it defines the magnet flux linked into the stator windings (for DQ and VDQ models), or the total flux (for the SH model),

Standard DQ Motor Characteristics

In normal conditions, the ideal sinusoidal stator voltages of the PMSM, back-EMFs, and inductances all have sinusoidal shapes. One can transform the equation using the Park transformation with a referential locked on the rotor position θ using (2a) and (2b).

Mathblock
alignmentleft
\left[\begin{array}{l}
{V_{d s}} \\
{V_{q s}}
\end{array}\right]=\mathrm{T}\left[\begin{array}{l}
{V_{a s}} \\
{V_{b s}} \\
{V_{c s}}
\end{array}\right]
Mathblock
alignmentleft
\mathrm{T}=\sqrt{2 / 3}\left[\begin{array}{cc}
{\cos (\theta)} & {\sin (\theta)} \\
{-\sin (\theta)} & {\cos (\theta)}
\end{array}\right]\left[\begin{array}{lccc}
{V_{d s}1} \\& {V_{q s}}
\end{array}\right]=\mathrm{T}\left[\begin{array}{l}
{V_{a s}} \\
{V_{b s}} \\
{V_{c s}}
\end{array}\right]
Mathblock
alignmentleft
\mathrm{T}=\sqrt{2 / 3}\left[\begin{array}{cc}
{\cos (\theta)} & {\sin (\theta)} \\
{-\sin (\theta)} & {\cos (\theta)}
\end{array}\right]\left[\begin{array}{ccc}
{1} & {-0.5} & {-0.5} \\
{0} & {\sqrt{3} / 2} & {-\sqrt{3} / 2}
\end{array}\right]

The Park transform (also called ‘DQ’ transform) reduces sinusoidal varying quantities of inductances, flux, current, and voltage to constant values in the D-Q frame thus greatly facilitating the analysis and control of the device under study.

...

-0.5} & {-0.5} \\
{0} & {\sqrt{3} / 2} & {-\sqrt{3} / 2}
\end{array}\right]

The Park transform (also called ‘DQ’ transform) reduces sinusoidal varying quantities of inductances, flux, current, and voltage to constant values in the D-Q frame thus greatly facilitating the analysis and control of the device under study.

It is important to note that there are many different types of Park transforms and this often leads to confusion when interpreting the motor states inside the D-Q frame. The one used here presents the advantage of being orthonormal (notice the 3/2  factor). This particular Park orthonormal transform is power-invariant which means that the power computed in the D-Q frame by performing a dot product of currents and voltages will be numerically equal to the one computed in the phase domain. With this transform (and only this transform) the PMSM torque can be expressed by (3), where pp is the number of pole pairs.

...

One may notice the absence of the 3/2 factor in (3), which is usually present in the PMSM torque equation when using non-orthonormal transforms. This is, again, because this model uses the orthonormal Park transform. Figure 1 explains the principle of the Park transform. Considering fixed ABC referential with all quantities ( Vbemf, motor current I) rotating at the electric frequency ω, if we observe these quantities in a D-Q frame turning at the same speed we can see that the motor quantities will be constant.

...

Include Page
INT:Mechanical model
INT:Mechanical model

Resolver Characteristics

The equations of the resolver sensors can be expressed as follows:

Mathblock
alignmentleft
\theta_{\text {res}}=\left(\theta_{\text {mee}}+\theta_{\text {offset}}\right) \cdot R_{p p}
Mathblock
alignmentleft
\text { cosine signal }=\text { Excitation } *\left(\cos \left(\theta_{\text {res }}\right) * R_{k_{c a}}+\sin \left(\theta_{\text {res}}\right) * R_{k_{\text {st }}}\right)
Mathblock
alignmentleft
\text { sine signal }=\text { Excitation } *\left(\cos \left(\theta_{\text {res }}\right) * R_{k_{\text {ce }}}+\sin \left(\theta_{\text {res }}\right) * R_{k_{\text {ge }}}\right)

where θres is the resolver angle, θmec is the mechanical angle of the machine, θoffset is the angle offset, Rpp is the Number of pole pairs of the resolver and Rk are the resolver sine cosine gains.

FPGA Implementation

Since the simulation is performed on FPGA hardware, the block implements a low pass filter on Vabc of stator set at 1000 Hz to help visualize the voltage. Because the original traces are square-like, it is harder to figure out the trace of Vabc without the filter. The FPGA block also implements a Vabc cut-off filter set at 200 Hz. It is used to remove high harmonics of the DQ currents from accessing the table, which could make the model stiffer.

Parameters & Measurements

The PMSM's parameters and measurements are separated in 4 different tabs, Electrical, Mechanical, Resolver and Encoder.

Electrical Parameters & Measurements

...

Symbol

...

Name

...

Description

...

Unit

...

Type

...

Mconf

...

Motor configuration type

...

Type of motor : Constant DQ, Variable DQ or Spatial Harmonics.

In Variable DQ and Spatial Harmonics mode, electrical input parameters are hidden and a resource file must be provided.

...

Input

...

Mfile

...

Motor configuration

...

Field only visible in Variable DQ and Spatial Harmonics modes. Allows to import a Variable DQ or Spatial Harmonics motor configuration resource file.

...

Input

...

Rs

...

Stator resistances

...

Resistances of the stator windings specified for every phase, A, B and C.

...

Ω

...

Input

...

Lls

...

Stator inductances

...

d and q axis inductances

...

H

...

Input

...

Back EMF profile

...

Input

...

EMFfile

...

Back EMF profile table

...

Field only visible in User defined mode. Allows to import a back EMF resource file.

...

Input

...

λm

...

Permanent magnet flux linkage

...

Amplitude of the rotor permanent magnet flux

...

Wb

...

Input

...

pp

...

Number of pole pairs

...

Number of pole pairs

...

Input

...

is

...

Stator currents

...

Currents measured at phases A, B and C of the stator

...

A

...

Measurement

...

isdq

...

Stator currents (DQ)

...

Currents measured of axis d and q

...

A

...

Measurement

...

Vs

...

Stator voltages

...

Voltages measured at phases A, B and C of the stator

...

V

...

Measurement

...

Bemf

...

Back EMF voltages

...

Phase to neutral voltage generated from the permanent magnet flux linkage

...

V

...

Measurement

...

P

...

Active power (3ph, instantaneous)

...

Instantaneous electrical active power

...

W

...

Measurement

...

Q

...

Reactive power (3ph, instantaneous)

...

Instantaneous electrical reactive power

...

var

...

Measurement

...

θe

...

Electrical rotor position

...

Position of the rotor from 0 to 360 degrees

...

°

...

Measurement

...

Rs

...

Snubber resistance

...

Resistances of the snubber on phase A, B and C

...

Ω

...

Input

...

Cs

...

Snubber capacitance

...

Capacitance of the snubber on phase A, B and C

...

F

...

Input

...

Mechanical Parameters & Measurements

...

Symbol

...

Name

...

Description

...

Unit

...

Type

...

J

...

Rotor inertia

...

Moment of inertia of the rotor

...

kg*m2

...

Input

...

Fv

...

Viscous friction coefficient

...

Viscous friction

...

N*m*s/rad

...

Input

...

Fs

...

Static friction torque

...

Static friction

...

N*m

...

Input

...

ctrl

...

Mechanical control mode

...

Control mode of the mechanical model. Has two possible values: speed or torque. In speed mode, the mechanical model is bypassed and the speed command is sent directly. In torque mode, the torque command is used to measure the speed using the mechanical parameters of the machine.

...

Input

...

T

...

Torque command

...

Torque command sent to the mechanical model

...

N*m

...

Input

...

ωrc

...

Rotor speed command

...

Speed command sent to the mechanical model

...

rpm

...

Input

...

ωr

...

Rotor speed

...

Speed of the rotor

...

rpm

...

Measurement

...

Te

...

Electromagnetic torque

...

Torque measured at the rotor

...

N*m

...

Measurement

...

θ0

...

Initial rotor angle

...

Rotor position at time t = 0

...

°

...

Input

...

θ

...

Rotor angle

...

Rotor position from 0 to 360 degrees

...

°

...

Measurement

Image Removed.

Resolver Parameters & Measurements

...

Symbol

...

Name

...

Description

...

Unit

...

Type

...

Ren

...

Enable resolver

...

Whether or not to enable the resolver

...

N/A

...

Input

...

Rsc

...

Resolver feedback signals

...

The two two-phase windings producing a sine and cosine feedback current proportional to the sine and cosine of the angle of the motor

...

N/A

...

Measurement

...

Rpp

...

Number of resolver pole pairs

...

Number of pole pairs of the resolver

...

N/A

...

Input

...

Rdir

...

Direction of the sensor rotation

...

Direction in which the sensor is turning, either clockwise or counterclockwise

...

N/A

...

Input

...

Rθ

...

Angle offset Δθ ( Sensor-  Rotor )

...

FPGA Implementation

Since the simulation is performed on FPGA hardware, the block implements a low pass filter on Vabc of stator set at 1000 Hz to help visualize the voltage. Because the original traces are square-like, it is harder to figure out the trace of Vabc without the filter. 

The FPGA block also implements a low-pass filter that is used to remove high harmonics of the DQ currents from accessing the table, which could make the model stiffer. Its default cut-off frequency is set at 200 Hz, but it can be adjusted by the parameter “TableInputCutoffFrequency“ in the json parameter file (see PMSM Variable DQ parameters file).

Parameters & Measurements

The PMSM's parameters and measurements are separated in 4 different tabs, Electrical, Mechanical, Resolver and Encoder.

Electrical Parameters & Measurements

Symbol

Name

Description

Unit

Type

Mconf

Motor configuration type

Type of motor : Constant DQ, Variable DQ or Spatial Harmonics.

In Variable DQ and Spatial Harmonics mode, electrical input parameters are hidden and a resource file must be provided.


Input

Mfile

Motor configuration

Field only visible in Variable DQ and Spatial Harmonics modes. Allows to import a Variable DQ or Spatial Harmonics motor configuration resource file.


Input

Rs

Stator resistances

Resistances of the stator windings specified for every phase, A, B and C.

Ω

Input

Lls

Stator inductances

d and q axis inductances

H

Input

δΦ/δθ

Back EMF profile

Profile of the back EMF, either Sinusoidal or User defined


Input

EMFfile

Back EMF profile table

Field only visible in User defined mode. Allows to import a back EMF resource file.


Input

λm

Permanent magnet flux linkage

Amplitude of the rotor permanent magnet flux

Wb

Input

pp

Number of pole pairs

Number of pole pairs


Input

is

Stator currents

Currents measured at phases A, B and C of the stator

A

Measurement

isdq

Stator currents (DQ)

Currents measured of axis d and q

A

Measurement

Vs

Stator voltages

Voltages measured at phases A, B and C of the stator

V

Measurement

Bemf

Back EMF voltages

Phase to neutral voltage generated from the permanent magnet flux linkage

V

Measurement

P

Active power (3ph, instantaneous)

Instantaneous electrical active power

W

Measurement

Q

Reactive power (3ph, instantaneous)

Instantaneous electrical reactive power

var

Measurement

θe

Electrical rotor position

Position of the rotor from 0 to 360 degrees

°

Measurement

Rs

Snubber resistance

Resistances of the snubber on phase A, B and C

Ω

Input

Cs

Snubber capacitance

Capacitance of the snubber on phase A, B and C

F

Input

...

Mechanical Parameters & Measurements

Symbol

Name

Description

Unit

Type

J

Rotor inertia

Moment of inertia of the rotor

kg*m2

Input

Fv

Viscous friction coefficient

Viscous friction

N*m*s/rad

Input

Fs

Static friction torque

Static friction

N*m

Input

ctrl

Mechanical control mode

Control mode of the mechanical model. Has two possible values: speed or torque. In speed mode, the mechanical model is bypassed and the speed command is sent directly. In torque mode, the torque command is used to measure the speed using the mechanical parameters of the machine.


Input

T

Torque command

Torque command sent to the mechanical model

N*m

Input

ωrc

Rotor speed command

Speed command sent to the mechanical model

rpm

Input

ωr

Rotor speed

Speed of the rotor

rpm

Measurement

Te

Electromagnetic torque

Torque measured at the rotor

N*m

Measurement

θ0

Initial rotor angle

Rotor position at time t = 0

°

Input

θ

Rotor angle

Rotor position from 0 to 360 degrees

°

Input

Rk

Resolver sine cosine gains

The sine/cosine modulation output sine/cosine component amplitude. Default value are 1, 0, 0 and 1

N/A

Input

Etype

Excitation source type

The source from which the excitation of the resolver is generated. Can either be AC, which is generated inside the FPGA with the specified frequency, DC, which is generated with a 90° from the rotor and External, which is generated from outside the model

Measurement

Image Added.

Resolver Parameters & Measurements

Source of the external excitation source when in External mode

Symbol

Name

Description

Unit

Type

Ren

Enable resolver

Whether or not to enable the resolver

N/A

Input

Ef

Excitation frequency

Frequency of the excitation when in AC mode

Hz

Input

Esrc

Excitation source

Rsc

Resolver feedback signals

The two two-phase windings producing a sine and cosine feedback current proportional to the sine and cosine of the angle of the motor

N/A

Measurement

Rpp

Number of resolver pole pairs

Number of pole pairs of the resolver

N/A

Input

Ets

Excitation time shift

This parameter is used to compensate the time offset between the carrier generation's input in the system and modulated signals' output

s

Input

...

OPAL-RT's resolver models are based off of the following sets of equations:

Mathblock
anchorSineOutput
alignmentcenter
Sine \; Output = [Sin.Sin*sin(pp(\theta_m - \theta_{Offset})) + Sin.Cos * cos(pp * \theta_m - \theta_{Offset}))] * Excitation
Mathblock
anchorCosineOutput
alignmentcenter
Cosine \; Output = [Cos.Sin*sin(pp(\theta_m - \theta_{Offset})) + Cos.Cos * cos(pp * \theta_m - \theta_{Offset}))] * Excitation

Where Sin.Sin, Sin.Cos, Cos.Sin, and Cos.Cos represent gains that are applied to simulate a non-ideal resolver.  To simulate an ideal resolver, set the Sin.Sin and Cos.Cos gains to 1, set the Sin.Cos and Cos.Sin gains to 0, set the pp to 1, and set the θOffset to 0.  This results in the following equations:

Mathblock
anchorsimpleSineOutput
alignmentcenter
Sine \; Output = sin(\theta_m) * Excitation

...

anchorsimpleCosineOutput
alignmentcenter

...

Rdir

Direction of the sensor rotation

Direction in which the sensor is turning, either clockwise or counterclockwise

N/A

Input

Rθ

Angle offset Δθ ( Sensor-  Rotor )

Angle offset between the resolver and the rotor position from 0 to 360 degrees

°

Input

Emod

Excitation mode

Number of resolver excitation windings. Can either be single (just one excitation signal) or double (two excitation signals)

N/A

Input

Rk1

Resolver sine cosine gains

The sine/cosine modulation output sine/cosine component amplitude. Default value are 1, 0, 0 and 1. When the double excitation is selected, the default values shall be set 0, 1, 1, and 0.

N/A

Input

Rk2

Resolver sine cosine gains for the second excitation

The sine/cosine modulation output sine/cosine component amplitude for the second excitation. Default value are -1, 0, 0 and 1

N/A

Input

Etype

Excitation source type

The source from which the excitation of the resolver is generated. Can either be AC, which is generated inside the FPGA with the specified frequency, DC (only for single excitation), and External, which is generated from outside the model

N/A

Input

Ef

Excitation frequency

Frequency of the excitation when in AC mode. When in Double excitation, the second excitation signal has the same frequency and is 90º leading.

Hz

Input

Esrc

Excitation source

Source of the external excitation source when in External mode

N/A

Input

Esrc2

Second excitation source

Source of the second external excitation source when in External mode and Double excitation

N/A

Input

Ets

Excitation time shift

This parameter is used to compensate the time offset between the carrier generation's input in the system and modulated signals' output

s

Input

Include Page
PINT:Resolver Model
PINT:Resolver Model
isMissingRequiredParameterstrue
Include Page
PINT:Double Excitation Resolver Model
PINT:Double Excitation Resolver Model

image-20240905-185049.pngImage Added

Encoder Parameters & Measurements

Symbol

Name

Description

Unit

Type

Encen

Enable encoder

Whether or not to enable the encoder

N/A

Input

Enctype

Encoder type

Encoder type, either Quadrature or Hall Effect

N/A

Input

QABZ

A B Z encoder signals

A B and Z signals of the encoder

N/A

Measurement

Qppr

Number of pulses per revolution

Number of pulses in one full revolution of the encoder

N/A

Input

Qdir

Direction of the sensor rotation

Direction in which the sensor is turning, either A leads B or B leads A

N/A

Input

Qθ

Angle offset Δθ ( Sensor - Rotor )

Angle offset between the encoder and the rotor position from 0 to 360 degrees

°

Input

Qrat

Encoder speed ratio ( sensor to mechanical position )

Mechanical to encoder ratio. Angle of Encoder = Qrat * machine mechanical angle. 

N/A

Input

Hθ

Hall effect sensor position

Position of sensor phases A, B and C in Hall effect mode

°

Input

Hrat

Hall effect sensor speed ratio ( sensor to mechanical position )

Mechanical to encoder ratio. Angle of Encoder = Hrat * machine mechanical angle in Hall effect mode

N/A

Input

...

Visualization of Resolver Encoder Parameters Effects

...