Main Content

ee_calculateFluxPartialDerivatives

Calculate flux partial derivatives for FEM-Parameterized PMSM block

Description

[dFdA,dFdB,dFdC,dFdX] = ee_calculateFluxPartialDerivatives(A,B,C,X,F) calculates the partial derivatives from flux linkage. For improved numerical performance, the FEM-Parameterized PMSM block works with flux linkage partial derivatives, rather than directly with flux linkage. If your finite-element motor design tool does not have an option to output partial derivatives, then you can use this function to calculate the partial derivatives from the flux linkage. The flux linkage F must be a four-dimensional matrix with the first three dimensions corresponding to the A, B, and C phase currents, and the fourth dimension corresponding to the rotor angle X. The function returns four-dimensional matrices for the four partial derivatives. Use this syntax in conjunction with the 4-D Data modeling option of the block.

example

[dFdA,dFdB,dFdC,dFdX,D,Q] = ee_calculateFluxPartialDerivatives(A,B,C,X,F) returns two additional output arguments corresponding to d-axis and q-axis currents, respectively. In this case, the four partial derivatives are three-dimensional, the first two dimensions corresponding to the d-axis and q-axis currents, and the third dimension corresponding to the rotor angle. Use this syntax in conjunction with the 3-D Data modeling option of the block.

example

Examples

collapse all

Suppose F is a four-dimensional matrix containing flux linkage data, exported by your finite-element motor design tool. The matrix dimensions correspond to the three phase currents and the rotor angle, respectively. The data is cyclical in the fourth dimension, corresponding to the rotor angle.

Tip

If you do not have data from a finite-element motor design tool for your PMSM, to prevent a simulation error, before running the code for this example, first generate the required F matrix by running the Generate 4-D Flux Linkage Matrix F example for the ee_generateIdealPMSMfluxData function.

Either directly import or recreate the current vectors. For example, if recreating a current vector with evenly spaced values between -250 and 250 A and 5 A increments, then:

iA = linspace(-250,250,5);
iB = iA;
iC = iA;

Import or define the number of pole pairs.

N = 6;

Import the rotor angle vector or recreate it based on the number of pole pairs.

X = pi/180*linspace(0,360/N,180/N+1);

Calculate the flux linkage partial derivatives.

[dFdA,dFdB,dFdC,dFdX] = ee_calculateFluxPartialDerivatives(iA,iB,iC,X,F);

The function returns four 4-D matrices for the flux linkage partial derivatives. The four matrices correspond to the three phase currents and the rotor angle, respectively. The matrix dimensions also correspond to the three phase currents and the rotor angle.

Suppose F is a four-dimensional matrix containing flux linkage data, exported by your finite-element motor design tool. The matrix dimensions correspond to the three phase currents and the rotor angle, respectively. The data is cyclical in the fourth dimension, corresponding to the rotor angle.

Tip

If you do not have data from a finite-element motor design tool for your PMSM, to prevent a simulation error, before running the code for this example, first generate the required F matrix by running the Generate 4-D Flux Linkage Matrix F example for the ee_generateIdealPMSMfluxData function.

Either directly import or recreate the current vectors. For example, if recreating a current vector with evenly spaced values between -250 and 250 A and 5 A increments:

iA = linspace(-250,250,5);
iB = iA;
iC = iA;

Import or define the number of pole pairs.

N = 6;

Import the rotor angle vector or recreate it based on the number of pole pairs.

X = pi/180*linspace(0,360/N,180/N+1);

Calculate the flux linkage partial derivatives.

[dFdA,dFdB,dFdC,dFdX,iD,iQ] = ee_calculateFluxPartialDerivatives(iA,iB,iC,X,F);

The function returns four 3-D matrices for the flux linkage partial derivatives and two vectors for the d-axis and q-axis current values. The four matrices correspond to the three phase currents and the rotor angle, respectively. The matrix dimensions correspond to the d-axis and q-axis currents and the rotor angle.

Input Arguments

collapse all

A-phase current, in amperes, specified as a vector. The vector must be monotonically increasing and two-sided (contain both positive and negative values). Best practice is to include zero current as one of the points.

Data Types: double

B-phase current, in amperes, specified as a vector. The vector must be monotonically increasing and two-sided (contain both positive and negative values). Best practice is to include zero current as one of the points.

Data Types: double

C-phase current, in amperes, specified as a vector. The vector must be monotonically increasing and two-sided (contain both positive and negative values). Best practice is to include zero current as one of the points.

Data Types: double

The rotor angle, in radians, specified as a vector. The values must be in the range from zero to 2π/N, where N is the number of pole pairs.

Data Types: double

The flux linkage, in weber-turns, specified as a four-dimensional matrix, with dimensions corresponding to the three phase currents and rotor angle. The data must be cyclical in the fourth (rotor angle) dimension, that is, for all i, j, and k, F(i,j,k,0) = F(i,j,k,2π/N), where N is the number of pole pairs.

Data Types: double

Output Arguments

collapse all

Flux linkage partial derivative with respect to the A-phase current, returned as a matrix. For syntax used with the 4-D Data modeling option of the block, the matrix is four-dimensional. For syntax used with the 3-D Data modeling option of the block, the matrix is three-dimensional, the first two dimensions corresponding to the d-axis and q-axis currents, and the third dimension corresponding to the rotor angle.

Flux linkage partial derivative with respect to the B-phase current, returned as a matrix. For syntax used with the 4-D Data modeling option of the block, the matrix is four-dimensional. For syntax used with the 3-D Data modeling option of the block, the matrix is three-dimensional, the first two dimensions corresponding to the d-axis and q-axis currents, and the third dimension corresponding to the rotor angle.

Flux linkage partial derivative with respect to the C-phase current, returned as a matrix. For syntax used with the 4-D Data modeling option of the block, the matrix is four-dimensional. For syntax used with the 3-D Data modeling option of the block, the matrix is three-dimensional, the first two dimensions corresponding to the d-axis and q-axis currents, and the third dimension corresponding to the rotor angle.

Flux linkage partial derivative with respect to the rotor angle, returned as a matrix. For syntax used with the 4-D Data modeling option of the block, the matrix is four-dimensional. For syntax used with the 3-D Data modeling option of the block, the matrix is three-dimensional, the first two dimensions corresponding to the d-axis and q-axis currents, and the third dimension corresponding to the rotor angle.

D-axis current, in amperes, returned as a vector. This is an optional output argument, to be used when you want to generate 3-D flux linkage partial derivatives. The vector defines the d-axis current values at which the partial derivatives are determined.

Q-axis current, in amperes, returned as a vector. This is an optional output argument, to be used when you want to generate 3-D flux linkage partial derivatives. The vector defines the q-axis current values at which the partial derivatives are determined.

Algorithms

The function calculates partial derivatives using Akima splines, the same method that is used for smooth interpolation in the Simscape™ language tablelookup function. For more information, see makima. Akima splines are suitable for estimating partial derivatives due to their smooth nature and tendency not to introduce local gradient reversals.

Version History

Introduced in R2017a