You are on page 1of 19

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/245236759

An event-driven simulation method for motor driver in virtual machine tool


system

Article  in  Journal of Intelligent Manufacturing · April 2008


DOI: 10.1007/s10845-008-0077-5

CITATION READS

1 624

5 authors, including:

Yadong Liu Wei Li


DMG MORI USA University of California, Davis
16 PUBLICATIONS   313 CITATIONS    6 PUBLICATIONS   84 CITATIONS   

SEE PROFILE SEE PROFILE

Kazuo Yamazaki Makoto Fujishima


University of California, Berkeley DMGMORISEIKI
196 PUBLICATIONS   2,820 CITATIONS    44 PUBLICATIONS   1,119 CITATIONS   

SEE PROFILE SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Omni-CNC View project

iAM-CNC View project

All content following this page was uploaded by Yadong Liu on 10 December 2017.

The user has requested enhancement of the downloaded file.


An Event-driven Simulation Method for Motor Driver in Virtual Machine
Tool System

Yadong Liu1, Wei Li1, Kazuo Yamazaki1, Keizo Kashihara2, Makoto Fujishima2
1
IMS-Mechatronics Laboratory, Department of Mechanical Aeronautical Engineering, University of California, Davis
2
Mori Seiki Co. Ltd., 2-35-16 Meieki, Nakamura-ku, Nagoya City, Japan

Abstract: In this paper, an event-driven simulation method is proposed for the motor driver in

a virtual machine tool system (VMT), of which simulation speed is always a puzzle. This

method utilizes a set of pre-defined events to trigger the execution of simulator in a

non-deterministic manner and at the most efficient moment. Comparing to the conventional

time domain simulation method, it dramatically reduces the CPU time consumption without

losing simulation accuracy, therefore it improves the simulation efficiency. The effectiveness of

this method is verified through a PMSM motor driver model in studying Servo/Mechanical

interaction within a VMT.

Keywords: Event-driven, Simulation, Motor Driver, PWM, Power Transmission

1. Introduction

CNC machine tool can be described as characteristic example of complex mechatronics

system, whose distinguished feature is that system functionality is achieved through the

integration of electronic and information sub functions on a mechanical carrier [1]. To predict

the control accuracy and machining precision, it is necessary to consider the machine tool as a

whole for simulation, in other words, besides individual component simulation, the interaction

of machine mechanism and controller should be simulated too.

To achieve this goal, the most popular approach is to model different components of CNC

machine tool in their nature way using corresponding supporting simulators. The whole system

1
performance can be evaluated through simulation coupling technique [2]. Such an integration,

in which separately developed machine tool models and simulation tools are combined, is

called virtual machine tool system (VMT) [3]. VMT proposed a good framework to facilitate the

integration of currently available and future models of machine tool systems. However, there is

one big obstacle that prevents wide application of VMT to predict machine tool performance.

That is the simulation speed for each subsystem.

According to reference [4], the power transmission process of motor driver in VMT, which

plays an important role in the control of AC servomotors, is the bottleneck of the simulation

efficiency for machine tool system. Therefore, in this research, simulation optimization of this

process becomes the focus. The function of power transmission process is to realize the

actual three-phase voltages from DC bus voltage for AC servomotor’s stator windings as

reference values calculated by control loops. One current modeling method available that

takes the power transmission process into account is to simplify it as low-pass filters [5]. More

detailed modeling about the nonlinearity in power conversion is also conducted by several

researchers. P. Pillay et al modeled the torque pulsation introduced by PWM-current control in

[6]; J. Liang and K. Yamazaki proposed a more sophisticated model in [7], where major

parameters, such as PWM basic frequency, duty resolution and switching pattern etc are taken

all into account. In these cases, time domain simulation with this level of details requires that

model runs with time steps perhaps in nano-second level, which leads to extreme amount of

computation burden over CPU during VMT simulation, therefore it increases the simulation

time.

Aiming at prompting the simulation speed, a new event-driven simulation method is

2
proposed. This method effectively incorporates the event-driven concept into the original sole

time domain simulation. Then, specifically in macro sense, for every PWM switching period,

the proposed method is responsible for the switching action within a PWM switching period.

This result overcomes the drawbacks of intensive CPU time consumption on the switching

action in time domain simulation, and therefore dramatically reduces the simulation time.

The rest of this paper is organized as follows. Section 2 describes the time domain

simulation of power transmission. Section 3 presents the event-driven simulation method.

Section 4 shows a simulation experiment and comparison between two methods. The paper

concludes with section 5, and the appendix I reviews a typical power transmission of AC motor

driver in machine tool system for reference.

2. Time domain simulation

Time domain simulation can be used to observe the performance of power transmission

process described in appendix I. Figure 1. provides a detailed flowchart of a typical time

domain simulation. Step 1: initial conditions must be set and simulation time must be initialized.

Step 2: the next sample hit time must be set. Step 3: the outputs of this sample hit are

determined. Step 4: Calculate the values of state variables (continue and discrete). Difference

or differential equations might be solved for continuous or discrete systems respectively.

Those values become the initial conditions for the next sample hit, in which the process (step 2

- step 4) repeats until the maximum simulation time has been reached.

3
Initialization

Calculate next sample hit

Calculate output Simulator

Update continue states

Update discrete states

Fig. 1. Flowchart of a typical time domain simulation

Step 1:

Initialize the power transmission model by setting associated parameters, such as DC Bus

voltage, switching frequency, duty resolution, delay time, etc. and specifying modulation

method.

Step 2:

The time for next sample hit is determined. The fixed simulation steps are used. The value

is calculated by adding the fix sampling time (Duty period divided by duty resolution) to current

time and informed to simulator.

Step 3:

In this step, the output voltages of power transistor arrays are generated according to the

internal states, which are defined in table I.

4
TABLE I
INTERNAL STATES

Internal states Representation

X1 Current time
X2 Phase A rising edge time
X3 Phase A falling edge time
X4 Phase B rising edge time
X5 Phase B falling edge time
X6 Phase C rising edge time
X7 Phase C falling edge time

All the time values in this table are normalized to the range 0 – duty resolution (RES). For

instance, if the duty resolution is 7 bits, then, the value must be in the range 0 - 27.

Step 4:

Internal states used in step 3 for the next sample hit are actually calculated or updated in

step 4. It is calculated only at the sample hit that is the first one in a PWM duty period. Figure 2.

depicts how the states defined in table I are updated if SVPWM technique is used. X1 is the

state which keeps the information about current time in a duty period. Initially, it is set to be

duty resolution (RES) and decreased by one every time the simulation loop is executed.

Therefore, it can be regarded as a counter and used to judge if current sample hit is the first or

last one in a PWM duty period. If it is the first one, internal states, X2-X7, need to be calculated

according to (4) addressed in Section II; If it is the last one, all states are reset (X1 is reset to

RES); Otherwise, only the X1 decreased by 1 and keeps other states unchanged.

5
X1 Current time

N
Is a new cycles?

Y
Determine which sector the
voltage is located in

Calculate T1, T2 by (4)5

Calculate X2-X8 by considering


switching pattern

N
Cycle ends?

Reset States

Fig. 2. Internal states updating flowchart (time domain simulation)

For implementing above time domain simulation, the tasks fall into two categories:

modeling environment (including simulator and interaction mechanism) and model itself. The

modeling environment provides the control of simulation time and the differential equation

solver, although in the PWM generation case, it is not necessary. Interaction mechanism is the

way how simulator executes the models. For instance, the functions described in step1-step4

are implemented as model functions. During the simulation time, simulator will enter a

simulation loop, as shown in Fig. 1, where each pass through the loop is referred to as a

simulation step, or sample hit. During each sample hit, the simulator executes the model

functions in the order determined during initialization.

3. Event-driven simulation

In section 2, the simulator generates PWM waves though taking a much small sample

6
time than PWM duty period. The problem is that many times when the simulation loop is

invoked, the outputs don’t need to be changed. Therefore, simulation loop is heavily overdue.

Such a simulation method is time consuming and sometimes may not be so practical when it

comes to the simulation from VMT environment point of view. Thus it is of practical significance

if we can reduce the overdue simulation loops. In this section, instead of time domain

simulation, the idea of event-driven simulation is proposed to eliminate the unnecessary

executions of the simulation loop. Event-driven simulation means that the actions are taken

only when some pre-defined events happen. In our case, since the PWM waves only changes

at a few time instants, we may define them as transition events, and trigger the execution of

simulation loop only when those events occur.

In order to implement such a simulation mechanism, additional states, listed in table II,

need to be supplemented to original seven states. X8 is used to store the time value, which

informs simulator when the next event will occur. The meaning of states X9-X15 is depicted in

Fig. 3. They are actually the time interval between two transition points (two events). During

the simulation, in one PWM duty period, the simulator updates the value of X8 according to the

calculation of states X9-X15. Therefore, the simulator always knows what the next execution

time is. The flowchart of this process is described as Fig. 4.

TABLE II
ADDITIONAL INTERAL STATES FOR EVENT-BASED SIMULATION

States Representation

X8 Next sample hit time


X9- X15 Sampling Time intervals
X16 Switching vector

7
X9 X10 X11 X12 X13 X14 X15

A
X3 X6

B
X4 X7

C
X5 X8

Duty period (T)

Fig. 3. Internal states definition for event base simulation

At the beginning of the update process, X1 is used to check if a new duty cycle starts. If so,

the simulator calculates time values of the raising and trailing edges for each phase and stores

those time values in X2-X7. Since the events corresponding to the up/down switching actions

occur sequentially, these values then are sorted in an ascending order and the time intervals

are calculated by finding the time difference between two adjacent items after sorting. The

resulting time intervals are kept in X9-X15. They function as an event queue. Each element in

the queue stands for one event. Fig. 5 (a) describes the initial status in the queue after all

events are set at the beginning of one cycle, then the next thing needs to be done is to set the

value of X8 which will be used to calculated the absolute time of next sample hit. This value

informs simulator to execute the simulation loop at the calculated value. The value is picked up

from head of the event queue. Once an event is set, it will be cleared from the queue and all

rest events move forward by one step. Fig. 5 (b) shows the status in the queue after E1 has

been picked up and set into X1.

8
X1 Current time

N
Is a new cycles?

Y
Set X2 – X8

Sort X2-X8 in ascending order

Store time intervals in X9 – X15

Set event trigger through queue


operation

Synthesize switching vector

Pick up next sample time from


the queue and set event trigger
X1

Remove one element from the


queue
N
Cycle ends?

Reset States

Fig. 4. Internal states updating flowchart (event base simulation)

Afterwards the simulator is in idle status and waits for the next sample hit. When the given

time specified in X8 elapses, simulation loop is invoked again. This time the other branch in Fig.

4 is executed. The switching vector, an indicator passing to the output process to generate the

pulse sequences accordingly, is synthesized. The value is written in X16. And again the time

for the occurrence of next event should be removed from the queue and its value is set in X8.

If the sign of cycle end is encountered, the states X1-X16 are reset for the execution of

next duty cycle. The end of one cycle can be determined by the value obtained from the event

9
queue. The value specified for the last event is RES, which stands for the value of PWM duty

resolution. Fig. 5 (c) shows an empty event queue at the end of one duty cycle.

E1 E2 E3 E4 E5 E6 RES

X9 X10 X11 X12 X13 X14 X15


(a)

E2 E3 E4 E5 E6 RES

X9 X10 X11 X12 X13 X14 X15


(b)

RES

X9 X10 X11 X12 X13 X14 X15


(c)
: No event in queue

Fig. 5. Event Queue Operation: (a) full queue; (b) queue with one event occurred; (c) empty
queue

4. Simulation verification

4.1 PMSM torque control model

The effectiveness of proposed simulation method is verified through a PMSM torque

control model, as shown in Fig.6. PMSM is a kind of AC servo motor that has permanent

magnet rotor; it is widely used in CNC machine tool due to constant electronic torque it

provides.

The model is built with MATLAB/SIMULINK and associated toolboxes. The PMSM driver

model is built as a SIMULINK block with 3-phase AC voltage inputs. Three-phase power

converter model is taken from SimPowerSystem toolbox. It consists of six power transistors,

whose ON/OFF status is controlled by the outputs of PWM generation model. Different PWM

generation schemes are modeled by using the S function mechanism [10] in SIMULINK

environment.

10
Vdc PMSM Model

U U’ V V’ W W’ ia ib ic

PWM Generation 
Model
iq
Current controller d-q
id transformation
Model

iq’ id’ = 0

Fig. 6. PMSM torque control model

In order to control the electronic torque generated from PMSM, vector control is applied in

current controller model. iu and iv are measured from the PMSM model and projected into

currents in the rotating frame (id and iq ). The (d, q) projection of the stator currents are then

compared to the reference values (iq’) and (iq’=0) and corrected by means of PI current

controller. The outputs of current controllers are passed as inputs to power transmission model,

in which the simulation schemes described in section 3 and 4 are implemented.

4.2 Simulation results and discussions

iq  sin(20 t )
The reference q axis current is and reference d axis current is 0. DC bus

voltage is set to be 220 v and PWM switching frequency and duty resolution are 20 KHZ and 6

bits respectively. PMSM parameters are set according to FANUC α12/3000i servo motor

specification given in Appendix II. Two simulation methods are compared (Current loop gains

are tuned based on motor specification and keeps same values in both cases).

11
(a) (b)
Fig. 7. Controlled d-q axis currents for PMSM motor model, (a) time domain simulation, (b)
event-driven simulation

The actual d-q axis currents measured under two simulation methods are shown in Fig. 7

(a) and (b) respectively. In both cases, the q-axis currents curve exhibit similar current ripple

level, while the d-axis currents are nearly keeping zero. These results substantiate that the use

of event-driven simulation method preserves the simulation accuracy that was achieved

through time domain simulation.

Time Domain Event-driven

120
CPU time consumption (s)

100

80

60

40

20

0
6 bits 7 bits

Fig. 8. Comparison of CPU time consumption under two simulation approaches (6bits/7 bits
stands for PWM duty resolution)

To test the efficiency, the CPU time consumptions were also measured for both cases. As

12
shown in Fig. 8, simulation in 0.1s cost 46.374s CPU time when time domain method was

used. It reduced to 5.671s if event-driven method was applied. And also, as previously stated,

the CPU time consumption rose significantly as the duty resolution increased. If the duty

resolution is 7 bit, it can be clearly seen from Fig.8 that the CPU time consumption almost

doubled for time domain method, while the time consumption value kept almost unchanged

when the event-driven method was used. All these results illustrate the effectiveness of the

proposed event-driven simulation method. In addition, since quite common problems exist in

the other subsystem of VMT, the proposed method is highly possible to be applied.

5. Conclusion

Virtual machine tool system can enhance machine tool system design dramatically.

However, its simulation speed is always a puzzle because of the low simulation efficiency on

the power transmission process of motor driver. In this paper, this process was studied.

Instead of the conventional time domain simulation method, the event-driven simulation

method was applied to reduce the overdue simulation loops. Compared to the time domain

simulation, the event-driven simulation triggers the execution of simulation loop only when a

set of pre-defined event occurs. As a result, the unnecessary executed simulation loops are

reduced intensely. This new method was verified through simulations of torque control PMSM

driver model. It turned out that the execution time of simulation was significantly reduced via

the new method while the accuracy was preserved. Such an improvement is very meaningful

to the simulation study of servo/mechanical interaction for multi-axes CNC machine tools,

which have several PMSM drives involved.

13
APPENDIX I
Power Transmission of AC Motor Driver

Overview

Since normal line frequency and voltage to motor windings are fixed, the motor drivers are

based on the fact that variable-frequency and variable-amplitude AC waveforms can be

generated. Although there are different types of AC motor drivers, the most common driver

utilize a converter-inverter structure as shown in Fig.9.

AC to DC DC to AC
Converter Inverter

DC Bus Power Transistor Array AC Motor


AC

C
AC

Control
PWM Control Unit
Signal

Fig. 9. Three-phase AC servomotor driver (converter-inverter)

The variable-frequency & variable-amplitude AC voltage is created by the inverter from

the DC bus voltage that is developed by the converter from the fixed AC line voltage. The

primary component in power transmission is the inverter. A typical voltage-source inverter is

comprised of a large capacitor, a power transistor array and corresponding control unit.

The power transistor array consists of three half H-bridge transistor circuit, which are used

to switch the high voltage DC bus and drive current into and out of each phase of the motor.

These H-bridges are controlled by a modulation algorithm executed by the control unit.

Voltage Modulation

14
Pulse-Width-Modulation (PWM) techniques are the standard for AC waveform creation.

Each phase of the AC servomotor requires two PWM signals, one for the top switch and the

other for the bottom switch. Two signals, as seen in Fig.10, are derived from the same PWM

where one is the reverse of the other with the inclusion of dead time, which are a short period

of time to avoid the occurrence of short current due to the fact that the top and bottom switches

conduct at the same time.

Delay time Vdc

PWM Top Gate


Gen. PWM Drive

Dead Bottom Gate


Time PWM Drive

Common
Fig. 10. PWM control unit

The essential point of control of the PWM signals for AC motor control is to constantly

update duty cycle in order to create AC waves for motor phases [9]. The method by which the

duty cycles are updated is called modulation technique.

Space Vector PWM

Space Vector Pulse Width Modulation (SVPWM) is one of the most popular modulation

techniques. It is reviewed in this section, since in the following section we will use it to explain

the proposed simulation method.

SVPWM treats the inverter as a single unit driven by eight basic states. Those basis

states are determined by the switching statuses of the power transistors. In Fig.11, S1 through

S6 are the six power transistors that determine the output. U, V, W and U’, V’, W’ control the

15
status of the transistors. When an upper transistor is switched on (when U, V, or W is 1), the

corresponding lower transistor is switched off (when U’, V’ or W’ is 0). Therefore the states of U,

V and W are sufficient to represent switching status. The switching variable vector [u, v, w] t is

used as the basic driven state. The eight basic states previously are listed in table III.

S1 S3 S5
U
U Vdc W
Vu
Vdc C Vv
Vw
S2 S4 S6
U' Vu W'

Fig. 11. Voltage source inverter

TABLE III
BASIC SPACE VECTORS

Vectors U V W

Vo (Null) 0 0 0
V1 0 0 1
V2 0 1 0
V3 0 1 1
V4 1 0 0
V5 1 0 1
V6 1 1 0
V7 (Null) 1 1 1

How to utilize SVPWM to determine the switching sequences of the upper three

transistors of the voltage source inverter will be explained as follows. In the voltage vector

space diagram, as shown in Fig. 12, two null vectors map to the origin while the other six

vectors equally distributed in one circle and with 60 degree between each other. The idea of

Vout
SVPWM is to approximate the reference voltage instantaneously by combination of the

two adjacent vectors and a null vector.

16
β -axis
(  1/ 3,1/ 3 ) ( 1/ 3,1/ 3 )

S1
V2 (110)
V3 (010) S0
S2 Vout

V0 (111)
(-2/3, 0) V4 (011) Δθ V1(100)
V7 (000)
(2/3, 0)
α -axis
S3 S5
V5 (001) V6 (101)

S4

(  1/ 3,1/ 3 ) ( 1/ 3,1/ 3 )

Fig. 12. Space vector distribution diagram for SVPWM

For a small time period, the average inverter voltage output is same as the average

Vout T1 T2
voltage as shown in (1). Note, and are respective duration times for which

Vx Vx  60 Vx Vx  60
switching states corresponding to and are applied. and are the basic

Vout
vectors which forms a sector containing voltage vector .

( n 1)T
1 1
T v
nT
out (t ) 
T
(T1v x  T2 v x  60 ) (1)

If it is assumed that Vout almost doesn’t change within the small time period T , then (1)

can be rewritten as:

1
vout (nT )  (T1v x  T2 v x 60 ), T1  T2  T (2)
T
In practice, the approximation is done in every PWM period, (1)-(2) means that for every

Vout Vx
PWM period can be approximated by letting the inverter in switching states and

Vx  60 T1 T2 T1 T2
for and duration of time respectively. Since the sum of and is less than

Tpwm V0 V7
, the inverter should be in (000) or (111) state for the rest time of one PWM period.

(4) describes the relationship between those time durations.

T pwmvout  T1v x  T2 v x60  T0 * 0 (3)

17
T pwm  T1  T2  T0 (4)

If given the reference voltage


Vout
,
T1
and
T2
are calculated by (5), where
v x Vx  60 
1

is the normalized decomposition matrix for that sector.

T1 T2   T pwm vx


T
v x60  vout
-1
(5)

APPENDIX II
FANUC α12/3000i AC Servo Motor Specification
Pole pairs (P) 4
Self inductance (Ls) 1 mH
Mutual inductance (Lm) 0.9 mH
Stator resistance (R s) 0.16 Ohms
Flux linkage due to PM (m) 0.069V-s-rad-1
Motor inertia (J) 6.2e-3 kg-m2
Viscous coefficient (Bm) 1.5e-5 Nm-s-rad-1
Torque constant (Km) 0.66NM/Amp DC
Back EMF 7.21Volts/KRPM
DC Voltage (V) 220 Volts

REFERENCES
[1] G. Reinhart, M. Weissenberger, “Multibody simulation of machine tools as mechatronic
systems for optimization of motion dynamics in the design process,” in Proc IEEE/ASME
Conf on Advanced Intelligent Mechatronics, Atlanta, USA, 1994, pp605-610.
[2] G. Pelz, Mechatronic Systems – Modelling and Simulation with HDLs, 2003, John Wiley &
Sons Ltd.
[3] P.N. Patrick, “The virtual machine tool system – an integrating framework for machining
system design and control”, 2002, Proc NSF Design and Manufacturing Grantees Conf.
[4] Bimal K.Bose, Power Electronics and Variable Frequency Drives, pp403-405, 1996, IEEE
Press.
[5] G. Ellis, Control System Design Guide, 2000, Academic Press.
[6] P. Pillay and R. Krishnan, “Modeling, simulation, and analysis of permanent-magnet motor
drives, Part II: the permanent-magent synchronous motor drive,” IEEE Transactions on
Industry Application, 1989, Vol. 25, No. 2.
[7] J. Liang, “The development of logical models for CNC machine tool motion control system
and its application to virtual machine tool design, ” University of California, Davis, Ph.D
dissertation 2005.
[8] MatLab, The Language of Technical Computing, ver.6, 2000, The Math Works Inc.
[9] R. Valentine, Motor Control Electronics Handbook, 1998, McGraw-Hill.

18

View publication stats

You might also like