> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/smart-power-simulation-software-sps/library-specific-guides/motor-drives/retune-the-drive-parameters.md).

# Retune the Drive Parameters

This example shows how to modify the parameters of an electric drive using the AC3 drive model. In this example, the nominal power of the motor changes from 200 hp to 5 hp.

Open the example: ac3\_example. Type `ac3_example` in the MATLAB® Command Window.

## Modify Motor Parameters

The parameters are set for a 200 hp motor.

1. Simulate the model in Accelerator mode and observe the results.
2. Double-click the Field-Oriented Control Induction Motor Drive block and select the **Asynchronous Machine** tab. Copy these parameters of the 5 hp motor into the drive's mask.

<table><thead><tr><th width="500.22216796875">Parameter</th><th>Value</th></tr></thead><tbody><tr><td><strong>Reference frame</strong></td><td>Rotor</td></tr><tr><td><strong>Discrete solver model</strong></td><td>Forward Euler</td></tr><tr><td><strong>Electrical parameters > Nominal values > Power</strong></td><td>3730</td></tr><tr><td><strong>Electrical parameters > Nominal values > Voltage</strong></td><td>460</td></tr><tr><td><strong>Electrical parameters > Nominal values > Frequency</strong></td><td>60</td></tr><tr><td><strong>Electrical parameters > Equivalent circuit values > Main winding stator > Resistance</strong></td><td>1.115</td></tr><tr><td><strong>Electrical parameters > Equivalent circuit values > Main winding stator > Leakage inductance</strong></td><td>0.005974</td></tr><tr><td><strong>Electrical parameters > Equivalent circuit values > Main winding stator > Mutual inductance</strong></td><td>0.2037</td></tr><tr><td><strong>Electrical parameters > Equivalent circuit values > Main winding rotor > Resistance</strong></td><td>1.083</td></tr><tr><td><strong>Electrical parameters > Equivalent circuit values > Main winding rotor > Leakage inductance</strong></td><td>0.005974</td></tr><tr><td><strong>Electrical parameters > Initial Currents > Ia_Magnitude</strong></td><td>0</td></tr><tr><td><strong>Electrical parameters > Initial Currents > Ia_Phase</strong></td><td>0</td></tr><tr><td><strong>Electrical parameters > Initial Currents > Ib_Magnitude</strong></td><td>0</td></tr><tr><td><strong>Electrical parameters > Initial Currents > Ib_Phase</strong></td><td>0</td></tr><tr><td><strong>Electrical parameters > Initial Currents > Ic_Magnitude</strong></td><td>0</td></tr><tr><td><strong>Electrical parameters > Initial Currents > Ic_Phase</strong></td><td>0</td></tr><tr><td><strong>Mechanical parameters > Inertia</strong></td><td>0.02</td></tr><tr><td><strong>Mechanical parameters > Friction factor</strong></td><td>0.005752</td></tr><tr><td><strong>Mechanical parameters > Pole pairs</strong></td><td>2</td></tr><tr><td><strong>Initial values > Slip</strong></td><td>1</td></tr><tr><td><strong>Initial values > Angle</strong></td><td>0</td></tr></tbody></table>

## Retune parameters of the flux regulator

1. To measure the signals associated to the flux regulator, add these blocks into the demux subsystem.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-ca792157e4870f368411d49fea2638100fe3a8ad%2FReturne_flux_regulator_param.png?alt=media" alt=""><figcaption></figcaption></figure>

2. Select the **Controller** tab in the mask of the Field-Oriented Control Induction Motor Drive block. Set the **Regulation type** to `Torque regulation` to access the controller parameters. The torque regulation mode is required to bypass the speed regulator parameters and act directly on the field-oriented control (FOC) controller. The current controlled by the FOC controller depends of the machine flux. The flux controller ensures that the required flux is correctly applied to the machine.
3. Copy these parameters into the drive’s mask:

<table><thead><tr><th width="500.22216796875">Parameter</th><th>Value</th></tr></thead><tbody><tr><td><strong>Machine flux > Initial</strong></td><td>0.705</td></tr><tr><td><strong>Machine flux > Nominal</strong></td><td>0.705</td></tr><tr><td><strong>Field oriented control > Flux controller > Proportional gain</strong></td><td>1</td></tr><tr><td><strong>Field oriented control > Flux controller > Integral gain</strong></td><td>0</td></tr><tr><td><strong>Field oriented control > Flux controller > Low-pass filter cutoff frequency</strong></td><td>10e3</td></tr><tr><td><strong>Field oriented control > Flux controller > Flux output limits > Negative</strong></td><td>-0.705*1.5</td></tr><tr><td><strong>Field oriented control > Flux controller > Flux output limits > Positive</strong></td><td>0.705*1.5</td></tr><tr><td><strong>Field oriented control > Current controller Hysteresis bandwidth</strong></td><td>1</td></tr></tbody></table>

4. To apply the nominal torque to the motor, modify the parameters of the [Stair Generator](https://opal-rt.atlassian.net/wiki/spaces/PSPS/pages/1551698938/Stair+Generator) blocks in the Speed reference subsystem and in the Load torque subsystem.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-d8938da95d13fb6c2981282f5f37c4d39e74511a%2FReturne_flux_generator_mask.png?alt=media" alt=""><figcaption></figcaption></figure>

5. On the **Logging** tab of the Scope block, set **Decimation** to 1 and **Variable name** to `simout1`. Select **Log data to workspace** and set **Save format** to `Structure With Time`.
6. Simulate the system for 0.5 s. Open the **FFT Analysis** tool of the [powergui](https://opal-rt.atlassian.net/wiki/spaces/PSPS/pages/1551732821/powergui) block.\
   In the **Input** list, select the `Stator current` signal and set **Start time** to `0.23`, **Number of cycles** to `1`, **Fundamental frequency** to `7.5`, and **Max Frequency (Hz)** to `20000` Hz.\
   Click **Display** to get the FFT graph.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-9d0a9c20c8c4a3a7c8d59524e811ffb34e81fb4c%2FReturnes_flux_generator_graph.png?alt=media" alt=""><figcaption></figcaption></figure>

7. Note that the switching frequency is about 5 kHz. To attenuate this frequency, set the Flux controller **Low-pass filter cutoff frequency** parameter to 500 Hz.
8. Open the Scope block and observe the flux signal. Note that the steady-state error is high.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-9a37b8cf3c594d6e9181eb69e04ae2020f645862%2Fmoddriveparam_ac3_fluxbadreg.gif?alt=media" alt=""><figcaption></figcaption></figure>

9. Gradually increase the Flux controller **Proportional gain** parameter and simulate until you obtain a satisfactory response. Increasing the gain above a certain value can cause a saturation of the Flux controller. The curve at the next plot is based on a proportional gain of 100.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-e3d0381a5e1aacaf6ad0eec2607346753ee176bc%2Fmoddriveparam_ac3_fluxkp.gif?alt=media" alt=""><figcaption></figcaption></figure>

10. Gradually increase the Flux controller **Integral gain** and simulate until you obtain a satisfactory steady-state result with minimal error. The next plot is based on an integral gain of 90.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-8269f326c89c4efc26e59e20888ced88381c85e9%2Fmoddriveparam_ac3_fluxgoodreg.gif?alt=media" alt=""><figcaption></figcaption></figure>

## Retune Parameters of the Speed Regulator

1. Select the **Controller** tab in the mask of Field-Oriented Control Induction Motor Drive block and set the **Regulation type** to `Speed regulation` to edit the controller parameters.

<table><thead><tr><th width="500.22216796875">Parameter</th><th>Value</th></tr></thead><tbody><tr><td><strong>Speed controller > Torque output limits> Negative</strong></td><td>-1200*1.5</td></tr><tr><td><strong>Speed controller > Torque output limits> Positive</strong></td><td>1200*1.5</td></tr><tr><td><strong>Speed controller > PI regulator > Proportional gain</strong></td><td>1</td></tr><tr><td><strong>Speed controller > PI regulator > Integral gain</strong></td><td>0</td></tr><tr><td><strong>Speed controller > Speed cutoff frequency</strong></td><td>500</td></tr><tr><td><strong>Field oriented control > Maximum switching frequency</strong></td><td>500</td></tr></tbody></table>

The speed ramp acceleration must be calculated to avoid exceeding the torque output limit. The required torque to accelerate the motor at 1750 rpm/s is given by:

$$
T\_{accel}=J\cdot\frac{\mathrm{Accel}*{(\mathrm{rpm}/\mathrm{s})}}{30}\cdot\pi \\\[8pt]
T*{accel}=0.02\cdot\frac{1750}{30}\cdot\pi=3.67,\mathrm{Nm} \\\[8pt]
$$

2. To apply the nominal torque to the motor, modify the parameters of the [Stair Generator](https://opal-rt.atlassian.net/wiki/spaces/PSPS/pages/1551698938/Stair+Generator) blocks in the Speed reference subsystem and in the Load torque subsystem.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-1540da45b3cc08c62b7625c53f1c3c0cecfa5ecd%2Ffig_3_1425753.png?alt=media" alt=""><figcaption></figcaption></figure>

3. Set the scope decimation to 25 to prevent memory overload. Start the simulation.\
   Observe the speed signal on the Scope block. The steady state error is high and the response time is not acceptable.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-b02455725baa1f5d51fe6408ed8e697971b2dded%2Fmoddriveparam_ac3_speedbadreg.gif?alt=media" alt=""><figcaption></figcaption></figure>

4. Gradually increase the **Proportional gain** parameter of the speed controller and simulate until you obtain a satisfactory response time without overshoot. Note that if the gain is too high, the system will be oscillatory. The next plot is based on a proportional gain of 3.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-c2b8d9e116a4d36ee33b2de7b070f263782dc458%2Fmoddriveparam_ac3_speedkp.gif?alt=media" alt=""><figcaption></figcaption></figure>

5. Gradually increase the **Integral gain** of the speed controller and simulate until you obtain a satisfactory steady state value with a minimal steady-state error. This curve is based on an integral gain of 100.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-f5bbf2f7fd33f494a4a94158304b22931b675b35%2Fmoddriveparam_ac3_speedgoodreg.gif?alt=media" alt=""><figcaption></figcaption></figure>

## Retune Parameters of the DC Bus Voltage

1. Select the **Converter and DC bus** tab in the mask of the Field-Oriented Control Induction Motor Drive block to tune the DC bus capacitor and the braking chopper parameters.
2. Set the **DC Bus Capacitance** parameter to 167e-6.

The DC bus capacitance is calculated in order to reduce the voltage ripple.

$$
C=\frac{P\_{motor}}{12f \cdot \Delta\_v \cdot V\_{DC}}
$$

where:

* *P*<sub>*motor*</sub> is the nominal power of the motor drive (W).
* *f* is the frequency of the AC source (Hz).
* Δ<sub>V</sub> is the desired voltage ripple (V).
* *V*<sub>*DC*</sub> is the average DC Bus voltage (V).

The motor drive of 5 hp (3728 W) is fed by a 60 Hz three-phase source. The average DC bus voltage is given by:

$$
V\_{DC} = 1.35 V\_{LL}
$$

where *V*<sub>*LL*</sub> represents the line to line rms voltage of the source. The source line to line voltage is 460 Vrms so the DC voltage is *V*<sub>*DC*</sub>= 621 V.

$$
C=\frac{3728}{12 \cdot 60 \cdot 50 \cdot 621}=167 \mu F
$$

3. Set the **Braking chopper Shutdown voltage** to 660V and the **Braking chopper Activation voltage** to 700 V.

In motor mode, the peak voltage of the DC bus is equal to

$$
V\_{peak}=V\_{LL} \cdot \sqrt{2}=460\sqrt{2}=650 V
$$

The shutdown voltage (V<sub>shut</sub>) of the braking chopper should be a little bit higher than this value. To limit the voltage increase during regenerative braking, shutdown voltage is set to 660 V, and the activation voltage (V<sub>act</sub>) is set to 700 V.

4. Set the Braking chopper **Resistance** to 131 ohms.

The braking chopper resistance is calculated using this equation:

$$
R=\frac{V^2\_{act}}{P\_{motor}}=\frac{700^2}{3728}=131 \Omega
$$

#### Simulate and Analyze the Results

Simulate the system and observe six sections of the simulation results.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-62b4f74427560142f9b365a2c68f747342f67e93%2Felectric_drives23.gif?alt=media" alt=""><figcaption></figcaption></figure>

<i class="fa-circle-1">:circle-1:</i> No-load acceleration

<i class="fa-circle-2">:circle-2:</i> Nominal load torque is applied

<i class="fa-circle-3">:circle-3:</i> Steady state speed

<i class="fa-circle-4">:circle-4:</i> Nominal generation torque is applied: Observe the DC bus voltage overshoot

<i class="fa-circle-5">:circle-5:</i> Deceleration

<i class="fa-circle-6">:circle-6:</i> Negative speed acceleration


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/smart-power-simulation-software-sps/library-specific-guides/motor-drives/retune-the-drive-parameters.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
