modeling and parameter identification of switched

53
Electronics Mechanics Computers The Ohio State University Mechatronic Systems Program Modeling and Parameter Identification of Switched Reluctance Motors by Wenzhe Lu, PhD student Ali Keyhani, Professor [email protected] Tel: 1-614-292-4430 Mechatronics Laboratory Department of Electrical Engineering The Ohio State University Columbus, Ohio 43210 All Rights Reserved by the Ohio State University March 18, 2002

Upload: others

Post on 26-Feb-2022

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Modeling and Parameter Identification of Switched

ElectronicsMechanics

Computers

The Ohio State University Mechatronic Systems Program

Modeling and Parameter Identification of Switched Reluctance Motors

by Wenzhe Lu, PhD student Ali Keyhani, Professor

[email protected] Tel: 1-614-292-4430

Mechatronics Laboratory Department of Electrical Engineering

The Ohio State University Columbus, Ohio 43210

All Rights Reserved by the Ohio State University

March 18, 2002

Page 2: Modeling and Parameter Identification of Switched

1

Content

1. Introduction ………………………………………………………………..…. 2 2. Inductance Model of SRM at Standstill ……………………………………… 3 3. Maximum Likelihood Estimation ……………………………………………. 7 4. Parameter Identification from Standstill Test Data ………………………….. 9 5. Direct parameter estimation using Output Error …………………………….. 20 6. SRM Model for Online Operation …………………………………………… 23 7. 2-Layer Recurrent Neural Network ………………………………………….. 27 8. Training of Neural Network ………………………………………………….. 29 9. Estimation Results and Model Validation ……………………………………. 30 10. Advantages of Neural Network Mapping …………………………………… 33 11. Conclusions ………………………………………………………………….. 33 12. Acknowledgement …………………………………………………………... 34 13. References ……….…………………………………………………………... 34 Appendix I. C program on DS1103 controller board for standstill test …………. 35 Appendix II. Matlab program for standstill test – align.m …………………….… 45 Appendix III. Matlab program for standstill test – sst.m ………………………... 48 Appendix IV. Matlab program for standstill test – mle.m ………………………. 51 Appendix V. Matlab program for standstill test – errfun1.m ……………………. 52

Page 3: Modeling and Parameter Identification of Switched

2

1. Introduction

Switched reluctance motors (SRM) have undergone rapid development in hybrid electric vehicles, aircraft starter/generator systems, washing machines, and automotive applications over the last two decades. This is mainly due to the various advantages of SRM’s over other electric motors such as simple and robust construction, and fault-tolerant performance.

In most of these applications, speed and torque control are necessary. To obtain high

quality control, an accurate model of SRM is often needed. At the same time, to increase reliability and reduce cost, sensorless controllers (without rotor position/speed sensor) are preferred. With the rapid progress in microprocessors (DSP), MIPS-intensive control techniques such as sliding mode observers and controllers [1] become more and more promising. An accurate nonlinear model of the SRM is essential to realize such control algorithms.

The nonlinear nature of SRM and high saturation of phase winding during operation

makes the modeling of SRM a challenging work. The flux linkage and phase inductance of SRM change with both the rotor position and the phase current. Therefore the nonlinear model of SRM must be identified as a function of the phase current and rotor position. Two main models of SRM have been suggested in the literature – the flux model [2] and the inductance model [3]. In the latter one, “the position dependency of the phase inductance is represented by a limited number of Fourier series terms and the nonlinear variation of the inductance with current is expressed by means of polynomial functions” [3]. This model can describe the nonlinearity of SRM inductance quite well.

Once a model is selected, how to identify the parameters in the model becomes an

important issue. Finite element analysis can provide a model that will be subjected to substantial variation after the machine is constructed with manufacturing tolerances. Therefore, the model and parameters need to be identified from test data. As a first step, the machine model can be estimated from standstill test using output error estimation (OE) or maximum likelihood estimation (MLE) techniques. This method has already been applied successfully to identify the model and parameters of induction and synchronous machines [4, 5].

Furthermore, during online operation, the model structures and parameters of SRM’s

may differ from the standstill ones because of saturation and losses, especially at high current. To model this effect, a damper winding may be added into the model structure, which is in parallel with the magnetizing winding. The magnetizing current and damper current are highly nonlinear functions of phase voltage, rotor position, and rotor speed. They are not measurable during operation, and are hard to be expressed with analytical functions. Neural network mapping are usually good choices for such tasks [7, 8, 9]. A 2-layer recurrent neural network has been adopted here to estimate these two currents, which takes the phase voltage, phase current, rotor position and rotor speed as inputs. When the damper current is estimated and damper voltage is computed, the damper

Page 4: Modeling and Parameter Identification of Switched

3

parameters can be identified using output error or maximum likelihood estimation techniques.

In this report, the procedures to identify an 8/6 SRM parameters from standstill test

data are presented after an introduction to the inductance model of SRM. Then a 2-layer recurrent neural network is constructed, trained and applied to identify the damper parameters of SRM from operating data. Model validation through on-line test is also given, which proves the applicability of the proposed methods.

2. Inductance Model of SRM at standstill

The inductance model of switched reluctance motor is shown in Figure. 1. The phase winding is model as a resistance (R) in series of an inductance (L).

Figure. 1 Inductance model of SRM at standstill

Since the phase inductance changes periodically with the rotor position angle, it can

be expressed as a Fourier series with respect to rotor position angle θ:

=

θ=θm

krk NkiLiL

0cos)(),( , (1)

where Nr is the number of rotor poles, and m is the number of terms included in the Fourier series. High order terms (H.O.T.) can be omitted without bringing significant errors.

In [3], The authors suggest using the first three terms of the Fourier series (m=3), but

more terms can be added to meet accuracy requirements. To determine the coefficients )(iLk in the Fourier series, we need to know the

inductances at several specific positions. Use )(iLθ to represent the inductance at position θ, which is a function of phase current i and can be approximated by a polynomial:

=

θθ =k

n

nniaiL

0,)( . (2)

Page 5: Modeling and Parameter Identification of Switched

4

where k is the order of the polynomial and na ,θ are the coefficients of polynomial. In our research, k = 5.

For an 8/6 machine, Nr=6. When θ=0 is chosen at the aligned position of phase A,

then θ=30 is the unaligned position of phase A. Usually the inductance at unaligned position can be treated as a constant.

constL =030 (3)

2.1 Three-term inductance model If three terms are used in the Fourier series (m=3), then we can compute the three

coefficients 0L , 1L , and 2L from 00L (aligned position), 015

L (midway position), and

030L (unaligned position). Since

−−=

=

2

1

0

2

1

0

00

00

30

15

0

111101

111

)30*12cos()30*6cos(1)15*12cos()15*6cos(1

111

0

0

0

LLL

LLL

LLL

, (4)

so

−−=

−−=

0

0

0

0

0

0

30

15

0

30

15

0

1

2

1

0

4/12/14/12/102/1

4/12/14/1

111101

111

LLL

LLL

LLL

. (5)

Or in separate form:

])(21[

21

000 153000 LLLL ++= ,

)(21

00 3001 LLL −= , (6)

])(21[

21

000 153002 LLLL −+= .

2.2 Four-term inductance model If Four terms are used in the Fourier series (m=4), then we can compute the four

coefficients 0L , 1L , 2L , and 3L from 00L (aligned position), 010

L , 020L , and 030

L (unaligned position). Since

Page 6: Modeling and Parameter Identification of Switched

5

=

3

2

1

0

000

000

000

30

20

10

0

)30*18cos()30*12cos()30*6cos(1)20*18cos()20*12cos()20*6cos(1)10*18cos()10*12cos()10*6cos(1

1111

0

0

0

0

LLLL

LLLL

, (7)

so

−−−−

−−=

0

0

0

0

30

20

10

0

3

2

1

0

6/13/13/16/13/13/13/13/13/13/13/13/1

6/13/13/16/1

LLLL

LLLL

. (8)

Or in separate form:

)]()(21[

31

0000 20103000 LLLLL +++= ,

)(31

0000 30201001 LLLLL −−+= , (9)

)(31

0000 30201002 LLLLL +−−=

)]()(21[

31

0000 20103003 LLLLL −−−= .

2.3 Five-term inductance model If Five terms are used in the Fourier series (m=5), then we can compute the five

coefficients 0L , 1L , 2L , 3L , and 4L from 00L (aligned position), 05.7

L , 015L (midway

position), 05.22L , and 030

L (aligned position). Since

=

4

3

2

1

0

0000

0000

0000

0000

30

5.22

15

5.7

0

)30*24cos()30*18cos()30*12cos()30*6cos(1)5.22*24cos()5.22*18cos()5.22*12cos()5.22*6cos(1

)15*24cos()15*18cos()15*12cos()15*6cos(1)5.7*24cos()5.7*18cos()5.7*12cos()5.7*6cos(1

11111

0

0

0

0

0

LLLLL

LLLLL

,

(10) so

Page 7: Modeling and Parameter Identification of Switched

6

−−−

−−

=

0

0

0

0

0

30

5.22

15

5.7

0

4

3

2

1

0

8/14/14/14/18/14/14/204/24/14/102/104/14/14/204/24/18/14/14/14/18/1

LLLLL

LLLLL

. (11)

Or in separate form:

)]()(21[

41

00000 5.22155.73000 LLLLLL ++++= ,

)](2)[(41

0000 5.225.73001 LLLLL −++=

)2(41

000 301502 LLLL +−= , (12)

)](2)[(41

0000 5.225.73003 LLLLL −−−=

)]()(21[

41

00000 5.22155.73004 LLLLLL +−−+= .

2.4 Voltages and Torque Computation Besides inductance, the phase winding also contains resistance (R). A simple model

structure of phase winding is shown in Figure 1. Based on the inductance model described above, the phase voltage equations can be

formed and the electromagnetic torque can be computed from the partial derivative of magnetic co-energy with respect to rotor angle θ. They are listed here:

)(dtdi

iLLi

dtdiLiR

dtdLi

dtdiLiRV

∂∂+ω

θ∂∂++⋅=

++⋅=, (13)

where

=

θ∂

∂=

∂∂ m

kr

k kNi

iLiL

0cos

)( (14)

=

θ−=θ∂

∂ m

krrk kNkNiLL

0sin)( . (15)

And

Page 8: Modeling and Parameter Identification of Switched

7

])([)sin(

])cos()([]),([),(

0

0

=

=

θ−=

θ∂

θ∂=

θ∂

θ∂=

θ∂θ∂

=

m

kkrr

m

krk

c

diiiLkNkN

diikNiLdiiiLiWT

. (16)

3. Maximum Likelihood Estimation 3.1 Basic principle of MLE

To minimize the effects of noise caused by the converter harmonics and the measurement, maximum likelihood estimation (MLE) technique can be applied to estimate the parameters. Suppose the dynamic response of the system is represented by

+=++=+

)()()()()()()()()()1(

kvkxCkykwkuBkxAkx

p

pp

θθθ

, (17)

where θp represents the system parameters, x(k) represents system states, y(k) represents the system output, u(k) is the system input, w(k) is the process noise, and v(k) is the measurement noise.

The maximum likelihood estimation is performed based on the mechanism shown in

Figure. 2. A model of the phase winging is excited with the same voltage as the real winding. The error between the estimated output and the measured output is used to adjust the model parameters to minimize the error. This process is repeated till the cost function )(θV is minimized.

The model structure in Figure. 1 is a first-order system. The dynamic equation for it

can be expressed as

dtdiLiRV +⋅= (18)

When transformed to discrete-time state space form, the states, input, output, and

parameters vector are

Tp LR

iyVuix],[

][],[],[=

===θ

. (19)

Page 9: Modeling and Parameter Identification of Switched

8

.0833.290242 0.9L-.0101.1569840.9R 20:1

.2595.290753 0.9L-.0416.1569350.9R 50:1 -.0558.2898380.9L.0086.1570140.9R100:1

.3496.291014 0.9L-.0175.1569720.9R 5:1

1.2842.293724 0.9L-.1046.1568360.9R 10:1

.0492.290143 0.9L-.0077.1569880.9R 200:1

-.0068.289980 0.9L-.0003.1569990.9R 500:1

.0115.290033 0.9L-.0013.1569980.9R 1000:1

-.0023.289993 0.9L.0001.1570000.9R 2000:1

.0000.290000 0.9L.0000.1570000.9R ∞ ∆L(%)Lest(mH) L0(mH)∆R(%)Rest (Ω)R0 (Ω) S/N

Figure. 2 Block diagram of Maximum Likelihood Estimation

3.2 Performance of MLE with noise-corrupted data To test the performance of the above algorithm, some simulations have been done in

Matlab. The circuits shown in Figure 4 are used for this simulation. A step input voltage is applied to the circuits, different noise is added to the output currents to get noise “corrupted” data with different signal-to-noise ration (S/N). Then Matlab function leastsq() is used to estimate the parameters (R & L) with different initial guesses. The estimated results are shown in the following tables. (The true value of R is 0.157 ohm and that of L is 0.290 mH)

In Table 1, the initial guesses are within 90% of true values. The relative estimation

error is also shown in the table.

Table 1. Estimation results with initial guesses within 90% of true values

Page 10: Modeling and Parameter Identification of Switched

9

In Table 2, the initial guesses are within 10% of true values.

Table 2. Estimation results with initial guesses within 10% of true values From the simulation results we can see that, the estimation algorithm can accurately

identify the system parameters from very ‘noisy’ data (S/N > 10:1), even with poor initial guesses.

4. Parameter Identification from Standstill Test Data 4.1 Standstill test configuration

The basic idea of standstill test is to apply a short voltage pulse to the phase winding

with the rotor blocked, record the current generated in the winding, and then use maximum likelihood estimation to estimate the resistances and inductances of the winding. By performing this test at different current level, the relationship between inductance and phase current can be curve-fitted with polynomials.

The standstill test configuration is shown in Figure 3. An 8/6 SRM is used in this test.

Before testing, the motor is rotated to a specific position and blocked. A DSP system (dSPACE DS1103 controller board) is used to generate the gating signal to a power converter to apply appropriate voltage pulses to that winding. The voltage and current at the winding is sampled and recorded. Later on, the test data is used to identify the winding parameters.

-.0090 .289974 0.1L -.0185.1569710.1R 20:1

.0531 .290154 0.1L -.0101. 1569840.1R 50:1 -.3129.289092 0.1L.0314.1570490.1R 100:1

-1.3248.286158 0.1L.0701.1571100.1R 5:1

-.2748 .289203 0.1L .0084. 1570130.1R 10:1

.0763 .290221 0.1L -.0046.1569930.1R 200:1

.0203 .290059 0.1L -.0016.1569970.1R 500:1

.0118 .290034 0.1L -.0014.1569980.1R 1000:1

-.0151 .289956 0.1L .0015.1570020.1R 2000:1

-.0015 .289995 0.1L .0000.1570000.1R ∞

∆L(%)Lest(mH) L0(mH)∆R(%)Rest (Ω)R0 (Ω) S/N

Page 11: Modeling and Parameter Identification of Switched

10

Figure 3. Standstill and on-line test setup

4.2 C and Matlab Programs for Data Acquisition

A C program is created for running on the DS1103 Master PowerPC and Slave DSP TMS320F240, which performs the following functions:

• Phase voltage and current sampling and A/D conversion; • Over current protection; • Rotor position detection; • Voltage pulse generating and phase current control.

It contains a main program and a timer interrupt subroutine. A/D sampling and

conversion, over current protection, and rotor position detection are performed in the interrupt subroutine. The main program performs the initialization, then it waits for operating commands and generates appropriate voltage pulses to corresponding phase windings according to the command. The flowchart of the program is shown in Figure 4.

Page 12: Modeling and Parameter Identification of Switched

11

Figure 4. Flowchart of DS1103 Master PPC program

The C code of this program is attached in the appendix. To start the test and capture the data during standstill test, several Matlab programs

are written which make use of the MLIB/MTRACE functions provided by dSPACE. MLIB/MTRACE provides a way for Matlab programs to access real-time variables on dSPACE hardware. So we can send commands to the program running on dSPACE controller board and retrieve real-time data from it.

First a Matlab program ‘align (PhaseNo)’ is used to make the rotor move to a position

where the rotor is aligned with the stator of the specified phase. When PPC receives this command, it will produce a series of pulses to the phase winding specified by the parameter ‘PhaseNo’. Then the rotor will move to and stay at the desired aligned position. During this period, a current control program will be activated to provide hysteresis current to the phase winding.

When the rotor is moved to a desired position, it will be blocked for standstill test.

Another Matlab program ‘sst (PhaseNo)’ is used to perform the test on the phase winding specified by ‘PhaseNo’. It first checks whether the real-time program is running on dSPACE, then it sets the pulse parameters such as pulse width and so on. When everything is ready, it will send the command to start the standstill test and capture the

Initialization

Error

Receive command?

Generate corresponding voltage pulses

No

Yes

Main Program

No

Yes

Voltage and

current sampling

Timer Interrupt Subroutine

Over current

protection

Rotor position detection

Over current?

Turn off switches and set error flag

Yes

No

Page 13: Modeling and Parameter Identification of Switched

12

real-time data (phase voltage and current). All the captured data will be saved to disk files for later process.

The Matlab programs for ‘align(PhaseNo)’ and ‘sst(PhaseNo)’ are attached in the

appendix. When all the test data are collected, MLE is used to identify the winding parameters

(R and L). The results of identification are validated with the test data: the voltages measured at standstill test are applied to the SRM model and the current responses are compared with the measured currents. From Figure 5, the estimated current (dotted curve) matches the measured current (solid curve) very well. This proves that the estimated parameters are quite satisfactory.

0 1 2 3 4 5

x 10-3

-1

0

1

2

3I (A)

estimatedactual

0 1 2 3 4 5

x 10-3

0

5

10

15Voltage (V)

time (s) Figure 5. Validation of model for standstill test

4.3 Standstill test results

The motor used in this test is an 8/6 SRM. Tests are performed at several specific

positions for current between 0~50 ampere.

For model development and validation, the inductances at the following rotor positions are tested for phase currents from 0 to 50 amperes:

θ=0o(aligned position), 5o, 6o, 7.5o, 10o, 12o, 15o(midway position), 18o, 20o, 22.5o,

24o, 25o, and 30o(unaligned position),

4.3.1 Resistance The winding resistance is computed from ratio of the steady-state phase voltage over

phase current. Test results show that the winding resistance doesn’t change much with the

Page 14: Modeling and Parameter Identification of Switched

13

rotor positions and phase currents. A mean value of the results at different rotor positions and phase currents is

R = 0.2996 ΩΩΩΩ.

4.3.2 Inductance

The winding inductance is computed from the dynamic response of phase current using maximum likelihood estimation. Test results show that,

• For θ=0o(aligned position), 5o, 6o, 7.5o, 10o, 12o, 15o(midway position), 18o, and

20o, the phase inductance decreases nonlinearly when phase current increases. The relationship between inductance and current is approximated with 5th-order polynomial. The polynomial coefficients are computed by curve fitting with least square techniques. (See Figures 6, 7, and 8)

0 5 10 15 20 25 300

1

2

3

4

5

6x 10

-3 inductance at theta = 0 deg

test data curve-fitting

Figure 6. Standstill test results for inductance at 0o and curve fitting result

Page 15: Modeling and Parameter Identification of Switched

14

0 5 10 15 20 25 300.5

1

1.5

2

2.5

3

3.5

4

4.5x 10

-3 inductance at theta = 10 deg

test data curve-fitting

Figure 7. Standstill test results for inductance at 10o and curve fitting result

0 5 10 15 20 25 300.8

1

1.2

1.4

1.6

1.8

2

2.2

2.4

2.6

2.8x 10

-3 inductance at theta = 15 deg

test data curve-fitting

Figure 8. Standstill test results for inductance at 15o and curve fitting result

• For θ=22.5o, 24o, and 25o, the phase inductance doesn’t change much when

phase current increases. The relationship between inductance and current can be approximated with a linear equation (1st-order polynomial) without significant error. The polynomial coefficients are computed by curve fitting with least square techniques.

Page 16: Modeling and Parameter Identification of Switched

15

0 5 10 15 20 25 300

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1x 10

-3 inductance at theta = 24 deg

test data curve-fitting

Figure 9. Standstill test results for inductance at 24o and curve fitting result

• For θ=30o(unaligned position), the phase inductance nearly keeps constant when

phase current increases. A mean value of the results at different phase currents is used as the unaligned position inductance.

0 5 10 15 20 25 300

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1x 10

-3 inductance at theta = 30 deg

test data curve-fitting

Figure 10. Standstill test results for inductance at 30o and curve fitting result

A summary of the coefficients for different rotor positions is shown in table 1.

Page 17: Modeling and Parameter Identification of Switched

16

Table 1. Curve fitting results for different rotor positions θ k kaa ,0, θθ → θL 0o 5 5.1892e-003

6.4641e-005 -7.7645e-005 6.5907e-006 -2.1974e-007 2.6214e-009

5 o 5 4.6557e-003 -5.2303e-005 -3.9006e-005 3.3400e-006 -1.0812e-007 1.2474e-009

6 o 5 4.3431e-003 4.3539e-005 -5.5141e-005 4.5786e-006 -1.5038e-007 1.7727e-009

7.5 o 5 4.2393e-003 -1.6142e-005 -3.9069e-005 3.2917e-006 -1.0824e-007 1.2807e-009

10 o 5 4.2396e-003 -1.9346e-004 -2.8209e-006 4.9546e-007 -1.3845e-008 1.1391e-010

12 o 5 3.2668e-003 3.3914e-005 -3.7114e-005 3.2147e-006 -1.1197e-007 1.3960e-009

15 o 5 2.6605e-003 -4.7806e-005 -2.9271e-006 4.3566e-008 4.2784e-009 -9.6186e-011

=

=k

n

nniaiL

0,)( θθ

Page 18: Modeling and Parameter Identification of Switched

17

18 o 5 1.6879e-003 -5.4708e-005 1.2748e-005 -1.1905e-006 4.1602e-008 -5.0098e-010

20 o 5 1.1875e-003 -1.9716e-005 3.8457e-006 -2.3203e-007 4.3266e-009 -1.9516e-011

22.5 o 2 6.1531e-004 -1.3104e-006

24 o 2 5.4706e-004 -8.3217e-007

25 o 2 5.4122e-004 -8.5467e-007

30 o 1 5.0304e-004

=

=k

n

nniaiL

0,)( θθ

A 3-D plot of inductance shown in Figure 11 depicts the profile of inductance versus rotor position and phase current.

Figure 11 Standstill test result: nonlinear phase inductance

Page 19: Modeling and Parameter Identification of Switched

At theta = 0 and 60 degrees, phase A is at its aligned positions and has the highest value of inductance. It decreases when the phase current increases. At theta = 30 degrees, phase A is at its unaligned position and has lowest value of inductance. The inductance here keeps nearly constant when the phase current changes.

4.3.3 Flux linkage

According to the inductances estimated above, the flux linkage versus current and rotor position theta can be computed and plotted. The flux linkage curves for 3-term, 4-term, and 5-term inductance model are shown in Figure 12, 13, and 14 respectively.

Figure 12. Flux linkage curves for 3-term inductance mod

d

Aligned Midway Unaligne

18

el

Page 20: Modeling and Parameter Identification of Switched

19

Figure 13. Flux linkage curves for 4-term inductance model

Figure 14. Flux linkage curves for 5-term inductance model

Aligned Midway Unaligned

Aligned Midway Unaligned

Page 21: Modeling and Parameter Identification of Switched

20

It’s obvious that the flux linkage curves at aligned position for 5-term inductance model were distorted (because of estimation error or over estimation). This will affect the accuracy of the model. We can see this from the validation through online operation data

5. Direct parameter estimation using Output Error

In previous sections, we get the coefficients of the polynomials for inductances by curve fitting. In fact we can identify them directly from test data using output error or maximum likelihood estimation.

5.1 Test procedure

Since what we want to get are these coefficients instead of the inductance values at

different values, we can put these coefficients into our model and identify them directly. By doing this, we also don’t need test the phase winding under several fixed phase currents. We can vary the current from zero to rated values (50A) and use output error estimation to get a set of coefficients that suits for full current range!

To realize this idea, the standstill test is performed as follows: Step 1. Block rotor at a specific position Step 2. Apply a voltage pulse to phase winding and let the phase current increase

from zero to rated value (50A). Step 3. Turn off voltage pulse and let the phase current decrease to zero. Step 4. Change voltage level to repeat above procedure. Changing voltage can change

the increasing rate of phase current. Step 5. Build an SRM model with the mentioned coefficients as parameters (and

provide appropriate initial guess for these parameters). Step 6. Simulate the model with measured voltage pulses, estimate the phase current. Step 7. Use output error to improve the parameters until estimation error is

acceptable. The model used here for output error estimation is shown as follows (Figure 15 and 16)

Figure 15. 3-term inductance model used for OE

Page 22: Modeling and Parameter Identification of Switched

21

Figure 16. 3-term inductance model used for OE

5.2 Estimation results

Here are some figures obtained from output error estimation at different rotor positions: It’s clear to see that the estimation errors are smaller than the model parameter obtained from curve fitting.

0 0.5 1 1.5 2 2.5 3 3.5

x 10-3

-10

0

10

20

30

40

50

60mean of error = -0.5018, covariance of error = 2.5753

measuredestimatederror

Figure 17. Output error estimation result at aligned position

Page 23: Modeling and Parameter Identification of Switched

22

0 0.5 1 1.5 2 2.5 3 3.5 4

x 10-3

-10

0

10

20

30

40

50mean of error = -0.7107, covariance of error = 0.1951

measuredestimatederror

Figure 18. Output error estimation result at midway position

0 0.5 1 1.5 2 2.5 3

x 10-3

-10

0

10

20

30

40

50

60mean of error = 0.1022, covariance of error = 0.0972

measuredestimatederror

Figure 19. Output error estimation result at unaligned position

Page 24: Modeling and Parameter Identification of Switched

23

6. SRM Model for Online Operation 6.1 Model structure with damper

For online operation case, especially under high load, the losses become significant. Considering the circulating currents and core losses at high currents, the model structure may be modified as shown in Figure 20, with dR and dL added to represent the losses.

Figure 20 Model structure of SRM under saturation

The phase voltage equations can be written as:

Vii

RRRR

ii

LLL

d

d

d

d

+

−−−=

−100

0 2

1

2

1

, (15)

where i1 and i2 are the magnetizing current and damper current. It can be re-written in state space form as:

DUCXYBUAXX

+=+=

(16)

where

][ 21 iiX = , ][VU = ,

−−−⋅

−=

d

d

d

d

RRRR

LLL

A0

0

1

,

−=

10

0

1

d

d

LLL

B ,

21 iiY += , ]11[=C , and

0=D . During operation, we can easily measure phase voltage V and phase current 21 iii += .

But we cannot measure the magnetizing current (i1) and the damper current (i2). Let’s assume that the phase parameters R and L obtained from standstill test data are accurate

Page 25: Modeling and Parameter Identification of Switched

24

enough for low current case. And we want to attribute all the errors at high current case to damper parameters. If we can estimate the exciting i1 during online operation, then it will be very easy to estimate the damper parameters. This is described in later sections. 6.2 Estimation of damper parameters from standstill test as initial guesses

Generally, the damper parameters should be identified from operating data in which saturation is high. But we can first using standstill test data to estimate the damper parameters, and use them as initial guesses for identification from operating data. These initial guesses will be improved by operating data.

Estimation results from standstill test data show that the damper winding resistance

Rd changes with phase current i, while it doesn’t change much with the rotor position θ. It can be approximated by a polynomial (as shown in figures 21-24). The damper winding inductance Ld keeps nearly constant at different currents and rotor positions (as shown in Figure 25).

In figure 21, the estimation results for Rd at aligned position (0o) is shown, together

with the polynomial curve fitting result. In figure 22, the estimation results for Rd at 10o is shown, together with the

polynomial curve fitting result. In figure 23, the estimation results for Rd at 20o is shown, together with the

polynomial curve fitting result. In figure 24, the estimation results for Rd at different positions are shown. It’s clear

that Rd doesn’t change much with the rotor position θ. A polynomial curve fitting result of the mean value of Rd is:

Ω×−×+×= 32 i0.0041i0.2613i5.4105-37.9659dR

In figure 25, the estimation results for Ld at different positions and different currents

are shown. It’s clear that Ld keeps nearly constant. The mean value is:

mH 5678.0=dL

Page 26: Modeling and Parameter Identification of Switched

25

0 5 10 15 20 25 30-5

0

5

10

15

20

25

30

35

40Rd at theta = 0 deg

test datacurve-fitting

Figure 21. Estimation results for Rd at 0o and curve fitting result

0 5 10 15 20 25 300

5

10

15

20

25

30

35

40

45Rd at theta = 10 deg

test datacurve-fitting

Figure 22. Estimation results for Rd at 10o and curve fitting result

Page 27: Modeling and Parameter Identification of Switched

26

0 5 10 15 20 25 30 350

5

10

15

20

25

30

35Rd at theta = 20 deg

test datacurve-fitting

Figure 23. Estimation results for Rd at 20o and curve fitting result

0 5 10 15 20 25 30-5

0

5

10

15

20

25

30

35

40

45Approximation of Rd

Rd

current

mean0101520

Figure 24. Estimation results for Rd and curve fitting result

Page 28: Modeling and Parameter Identification of Switched

27

0 5 10 15 20 25 30-2

-1

0

1

2

3

4

5x 10-3 Approximation of Ld

Ld

current

0101520

Figure 25. Estimation results for Ld and mean value

7. 2-Layer Recurrent Neural Network

During online operation, there will be motional back EMF in the phase winding. So the exciting current i1 will be affected by:

• Phase voltage V, • Phase current i, • Rotor position θ, and • Rotor speed ω.

To map the relation ship between i1 and V, i, θ, ω, the neural network structure shown

in Figure 26 is used. It is a two-layer recurrent neural network. The first layer is the input layer. The inputs of the network are V, i, θ, ω (with

possible delays). One of the outputs, the current i, is also fed back to the input layer to form a recurrent neural network.

The second layer is the output layer. The outputs are i (used as training objective) and

i1. A hyperbolic tangent sigmoid transfer function – “tansig()” is chosen to be the

activation function of the input layer, which gives the following relationship between its inputs and outputs:

Page 29: Modeling and Parameter Identification of Switched

28

112,1

4

1,11 byLWpIWn

iii +⋅+⋅=

=

11

2)(1211 −

+== − ne

ntansiga . (17)

A pure linear function is chosen to be the activation of the output layers, which gives:

211,22 baLWn +⋅=

2221 )( nnpurelinay === ; (18)

311,33 baLWn +⋅=

3332 )( nnpurelinay === . (19) After the neural network is trained with simulation data (using parameters obtained

from standstill test). It can be used to estimate exciting current during on-line operation. When i1 is estimated, the damper current can be computed as

12 iii −= , (20) and the damper voltage can be computed as

RiVV ⋅−=2 , (21) then the damper resistance Rd and inductance Ld can be identified using output error

or maximum likelihood estimation.

Fig. 26 Recurrent neural network structure for estimation of exciting current

Page 30: Modeling and Parameter Identification of Switched

29

8. Training of Neural Network

The data used for training is generated from simulation of SRM model obtained from standstill test.

First, from standstill test result, we can estimate the winding parameters ( R and L ) and damper parameters ( dR and dL ). The dR and dL got from standstill test data may not be accurate enough for online model, but it can be used as initial values that will be improved later.

Second, build an SRM model with above parameters and simulate the motor with

hysteresis current control and speed control. The operating data under different reference currents and different rotor speeds are collected and sent to neural network for training.

Third, when training is done, use the trained ANN model to estimate the magnetizing

current (i1) from online operating data. Compute damper voltage and current according to equations (20) and (21). Then estimate dR and dL from the computed V2 and i2 using output error estimation. This dR and dL can be treated as improved values of standstill test results.

Repeat above procedures until dR and dL are accurate enough to represent online operation (it means that the simulation data matches the measurements well).

In our research, the neural network can map the exciting current from and V, i, θ, ω

very well after training of 200 epochs. The performance of the neural network during training is shown in Figure 27.

Figure 27 Performance of NN during training

Page 31: Modeling and Parameter Identification of Switched

30

After training of 200 epochs, the neural network can map the exciting current from

and V, i, θ, ω very well. In Figure 28, the output of neural network from some specified

input data is shown, together with the actual values. It’s clear that the error is negligible.

Figure 28 Validation of neural network after training

9. Estimation Results and Model Validation

Some of the results are shown in Figure 29 and 30. In this case, we successfully get the parameters for damper. But in some other cases, we cannot get reasonable results. This is partly because that the neural network is trained from simulation data that using standstill test parameters. And there may be some errors in the standstill test parameters.

Page 32: Modeling and Parameter Identification of Switched

31

Figure 29. Estimated exciting current during on-line operation

Figure 30. Estimated damper current and damper voltage

The model and parameters obtained above is also validated with operating data. Similar result as that shown in figure 11 is obtained.

Page 33: Modeling and Parameter Identification of Switched

32

To validate the parameters obtained from above test, a simple on-line test has been

performed. In this test, the motor is accelerated with a fixed reference current of 20 ampere. All the operating data such as phase voltages, currents, rotor position, and rotor speed are measured. Then the phase voltages are fed to an SRM model running in Simulink, which has the same rotor position and speed as the real motor. All the phase currents are estimated from the Simulink mode and compared with the measured currents. In Figure 30, the phase current responses are shown. The dashed curve is the voltage applied to phase winding; the solid curve is the measured current; and the dotted curve is the estimated current. An enlarged view of the curves for phase A is shown in Figure 31. It is clear that the estimation approximates to the measurement quite well.

Compared with the standstill model, the online model gives much better estimation of operating phase currents.

0.05 0.1 0.15-20

-10

0

10

20

Current Response in Phase A - cov = 1.1962

time (s)

measured current (A)estimated current (A)measured voltage (V)

0.05 0.1 0.15-20

-10

0

10

20

Current Response in Phase B - cov = 0.7887

time (s)

measured current (A)estimated current (A)measured voltage (V)

0.05 0.1 0.15-20

-10

0

10

20

Current Response in Phase C - cov = 0.5873

time (s)

measured current (A)estimated current (A)measured voltage (V)

0.05 0.1 0.15-20

-10

0

10

20

Current Response in Phase D - cov = 0.6806

time (s)

measured current (A)estimated current (A)measured voltage (V)

Figure 30 Validation of model with on-line operating data

Page 34: Modeling and Parameter Identification of Switched

33

0.05 0.1 0.15-20

-15

-10

-5

0

5

10

15

20

25Current Response in Phase A

time (s)

measured current (A) estimated current (A)measures voltage (V)

Figure 31 Validation of model with on-line operating data (Phase A)

10. Advantages of Neural Network Mapping

During online operation, the exciting current i1 changes with phase voltage V, rotor position θ, and rotor speed ω. The relationship between them is highly nonlinear and cannot be easily expressed by any analytical equation. The neural network can provide very good mapping if trained correctly. This makes it a good choice for such a task.

Once the NN is trained, it can estimate the exciting current from inputs very quickly,

without solving any differential equations that is necessary in conventional methods. So it can be used for online parameter identification with no computational difficulties. 11. Conclusions

This paper presents the idea and procedure to use artificial neural network to help identify the resistance and nonlinear inductance of SRM winding from operating data. First the resistance and inductance of the magnetizing winding are identified from standstill test data. Then a 2-layer recurrent neural network is setup and trained with simulation data based on standstill model. By applying this neural network to online operating data, the magnetizing current can be estimated and the damper current can be computed. Then the parameters of the damper winding can be identified using maximum likelihood estimation. Tests performed on a 50-ampere 8/6 SRM show satisfactory results of this method.

Page 35: Modeling and Parameter Identification of Switched

34

12. Acknowledgement

This work is supported in part by NSF Grant ECS0105320, and TRW and Delphi Automotive Systems. 13. References [1] Vadim Utkin, Jurgen Guldner, and Jingxin Shi, “Sliding Model Control in

Electromechanical Systems”, Taylor & Francis Inc., 1999. [2] Sayeed Mir, Iqbal Husain and Malik E. Elbuluk, “Switched Reluctance Motor

Modeling with On-line Parameter Identification”, IEEE Transactions on Industry Applications, Vol. 34, No. 4, July/August 1998

[3] B. Fahimi, G. Suresh, J. Mahdavi, and M. Ehsani, “A New Approach to Model Switched Reluctance Motor Drive Application to Dynamic Performance Prediction, Control and Design”, Power Electronics Specialists Conference, Vol. 2, 1998.

[4] Longya Xu and E. Ruckstadter, “Direct Modeling of Switched Reluctance Machine by Coupled Field-Circuit Method”, IEEE Transactions on Energy Conversion, vol. 10, issue 3, September 1995

[5] Seung-Ill Moon and Ali Keyhani, “Estimation of Induction Machine Parameters from Standstill Time-Domain Data”, IEEE Transactions on Industry Applications, Vol. 30, No. 6, November/December 1994

[6] A. Keyhani, H. Tsai, and T. Leksan, “Maximum Likelihood Estimation of Synchronous Machine Parameters from Standstill Time Response Data”, presented at the 1993 IEEE/PES Winter Meeting, Columbus, OH. Jan. 31- Feb. 5, 1993.

[7] Kevin M. Passino, “Intelligent Control: Biomimicry for Optimization, Adaptation, and Decision-Making in Computer Control and Automation”, EE858 textbook, The Ohio State University, March 2001

[8] Srinivas Pillutla, Ali Keyhani, “Neural Network Based Modeling of Round Rotor Synchronous Generator Rotor Body Parameters from Operating Data”, IEEE Transactions on Energy Conversion, 1998

[9] Srinivas Pillutla, Ali Keyhani, “Neural Network Based Saturation Model of Round Rotor Synchronous Generator Rotor”, IEEE Transactions on Energy Conversion, 1998

[10] S. S. Ramamurthy, R. M. Schupbach, and J. C. Balda, “Artificial Neural Networks based Models for the Multiply Excited Switched Reluctance Motor”, APEC 2001

[11] B. Fahimi, G. Suresh, J. Mahdavi, and M. Ehsani, “A New Approach to Model Switched Reluctance Motor Drive Application to Dynamic Performance Prediction, Control and Design”, Power Electronics Specialists Conference, Vol. 2, 1998.

Page 36: Modeling and Parameter Identification of Switched

35

APPENDIX I

C program on DS1103 controller board for standstill test /************************************************************ * * FILE: * sstest.c * * RELATED FILES: * Brtenv.h - Basic Real Time Environment * * DESCRIPTION: * Standstill and online test for SRM using DS1103 controller board. * * AUTHOR: * Wenzhe Lu * Mechatronics Laboratory, The Ohio State University * November 21, 2000 * *************************************************************/ #include <Brtenv.h> /*----------------------------------------------------------*/ #define DT 2.5e-5 /* 25 us simulation step size */ #define NPHASES 4 /* number of phases */ #define I_MAX_SET 35 /* peak current rating */ #define I_RMS_SET 30 /* square of rms current rating */ #define SCALECURRENT 100 /* 24.2 current transformation ratio */ #define SCALEVOLTAGE 200 /* 19.9 voltage transformation retio */ /* variables for TRACE */ Float64 u[NPHASES] = 0.0, 0.0, 0.0, 0.0; Float64 i[NPHASES] = 0.0, 0.0, 0.0, 0.0; Float64 i_rms[NPHASES] = 0.0, 0.0, 0.0, 0.0; Float64 i_oc_rms = 0.0, i_oc_max = 0.0; Float64 Iref; UInt32 phase_oc = 0; UInt32 count[NPHASES] = 0, 0, 0, 0; UInt32 bGrayCode; Float64 bRotorPosition; Float64 bPrevPosition = 0.0; UInt32 bCurrentPhase = 0; UInt32 bPhase = 2; UInt32 iSample = 0; Int16 task_id = 0; /* communication channel */ Int16 index = -1; /* command table index */ UInt32 bOverCurrent = 0; /* over current flag */

Page 37: Modeling and Parameter Identification of Switched

36

UInt32 bPhaseSelect = 1; Float64 fPulseWidth = 1.0e-4; Float64 Idecay; UInt32 bPulseOn = 0; UInt32 bAlign = 0; UInt32 bRotate = 0; UInt32 bDecay = 0; Float64 exec_time; /* execution time */ UInt8 k = 0, m = 1; Float64 ts = 0, fSpeed = 0; /* functions defined in this program */ void isr_timerA(void); /* ISR of Timer A */ void rms_current_calculation(void); void over_current_protection(void); void rotor_position_detection(void); UInt32 Graycode2Binary(UInt32 bGrayCode); /*(void speed_controller(void);*/ /*----------------------------------------------------------*/ void main(void) /* init ds1103 */ ds1103_init(); /* init communication with slave_dsp */ ds1103_slave_dsp_communication_init(); /* Initialize Bit 0~7 of group 2 for Bit In: Encoder bit01~08 */ ds1103_slave_dsp_bit_io_init(task_id, 2, SLVDSP1103_BIT_IO_BIT0_MSK | SLVDSP1103_BIT_IO_BIT1_MSK | SLVDSP1103_BIT_IO_BIT2_MSK | SLVDSP1103_BIT_IO_BIT3_MSK | SLVDSP1103_BIT_IO_BIT4_MSK | SLVDSP1103_BIT_IO_BIT5_MSK | SLVDSP1103_BIT_IO_BIT6_MSK | SLVDSP1103_BIT_IO_BIT7_MSK, SLVDSP1103_BIT_IO_BIT0_IN | SLVDSP1103_BIT_IO_BIT1_IN | SLVDSP1103_BIT_IO_BIT2_IN | SLVDSP1103_BIT_IO_BIT3_IN | SLVDSP1103_BIT_IO_BIT4_IN | SLVDSP1103_BIT_IO_BIT5_IN | SLVDSP1103_BIT_IO_BIT6_IN | SLVDSP1103_BIT_IO_BIT7_IN); /* register read function in the command table for group 2 */ ds1103_slave_dsp_bit_io_read_register(task_id, &index, 2); /* init digital I/O ports: set I/O port1 to output set I/O port2 to output set I/O port3 to input set I/O port4 to input */ ds1103_bit_io_init(DS1103_DIO1_OUT | DS1103_DIO2_IN | DS1103_DIO3_OUT | DS1103_DIO4_IN); /* Gating signal: IO17-SA1, IO19-SA2, IO21-SB1, IO23-SB2, IO16-SC1, IO18-SC2, IO20-SD1, IO22-SD2 */ /* Encoder: bit01-IO09 bit02-IO11 bit03-IO13 bit04-IO15 */ /* Encoder: bit05-IO08 bit06-IO10 bit07-IO12 bit08-IO14 */ /* Encoder: bit09-IO24 bit10-IO26 bit11-IO28 bit12-IO30 */

Page 38: Modeling and Parameter Identification of Switched

37

/* turn off all switches */ //ds1103_slave_dsp_bit_io_write(task_id, index, 0x00); ds1103_bit_io_write(0x00000000); /* adjust mux 1 (converter 1) to channel 2: Ia, mux 2 (converter 2) to channel 6: Ib, mux 3 (converter 3) to channel 10:Ic, mux 4 (converter 4) to channel 14:Id, */ ds1103_adc_mux_all(2, 6, 10, 14); /* start AD convertion */ ds1103_adc_delayed_start(DS1103_ADC1 | DS1103_ADC2 | DS1103_ADC3 | DS1103_ADC4); /* wait 5 us for AD convertion*/ ds1103_tic_delay(5.0e-6); /* Iref = P * fabs(SpeedCmd - speed); */ Iref = 30; /* periodic event in ISR */ ds1103_start_isr_timerA(DT, isr_timerA); /* Background task */ while(1) master_cmd_server(); host_service(0, 0); /* COCKPIT service */ if ((bPulseOn == 1) & (bOverCurrent == 0)) switch (bPhaseSelect) case 1: ds1103_bit_io_write(0x000a0000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x82); ds1103_tic_delay(fPulseWidth); ds1103_bit_io_write(0x00080000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x00); break; case 2: ds1103_bit_io_write(0x00a00000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x14); ds1103_tic_delay(fPulseWidth); ds1103_bit_io_write(0x00800000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x00); break; case 3: ds1103_bit_io_write(0x00050000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x41); ds1103_tic_delay(fPulseWidth); ds1103_bit_io_write(0x00040000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x00); break; case 4: ds1103_bit_io_write(0x00500000);

Page 39: Modeling and Parameter Identification of Switched

38

//ds1103_slave_dsp_bit_io_write(task_id, index, 0x28); ds1103_tic_delay(fPulseWidth); ds1103_bit_io_write(0x00400000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x00); break; default: ds1103_bit_io_write(0x00000000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x00); bPulseOn = 0; ds1103_tic_delay(fPulseWidth*2); ds1103_bit_io_write(0x00000000); if ((bDecay == 1) & (bOverCurrent == 0)) switch (bPhaseSelect) case 1: ds1103_bit_io_write(0x000a0000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x82); ds1103_tic_start(); while ((ds1103_tic_read() < .015)); ds1103_bit_io_write(0x00000200); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x02); break; case 2: ds1103_bit_io_write(0x00a00000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x14); ds1103_tic_start(); while ((ds1103_tic_read() < .015)); ds1103_bit_io_write(0x00002000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x10); break; case 3: ds1103_bit_io_write(0x00050000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x41); ds1103_tic_start(); while ((ds1103_tic_read() < .015)); ds1103_bit_io_write(0x00000100); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x01); break; case 4: ds1103_bit_io_write(0x00500000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x28); ds1103_tic_start(); while ((ds1103_tic_read() < .015)); ds1103_bit_io_write(0x00001000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x08); break; default: ds1103_bit_io_write(0x00000000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x00); ds1103_tic_delay(2); ds1103_bit_io_write(0x00000000);

Page 40: Modeling and Parameter Identification of Switched

39

//ds1103_slave_dsp_bit_io_write(task_id, index, 0x00); bDecay = 0; if (bAlign == 1) if ((k < 500) && (bOverCurrent == 0)) if ((i[bPhaseSelect-1] < .9*Iref) & (m == 1)) switch (bPhaseSelect) case 1: ds1103_bit_io_write(0x000a0000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x82); break; case 2: ds1103_bit_io_write(0x00a00000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x14); break; case 3: ds1103_bit_io_write(0x00050000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x41); break; case 4: ds1103_bit_io_write(0x00500000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x28); break; m = 0; k++; else if ((i[bPhaseSelect-1] > Iref) & (m == 0)) switch (bPhaseSelect) case 1: ds1103_bit_io_write(0x00080000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x82); break; case 2: ds1103_bit_io_write(0x00800000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x14); break; case 3: ds1103_bit_io_write(0x00040000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x41); break; case 4: ds1103_bit_io_write(0x00400000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x28); break; m = 1; k++;

Page 41: Modeling and Parameter Identification of Switched

40

else bAlign = 0; ds1103_bit_io_write(0x00000000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x00); k = 0; m = 1; else if (bRotate == 1) if (bOverCurrent == 0) if ((i[bPhase-1] < .9*Iref) & (m == 1)) switch (bPhase) case 1: ds1103_bit_io_write(0x000a0000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x82); break; case 2: ds1103_bit_io_write(0x00a00000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x14); break; case 3: ds1103_bit_io_write(0x00050000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x41); break; case 4: ds1103_bit_io_write(0x00500000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x28); break; m = 0; else if ((i[bPhase-1] > Iref) & (m == 0)) ds1103_bit_io_write(0x00000000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x00); m = 1; else bRotate = 0; ds1103_bit_io_write(0x00000000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x00); m = 1; else k = 0; m = 1;

Page 42: Modeling and Parameter Identification of Switched

41

ds1103_bit_io_write(0x00000000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x00); /*----------------------------------------------------------*/ void isr_timerA(void) ds1103_begin_isr_timerA(); /* overload check */ host_service(1, 0); /* TRACE service */ ds1103_tic_start(); /* start time measurement */ ts = ts + DT; /* samples current when iSample = 0; else samples voltage */ if (iSample == 0) iSample = 1; /* read results of last convertion */ ds1103_adc_read2(1, &i[0], &i[1]); ds1103_adc_read2(3, &i[2], &i[3]); i[0] = i[0] * SCALECURRENT + .192; i[1] = i[1] * SCALECURRENT + .192; i[2] = i[2] * SCALECURRENT + .192; i[3] = i[3] * SCALECURRENT + .192; /* adjust mux 1 (converter 1) to channel 4: Va, mux 2 (converter 2) to channel 8: Vb, mux 3 (converter 3) to channel 12:Vc, mux 4 (converter 4) to channel 16:Vd, */ ds1103_adc_mux_all(4, 8, 12, 16); else iSample = 0; /* read results of last convertion */ ds1103_adc_read2(1, &u[0], &u[1]); ds1103_adc_read2(3, &u[2], &u[3]); u[0] = u[0] * SCALEVOLTAGE + .374; u[1] = u[1] * SCALEVOLTAGE + .374; u[2] = u[2] * SCALEVOLTAGE + .374; u[3] = u[3] * SCALEVOLTAGE + .374; /* adjust mux 1 (converter 1) to channel 2: Ia, mux 2 (converter 2) to channel 6: Ib, mux 3 (converter 3) to channel 10:Ic, mux 4 (converter 4) to channel 14:Id, */ ds1103_adc_mux_all(2, 6, 10, 14);

Page 43: Modeling and Parameter Identification of Switched

42

/* start AD convertion */ ds1103_adc_delayed_start(DS1103_ADC1 | DS1103_ADC2 | DS1103_ADC3 | DS1103_ADC4); if (iSample == 1) rms_current_calculation(); else over_current_protection(); rotor_position_detection(); exec_time = ds1103_tic_read(); ds1103_end_isr_timerA(); /*----------------------------------------------------------*/ void rms_current_calculation(void) UInt8 j; for (j=0; j<NPHASES; j++) i_rms[j] = sqrt((i_rms[j] * i_rms[j] * (Float64)count[j] + i[j] * i[j]) / (Float64)(count[j] + 1)); count[j]++; /*----------------------------------------------------------*/ void over_current_protection(void) phase_oc = 0; if ((i[0] > I_MAX_SET) | (i_rms[0] > I_RMS_SET)) phase_oc = 1; else if ((i[1] > I_MAX_SET) | (i_rms[1] > I_RMS_SET)) phase_oc = 2; else if ((i[2] > I_MAX_SET) | (i_rms[2] > I_RMS_SET)) phase_oc = 3; else if ((i[3] > I_MAX_SET) | (i_rms[3] > I_RMS_SET)) phase_oc = 4; if (phase_oc != 0) /* turn off all switches */ ds1103_bit_io_write(0x00000000); //ds1103_slave_dsp_bit_io_write(task_id, index, 0x00); /* record fault current */ i_oc_rms = i_rms[phase_oc-1]; i_oc_max = i[phase_oc-1]; /* set over current flag */ bOverCurrent = 1; bPulseOn = 0;

Page 44: Modeling and Parameter Identification of Switched

43

bAlign = 0; bRotate = 0; /*----------------------------------------------------------*/ UInt32 Graycode2Binary(UInt32 bGrayCode) UInt32 bin; bin = bGrayCode ^ (bGrayCode >> 8); bin = bin ^ (bin >> 4); bin = bin ^ (bin >> 2); bin = bin ^ (bin >> 1); return bin; /*----------------------------------------------------------*/ void rotor_position_detection(void) UInt8 bTemp8; UInt16 slave_err_read; UInt32 bTemp32; UInt8 j; Float64 fAngle; bTemp32 = ds1103_bit_io_read(); ds1103_slave_dsp_bit_io_read_request(task_id, index); /* read bitmap from the specified I/O group */ //do // slave_err_read = ds1103_slave_dsp_bit_io_read(task_id, index, &bTemp8); // //while(slave_err_read == SLVDSP1103_NO_DATA); if (slave_err_read == SLVDSP1103_NO_DATA) return; bGrayCode = 0; if ((bTemp8 & 0x02) != 0) bGrayCode = bGrayCode | 0x800; if ((bTemp8 & 0x80) != 0) bGrayCode = bGrayCode | 0x400; if ((bTemp8 & 0x10) != 0) bGrayCode = bGrayCode | 0x200; if ((bTemp8 & 0x04) != 0) bGrayCode = bGrayCode | 0x100; if ((bTemp8 & 0x01) != 0) bGrayCode = bGrayCode | 0x80; if ((bTemp8 & 0x40) != 0) bGrayCode = bGrayCode | 0x40;

Page 45: Modeling and Parameter Identification of Switched

44

if ((bTemp8 & 0x08) != 0) bGrayCode = bGrayCode | 0x20; if ((bTemp8 & 0x20) != 0) bGrayCode = bGrayCode | 0x10; if ((bTemp32 & 0x01000000) != 0) bGrayCode = bGrayCode | 0x8; if ((bTemp32 & 0x04000000) != 0) bGrayCode = bGrayCode | 0x4; if ((bTemp32 & 0x10000000) != 0) bGrayCode = bGrayCode | 0x2; if ((bTemp32 & 0x40000000) != 0) bGrayCode = bGrayCode | 0x1; bRotorPosition = Graycode2Binary(bGrayCode) * 360.0 / 4096.0; //bCurrentPhase = ((int)bRotorPosition % 60) / 15 + 1; if ((bRotorPosition >= 3.047) && (bRotorPosition < 18.047)) bCurrentPhase = 1; else if ((bRotorPosition >= 18.047) && (bRotorPosition < 33.047)) bCurrentPhase = 2; else if ((bRotorPosition >= 33.047) && (bRotorPosition < 48.047)) bCurrentPhase = 3; else bCurrentPhase = 4; if ((bRotorPosition != bPrevPosition) && (bPrevPosition != 0.0)) if (ts > DT) /*if (bRotorPosition >= bPrevPosition) fAngle = (bRotorPosition - bPrevPosition) * 360 / 4096; else fAngle = (bRotorPosition - bPrevPosition + 4096) * 360 / 4096;*/ fAngle = fabs(bRotorPosition - bPrevPosition); fSpeed = fAngle / 360. / ts * 60; bPrevPosition = bRotorPosition; ts = 0; for (j=0; j<NPHASES; j++) count[j] = 0;

Page 46: Modeling and Parameter Identification of Switched

45

APPENDIX II

Matlab program for standstill test – align.m function align(phase) % Syntax: Standstill Test of SRM Parameters; % % Purpose: Estimate SRM parameters through stnadstill test. % % This file needs the real-time processor application 'sstest.ppc' running. % To change simulation parameters while the continuous data acquisition % is running open ControlDesk and load the experiment file 'sstest.cdx'. % Copyright (c) 2000 by OSU % select DS1103 board for use with MLIB mlib('SelectBoard','DS1103'); % check if the application sstest.ppc is running ApplName = lower([pwd,'\sstest.ppc']); if mlib('IsApplRunning'), ApplInfo = mlib('GetApplInfo'); if strcmp(ApplName,lower(ApplInfo.name)) ~= 1 err_msg = sprintf('*** This MLIB demo file needs the real-time processor application\n*** ''%s'' running!',... ApplName); error(err_msg); end; else err_msg = sprintf('*** This MLIB demo file needs the real-time processor application\n*** ''%s'' running!',... ApplName); error(err_msg); end; % specify the variables used by MLIB and get they descriptors variables = 'Signals/i[0]'; 'Signals/u[0]'; 'Signals/i[1]'; 'Signals/u[1]'; 'Signals/i[2]'; 'Signals/u[2]'; 'Signals/i[3]'; 'Signals/u[3]'; parameter1 = 'Control Variables/bAlign'; parameter2 = 'Control Variables/fPulseWidth'; parameter3 = 'Control Variables/bPhaseSelect'; parameter4 = 'Control Variables/bRotorPosition'; parameter5 = 'Control Variables/bPulseOn'; parameter6 = 'Control Variables/bOverCurrent'; parameter7 = 'Signals/i_oc_rms'; parameter8 = 'Signals/i_oc_max'; parameter9 = 'Signals/phase_oc'; [Ia, Va, Ib, Vb, Ic, Vc, Id, Vd] = mlib('GetTrcVar', variables); bAlign = mlib('GetTrcVar', parameter1);

Page 47: Modeling and Parameter Identification of Switched

46

fPulseWidth = mlib('GetTrcVar', parameter2); bPhaseSelect = mlib('GetTrcVar', parameter3); bRotorPosition = mlib('GetTrcVar', parameter4); bPulseOn = mlib('GetTrcVar', parameter5); bOverCurrent = mlib('GetTrcVar', parameter6); i_oc_rms = mlib('GetTrcVar', parameter7); i_oc_max = mlib('GetTrcVar', parameter8); phase_oc = mlib('GetTrcVar', parameter9); pw = 2e-1; % set the option of the data acquisition performed by service number 1 (default) mlib('Set','StepSize',2.5e-5,... % continuos mode can be actived only with disabled triggering 'TraceVars',[Ia; Va; Ib; Vb; Ic; Vc; Id; Vd],... 'Start',0,... 'Stop',pw*3,... 'Downsampling',2); clf; t = [0:5e-5:pw*3+5e-5]; mlib('Write', bOverCurrent, 'Data', 0); mlib('Write', i_oc_rms, 'Data', 0.0); mlib('Write', i_oc_max, 'Data', 0.0); mlib('Write', bPhaseSelect, 'Data', phase); mlib('StartCapture'); % start the continuous data acqusition on the DS1103, default service number 1 mlib('Write', bAlign, 'Data', 1); while mlib('CaptureState') ~= 0 end out_data = mlib('FetchData'); Ia = out_data(2*phase-1,:); Va = out_data(2*phase,:); mlib('StopCapture'); % stop the continuous data acquisition on the DS1103 board mlib('Write', bAlign, 'Data', 0); %mlib('Write', bPulseOn, 'Data', 1); theta = mlib('Read', bRotorPosition); bOC = mlib('Read', bOverCurrent); if (bOC == 1) fprintf('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'); fprintf('Phase %d over curent!\n', mlib('Read', phase_oc)+1); fprintf('RMS current = %f, peak current = %f\n', mlib('Read', i_oc_rms), mlib('Read', i_oc_max)); fprintf('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'); ; else fprintf('=======================================================\n'); fprintf('Current rotor position: th = %8.4f\n', theta); fprintf('\n'); fprintf('Use sstest to perform standstill test.\n'); fprintf('=======================================================\n'); ;

Page 48: Modeling and Parameter Identification of Switched

47

end subplot(2,1,1); plot(t, out_data(2*phase-1,:), 'b'); ylabel('I'); grid on subplot(2,1,2); plot(t, out_data(2*phase,:), 'b'); ylabel('V'); grid on save align.mat Ia Va

Page 49: Modeling and Parameter Identification of Switched

48

APPENDIX III

Matlab program for standstill test – sst.m function sst(phase) % Syntax: Standstill Test of SRM Parameters; % % Purpose: Estimate SRM parameters through stnadstill test. % % This file needs the real-time processor application 'sstest.ppc' running. % To change simulation parameters while the continuous data acquisition % is running open ControlDesk and load the experiment file 'sstest.cdx'. % Copyright (c) 2000 by OSU % select DS1103 board for use with MLIB mlib('SelectBoard','DS1103'); % check if the application sstest.ppc is running ApplName = lower([pwd,'\sstest.ppc']); if mlib('IsApplRunning'), ApplInfo = mlib('GetApplInfo'); if strcmp(ApplName,lower(ApplInfo.name)) ~= 1 err_msg = sprintf('*** This MLIB demo file needs the real-time processor application\n*** ''%s'' running!',... ApplName); error(err_msg); end; else err_msg = sprintf('*** This MLIB demo file needs the real-time processor application\n*** ''%s'' running!',... ApplName); error(err_msg); end; % specify the variables used by MLIB and get they descriptors variables = 'Signals/i[0]'; 'Signals/u[0]'; 'Signals/i[1]'; 'Signals/u[1]'; 'Signals/i[2]'; 'Signals/u[2]'; 'Signals/i[3]'; 'Signals/u[3]'; parameter1 = 'Control Variables/bPulseOn'; parameter2 = 'Control Variables/fPulseWidth'; parameter3 = 'Control Variables/bPhaseSelect'; parameter4 = 'Control Variables/bRotorPosition'; parameter5 = 'Control Variables/bOverCurrent'; parameter6 = 'Signals/i_oc_rms'; parameter7 = 'Signals/i_oc_max'; parameter8 = 'Signals/phase_oc'; [Ia, Va, Ib, Vb, Ic, Vc, Id, Vd] = mlib('GetTrcVar', variables); bPulseOn = mlib('GetTrcVar', parameter1); fPulseWidth = mlib('GetTrcVar', parameter2);

Page 50: Modeling and Parameter Identification of Switched

49

bPhaseSelect = mlib('GetTrcVar', parameter3); Phase = mlib('GetTrcVar', parameter4); bOverCurrent = mlib('GetTrcVar', parameter5); i_oc_rms = mlib('GetTrcVar', parameter6); i_oc_max = mlib('GetTrcVar', parameter7); phase_oc = mlib('GetTrcVar', parameter8); pw = 150e-4; % set the option of the data acquisition performed by service number 1 (default) mlib('Set',... % continuos mode can be actived only with disabled triggering 'TraceVars',[Ia; Va; Ib; Vb; Ic; Vc; Id; Vd],... 'NumSamples',fix(2*pw/5e-5)+1,... 'Downsampling',2); clf; t = [0:5e-5:2*pw]; mlib('Write', bOverCurrent, 'Data', 0); mlib('Write', i_oc_rms, 'Data', 0.0); mlib('Write', i_oc_max, 'Data', 0.0); mlib('Write', fPulseWidth, 'Data', pw); %phase = 1; mlib('Write', bPhaseSelect, 'Data', phase); mlib('StartCapture'); % start the continuous data acqusition on the DS1103, default service number 1 mlib('Write', bPulseOn, 'Data', 1); while mlib('CaptureState') ~= 0 end out_data = mlib('FetchData'); I = out_data(2*phase-1,:); V = out_data(2*phase,:); mlib('StopCapture'); % stop the continuous data acquisition on the DS1103 board mlib('Write', bPulseOn, 'Data', 0); save VI.mat V I h = 1; t = length(I); while (h < length(I)) if abs(I(h)) > 0.15 break; else h = h+1; end end while (t > 1) if abs(I(t)) > 0.2 break; else t = t-1; end end V = V(h:t); I = I(h:t);

Page 51: Modeling and Parameter Identification of Switched

50

subplot(2,1,1); plot(I); axis([0 length(I) -1 6]); ylabel('I'); grid on subplot(2,1,2); plot(V); axis([0 length(V) -25 25]); ylabel('V'); grid on Z = [I' V']; R = 0.9; L = 1e-3; th_orig = [R L]; options(14) = 2000; [th, options] = leastsq('mtfun', th_orig, options, [], Z); R = th(1) L = th(2)

Page 52: Modeling and Parameter Identification of Switched

51

APPENDIX IV

Matlab program for standstill test – mle.m options = optimset('TolX', 1e-5, 'TolFun', 1e-5, 'MaxFunEvals', 1e5); I=Ia(61:240); V=Va(61:240); % Get input and measured output Z = [I' V']; % Guess initial parameters L = 0.004; th = [R L]; % set leastsq() options %options(1) = 1; % display intermediate result %options(14) = 2000; % maximum iteration count % maximum likelihood estimation: Kalman filtering + OE % estimate parameters using output error estimation - leastsq() % Kalman filter is used inside errfun() [th, options] = lsqnonlin('errfun1', th, [1e-1 1e-4], [1 1e-3], options, [], Z); R = th(1); L = th(2); % display results fprintf('\n==================================================\n'); fprintf(' Estimated parameters: \n'); fprintf(' R = %9.6f ohm\n', R); fprintf(' L = %9.6f H\n', L); fprintf('==================================================\n');

Page 53: Modeling and Parameter Identification of Switched

52

APPENDIX V

Matlab program for standstill test – errfun1.m function err = errfun1(th, Z) % This function is called by leastsq() function. % It is used to compute the estimation err e=y-yhat in each iteration. % Parameters RR = th(1); LL = th(2); % covariance of process noise and measurement noise Q = 1e-10; R = 1e-2; % Input and output I = Z(:,1); V = Z(:,2); % Form the state space matrix from parameters Ac = -inv(LL) * RR; Bc = inv(LL)'; % Convert to discrete-time model T = 5e-5; [Ad, Bd] = c2d(Ac, Bc, T); Cd = 1; % Design Kalman filter sys = ss(Ad, [Bd 1], Cd, 0, -1); [kalmf,L,P,M] = kalman(sys, Q, R); kalmf = kalmf(1,:); % Estimate output through Kalman filter using input and measured output ZZ = [V I]; yhat = lsim(kalmf, ZZ); % compute estimation error: e = y - yhat err = I - yhat;