> 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/example-models/motor-drives/ac-drives/ac7-brushless-dc-motor-drive-during-speed-regulation.md).

# AC7 - Brushless DC Motor Drive During Speed Regulation

This example shows the AC7 Brushless DC Motor Drive during speed regulation.

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

O.Tremblay, L.-A. Dessaint (Ecole de technologie supérieure, Montreal)

## Description <a href="#description" id="description"></a>

This circuit uses the AC7 block of SPS library. It models a brushless DC motor drive with a braking chopper for a 3HP motor.

The permanent magnet synchronous motor (with trapezoidal back-EMF) is fed by a PWM voltage source inverter, which is built using a Universal Bridge Block. The speed control loop uses a PI regulator to produce the torque reference for the current control block. The current control block computes the three reference motor line currents, in phase with the back electromotive forces, corresponding to the torque reference and then feeds the motor with these currents using a three- phase current regulator.

Motor current, speed, and torque signals are available at the output of the block.

## Simulation <a href="#simulation" id="simulation"></a>

Start the simulation. You can observe the motor stator current, the rotor speed, the electromagnetic torque and the DC bus voltage on the scope. The speed set point and the torque set point are also shown.

At time t = 0 s, the speed set point is 300 rpm. Observe that the speed follows precisely the acceleration ramp.

At t = 0.5 s, the full load torque is applied to the motor. You can observe a small disturbance in the motor speed, which stabilizes very quickly.

At t = 1 s, the speed set point is changed to 0 rpm. The speed decreases down to 0 rpm following precisely the deceleration ramp.

At t = 1.5 s., the mechanical load passes from 11 Nm to -11 Nm. The motor speed stabilizes very quickly after a small overshoot.

Finally, note how well the DC bus voltage is regulated during the whole simulation period.

#### Notes <a href="#notes" id="notes"></a>

1. The power system has been discretized with a 2 us time step. The speed controller uses a 140 us sample and the current controller uses a 20 us sample time in order to simulate a microcontroller control device.
2. To calculate automatically the speed regulator gains, double-click on the PI gain calculator icon. Enter the mechanical parameters of the machine and click on the "Enter specification" checkbox. Enter the desired specifications and click on the "Calculate Kp and Ki" checkbox.

If you don't know the specifications, uncheck the "Enter specification" checkbox and enter the electrical parameters of the machine. Click on the "Machine natural frequency" checkbox to obtain the open-loop machine response. After, click on the "Enter specification" checkbox to enter a response time faster than the open loop response time and click on the "Calculate Kp and Ki" checkbox.

3. To obtain the operation regions of the drive system, double-click on the Speed-Torque curve icon. Enter the machine parameters, the DC bus voltage, the output torque limit and the acceleration speed ramp and click on the "Plot Speed-Torque curve" checkbox.
4. A simplified version of the model using average-value inverter can be used by selecting 'Average' in the 'Model detail level' menu of the graphical user-interface. The time step can then be increased up to 40 us. This can be done by typing 'Ts = 40e-6' in the workspace, by setting current control sample time to 40e-6 and by setting Speed controller sample time to 120e-6 in the case of this example. See also **ac7\_example\_simplified** model.

## Command <a href="#command" id="command"></a>

Example model name: ac7\_example

{% code lineNumbers="true" expandable="true" %}

```matlab
open('ac7_example')
```

{% endcode %}


---

# 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/example-models/motor-drives/ac-drives/ac7-brushless-dc-motor-drive-during-speed-regulation.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.
