# Documentation

## Simulate a DC Motor Drive

### Introduction

In this section, you will learn how to use the DC drive models of the Electric Drives library. First, we will specify the types of motor, converters, and controllers used in the seven DC drive models of the library, designated DC1 to DC7. These seven models are based on the DC brush motor in the Electric Drives library. As in any electric motor, the DC brush motor has two main parts, the stator (fixed) part and the rotor (movable) part. The DC brush motor also has two types of windings, the excitation or field winding and the armature winding. As its name implies, the field winding is used to produce a magnetic excitation field in the motor whereas the armature coils carry the induced motor current. Since the time constant (L/R) of the armature circuit is much smaller than that of the field winding, controlling speed by changing armature voltage is quicker than changing the field voltage. Therefore the excitation field is fed from a constant DC voltage source while the armature windings are fed by a variable DC source. The latter source is produced by a phase-controlled thyristor converter for the DC1 to DC4 models and by a transistor chopper for the DC5, DC6, and DC7 models. The thyristor converter is fed by a single-phase AC source in the cases of DC1 and DC2 and by a three-phase AC source in the cases of DC3 and DC4. Finally, the seven DC models can work in various sets of quadrants. All these possibilities are summarized in the following table.

DC Models

Model

Type of Converter

DC1

Single-phase thyristor converter

I-II

DC2

Single-phase thyristor converter

I-II-III-IV

DC3

Three-phase thyristor converter

I-II

DC4

Three-phase thyristor converter

I-II-III-IV

DC5

Chopper

I

DC6

Chopper

I-II

DC7

Chopper

I-II-III-IV

### Regenerative Braking

Operation in quadrants II and IV corresponds to forward and reverse braking, respectively. For the DC models of the Electric Drives library, this braking is regenerative, meaning that the kinetic energy of the motor-load system is converted to electric energy and returned to the power source. This bidirectional power flow is obtained by inverting the motor's connections when the current becomes null (DC1 and DC3) or by the use of a second converter (DC2 and DC4). Both methods allow inverting the motor current in order to create an electric torque opposite to the direction of motion. The chopper-fed DC drive models (DC5, DC6, DC7) produce regenerative braking in similar fashions.

### Example: Thyristor Converter-Based DC Motor Drive

In this example, you will build and simulate the simple thyristor converter-based DC motor drive shown in Thyristor Converter-Based DC Motor Drive Example Circuit.

Thyristor Converter-Based DC Motor Drive Example Circuit

This step-by-step example illustrates the use of the DC3 model with a 200 hp DC motor parameter set during speed regulation. The DC3 block models a two-quadrant three-phase thyristor converter drive. During this example, the motor will be connected to a load and driven to its 1750 rpm nominal speed.

In this tutorial, you learn about

#### Getting the DC3 Model from the Drives Library

1. Open a new window and save it as `DC_example`.

2. Open the Simscape™ Power Systems™ Electric Drives library. You can open the library by typing `electricdrivelib`in the MATLAB® Command Window or by using the Simulink® Library Browser. The DC3 model is located inside the DC Drives library. Copy the DC3 block and drop it in the `DC_example` window.

DC3 Model Inside the Electric Drives Library

#### Connecting the DC3 Model to a Voltage Source

All models of the library have three types of inputs: the electrical power inputs, the speed or torque set point input (SP), and the mechanical torque input (Tm). Because the DC3 model is a three-phase drive, it presents three electrical inputs: A, B, and C. In order for the DC3 model to work, you must now connect those inputs to a proper voltage source:

1. Open the Electrical Sources library and copy the 3-Phase Source block into your circuit. Connect the voltage source outputs A, B, and C to the DC3 A, B, and C inputs, respectively.

In this example, you are driving a 200 hp DC motor of 500 V nominal armature voltage. The mean output voltage ${\stackrel{^}{V}}_{out}$ of a three-phase thyristor rectifier bridge is given by

`${\stackrel{^}{V}}_{out}=\frac{3\sqrt{2}\cdot {V}_{l,rms}}{\pi }\cdot \mathrm{cos}\alpha$`

where ${V}_{l,rms}$ is the phase-to-phase rms voltage value of the three-phase voltage source and α is the firing angle value of the thyristors. For better voltage control, a lower firing angle limit is usually imposed, and the maximum mean output voltage available from the rectifier bridge is thus given by

`${\stackrel{^}{V}}_{out,\mathrm{max}}=\frac{3\sqrt{2}\cdot {V}_{l,rms}}{\pi }\cdot \mathrm{cos}{\alpha }_{\mathrm{min}}$`

where αmin is the lower firing angle limit. In our case, the lower firing angle limit used in the DC3 model is 20 degrees. With such an angle value and in order to have a maximum mean output voltage value of 500 V to drive the 200 hp motor to its nominal speed, the needed phase-to-phase rms voltage value given by the preceding equation is 370 V. Assuming the drive is connected to an American electrical network, the closest standard voltage value is 460 V.

2. Set the AC source phase-to-phase rms voltage value to 460 V and the frequency to 60 Hz. Name the AC source ```460 V 60 Hz```.

Note that the voltage source amplitude and frequency values needed for each drive model of the Electric Drives library can be found in the reference notes. The nominal values of the corresponding motors are also included. DC3, 200 HP Drive Specifications contains the values corresponding to the DC3 200 hp model.

DC3, 200 HP Drive Specifications

 Drive Input Voltage Amplitude 460 V Frequency 60 Hz Motor Nominal Values Power 200 hp Speed 1750 rpm Voltage 500 V

In order to represent a real-life three-phase source, you must specify correct source resistance R and inductance L values. To determine these, one usually uses the short-circuit power value Psc and a given X /R ratio (where $X=L\cdot \omega$, ω being the angular frequency of the voltage source). As a rule of thumb, the short-circuit power absorbed by the source impedance is supposed to be at least 20 times bigger than the nominal power of the drive, and the X /R ratio is usually close to 10 for industrial plants.

The value of the source impedance Z is obtained by

`$Z=\frac{{V}^{2}}{{P}_{sc}}$`

where V is the phase-to-phase rms voltage value of the voltage source. For a high X /R ratio r, the source resistance R is approximately equal to

 $R=\frac{Z}{r}$ (4-1)

and the source inductance L to

 $L=\frac{Z}{\omega }$ (4-2)

In this example, the phase-to-phase rms voltage is worth 460 V and the source frequency is 60 Hz. If we assume a short-circuit power of 25 times the nominal drive power, we find a source impedance of 0.056 Ω. For an X /R ratio of 10, using Equation 4-1 and Equation 4-2, we find a resistance value of 0.0056 Ω and an inductance value of 0.15 mH.

3. Clear the Specify impedance using short-circuit level check box, and set the AC source resistance value to 0.0056 Ω and the inductance to 0.15 mH.

#### Connecting the DC3 Model to a Mechanical Load

The Tm input represents the load torque applied to the shaft of the DC motor. If the values of the load torque and the speed have opposite signs, the acceleration torque will be the sum of the electromagnetic and load torques. Many load torques are proportional to the speed of the driven load such as represented by the equation

 ${T}_{mec}=K\cdot {\omega }_{m}={K}^{\prime }\cdot {N}_{m}$ (4-3)

where ωm is the speed in rad/s and N the speed in rpm. You will now build such a load.

To compute this type of mechanical load torque, the speed of the DC motor is needed. This one can be obtained by using the outputs of the DC3 model. All drive models of the Electric Drives library have four output vectors: Motor, Conv., Ctrl, and Wm. The Motor vector contains all motor-related variables, the Conv. vector contains all converter voltage and current values, the Ctrl vector contains all the regulation important values, such as the speed or torque reference signals, the speed or torque regulation error, the firing angle value, and so on, and Wm is the motor speed in rad/s. All input-output descriptions are available on the reference page of every model.

The motor speed (Wm) can be multiplied by the constant K of Equation 4-3 to obtain the load torque signal to be connected to the Tm input of the DC3 model:

1. Build the subsystem following and name it `Linear load torque`.

The constant K can be computed knowing that at nominal speed, the motor should develop nominal torque. As shown in DC3, 200 HP Drive Specifications, the DC motor used in this simulation has a nominal speed Nm,n of 1750 rpm. Since the nominal mechanical output power Pm,n of the motor is 200 hp, the nominal mechanical load torque Tmec,n can be computed following Equation 4-4 (where viscous friction is neglected)

 ${P}_{m,n}={T}_{mec,n}\cdot {\omega }_{m,n}={T}_{n}\cdot \frac{\pi \cdot {N}_{m,n}}{30}$ (4-4)

where ωm,n is the nominal speed in rad/s. Using this equation, we find a nominal mechanical torque of 814 N.m. Finally Equation 4-3 gives us a K value of 4.44.

2. Set the constant value of the Linear load torque block to `4.44`.

3. Connect the input and output of the Linear load torque block to Wm and Tm input of the DC3 block, respectively. Your schematic should now look like the following.

Building the Example Circuit

#### Defining the Set Point

The set point input of the DC3 model can either be a speed value (in rpm) or a torque value (in N.m) depending on the regulation mode (speed or torque regulation). In this example, we will set the DC3 block in speed regulation mode and drive the 200 hp DC motor to its nominal speed of 1750 rpm.

1. Open the Simulink Sources library and copy a Constant block into `DC_example`.

2. Connect the Constant block to the set point input of the DC3 model and name it ```Speed reference```.

3. Set the set point to 1750 rpm.

#### Visualizing Internal Signals

You must now use the DC3 model outputs to visualize interesting signals with a scope. Suppose you need to visualize the following signals:

• The thyristor bridge firing angle

• The motor armature voltage

• The motor armature current and reference

• The speed reference and the motor speed

Note that all model input-output descriptions can be found in the corresponding reference notes. To see which signals are connected to the DC3 outputs, select the DC3 model and use the Diagram > Mask > Look Under Mask menu item.

As you can see below, the firing angle is contained inside the Ctrl output vector. The firing angle Alpha (see the DC3 block reference notes) is the second element of this vector.

Location of the Firing Angle Signal Inside the Ctrl Output Vector

The Motor vector (shown in the next figure) contains three of the needed signals: the armature voltage and current signals are the first and third elements, respectively. The speed is the second element of the Motor vector.

Motor Vector

Finally, the current and speed reference signals are the first and fourth elements of the Ctrl vector, respectively (see the following figure). Note that the Ref. signal of the Regulation switch block would be a torque reference in torque regulation mode.

Location of the Speed Reference Signal Inside the Ctrl Output Vector

Internal bridge current and voltage signals can be extracted via the Conv. output, which is connected to a multimeter output. To view these signals, open the Measurements library and copy the Multimeter block into your circuit. By clicking the Multimeter block, you can select the converter signals you want to output. Refer to the Multimeter block reference page for more information on how to use the Multimeter block.

By using Selector blocks of the Signal Routing library, you can now extract the needed signals from the three output vectors in order to visualize them:

1. Build the following subsystem in order to extract all the needed visualization signals. Name it ```Signal Selector```.

Signal Selector Subsystem

2. Connect the Motor, Conv., and Ctrl outputs of the DC3 block to the Motor, Conv., and Ctrl inputs of your Signal Selector block.

3. Copy two scopes to your model. They will be used to display the output signals of the Signal Selector block and the Multimeter block. For the first scope, open the Scope Parameters dialog box. On the General tab, set the number of axes to `4`, the simulation time range to `auto`, and use a decimation of `20`. Clear the Limit Data Points to last check box on the Data history tab. Connect the four outputs of the Signal Selector block to the inputs of the scope. Connect the output of the Multimeter block to the input of the second scope.

#### Setting the Fixed-Step Simulation Environment

All drive models of the library are discrete models. In order to simulate your system, you must now specify the correct simulation time step and set the fixed-step solver option. Recommended sample time values for DC drives, AC drives, and mechanical models can be found in the Remarks sections of the corresponding block reference pages. The recommended sample time for the DC3 model is 5 µs. Follow these steps:

1. Open the Simscape Power Systems library and copy a Powergui block into `DC_example`. Open the Powergui, click Configure Parameters, and in the Powergui block parameters dialog box set Simulation type to `Discrete`. Set the sample time to 5 µs.

Your circuit should now look like Thyristor Converter-Based DC Motor Drive Example Circuit.

2. Open the Simulation/Configuration Parameters dialog box. Select the `fixed-step`, ```Discrete (no continuous states)``` solver option. Set the stop time to `12` seconds.

Before simulating your circuit, you must first set the correct DC3 internal parameters.

#### Setting the High Power Drive Parameter Set

Many models of the Electric Drives library have two sets of parameters: a low-power set and a high-power set. By default, all models are initially loaded with the low-power set. The DC3 model parameters currently loaded in `DC_example` are those of a 5 hp drive.

You will now set the high-power drive parameters, which are those of a 200 hp drive. To do this, you will use the graphical user interface:

1. Open the user interface by double-clicking the DC3 block. The interface is shown.

DC3 User Interface

The interface is divided following the three main parts of a drive system: the motor parameters (DC Machine tab), the converter parameters (Converter tab), and the regulation parameters of the drive controller (Controller tab).

When you click the Load button, a window containing the low-power and high-power parameter files of every AC and DC model appears. These files contain all the parameters used by the graphical user interface. The name of each file begins with the model name followed by the power value. The 200 hp version of DC3 is thus named `dc3_200hp_params`.

3. In the parameters selection window, select the `dc3_200hp_params.mat` file and click Load.

The 200 hp parameters are now loaded. Note that you can also save custom drive parameters by using the Save button. When you do so, your custom parameters are saved in a MAT-file format and can be reloaded at any time.

#### Setting the Motor Inertia Value

All default inertias of the library drives are "no-load" inertias that only represent rotor inertias. When the motor is coupled to a load, the inertia field of the DC Machine tab represents the combined inertias of the rotor and of the driven load. In this example, the no-load inertia of the DC3 200 hp motor is 2.5 kg*m^2. Since the drive is directly coupled to a load, you must increase this value by the inertia of the load. Suppose that the new combined inertia amounts to 15 kg*m^2.

1. In the DC Machine section of the dialog box, change the inertia value to `15` kg*m^2.

2. Click OK to apply the changes and close the dialog box.

#### Setting the DC3 Controller Parameters and Simulation Results

The speed and current controllers of the DC3 block are both composed of a proportional-integral regulator. More details on the regulators of each drive model of the library can be found on the corresponding block reference pages. To have a quick idea of the internal structure of a drive controller, a schematic is available inside the user interface of each model. Let's open the schematics related to our DC3 model:

1. Open the user interface. Click the Controller tab and then the Schematic button. You should see the controller schematics as shown in Controller Schematics of the User Interface.

Controller Schematics of the User Interface

All default regulation parameters (speed and current controller parameters) have been trimmed for "no-load" inertias. Because the inertia has been modified, some changes are needed regarding the speed controller. The current controller should not be modified, the change of inertia having little influence on the current control.

In order to visualize the changes that need to be made, run a simulation of the present circuit.

2. Start the simulation. The simulation results visualized on the scope are shown below.

Simulation Results

Notice that the armature current follows its reference very well, but saturates at 450 A during the accelerating phase. This saturation is a result of the current controller reference limit of 1.5 pu. This results in insufficient acceleration torque, and the motor is unable to follow the 650 rpm/s default speed ramp. Since the acceleration torque cannot be increased (this would result in a burnout of the armature circuit), the speed ramp must be lowered. A guideline is to lower the speed ramp by the same amount that the inertia was increased. Indeed, following the equation below, the same torque vs. speed curve (or current vs. speed) as the default one obtained with a 2.5 kg*m^2 inertia can be obtained with the new inertia I, if the speed ramp $\stackrel{˙}{\omega }$ is reduced by an amount equal to the inertia increase.

`${T}_{em}\left(\omega \right)=I\cdot \stackrel{˙}{\omega }+{T}_{mec}+B\cdot \omega =I\cdot \stackrel{˙}{\omega }+{K}^{\prime }\cdot \omega +B\cdot \omega$`

The $B\cdot \omega$ term represents the viscous friction in the drive where B is the viscous friction coefficient.

In this case, we decrease the speed ramp slightly less than the inertia increase in order to have a high enough acceleration, and set it to 200 rpm/s.

3. Open the user interface. In the Controller section, set the acceleration speed ramp parameter of the speed controller menu to ```200 rpm/s```.

Change of the Acceleration Speed Ramp Parameter

4. Start the simulation and observe the new results on the scope.

Simulation Results with a New Acceleration Speed Ramp Value

The current regulation is very good, and no current regulator changes will be undertaken. The speed regulation is satisfactory, but some improvements could be made: the initial tracking of the speed reference could be faster, and the speed overshoot and the small speed ramping error encountered during the accelerating phase could be reduced. A modification of the proportional and integral gains of the PI speed regulator will allow you to achieve these goals:

• By increasing the proportional gain of the speed controller, you increase the controller's sensitivity by making it react a lot faster to small speed regulation errors. This allows a better initial tracking of the speed reference by a faster reaction of the current reference issued by the speed controller. This increased sensitivity also reduces the speed overshooting, the armature current being reduced a lot faster once the desired speed is reached.

• An increase of the integral gain will allow the motor speed to catch up with the speed reference ramp a lot faster during ramping periods. This will indeed allow a faster reaction to small speed error integral terms that occur when a signal is regulated following a ramp. The controller will react in order to diminish the speed error integral a lot faster by producing a slightly higher acceleration torque when following an acceleration ramp.

Be aware that too high an increase of the proportional and integral gains can cause instability, the controller becoming oversensitive. Too high gains can also cause current saturation. An easy way to adjust the speed controller gains is to increase them step by step and to simulate the new configuration after each change until the desired system performances are obtained (trial/error method).

Note that when the current controller has to be trimmed, a good way to achieve this is to keep the rotor still by setting a very high combined inertia value. This allows a decoupling of the electrical and mechanical parameters. You then adjust the current controller parameters until the current follows given current references perfectly. The same remarks can be made for the current regulator as those made above for speed regulation. Once the current regulator is trimmed, you can then trim the speed regulator by resetting the combined inertia to its initial value.

5. Try different speed regulator values and observe the resulting changes in the system dynamics. A proportional gain of 80 and an integral gain of 200 give very good results, as shown.

Simulation Results with Trimmed Speed Regulator Parameters

Observe that the firing angle value lowers with the speed increase in order to generate a growing converter output voltage. The converter is here working in rectifier mode, the power transiting from the AC source to the DC motor. The voltage increase allows the converter to keep feeding current to the DC motor during the acceleration phase, the armature voltage increasing proportionally with the speed. The current increase observed during this phase is due to the increasing torque opposed by the load. Around t = 8.5 s, the speed reaches its set point, and the armature current lowers to about 335 A since no more acceleration torque is needed.

Before concluding this example, notice the two first-order filters used in the speed and current controllers of Controller Schematics of the User Interface. These filters remove unwanted current and speed harmonics in the current and speed measurement signals. These harmonics are caused by the rectified output voltages of the three-phase full converters. The main ripple frequency introduced by a three-phase full converter is equal to six times the voltage source frequency (6th harmonic). In the case of this example, the first harmonic frequency is thus equal to 360 Hz. The cutoff frequency of the first-order filters must at least be lower than 360 Hz. Since the filters are first-order filters, the cutoff frequency must be a lot lower to have a reasonably good harmonic rejection. Keep in mind that too low a cutoff frequency can cause system instability. In the case of chopper drives like DC5, DC6, and DC7, the fundamental frequency is equal to the PWM frequency.

#### Simulating in Average-Value Mode

Most drive models can be simulated in average-value mode. In such mode, the Universal Bridge blocks used to simulate the power converters driving the motors are replaced by average-value converters. The average-value converter models used are described in the reference pages of each drive model. This lets you increase the simulation time step and thus increase simulation speed.

Use the following procedure to simulate a model in average-value mode.

1. Open the user interface. Select the `Average` option in the Model detail level drop-down list located in the lower part of the user interface, as shown in the following illustration.

Selecting the Average-Value Simulation Mode

2. Select the Converter section.

Notice that it contains some extra parameters specific to average-value mode. These parameters affect the external voltage source and are used by the average-value rectifier. All parameters are described in the reference pages.

Extra Parameters Used in Average-Value Mode

When simulating in average-value mode, the time step can be increased in order to run faster simulations. A guideline is to increase the time step up to the smallest controller sampling time used in the model. In this case the sampling time is the same for the speed and current controllers and is equal to 100 µs.

3. Close the user interface and open the Powergui block. Click Configure Parameters, and in the Powergui block parameters dialog box set Simulation type to `Discrete`. Set the sample time to 100 µs. Run the simulation.

Notice that the simulation time is reduced. Observe the simulation results: the rectifier output voltage and current ripples are not represented, you can see only the average value of these signals. If you later try to visualize the input current, you will only see the 60 Hz fundamental component of the detailed current.