• Non ci sono risultati.

Modelling, simulation and design of a power drive controller using dSPACE Hardware-in-the-Loop environment.

N/A
N/A
Protected

Academic year: 2021

Condividi "Modelling, simulation and design of a power drive controller using dSPACE Hardware-in-the-Loop environment."

Copied!
124
0
0

Testo completo

(1)

Scuola di Ingegneria

Dipartimento di Ingegneria dell’Informazione

Corso di Laurea Magistrale in

Ingegneria Robotica e dell’Automazione

MODELLING, SIMULATION AND DESIGN OF A

POWER DRIVE CONTROLLER USING dSPACE

HARDWARE-IN-THE-LOOP ENVIRONMENT

SUPERVISOR

Prof. Sergio Saponara

CANDIDATE

Giordano Baldeschi

CO-SUPERVISORS

Prof. Lucian Mihet-Popa

Prof. Andrea Caiti

(2)

1

Index

1. Introduction 2

1.1. Justification of the subjects 2

1.2. Objectives of thesis 2

1.3. Description of contents 3

2. Research Review 4

2.1. Structure of the electric drive 4

2.2. Electric machine 5

2.3. DC motor 7

2.4. Brushless motor 13

2.4.1. Space vector and reference frame 22

2.4.2. Inverter 25 2.4.3. SVPWM 26 2.4.4. Hall sensors 30 2.5. Motor control 31 2.5.1. DC controls 31 2.5.2. Brushless controls 34

3. Modelling and simulation of electrical machines 39

3.1. Matlab-Simulink 39

3.2. Development and implementation of the models 43

3.3. Simulation results 46

4. Interface and communication 60

4.1. Describe the setup components 60

4.2. Communication 63

4.3. Complete simulation model 64

4.4. Datasheet 65

5. Experimental setup and hardware implementation 73

5.1. Testing methods 73

5.2. Setup 75

5.3. RTI and communication 81

5.4. Experimental results 84

5.4.1. Model-in-the-Loop 84

5.4.2. Software-in-the-Loop 92

5.4.3. Processor-in-the-Loop 98

5.4.4. Hardware-in-the-Loop 112

6. Conclusions and contributions 116

References 118

(3)

2

1. Introduction

1.1. Justification of the subject

The creation, development, simulation and the real-time implementation of real physical system has destination in many different fields and has led a success of techniques such as hardware-in-the-loop.

In the relation, the control of the electric machines is addressed in the simulative and practical part, so in the software and hardware aspect.

These controls are initially focused on a direct current motor and subsequently on a brushless motor. These approaches are given by the simplicity of the mathematical model of the direct current motor, the development of the controls is faced with increasing difficulty.

1.2. Objectives of the thesis

The proposed thesis has been focused on modelling, simulation and design of power drive controllers, for DC and Brushless motors, using methodologies from MIL (Model in the Loop) to SIL (SW in the Loop), PIL (Processor in the Loop) and finally HIL

Hardware in the Loop). The objectives are reached step by step, in a logical chain that starts from the theory to the physical system, including study and modelling of

electrical motors, modelling and design of different control strategies, simulations of electric drives and real-time-interface with a control processor, hardware emulation on a prototyping board (although with a low-power scaled version of the brushless motor vs. the full capability of the power drive).

The objectives are reached step by step, in a logical chain that starts from the theory to the physical system.

Specifically, the real work of the thesis can be summarize in the following diagram.

(4)

3

1.3. Description of the contents

Cap.1

Justifications, objectives and contents of the thesis.

Cap.2

The electric drive is descripted in all its components with the description of its controls, both for the direct current motor and brushless motor. Schematically inside of this chapter there is a general classification of the electric machines with block diagrams of the single structure and the working areas. There is a theoretical part of the DC machine with all formulas that describe the behavior and the mechanical characteristics. The advantages, characteristics, formulas, reference frames, electronic drives as inverter, hall sensors are descripted here. The main part of this chapter consists of the control types for DC motor and brushless motor.

Cap.3

In this chapter Matlab and Simulink software are used for the simulations of the systems. The all Simulink models are shown in this chapter: DC motor and brushless motor, observer, frame converters, inverter and space vector modulation. The simulations is faced in every different cases for motors and controls with graphs and explanations of the methods of approach. Precisely, the direct current motor is controlled in three different ways: current control with PI controller, speed control with PI and PID controller. The brushless motor is controlled in speed with a PI controller.

Cap.4

There is a hardware and software description for the implementation of the systems, with connection details between all units. The hardware part is composed by J-link debugger, MEDKit board, dSpace MicroLabBox and host PC. The software part is composed by Keil µVision5, ControlDesk and Simulink.

Cap.5

The setup and the execution of the devices are reported step by step in the experiments with the results obtained. Here, the definition for Model-in-the-Loop, Software-in-the-Loop, Processor-in-the-Loop and Hardware-in-the-Loop are defined. The installations of the software are described together to the Windows setup for the Ethernet connection to dSPACE MicroLabBox. ControlDesk software is set in order to communicate with MicroLabBox. There is a description of how to create a C code to implement on the MEDKit microcontroller of the board and the C code for ControlDesk. The graphs and the C code of the Processor-in-the-Loop simulation are reported, the same for Hardware-in-the-Loop simulations.

Cap.6

At the end, the conclusions and contributions. Therefore the opinion concerning the thesis results and the future developments for that kind of the experiments.

(5)

4

2. Research review

In this chapter, it summarize the components of any electric drive.

Here it is possible to understand which problems are faced and what is necessary to do for design the components.

2.1. Structure of the electric drive

Exist an electric drive when we set the output mechanical variable (torque, speed or angular position).

The electric drives are systems that through an actuator (motor) transform the electrical energy in mechanical energy, the use of electronic power equipment (converter) to modularize the electrical energy in according to command function (torque control, speed control, position control).

Architecture:

Fig.2.1.1: Structure of electric drive

The actuator converts electrical energy in mechanical energy and it acts on the system through the mechanical transmission.

The electrical converter receives the commands from the control system and it supplies electric energy to electric motor which controls voltage and/or current to obtain torque, speed or position desired.

The measurement system is the set of sensors through which the control unit obtains the states of system variables.

The control unit represents the local intelligence which relies on the electromechanical measurements and the commands through interface with the outside world and it is able to elaborate the commands to modulate the electrical energy.

(6)

5 Electric driver’s advantages:

 Available in a power interval between 10−6 [𝑊] and 108 [𝑊] .

 Large interval of torque delivered ( > 107 [𝑁𝑚] ) and speed ( > 105 [𝑟𝑝𝑚] ).

 Work in critical conditions.  Low noise emitted.

 High efficiency (energy recovery).

 Low consumption when they work without load.  Easy to control.

 Increase of the global efficiency of the system.

 Reduction of the business costs, with recovery of the most investment costs.  Limitation of the torque in every conditions.

 Improvement of the dynamic performances.  Opportunity for a targeted project.

Applications:  Motor vehicles ( 20 − 40 [𝑘𝑊] ).  Materials manipulation ( 5 − 100 [𝑘𝑊] ).  Fluid handling ( 2 − 20 − 1000 − 𝑜𝑣𝑒𝑟 [𝑘𝑊] ).  Machine tools ( 3 − 200 [𝑘𝑊] ).  Iron metallurgy ( 300 − 10000 [𝑘𝑊] ).  Operating machines ( 5 − 200 [𝑘𝑊] ).  Servomechanisms ( 0.5 − 100 [𝑘𝑊] ). 2.2. Electric machine

The electric machine converts a kind of energy in another, where one of this is an electrical energy or a change of the type of electric energy.

The electric machines are divided in two groups: static machines and rotor machines. The first ones not have parts in movement, they vary the current or alternating voltage maintaining the power in output, the transformer is an example.

The second ones have a part which rotates around an axis, there are three main groups: synchronous, which works in sinusoidal regime; asynchronous, which works always in sinusoidal regime but with a rotation speed dependent of the magnetic field inside the machine and variables with the load; direct current, which works in stationary regime, because the electric energy is provided or generated in direct current.

(7)

6 The scheme shows the main classification of the electric machines:

Fig.2.2.1: Classification of electric drives

Below is represented a block diagram of an electric machine:

Fig.2.2.2: Block diagram of an electric machine

Fuelling the machine with a power supply, the currents are generated, which produce rotor and stator magnetic fields, this fields develop an electromagnetic torque, which generates a rotor axis rotation.

From the torque is obtained the speed that integrated returns the position:

𝑇𝑚− 𝑇𝑟= 𝐽 𝜔𝑚 → 𝜔𝑚= ∫ 𝑇𝑚(𝜏) − 𝑇𝑟(𝜏) 𝐽 𝑡 −∞ 𝑑𝜏 𝜃̇𝑚 = 𝜔𝑚 → 𝜃𝑚 = ∫ 𝜔𝑚(𝜏) 𝑡 −∞ 𝑑𝜏

The working area is identified in the four quadrants of the 𝑇𝑚- Ω𝑚 characteristic.

Conventionally, it is chosen a positive direction for the speed Ω𝑚, the 𝑇𝑚 sign is

(8)

7 𝑃𝑚 > 0 . The electric machine behaves as a generator when the torque has an opposite sign compared to the speed and then the mechanical power is 𝑃𝑚 < 0 .

Fig.2.2.3: Working quadrants

2.3. DC motor

It is composed from a stator and a rotor; in the first one there is an excitation circuit; in the second one there is a close armor coil placed on the surface.

In one of the head of the rotor is present a collector consisting of a series of isolated lamellae connected to an armor coil with conductors, called flags.

There are two brushes which rub on the lamellae, these brushes set on a diameter, called brush’s axis.

(9)

8

Electro-mechanical characteristics and equations

Operation of the direct current machine like a motor: a direct voltage 𝑉 is applied at the ends of brushes then a current 𝐼 starts to flow in the close armature circuit.

A space distribution of the current is due to the presence of the collector.

Fig.2.3.2: A schematic DC motor

Therefore a magnetic field is born and subsequently an armature flux 𝜙𝑎.

From the interaction between two fluxes 𝜙𝑎 and 𝜙𝑒𝑐𝑐 an electromagnetic torque 𝑇𝑚 is

generated and the rotor starts to rotate in anticlockwise. 𝑇𝑚 = 𝜙𝑎 𝜙𝑒𝑐𝑐sin(𝜙𝑎 𝜙𝑒𝑐𝑐) = 𝜙𝑎 𝜙𝑒𝑐𝑐

The crankshaft rotates in according with the dynamic law:

𝑇𝑚− 𝑇𝑟= 𝐽 𝑑𝜔 𝑑𝑡

This rotation produces in the stator winding an 𝑒𝑚𝑓 voltage. Model of DC Motor: 𝑉𝑎(𝑡) = 𝐿 𝑑𝑖𝑎(𝑡) 𝑑𝑡 + 𝑅𝑖𝑎(𝑡) + 𝑒𝑚𝑓(𝑡) 𝐽𝑑𝜔(𝑡) 𝑑𝑡 = 𝑇𝑚(𝑡) − 𝑇𝑟(𝑡) 𝑒𝑚𝑓(𝑡) = 𝐾𝑒𝜙𝑒𝑐𝑐𝜔(𝑡) 𝑇𝑚(𝑡) = 𝐾𝑡𝜙𝑒𝑐𝑐𝑖𝑎(𝑡)

(10)

9 L-transformed: 𝑉𝑎(𝑠) = 𝐿𝑠𝐼𝑎(𝑠) + 𝑅𝐼𝑎(𝑠) + 𝑒𝑚𝑓(𝑠) 𝐽𝑠Ω(𝑠) = 𝑇𝑚(𝑠) − 𝑇𝑟(𝑠) 𝑒𝑚𝑓(𝑠) = 𝐾𝑒𝜙𝑒𝑐𝑐Ω(𝑠) 𝑇𝑚(𝑠) = 𝐾𝑡𝜙𝑒𝑐𝑐𝐼𝑎(𝑠) From the first equation it is obtained:

𝐼𝑎(𝑠) = 1

𝑅 + 𝐿𝑠 [𝑉𝑎(𝑠) − 𝑒𝑚𝑓(𝑠)] From the second equation it is got:

Ω(𝑠) = 1

𝐽𝑠 [𝑇𝑚(𝑠) − 𝐶𝑟(𝑠)] The dynamic system is:

(11)

10 Assuming 𝑇𝑟 = 0 , we want calculate the transfer function from 𝑉𝑎 to 𝜔, the block

diagram becomes:

Fig.2.3.4: Block diagram of a DC motor without 𝑇𝑟

It is got:

𝐺(𝑠) = Ω(𝑠) 𝑉𝑎(𝑠) =

𝐾𝑡𝜙𝑒𝑐𝑐

𝐽𝑠(𝑅 + 𝐿𝑠) + 𝐾𝑒𝐾𝑡𝜙𝑒𝑐𝑐2

A second order system, with a small pole associate to the electric dynamic and one pole more bigly associate to the mechanical dynamic.

Mechanical characteristics

The mechanical characteristic represent the Torque-Speed curve, it’s studied in steady-state condition. 𝑉𝑎(𝑠) = 𝑅𝐼𝑎(𝑠) + 𝑒𝑚𝑓(𝑠) 𝑒𝑚𝑓(𝑠) = 𝐾𝑒𝜙𝑒𝑐𝑐Ω(𝑠) 𝑇𝑚(𝑠) = 𝐾𝑡𝜙𝑒𝑐𝑐𝐼𝑎(𝑠) 𝑇𝑚 = 𝐾𝑡𝜙𝑒𝑐𝑐𝐼𝑎(𝑠) = 𝐾𝑡𝜙𝑒𝑐𝑐𝑉𝑎 𝑅 − 𝐾𝑡𝐾𝑒𝜙𝑒𝑐𝑐2 𝑅 Ω

(12)

11 The characteristic is linear with the speed.

Fig.2.3.5: 𝑇𝑚− Ω characteristic

The steady-state speed is in the intersection between the driving torque characteristic and resistance torque.

Fig.2.3.6: 𝑇𝑚− Ω characteristic with the mechanical and load torque

𝑇𝑚 Ω 𝐾𝑡𝜙𝑒𝑐𝑐𝑉𝑎 𝑅 𝑉𝑎 𝐾𝑒𝜙𝑒𝑐𝑐 𝑇𝑚 Ω 𝐾𝑡𝜙𝑒𝑐𝑐𝑉𝑎 𝑅 𝑉𝑎 𝐾𝑒𝜙𝑒𝑐𝑐 𝑇𝑚𝑎𝑥 𝑇𝑟

(13)

12 It is possible to modify the mechanical characteristic changing the voltage supply.

Fig.2.3.7: 𝑇𝑚− Ω characteristic with different 𝑉𝑎

Therefore it is possible to extend the characteristic to all quadrants and the total work area is obtained.

Fig.2.3.8: Four quadrants 𝑇𝑚− Ω characteristic

𝑇𝑚 Ω 𝐾𝑡𝜙𝑒𝑐𝑐𝑉𝑎(𝑡) 𝑅 𝑉𝑎(𝑡) 𝐾𝑒𝜙𝑒𝑐𝑐 𝑇𝑚𝑎𝑥 𝑇𝑟 𝑉𝑎 Ω 𝑇𝑚 𝑇𝑚𝑎𝑥 Ω𝑛𝑜𝑚 Ω𝑚𝑎𝑥 Regime Area Transient Area

(14)

13

2.4. Brushless motor

BLDC motor is used in industries such as Appliances, Automotive, Aerospace, Consumer, Medical, Industrial Automation Equipment and Instrumentation.

As the name implies, BLDC motor do not use brushes for commutation; instead, they are electronically commutated.

BLDC motor has many advantages over brushed DC motor and induction motor. The advantages are:

 Lower maintenance and null environmental limitations  Higher power density therefore lower weights and volumes  Possibility to supply torque with null speed

 Better torque/power rate therefore better dynamic performance  Greater stability

 Possibility to work with speed, torque and power supply higher  Max torque until max speed

 Null rotor losses therefore more efficiency

 Without brushes the motor has a long life, less noisy operation and no dust in the environment

At constant load: applications like compressors, pumps and fans; the change of speed is more important than accuracy, the motor requires a low cost controller in open loop and the load is directly connected with engine shaft.

At variable load: automotive, domestic, aerospace applications; the system requires good dynamic response and feedback device for speed, therefore it needs an advanced control algorithm and complex controller, so higher cost for the system.

Of positioning: a lot of industrial automatic applications, it’s required a frequently inversion of the speed direction, they are important the speed and torque dynamic response.

The motor load can change during the acceleration, constant speed, deceleration and positioning, resulting in an increase complexity of the controller.

This system contains a closed loop with one or more control loop (torque, speed, position).

The brushless is a motor with a stator similar to asynchronous motor, inside there is a three phase coil.

This motor can be classified like a synchronous machine since the magnetic field speed coincides with that mechanical of the rotor.

The manufacture is more complex than the asynchronous motor and therefore is more expensive for the presence of the magnets.

(15)

14 Schematically a brushless machine is shown below.

Fig.2.4.1: Exploded picture of all parts of a BLDC

According with the 𝑒𝑚𝑓 induced in the stator coils the brushless with radial flux can be classified in:

 Trapezoidal

 Sinusoidal (PMSM)

(16)

15 Furthermore, in according of magnets arrangement:

 Superficial magnets (SPM)  Internal magnets (IPM)

Fig.2.4.3: Kind of magnets arrangement

In according of field direction produced from magnets:  Radial flux

 Axial flux

Fig.2.4.4: Kind of flux

In according of the windings arrangement:  Distributed windings  Concentrated windings Radial Flux Axial Flux

(17)

16

Electro-mechanical characteristic and equations

A brushless motor is composed from a rotor with permanent magnets and a stator, in this case, with three phases.

Feeding the phases with three different current properly out of phase, in every winding an alternative magnetic field is produced.

The result of these three fields is a one field constant in amplitude, rotating with an angular speed:

𝜔 = 2𝜋𝑓 𝑝 This is the situation:

Fig.2.4.5: Representation of the magnetic fields

Estimating or measuring the rotor position (therefore the 𝜙𝑅) it is possible by adjusting

the current in the stator windings, make the two fields orthogonal and control the torque, the general case has the formula below:

𝑇𝑚 = 𝑘|𝜙𝑅||𝜙𝑆|sin(𝜃)

𝜙𝑆

𝜙𝑅

(18)

17 The architecture of a brushless drive is the same of any others electric drive, indeed the functional scheme is shown below:

Fig.2.4.6: Schematic representation of a brushless electric drive

The dynamic equations has the following form:

𝑣𝑗𝑁 = 𝑅𝑖𝑖𝑗+ 𝑑𝜙𝑗 𝑑𝑡

The 𝑣𝑗𝑁 is the voltage of the 𝑗-𝑡ℎ phase, from the power supply node to neutral node,

𝑖𝑗 is the current of the 𝑗-𝑡ℎ phase, 𝑅𝑗 is the resistance of the 𝑗-𝑡ℎ phase and 𝜙𝑗 is the

resistance of the 𝑗-𝑡ℎ phase.

In the brushless motor we have only the equations related on the stator windings, while the information on the presence of the superficial magnets is contained in the flux expression.

The three equations of electrodynamic equilibrium for the three phases in the machine axis are: 𝑣𝑎𝑁= 𝑅𝑖𝑎+ 𝑑𝜙𝑎 𝑑𝑡 𝑣𝑏𝑁 = 𝑅𝑖𝑏+𝑑𝜙𝑏 𝑑𝑡 𝑣𝑐𝑁 = 𝑅𝑖𝑐 + 𝑑𝜙𝑐 𝑑𝑡

(19)

18 And the flux equations are:

𝜙𝑎 = 𝜙𝑝𝑚𝑎 + 𝜙𝐴𝑎+ 𝜙𝑀𝑎 𝜙𝑏 = 𝜙𝑝𝑚𝑏+ 𝜙𝐴𝑏+ 𝜙𝑀𝑏

𝜙𝑐 = 𝜙𝑝𝑚𝑐+ 𝜙𝐴𝑐+ 𝜙𝑀𝑐

Where:

𝜙𝑝𝑚𝑗 : concatenated flux generated from magnets concatenated with 𝑗-𝑡ℎ phase. 𝜙𝐴𝑗 : auto-induction flux generated with 𝑗-𝑡ℎ phase generated from current 𝑖𝑗 .

𝜙𝑀𝑗 : mutual-induction flux for 𝑗-𝑡ℎ phase.

Follow, it is reported the final formulas derived from the theory. For the concatenated fluxes:

𝜙𝑝𝑚𝑎 = 𝑘𝜙cos (𝛳) 𝜙𝑝𝑚𝑏 = 𝑘𝜙cos (𝛳 − 2 3𝜋) 𝜙𝑝𝑚𝑏 = 𝑘𝜙cos (𝛳 − 4 3𝜋) For the auto-induction fluxes:

𝜙𝐴𝑎 = 𝑟𝑙 𝑁2 3 𝑖𝑎 𝑡𝑎𝑔+ 𝑠𝑝𝑚2𝜋 𝜙𝐴𝑏 = 𝑟𝑙𝑁 2 3 𝑖𝑏 𝑡𝑎𝑔+ 𝑠𝑝𝑚2𝜋 𝜙𝐴𝑐 = 𝑟𝑙𝑁 2 3 𝑖𝑐 𝑡𝑎𝑔 + 𝑠𝑝𝑚2𝜋

Where 𝑡𝑎𝑔 is the measurement of the air (gap) and 𝑠𝑝𝑚 is the thickness of permanent

(20)

19 𝜙𝑀𝑎 = −𝑟𝑙𝑁 2 3 𝑖𝑏+ 𝑖𝑐 𝑡𝑎𝑔 + 𝑠𝑝𝑚𝜋 𝜙𝑀𝑏 = −𝑟𝑙 𝑁2 3 𝑖𝑎+ 𝑖𝑐 𝑡𝑎𝑔 + 𝑠𝑝𝑚𝜋 𝜙𝑀𝑐 = −𝑟𝑙𝑁 2 3 𝑖𝑎+ 𝑖𝑏 𝑡𝑎𝑔+ 𝑠𝑝𝑚𝜋

With assumption of linear magnetization, this means that the permanent magnets material works in linear area and then it is possible to consider the flux proportional to the current which generated it with an appropriate coefficient.

𝜙𝐴𝑗 = 𝐿𝑗𝑖𝑗

𝜙𝑀𝑗 = 𝑀𝑗ℎ𝑖𝑗 + 𝑀𝑗𝑘𝑖𝑘 , where ℎ, 𝑘 ≠ 𝑗

Therefore for visual inspection it is possible to define the coefficients of auto-induction and mutual-induction: 𝐿𝑎 = 𝐿𝑏 = 𝐿𝑐 = 𝐿 = 𝑟𝑙𝑁 2 3 2𝜋 𝑡𝑔+ 𝑠𝑝𝑚 𝑀𝑎𝑏 = 𝑀𝑎𝑐 = 𝑀𝑏𝑐 = 𝑀 = −𝑟𝑙𝑁 2 3 𝜋 𝑡𝑔+ 𝑠𝑝𝑚 = − 𝐿 2 Now it is possible to rewrite the congruent equations for fluxes:

𝜙𝑎 = 𝜙𝑝𝑚𝑎+ 𝐿𝑖𝑎+ 𝑀(𝑖𝑏+ 𝑖𝑐) 𝜙𝑏= 𝜙𝑝𝑚𝑏+ 𝐿𝑖𝑏+ 𝑀(𝑖𝑎+ 𝑖𝑐) 𝜙𝑐 = 𝜙𝑝𝑚𝑐+ 𝐿𝑖𝑐 + 𝑀(𝑖𝑎+ 𝑖𝑏)

(21)

20 Furthermore, using the currents 𝑖𝑎+ 𝑖𝑏+ 𝑖𝑐 = 0 it is possible to simplify in:

𝜙𝑎 = 𝜙𝑝𝑚𝑎+ (𝐿 − 𝑀)𝑖𝑎 = 𝜙𝑝𝑚𝑎+ 𝐿𝑒𝑞𝑖𝑎 𝜙𝑏 = 𝜙𝑝𝑚𝑏+ (𝐿 − 𝑀)𝑖𝑏 = 𝜙𝑝𝑚𝑏+ 𝐿𝑒𝑞𝑖𝑏

𝜙𝑐 = 𝜙𝑝𝑚𝑐+ (𝐿 − 𝑀)𝑖𝑐 = 𝜙𝑝𝑚𝑐+ 𝐿𝑒𝑞𝑖𝑐

Where 𝐿𝑒𝑞 is the equivalent inductance.

The electrical equilibrium equations of the machine are:

𝑣𝑎 = 𝑅𝑖𝑎+ 𝐿𝑒𝑞𝑑𝑖𝑎 𝑑𝑡 + 𝑑𝜙𝑝𝑚𝑎 𝑑𝑡 𝑣𝑏= 𝑅𝑖𝑏+ 𝐿𝑒𝑞𝑑𝑖𝑏 𝑑𝑡 + 𝑑𝜙𝑝𝑚𝑏 𝑑𝑡 𝑣𝑐 = 𝑅𝑖𝑐 + 𝐿𝑒𝑞 𝑑𝑖𝑐 𝑑𝑡 + 𝑑𝜙𝑝𝑚𝑐 𝑑𝑡 The equations related to rotor are:

𝑣𝑑 = 𝑅𝑖𝑑+ 𝐿𝑑 𝑑𝑖𝑑 𝑑𝑡 − 𝜔𝐿𝑞𝐼𝑞 𝑣𝑞 = 𝑅𝑖𝑞+ 𝐿𝑒𝑞𝐿𝑖𝑞 𝑑𝑡 + 𝜔𝐿𝑑𝐼𝑑+ 𝜔𝜙𝑃𝑀 𝜙𝑑 = 𝐿𝑑𝐼𝑑+ 𝜙𝑃𝑀 𝜙𝑞 = 𝐿𝑞𝐼𝑞 𝑇𝑚 =3 2𝑝[𝜙𝑃𝑀𝐼𝑞+ (𝐿𝑑− 𝐿𝑞)𝐼𝑑𝐼𝑞] 𝑇𝑚− 𝑇𝑟 = 𝐽 𝑑Ω 𝑑 𝜔 = 𝑝Ω 𝛳̇ = Ω Where 𝑝 represent the pole pairs.

(22)

21 From the equations and Laplace are obtained:

𝑣𝑑 = (𝑅 + 𝐿𝑑𝑠)𝑖𝑑 − 𝜔𝐿𝑞𝐼𝑞 𝑣𝑞 = (𝑅 + 𝐿𝑞𝑠)𝑖𝑞+ 𝜔(𝐿𝑞𝐼𝑞+ 𝜙𝑃𝑀) The dynamic system is:

(23)

22

2.4.1. Space vector and reference frames

It is required that the machine works like a DC motor, so the equilibrium equations are rewritten in order to highlight the common points between the two typologies of the machine.

Definitely, the equations are written in a Cartesian reference, so it is necessary to set a base change between a subspace in 𝑅3 and a subspace in 𝑅2.

Therefore the space vector is required, initially the instantaneous magnitude is considered:

𝑋 = {𝑥𝑎, 𝑥𝑏, 𝑥𝑐} and with this is associated an entity defined from: 𝑥𝛼𝛽 = 𝜌(𝑥𝑎+ 𝑥𝑏𝑒𝑗𝛾+ 𝑥

𝑐𝑒𝑗𝛾)

Where 𝜌 ∊ 𝑅 and 𝛾 = 2

3𝜋 .

So a complex number is associated to a triad of instantaneous magnitudes, it is possible to identify the real and complex part, indeed expanding the equations it is got: 𝑥𝛼𝛽 = 𝜌 (𝑥𝑎+ 𝑥𝑏cos2 3𝜋 + 𝑥𝑐𝑐𝑜𝑠 4 3𝜋) + 𝑗𝜌 (𝑥𝑎+ 𝑥𝑏cos 2 3𝜋 + 𝑥𝑐𝑐𝑜𝑠 4 3𝜋) = 𝑥𝛼+ 𝑗𝑥𝛽 Graphically:

(24)

23 The matrix transformation which described the machine in a biphasic axes is:

𝑥𝛼𝛽 = [ 𝑥𝛼 𝑥𝛽] = 𝜌 [ 1 −1 2 − 1 2 0 √3 2 − √3 2 ] [ 𝑥𝑎 𝑥𝑏 𝑥𝑐]

Where ρ is taken in base of the conventions, which we omit the demonstrations:  Invariance of the amplitudes:

𝜌 =2 3  Invariance of the power:

𝜌 = √2 3

Now it is obtained the equilibrium equations of the machine, expressed in the 𝛼𝛽 reference: 𝑣𝛼𝛽 =2 3 [ 1 −1 2 − 1 2 0 √3 2 − √3 2 ] [ 𝑣𝑎 𝑣𝑏 𝑣𝑐 ] = 𝑣𝛼+ 𝑗𝑣𝛽 𝑖𝛼𝛽 = 2 3 [ 1 −1 2 − 1 2 0 √3 2 − √3 2 ] [ 𝑖𝑎 𝑖𝑏 𝑖𝑐 ] = 𝑖𝛼+ 𝑗𝑖𝛽 𝜙𝛼𝛽 =2 3 [ 1 −1 2 − 1 2 0 √3 2 − √3 2 ] [ 𝜙𝑎 𝜙𝑏 𝜙𝑐 ] = 𝜙𝛼+ 𝑗𝜙𝛽 = 𝜙𝑝𝑚𝛼𝛽(𝛳) + 𝐿𝑒𝑞𝑖𝛼𝛽

The transformation is invariant time and therefore also the dynamic equilibrium equations remain formally identical to machine axis:

𝑣𝛼𝛽 = 𝑅𝑖𝛼𝛽+ 𝐿𝑒𝑞𝐿𝑖𝛼𝛽 𝑑𝑡 +

𝑑𝜙𝑝𝑚𝛼𝛽 𝑑𝑡

(25)

24 The advantage is to pass from three to two equations, but the problem remains the dependence on the angular position of the rotor in the concatenated flux produced from permanent magnets and therefore also the electromagnetic torque is dependent from the angle.

Then it is possible to rewrite the equation in a framework fixed with the rotor but always biphasic.

This means that the new reference it is rotated respect to 𝛼𝛽 with an 𝛳 angle.

Fig.2.4.1.2: 𝛼𝛽 and 𝑑𝑞 references

Now the vector’s components are rewritten in the new reference system: 𝑥𝛼= 𝑥𝑑𝑐𝑜𝑠𝛳 − 𝑥𝑞𝑠𝑖𝑛𝛳

𝑥𝛽 = 𝑥𝑑𝑠𝑖𝑛𝛳 + 𝑥𝑞𝑐𝑜𝑠𝛳

In matrix form become:

𝑥𝛼𝛽 = [𝑥𝑥𝛼 𝛽] = [ 𝑐𝑜𝑠𝛳 −𝑠𝑖𝑛𝛳 𝑠𝑖𝑛𝛳 𝑐𝑜𝑠𝛳 ] [ 𝑥𝑑 𝑥𝑞] = 𝐴(𝛳)𝑥𝑑𝑞

𝐴(𝛳) ∊ 𝑆𝑂(2) this means that is an orthogonal matrix and then 𝐴−1= 𝐴𝑇, the inverse relation is:

𝑥𝑑𝑞 = 𝐴𝑇(𝛳)𝑥 𝛼𝛽

(26)

25

2.4.2. Inverter

This device converts the direct power supply on input into an alternative power supply in output.

It is an opposite device respect to rectifier. There are two different typologies of inverter:

 Single-phase inverter  Three-phase inverter

We focus on the inverter three-phase because the electric motor used is a Brushless three phase.

The three-phase inverter is used to rotate the BLDC rotor, the stator windings must be energized with a specific sequence and this sequence is due to knowledge of the rotor position.

Fig.2.4.2.1: Three-phase inverter in connection with AC Motor

(27)

26

2.4.3. SVPWM

The Space Vector Pulse Width Modulation refers to a special switching sequence of the upper three power devices of a three-phase voltage source inverters.

Space Vector PWM method is an advanced computation intensive PWM method and possibly the best techniques for variable frequency drive application.

In SVPWM technique, instead of using a separate modulator for each of the three phases, the complex reference voltage vector is processed as a whole.

Therefore, the interaction between the three motor phases is considered.

SVPWM generates less harmonic distortion in the output voltages and currents in the windings of the motor load and provides a more efficient use of the DC supply voltage in comparison with sinusoidal modulation techniques.

Since SVPWM provides a constant switching frequency; the switching frequency can be adjusted easily.

Although SVPWM is more complicated than sinusoidal PWM, it may be implemented easily with modern DSP based control systems.

Consider three phase waveforms which are displaced by 120°: 𝑉𝑎 = 𝑉𝑚sin(𝜔𝑡) 𝑉𝑏 = 𝑉𝑚sin(𝜔𝑡 − 120 °)

𝑉𝑐 = 𝑉𝑚sin(𝜔𝑡 + 120 °)

These three vectors can be represented by a one vector which is known as space vector.

Space vector is defined as:

𝑉𝑠 = 𝑉𝑎+ 𝑉𝑏 𝑒𝑗2𝜋3 + 𝑉𝑐 𝑒 −𝑗2𝜋 3 𝑉̅𝑠= 3 2 𝑉𝑚 [ sin(𝜔𝑡) − 𝑗 cos(𝜔𝑡) ]

(28)

27 SVPWM aims to generate a voltage vector that is close to the reference circle through the various switching modes of inverter.

The figure 2.4.4.2 is the typical diagram of a three-phase voltage source inverter model. S1 to S6 are the six power switches that shape the output, which are controlled by the switching variables a, a‟, b, b‟, c and c‟.

When an upper transistor is switched ON, when a, b or c is 1, the corresponding lower transistor is switched OFF, the corresponding a‟, b‟ or c‟ is 0.

Therefore, the ON and OFF states of the upper transistors S1, S3 and S5 can be used to determine the output voltage.

Hence there are 8 possible switch states, (0,0,0), (0,0,1), (0,1,0), (0,1,1), (1,0,0), (1,0,1), (1,1,0), (1,1,1).

The inverter has six states, when a voltage is applied to the motor and two states when the motor is shorted through the upper or lower transistors resulting in zero volts being applied to the motor.

Fig.2.4.3.2: All switching possibilities

Consider an inverter feeding a star connected load and center point of the dc link is take as reference point as shown in figure 2.4.4.3:

Fig.2.4.3.3: Principle scheme of the system

The potential of point 𝑎, point 𝑏 and point 𝑐 with respect to the center point of the dc link is known if the conducting states of the switches are known.

When upper switch is ON, the potential of 𝑎, 𝑏 and 𝑐 is 𝑉2𝑑𝑐 and when lower switch is ON, the potential of 𝑎, 𝑏 and 𝑐 is −𝑉𝑑𝑐

2 :

𝑉𝑎0 = 𝑉𝑎𝑛+ 𝑉𝑛0 𝑉𝑏0= 𝑉𝑏𝑛+ 𝑉𝑛0

(29)

28 𝑉𝑛0= 1 3 [ 𝑉𝑎0+ 𝑉𝑏0+ 𝑉𝑐0 ] [ 𝑉𝑎𝑛 𝑉𝑏𝑛 𝑉𝑐𝑛 ] = 1 3 [ 2 −1 −1 −1 2 −1 −1 −1 2 ] [ 𝑉𝑎0 𝑉𝑏0 𝑉𝑐0 ]

Consider the switching states (0,0,0) and (1,1,1): 𝑉𝑎𝑛 = 𝑉𝑏𝑛 = 𝑉𝑐𝑛 = 0 Hence: 𝑉𝑝 = 𝑉𝑞= 0

Therefore: 𝑉𝑠 = 0∠0°

Since (0,1,1) is the complementary of (1,0,0); For (0,1,1): 𝑉𝑠 = 𝑉𝑑𝑐∠180°

Similarly derive the magnitude and angle of space vector for all possible switching states.

The complete combinations are: (0,0,0): 𝑉𝑠 = 0∠0° → 𝑉0 (0,0,1): 𝑉𝑠 = 𝑉𝑑𝑐∠0° → 𝑉1 (0,1,0): 𝑉𝑠 = 𝑉𝑑𝑐∠60° → 𝑉2 (0,1,1): 𝑉𝑠 = 𝑉𝑑𝑐∠120° → 𝑉3 (1,0,0): 𝑉𝑠 = 𝑉𝑑𝑐∠180° → 𝑉4 (1,0,1): 𝑉𝑠 = 𝑉𝑑𝑐∠240° → 𝑉5 (1,1,0): 𝑉𝑠 = 𝑉𝑑𝑐∠270° → 𝑉6 (1,1,1): 𝑉𝑠 = 0∠0° → 𝑉7

(30)

29

Fig.2.4.3.5: Output voltages

While plotting 8 voltage vectors in complex plane, the non-zero vectors form the axes of a hexagon as shown in figure 2.4.4.6.

The angle between any adjacent two non-zero vectors is 60 electrical degrees.

The zero vectors (or null vectors) are at the origin and apply a zero voltage vector to the motor.

If the phase voltages are sinusoidal, locus of the 𝑉𝑠 is circle.

The maximum value of 𝑉𝑠 for which locus is circle is the radius of the inscribing

circle, 32𝑉𝑑𝑐 .

(31)

30

2.4.4. Hall sensors

This kind of sensors are used to measure the position of the rotor.

In a rectangular plate of conductor or semiconductor polarized, the electron flux occurs in absence of magnetic flux incident, in straight line between the frontal edges, without electron flux in transverse direction, i.e. with no current in the circuit that connect the sides edge of the lamina.

In presence of an incident magnetic field, the electrons movement is deviated for the Lorentz’s forces, acquiring a no null transverse direction.

There is a current in the circuit that connect the sides edge, the current intensity is proportional to the flow intensity associated with the lamina.

The conductor is path from the current 𝐼𝑚 to measure, this current originates an

induction.

In the air-gap is inserted a siliceous bar alimented with a 𝐼𝑟𝑒𝑓 .

At the ends of the bar there is a potential difference 𝑉𝑜𝑢𝑡 proportional from 𝐼𝑚 .

(32)

31

2.5. Motor control

Through a regulation it is possible to stabilize the desired input signals in terms of electromechanical dimension, these dimensions are electric current, angular speed and position delivered from the machine.

2.5.1. DC controls

In the regulation field of the DC electric machines it is used a common structure for feedback control called “cascade control”, which it provides a control loop for every physical dimension.

In the picture below a cascade control of the mechanical quantities is reported.

Fig.2.5.1.1: Cascade control

The torque (current) loop is inner, the speed loop is intermediate and the position loop is external.

The next figure shows a feedback for a brushless motor but the same logic is follows from a DC motor:

Fig.2.5.1.2: Control architecture

The character of this structure is to stabilize of the external loops defining the reference of the internal loops, therefore in phase of design, one of the main target is the bandwidth of the loops.

(33)

32 In the last years the “sensorless” architecture was born, there is the same structure with the loops but without the angular position and speed sensors replaced with observers of the state, all this because the sensor increase the cost of machines and then the designer the problems to obtain the physical dimension to complete the control.

Following the conceptual and schematic examples of a DC motor control are described.

Current loop

Fig.2.5.1.3: Block diagram of the current controller and a part of the DC motor

The design of the controller 𝐶𝑖 has to satisfy the following conditions: 1. Null error at regime for a step input

2. Closed loop bandwidth > 𝐵𝑖bandwidth

The first condition means that the loop should be able to tracking the reference.

If the internal loop was slower than the external one the latter would see a slowly variable reference signal.

The second condition is tied to the speed response of the system when a variation of the reference signal is applied.

The 𝑒𝑚𝑓 is the back electric-motor force, it is tied to mechanical speed and dynamic. In this case the 𝑒𝑚𝑓 is slowly variable compared to 𝑉𝑎 input, so we assume 𝑒𝑚𝑓 like a

step noise.

Therefore the controller 𝐶𝑖 must not introduce errors in the output signal (at regime

(34)

33

Speed loop

Fig.2.5.1.4: Block diagram of the speed controller and the DC motor

If there is a speed reducer, 𝑇𝑟 and 𝐽 are considered equivalent to those on the motor

side.

The current loop has as a transfer function 𝑊𝑖 .

The design of the controller 𝐶Ω has to satisfy the following conditions:

1. Null error at regime for a step input 2. Bandwidth 𝐵𝑖 > bandwidth 𝐵Ω

The first condition means that the loop should be able to tracking the reference.

The second condition is tied to the condition of the cascade control, so the internal loop must be more quickly than external loop.

In this case the system has two input, the reference current 𝐼𝑟𝑒𝑓 and the resistant

torque 𝑇𝑟 .

The latter is an aleatory variable.

The controller 𝐶 must compensate the contribution of signal 𝑇𝑟 in the output variable. 𝑇𝑟 signal supposed slowly variable and so it is assumed as a step noise.

Position loop

The link between the angular position and rotational speed is:

𝛳(𝑡) = 𝐾𝜃∫ Ω(𝑡)𝑑𝑡 𝑡 0 In Laplace domain: 𝛳(𝑠) =𝐾𝛳 𝑠 Ω(𝑠) The transfer function is:

(35)

34 𝐾𝛳

𝑠 = 𝛳(𝑠) Ω(𝑠)𝑠

Fig.2.5.1.5: Block diagram of the position controller and the DC motor

𝑊 is found with the design of current and speed loop.

The design of the controller 𝐶𝜃 has to satisfy the following conditions:

1. Null error at regime for a step input 2. Step response without overshoot 3. Bandwidth 𝐵 > bandwidth 𝐵𝜃

The second specific is important in case of approaching of a tool to a workpiece. If this movement has an overshoot there is a collision with the piece.

To realize this condition, the closed loop transfer function must has all real poles or complex conjugate poles with damping ratio > 1/√2 .

2.5.2. Brushless controls

Sinusoidal commutation

Trapezoidal commutation is inadequate to provide smooth and precise motor control of brushless DC motors, particularly at low speeds, the sinusoidal commutation solves this problem.

Sinusoidally commutated brushless motor controllers attempt to drive the three motor windings with three currents that vary smoothly and sinusoidally as the motor turns. The relative phases of these currents are chosen so that they should result in a smoothly rotating current space vector that is always in the quadrature direction with respect to the rotor and has constant magnitude.

This eliminates the torque ripple and commutation spikes associated with trapezoidal commutation.

In order to generate smooth sinusoidal modulation of the motor currents as the motor turns, an accurate measurement of rotor position is required.

The Hall devices provide only a coarse measure of rotor position and are inadequate for this purpose, for this reason, angle feedback from an encoder, or similar device, is required.

A block diagram of a sinusoidal brushless motor drive is shown in figure 2.4.2.1, this scheme uses a separate current loop for each of two motor winding currents.

(36)

35 Since the motor is WYE wired, the current in the third motor winding is equal to the negative sum of the currents in the first two windings, and therefore cannot be separately controlled.

Fig.2.5.2.1: Simplified sinusoidal controller for brushless motors

Since the winding currents must combine to produce a smoothly rotating current space vector of constant magnitude, and because the stator windings are oriented 120 degrees apart from each other, currents in each winding must be sinusoidal and phase shifted by 120 degrees.

Position information from the encoder is used to synthesize two sinusoids, one 120 degrees phase shifted from the other.

These signals are then multiplied by the torque command so that the amplitudes of the sine waves are proportional to desired torque.

The result is two sinusoidal current command signals appropriately phased to produce a rotating stator current space vector in the quadrature direction.

The sinusoidal current command signals are provided as inputs to a pair of PI controllers that regulate current in the two appropriate motor windings.

The current in the third motor winding is the negative sum of the currents in the controlled windings and therefore cannot be separately controlled.

The output from each PI controller is fed to a pwm modulator and then to the output bridge and two motor terminals.

Voltage applied to the third motor terminal is derived as the negative sum of the signals applied to the first two windings, as appropriate for three sinusoidal voltages each separated by 120 degrees.

To the extent that the actual output current waveform accurately tracks the sinusoidal current command signals, the resulting current space vector is smoothly rotating, constant in magnitude and oriented in the quadrature direction, as desired.

Sinusoidal commutation results in smoothness of control that is generally unachievable with trapezoidal commutation. However, while it is very effective at low motor speeds, it tends to fall apart at high motor speeds. This is because as speed goes up the current loop controllers must track a sinusoidal signal of increasing frequency.

(37)

36 At the same time they must overcome the motor back e.m.f. that also increases in amplitude and frequency as speed goes up.

Because the PI controllers have limited gain and frequency response, the time variant perturbations to the current control loop cause phase lag and gain error in the motor currents.

Higher speeds result in larger errors. This perturbs the direction of the current space vector relative to the rotor, causing it to shift away from the quadrature direction. When this happens, less torque is produced by a given amount of current and therefore more current is required to maintain torque. Efficiency deteriorates.

This degradation continues as speed increases. At some point motor current phase shift crosses through 90 degrees. When this happens torque is reduced to zero. With sinusoidal commutation, speeds above this point result in negative torque and are therefore not achievable.

Field Oriented Control (FOC)

The Field Oriented Control is better than sinusoidal commutation because it provides the smooth motion at slow speeds as well as efficient operation at high speeds. Sinusoidal commutation produces smooth motion at speeds, but is inefficient at high speeds. Trapezoidal commutation can be relatively efficient at high speeds, but causes torque ripple at slow speeds. Field Oriented Control provides the best of both worlds. The fundamental weakness of sinusoidal commutation is that it attempts to control motor currents that are time variant in nature.

This breaks down as speeds and frequencies go up due to the limited bandwidth of PI controllers. Field Oriented Control solves this problem by controlling the current space vector directly in the 𝑑𝑞 reference frame of the rotor.

In the ideal case, the current space vector is fixed in magnitude and direction (quadrature) with respect to the rotor, irrespective of rotation, because the current space vector in the 𝑑𝑞 reference frame is static, the PI controllers operate on direct current, rather than sinusoidal signals.

This isolates the controllers from the time variant winding currents and voltages, and therefore eliminates the limitation of controller frequency response and phase shift on motor torque and speed.

Using Field Oriented Control, the quality of current control is largely unaffected by speed of rotation of the motor.

In Field Oriented Control, motor currents and voltages are manipulated in the 𝑑𝑞 reference frame of the rotor.

This means that measured motor currents must be mathematically transformed from the three phase static reference frame of the stator windings to the two axis rotating 𝑑𝑞 reference frame, prior to processing by the PI controllers.

Similarly, the voltages to be applied to the motor are mathematically transformed from the 𝑑𝑞 frame of the rotor to the three phase reference frame of the stator before they can be used for pwm output. It is these transformations, which generally require the fast math capability of a DSP or high performance processor that are the heart of Field Oriented Control.

(38)

37 Although the reference frame transformations can be performed in a single step, they are best described as a two-step process.

The motor currents are first translated from the 120 degree physical frame of the motor stator windings to a fixed orthogonal reference frame.

They are then translated from the fixed frame of the stator to the rotating frame of the rotor. This must be done at the update rate of the PI controllers in order to insure valid results.

This process is reversed to transform voltage signals from the PI controllers from the 𝑑𝑞 frame of reference to the terminals of the stator windings.

Once the motor currents are transformed to the 𝑑𝑞 reference frame, control becomes rather straightforward.

Two PI controllers are used; one for the direct current component, and one for quadrature current. The input to the controller for the direct current and has zero input. This drives the direct current component to zero and therefore forces the current space vector to be exclusively in the quadrature direction. Since only the quadrature current produces useful torque, this maximizes the torque efficiency of the system.

The second PI controller operates on quadrature current and takes the requested torque as input. This causes the quadrature current to track the requested torque, as desired.

(39)

38 The outputs from the two PI controllers represent a voltage space vector with respect to the rotor. Mirroring the transformation performed on motor currents, these static signals are processed by a series of reference frame transformations to produce voltage control signals for the output bridge. They are first translated from the rotating 𝑑𝑞 frame of the rotor to the fixed 𝑥𝑦 frame of the stator. The voltage signals are then converted from an orthogonal frame to the 120 degree physical frame of the U, V and W motor windings.

This results in three voltage signals appropriate for control of the pwm output modulator.

It is the reference frame transformations that do the work of converting between the sinusoidal time variant current and voltage signals at the motor windings into the DC signal representations in the 𝑑𝑞 space.

The important architectural difference between sinusoidal commutation and Field Oriented Control is the sequence of the commutation and current control processes. In sinusoidal commutation, commutation is performed first and is followed by PI control of the resulting sinusoidal current command signals.

The PI controllers in a sinusoidal system are therefore exposed to the time variant currents and voltages of the motor, and motor performance is limited by the bandwidth and phase shift of the controllers.

In Field Oriented Control, PI control of current is performed first and is followed by fast commutation processes. The PI controllers are therefore isolated from the time varying currents and voltages, and the system is not limited by PI control loop bandwidth and phase shift.

(40)

39

3. Modelling and Simulation of electrical machines

At first some simulations are built to create a “real” control drive system, in order to show the behaviour of these controls.

Three different kinds of control are used for the DC motor; the first one is a current control with a PI controller, the second one is a cascade control with two controllers, PI controller for the current and PI controller for the speed, the third one is always a cascade control with two controllers, PI controller for the current and PID controller for the speed.

After that, a speed control with PI controllers is used for a brushless motor.

3.1. Matlab-Simulink

All Simulink blocks are reported in this this chapter 3.1, while in the 3.3 there are the integral parts of the systems.

Regarding the DC motor, it is used a mathematical model:

(41)

40 Regarding the brushless motor, the mathematical model is more complex:

Fig 3.1.2: Brushless motor model

The observer has the following structure with the Clark’s transformation.

(42)

41 Below is reported a model of coordinates change.

Fig 3.1.4: Conversion from 𝑎𝑏𝑐 to 𝑑𝑞

And the reverse conversion:

Fig 3.1.5: Conversion from 𝑑𝑞 to 𝑎𝑏𝑐

It is shown the inverse Park’s conversion.

(43)

42 The inverter is shown in the figure below.

Fig.3.1.7: Inverter model

The Space Vector Modulation model is made like this:

(44)

43 The 𝐼𝑞 reference is got from:

Fig.3.1.9: 𝐼𝑞 reference for FOC control strategy 3.2. Development and implementation of the models

The references of the DC motor in both cases, current and speed, are trapezoidal wave forms, because in reality it is impossible have an instantaneous change like a rectangular wave form, therefore the change are slower.

The picture below shows the waves:

(45)

44

Fig.3.2.2: Speed DC motor reference

For the resistance torque the basic idea is to apply it some seconds after the reference wave:

Fig.3.2.3: Resistance torque

The form is the same as the previous one for the same reasons.

So, to recap, the work quadrants are the first and the third, the motors operate in clockwise and anticlockwise rotation.

(46)

45 The speed reference of the brushless motor, in this case is a random wave, always with a not instantaneous change like in the DC case:

Fig.3.2.4: Speed brushless motor reference

In this model the motor works only in the first quadrant.

For the choice of the controllers, the procedures followed were different for every cases.

The PID Tuner command in Matlab was used for the DC motor with PI controller for the speed.

After that, the next controllers was developed with Ziegler-Nichols method at the start, then with changes it was possible to improve it.

Control Type Kp Ti Td

P 0.5Ku / /

PI 0.45Ku Tu/1.2 /

PD 0.8Ku / Tu/8

PID 0.6Ku Tu/2 Tu/8

Fig.3.2.5: A part of the Ziegler-Nichols method

Where 𝐾𝑢 is called the ultimate gain, it is the first value of 𝐾𝑝 which makes stable and

consistent the output oscillations; 𝑇𝑢 is the oscillation period.

The electric drive of the brushless is a nonlinear system therefore it is impossible to use the PID Tuner command, the only way is the approach with Ziegler-Nichols methods.

(47)

46

3.3. Simulation results

The first system is a DC motor with PI current controller.

Fig.3.3.1: PI current controller for DC motor

The input signal and the resistance torque have been seen in the chapter 3.2.

Here the output signal is the current, the following figure shows the reference input and the output.

(48)

47

Fig.3.3.3: Zoom of the fig.3.3.2

The second system is a DC motor with PI and PID speed controllers.

Fig.3.3.4: PI and PID speed controller for DC motor

The input signal and the resistance torque have been seen in the chapter 3.2.

Here the output signal is the angular speed, the following figure shows the reference input and the output of the DC motor in the case of PI controller.

(49)

48

Fig.3.3.5: Reference and generated angular speed (PI controller)

(50)

49

Fig.3.3.7: Zoom of the fig.3.3.5

Others graphics of the system with PI controller are:

(51)

50

Fig.3.3.9: Rotor position (PI controller)

Below there are the results of the electric drive with PID controller.

(52)

51

Fig.3.3.11: Zoom of the fig.3.3.10

(53)

52 Others graphics of the system with PID controller are:

Fig.3.3.13: Reference and generated current (PID controller)

(54)

53 Now, the figures with PI and PID controller in the systems will be compared.

Fig.3.3.15: (PI and PID controllers)

(55)

54

Fig.3.3.17: Zoom of the fig.3.3.15

(56)

55

Fig.3.3.19: (PI and PID controllers)

(57)

56 The third system is a brushless motor with PI speed controllers.

Fig.3.3.21: PI speed controller for brushless motor

The input signal and the resistance torque have been seen in the chapter 3.2.

Here the output signal is the angular speed, the following figure shows the reference input and the output of the brushless motor.

Fig.3.3.22: Reference and generated angular speed

(58)

57

Fig.3.3.23: 𝐼𝑎, 𝐼𝑏, 𝐼𝑐 currents in the three phases

(59)

58

Fig.3.3.25: Position generated

(60)

59

Fig.3.3.27: Zoom of the fig.3.3.26

It is possible to observe the goodness of the simulations, for each of them the magnitudes (current, angular speed) reach the regime in few seconds, the overshoots are small.

In the electric drive for DC motor with PI and PID controllers, the differences between them are minimums, the PID controller is less sensitive to the application of the resistance torque.

The observer in the brushless motor works really well, the picture 3.3.27 shows its job comparing the real rotor position with the observed rotor position.

(61)

60

4. Interface and communication

In order to use the dSPACE hardware and MEDKit board there are some steps to achieve, they are made up of the use of several software and building of the C codes. In the next paragraphs names like PIL and HIL are used, those meaning will be descripted in the chapter 5.

4.1. Describe the setup components

The first software is Matlab, here it is possible to create variables so use them in the forward step.

The next step is the use of a Simulink model, it is a representation of the real system. In the PIL (processor-in-the-loop) case, it is necessary to have a control drive model and a brushless model of the motor.

In the HIL (hardware-in-the-loop) case, it is necessary to have a system represented the interfaces of input/output dSpace hardware together with the system.

The C code created in Simulink is used in an IDE (Integrated Development Environment) like the Keil µVision5, here it is possible to look row per row the meaning of the code.

This passage is for the PIL mode, because the C code will be flashed in the microcontroller of the MEDKit board.

(62)

61 After that it is necessary using a debugger like J-Link to connect the PC with the board, the C code is debugged here before to reach the MEDKit board.

The PIL setup is finished with this final step.

Fig.4.1.2: J-Link debugger

(63)

62 For the HIL mode it is indispensable to use the MicroLabBox, this device lets to perform the real time experiments, to employ it is necessary a GUI (Graphical User Interface) called ControlDesk.

Fig.4.1.4: Example of a ControlDesk interface

(64)

63

4.2. Communication

There are two differences in the connection for PIL and HIL mode. In the first case is required the using of Matlab/Simulink and µVision5 software, J-Link

and MEDKit board.

There is an USB connection from host PC and Link, then a JTAG connection from J-Link and the board.

Fig.4.2.1: connection between host PC and J-Link

Fig.4.2.2: connection between J-Link and board

In the second case is required the using of Matlab/Simulink software, dSpace MicroLabBox.

(65)

64 There is an Ethernet connection from host PC and MicroLabBox.

Fig.4.2.3: dSpace MicroLabBox Ethernet port

4.3. Complete simulation model

The integrated Simulink model of the system board is showed in the following picture, this model includes all three different types of controllers (current, speed, position), SVPWM block (Space Vector Modulation), inverter block and brushless motor model.

(66)

65

4.4. Datasheet

Here the quick specifications are reported: Microcontroller:

 STM32F107VCT: 72MHz, 256k Flash, 64k Ram Interfaces / Functions:

 Full Speed USB on-the-go (OTG)  CAN-Bus

 Micro SD-Card  8 LEDs

 Onboard potentiometer  Hall-effect current sensor  Temperature sensor Inverter / Power Stage:

 12V - 48V

 18kHz sinusoidal commutation

 Current capabilities for e-Mobility projects:

o More than 50A continuously with passive cooling o Peak current over 75A (max. 180A)

o Depending on cooling & copper Layer thickness, housing, etc.  Power Supply:

o External 12V supply (default)

o Onboard DC/DC converter for battery voltages 16V – 48V in e-Mobility projects

Reset button:

 Reset the MCU

 Connection to MCU: Pin14 (NRST)

 Design annotations: 100𝑛𝐹 (C13) capacitor to avoid resets through EMI  Pin14 NRST also connected to JTAG-Reset

 NRST is MCU-internally pulled high, no external pull-up required

(67)

66 User push buttons:

 General purpose user input  Connection to MCU

o Button T1: Pin C8 o Button T2: Pin D15 o Button T3: Pin D13  Design annotations:

o 10𝑘 resistor for each button to limit current in case of erroneous port/pin setting

o To use the buttons in your software, configure each as “input with internal pull-down (IPD)”

 Worst-case calculations: current on port setting “output”: 𝐼 = 3,3𝑉 10𝑘⁄ = 0,33𝑚𝐴

Fig.4.4.2: User button

LEDs:

 Blue LED Bar

 Connection to MCU: see diagram

 Design annotations: 560𝑅 resistors to limit current

(68)

67 Potentiometer:

 Onboard potentiometer

 Connection to MCCU: Pin A1 (ADC0 Channel 1)

 Design annotations: C26 can be replaced by a resistor if pull-down function is required when Pin A1 is used as an external throttle input connection for e-mobility applications

 Worst-case calculations: constant current flow: 𝐼 = 3,3𝑉 50𝑘⁄ = 0,66𝑚𝐴

Fig.4.4.4: Potentiometer

Hall-sensor interface:

 Connector socket from Tyco (7-215079-8)  Hall sensor connection to the MCU

o Hall A: Pin B12 o Hall B: Pin B13 o Hall C: Pin B14 o VCC: +3,3V

 General pinout of the connector: see below

 If +5V hall-sensor supply is required, the optional DCDC converter can drive the sensor supply

(69)

68 Port connector 4:

 Interface to hall sensor signals  Connection to the MCU

o Hall A: Pin B12 o Hall B: Pin B13 o Hall C: Pin B14 o VCC: +3,3V

Fig.4.4.6: Hall sensor interface

MCU power supply:

 Power supply (3,3V) from voltage regulator (see section power supply)  ADC-supply VDDA: L1 4.7µH

(70)

69 MOSFET driver:

 Allegro A4935

 Three phase half bridge driver for motor control o Management of the three phase inverter o Switching of high- & low-side gate drive supply o Internal dead-time generation

o Shoot-through & undervoltage protection o Diagnostic functions with serial interface  Design annotations:

o Deadtime-resistor: 100𝑘 (∼ 2µ𝑠) o Bootstrap Cap.: 470𝑛𝐹

o Gate driver resistors: 18𝑅

o Risetime: 10% − 90%: 1.50µ𝑠 @2𝐴

o Max. voltage across MOSFET half-bridge: 48V (limitation by A4935)

Fig.4.4.8: MOSFET driver

Three phase full-bridge:

 MEDKit is equipped with high-current N-channel MOSFETs  One half-bridges for each motor-phase

(71)

70 Faulhaber BLDC servo:

 12V brushless DC servo drive  8000𝑟𝑝𝑚 , 24𝑊

 Two pole-pairs: two electrical commutation cycles for one mechanical revolution

 Very robust: no adhesives -> magnets do not get lose off even under highest temperatures above 120°𝐶

 Internal hall sensors: rotor position feedback with three digital hall-sensors  Hall sensor signal

(72)

71

(73)

72

(74)

73

5. Experimental setup and hardware implementation

In this chapter it will presented the description of MIL, SIL, PIL, HIL, all steps for the creation of the RTI dSpace and the using of the MEDKit board.

5.1. Testing methods

MIL

The first step is to record data for reference plots from the simulation model. The Model-in-the-Loop simulation captures the specified behavior of the model that is to be implemented in C code later on. This act as a reference for the next verification steps.

SIL

Software-in-the-Loop means that the code is generated and it replaces the controller blocks in the same simulation model (e.g. same plant and stimulus signals). The simulation plots should be widely identical when compared to the results of Model-in-the-Loop simulation. If they are not, the plots can be analyzed to get a better understanding about the cause of the deviation.

PIL

Finally, the generated code runs on an embedded processor. An off-the-shelf evaluation board is connected to the host PC, and the generated code is compiled and downloaded to the evaluation board. If plots from Processor-in-the-Loop simulation deviate from Software-in-the-Loop simulation, the most likely cause is a bug in the

target compiler or a problem with the processor.

HIL

Hardware-in-the-Loop is a form of real-time simulation. HIL differs from pure real-time simulation by the addition of a “real” component in loop. This component may be an electronic control unit (ECU for automotive) or a real engine. The current industry definition of a Hardware-in-the-Loop system is shown in figure 5.1.1.

It shows that the plant is simulated and the ECU is real. The purpose of a HIL system is to provide all of the electrical stimuli needed to fully exercise the ECU. In effect, “fooling” the ECU into thinking that it is indeed connected to a real plant.

(75)

74

A typical HIL system is comprised of the following components:

 A math model of the plant  Sensors models

 A real time target computer I/O  Real or simulated load

 A host PC with communications link to target computer and diagnostic link to ECU for example

 A GUI application to download and control the real time process  A test automation application to automate all aspects of the test

Fig.5.1.1: Typical HIL System

Signal Amplifiers Load Simulation Fault Matrix Diagnostic Interface ECU Host PC RTI Simulation Hardware Signal adaptation and fault simulation hardware

GUI and Test Automation Software Fa u lt M atr ix C o n tr o l D iagnos tic C om m . L ink

(76)

75

5.2. Setup

The software and hardware references are: Windows 10, Matlab/Simulink 2016a, dSpace MicroLabBox (front side panel version), MEDKit ARM Cortex-M3, Keil μVision5, Segger J-Link, CDs containing TargetLink and ControlDesk software, dongle licenses (one for ControlDesk and one for TargetLink).

Software installation: Insert CD1 and choose “dSpace_MasterSetup” after that

in one step of the installation a license will be required, choose the ControlDesk license; continue in the installation changing CD and paths when is required. This kind of installation (MasterSetup) provides to install all software related to

license used.

Fig.5.2.1: These real-time libraries are available after the installation

Host PC connection: Via Ethernet is possible to connect the PC (Ethernet Port)

to MicroLabBox (Host PC Port); then is necessary set the Ethernet connection from PC, Control Panel > Network and Sharing Center > Change adapter settings > Ethernet > Internet Protocol Version 4 (TCP/IPv4) > Use the following IP address > IP address > 192.168.140.100 and subnet mask > 255.255.255.0 then OK.

Riferimenti

Documenti correlati

fatti i tuberi di Rossa di Cetica rappresentano un prodotto molto apprezzato sul mercato locale che agisce anche come motore propulsivo per la commercializzazione di altri

Le scelte degli autori dei testi analizzati sono diverse: alcuni (per esempio Eyal Sivan in Uno specialista) usano materiale d’archivio co- me fotografie e filmati, altri invece

Here, to make up for the relative sparseness of weather and hydrological data, or malfunctioning at the highest altitudes, we complemented ground data using series of remote sensing

The continuous development of technologies for the fast prototyping of RT code has contributed to speed up the diffusion of complex HIL testing techniques also to the fluid

The impact of age at the time of labor market entry is perhaps surprising: younger entrants survive less than older ones, possibly the unobserved effect of higher education

Focusing on the case of Jordan, a country known to have produced the highest number of fighters to have joined Islamic organizations in Syria and Iraq, and specifically on youth,

The power ranges of the rotation drive of two-bit cutting bodies with a disc tool on trihedral prisms are determined, they are 114 to 402 kW when the boom moves up and the bits