> 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/courseware/electric-courseware/electric-motor-drives/brushed-dc-motor-dcm-drive/virtual-test-bench-overview.md).

# Virtual Test Bench Overview

## Virtual test bench diagram

The diagram of the virtual laboratory test bench is shown in figure 1.&#x20;

<figure><img src="https://4054096626-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYbyVjpgEQX9nfCkpYoFP%2Fuploads%2FwootBVKwkXwdwoP27xGr%2Fa05c71cf-e845-47b6-aa18-5a886c896b34.png?alt=media&amp;token=e4d9f5ee-6a4e-4e66-85ee-eb2a17c7d72f" alt="" width="450"><figcaption><p><strong>Figure 1</strong>: Virtual Test Bench of the DCM Drive</p></figcaption></figure>

The major elements in the test bench are:

* The **DC motor** under test (**MUT**) with adjustable field voltage *Vf*.
* A **DC machine** with adjustable field voltage and a variable load.
* **Command switches** (<mark style="color:$danger;">**K1**</mark>) and (<mark style="color:$danger;">**K2**</mark>) allow connecting the MUT and DCM to the single-phase two-level inverter, while (<mark style="color:$danger;">**K3**</mark>) allows the connection (disconnection) of the variable load to (from) DCM.
* A **mechanical shaft** coupling the DCM and MUT.
* A **protection system** composed of fuses connected in series with the windings from both machines.
* A **single-phase two-level inverte**r as armature voltage to either the MUT or the DCM.

The different modules covered in this laboratory are discussed next.

## DC motor parameters identification <a href="#dc-motor-parameters-identification" id="dc-motor-parameters-identification"></a>

### Determination of the back-emf constant *Ke* <a href="#determination-of-the-back-emf-constant-ke" id="determination-of-the-back-emf-constant-ke"></a>

The back electromotive force (emf) that is generated in a DC motor is directly proportional to the speed ω of the motor [\[2\]](https://www.opal-rt.com/docs/courseware/electric-courseware/electric-motor-drives/brushed-dc-motor-dcm-drive/references.md).

$$\\\[8pt]E\_{b} = \omega K\_{e} ; (1)\\\[8pt]$$\
To determine *Ke*, the MUT is driven at a certain speed by the DC machine running as a motor (see figure 2).\
During this test, switch (<mark style="color:$danger;">**K1**</mark>) is closed, and the MUT armature voltage is open.

<figure><img src="https://4054096626-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYbyVjpgEQX9nfCkpYoFP%2Fuploads%2FDpGmysyMzxZlXL9Y2tq4%2F9c6cb7e1-4cb3-43d5-87c0-b3fdae91f332.png?alt=media&amp;token=908c7048-ad3d-4178-b165-c7acf5daceef" alt="" width="450"><figcaption><p><strong>Figure 2</strong>: Open Circuit Test for the Determination of Ke</p></figcaption></figure>

By varying the applied voltage, different switching pulses are generated to drive the inverter, which then applies different voltages to the DCM armature.\
This leads to the DCM driving the MUT at different speeds that are recorded, while at the same time measuring the open circuit armature voltage *Va*.\
The student can then plot the speeds and the measured Va values and find the slope of this line.\
This slope corresponds to *Ke* as seen from equation (1) above.

### Determination of the armature resistance *Ra* <a href="#determination-of-the-armature-resistance-ra" id="determination-of-the-armature-resistance-ra"></a>

To estimate the MUT armature resistance, a varying voltage is applied to its armature via the inverter.\
The MUT drives the DCM running as a generator which is connected or not to a variable load resistance (see figure 3).\
The armature voltage of the MUT can be written as:\
$$\\\[8pt]V\_{a} = R\_{a} I\_{a} + K\_{e}\omega + L\_{a}\frac{d i\_{a}}{dt} ; (2)\\\[8pt]$$

Under the assumption of steady state, equation (2) is rewritten as:\
$$\\\[8pt]V\_{a} = R\_{a} I\_{a} + K\_{e}\omega ; (3)\\\[8pt]$$

<figure><img src="https://4054096626-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYbyVjpgEQX9nfCkpYoFP%2Fuploads%2F0qjzq0PhGhZwKnrPoUko%2F61f727d9-a458-439c-9b83-7cfc356371ec.png?alt=media&amp;token=b0f4fe71-ebd2-46b5-b7b2-d16ffb9f0743" alt="" width="450"><figcaption><p><strong>Figure 3</strong>: Steady State Test for the Determination of Ra</p></figcaption></figure>

From (3), *Ra* is obtained as:

$$
\\\[8pt]R\_{a} = \frac{V\_{a} - K\_{e}\omega}{I\_{a}} ; (4)\\\[8pt]
$$

With *Ke* known, one can determine *Ra* by measuring the armature voltage *Va* and current Ia of the MUT, and its speed ω (referred to as *N* in figure 3) for a random operating point.\
For a more accurate result, the student can test many different operating points, and then take the average result as an estimation of the armature resistance.

### Determination of the armature inductance *La* <a href="#determination-of-the-armature-inductance-la" id="determination-of-the-armature-inductance-la"></a>

<figure><img src="https://4054096626-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYbyVjpgEQX9nfCkpYoFP%2Fuploads%2FKPU7VdJ3ZD0vWZt8Zyyu%2Fe8a5e9a4-fadf-4efc-af3f-473ec0d5c8fc.png?alt=media&amp;token=088a5afe-e6b5-48fd-8d70-358222e15a9d" alt="" width="450"><figcaption><p><strong>Figure 4</strong>: Blocked Rotor Test for the Determination of La</p></figcaption></figure>

To estimate the armature inductance, the motor under test must be held in a standstill, ω = 0 (locked rotor), as shown in figure 4.\
Therefore, equation (2) above simplifies to:

$$
\\\[8pt]V\_{a} = R\_{a} I\_{a} + L\_{a}\frac{d i\_{a}}{dt} ; (5)\\\[8pt]
$$

At time $$t = 0^{+}$$ (right after a step voltage is applied), the instantaneous current is $$i\_{a}(0^{+}) = 0$$ so we can say from the voltage equation in (5) that:

$$
V\_{a} = L\_{a}\left(\frac{d i\_{a}}{dt}\right)\_{t = 0^{+}} ; (6)
$$

From (6), one can determine the value of *La* by measuring *Va* during the block rotor test and the slope of the armature current right after the step voltage is applied.\
It is important to mention that during the blocked rotor test, the applied voltage should not exceed 10% of the MUT nominal voltage.

{% hint style="info" %}
The parameters *Ke*, *Ra*, and *La* are defined as the **electrical parameters** of the brushed-DC motor under test.
{% endhint %}

### Determination of the friction torque Tf and friction coefficient *B* <a href="#determination-of-the-friction-torque-tf-and-friction-coefficient-b" id="determination-of-the-friction-torque-tf-and-friction-coefficient-b"></a>

<figure><img src="https://4054096626-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYbyVjpgEQX9nfCkpYoFP%2Fuploads%2F14SrzD73qJZ2QEHVyarT%2Ff98f85bc-aa61-4d0b-ad26-f5fa20ab5334.png?alt=media&amp;token=a55f362c-ee75-421f-aaba-dca42bed78a0" alt="" width="450"><figcaption><p><strong>Figure 5</strong>: Identification of Friction Parameters</p></figcaption></figure>

The equation for the electrical torque in steady state (constant speed) can be approximated by a friction-type model [\[2, 3\]](https://www.opal-rt.com/docs/courseware/electric-courseware/electric-motor-drives/brushed-dc-motor-dcm-drive/references.md):

$$
\\\[8pt]T\_{e} = T\_{L} + B\omega + T\_{f} ; (7)\\\[8pt]
$$

where $$T\_{e}$$ is the MUT electromagnetic torque \[Nm] and $$T\_{L}$$ is the load torque applied on the shaft \[Nm].\
In a no-load test, there is no load torque $$(T\_{L}=0)$$ and the expression simplifies to:

$$
\\\[8pt]T\_{e} = B\omega + T\_{f} ; (8)\\\[8pt]
$$

To simulate the no-load test, the MUT drives the DCM running as a generator with switch <mark style="color:$danger;">**K3**</mark> open (see figure 5 above).\
The student can apply different voltage values and record the speed and armature current of the MUT.\
With the armature current known, the electromagnetic torque can be calculated as:

$$
\\\[8pt]T\_{e} = k\_{T} I\_{a}, \qquad k\_{T},\[\mathrm{Nm/A}] = K\_{e},\[\mathrm{Vs/rad}] ; (9)\\\[8pt]
$$

Finally, plot the values of speed (x-axis) vs *Te* and find the slope of the line and the y-intercept.\
The slope corresponds to the friction coefficient *B*, and the y-intercept to the friction torque *Tf*.&#x20;

### Determination of the moment of inertia *J* <a href="#determination-of-the-moment-of-inertia-j" id="determination-of-the-moment-of-inertia-j"></a>

<figure><img src="https://4054096626-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYbyVjpgEQX9nfCkpYoFP%2Fuploads%2FZWn9GyypPS8Ac6G0vXOQ%2F2b48d429-dcc2-4bf5-83c5-145c6506d30d.png?alt=media&amp;token=00f16a50-b64a-4f01-a1a7-76795f79d1be" alt="" width="450"><figcaption><p><strong>Figure 6</strong>: Identification of the Moment of Inertia</p></figcaption></figure>

The equation for the electrical torque in transient state (acceleration or deceleration) is as follows:

$$
\\\[8pt]T\_{e} = T\_{L} + B\omega + T\_{f} + J\frac{d\omega}{dt} ; (10)\\\[8pt]
$$

If the motor is instantly shut off from steady state and there is no applied load torque, we obtain:

$$
\\\[8pt]0 = B\omega\_{0} + T\_{f} + J\left(\frac{d\omega}{dt}\right)\_{t = 0^{+}} ; (11)\\\[8pt]
$$

Where $$\omega\_0$$ is the speed \[rad/s] at shutoff time $$t=0^-$$.\
From this, we can isolate the moment of inertia:

$$
\\\[8pt]J = -\frac{B\omega\_{0} + T\_{f}}{\left(\dfrac{d\omega}{dt}\right)*{t = 0^{+}}}
\= -\frac{k*{T} i\_{a}(0^{-})}{\left(\dfrac{d\omega}{dt}\right)\_{t = 0^{+}}} ; (12)\\\[8pt]
$$

As shown in figure 6 above, the MUT is mechanically coupled to the DC machine acting as a generator for the determination of the inertia *J*.\
With switch <mark style="color:$danger;">**K2**</mark> closed, the model runs until steady state is reached, then the motor is shut off.\
A plot of decreasing motor speed is obtained from this operation.\
To find the inertia, equation (12) is used by considering two points at the very beginning of the decreasing slope.\
The current $$i\_{a}(0^{-})$$ is the armature current at the shutoff time $$t=0^{-}$$ , while $$k\_{T}$$ is equal to the back-emf constant Ke (see equation (9) above).

{% hint style="info" %}
The parameters $$T\_{f}$$, *B*, and J are defined as the **mechanical parameters** of the brushed-DC motor under test.
{% endhint %}

## DC motor current control <a href="#dc-motor-current-control" id="dc-motor-current-control"></a>

The first and simplest way to control a DC motor is with a current control loop (see figure 7).\
This is because in a DC motor, the torque and the current have a purely linear relationship.\
The objective is to output a voltage that can achieve a current in the machine that matches the input reference current.\
A simple proportional-integral (PI) controller can then be designed for the current of the DC motor.\
Such a controller has a transfer function of the following form (note that for simplicity, the equations are shown in the Laplace domain, but know that in this laboratory they are implemented in the discrete domain as it is a requirement for real-time simulation):

$$
\\\[8pt]G\_{I}(s) = k\_{pI} + \frac{k\_{iI}}{s}
\= \frac{k\_{iI}}{s}\left(1 + \frac{s}{k\_{iI}/k\_{pI}}\right) ; (13)\\\[8pt]
$$

<figure><img src="https://4054096626-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYbyVjpgEQX9nfCkpYoFP%2Fuploads%2FMUAEgW3d8mCABRgG91aE%2F5076083a-3dca-4923-817f-998368d77093.png?alt=media&amp;token=032da0e8-66f3-4eab-a652-3c2f7da4f3e1" alt=""><figcaption><p><strong>Figure 7</strong>: Closed-Loop Current Control</p></figcaption></figure>

There are multiple methods to calculate proper values for the gain constants $$k\_{iI}$$ and $$k\_{pI}$$.\
One method is to analyze the transfer function of the electrical model of the DC motor:

$$
\\\[8pt]G\_{Me}(s) = \frac{1}{R\_{a} + L\_{a}s} = \frac{\tfrac{1}{R\_{a}}}{1 + \tfrac{s}{1/\tau\_{e}}}, \qquad \tau\_{e} = \frac{L\_{a}}{R\_{a}}\\\[8pt]
$$

Since there is a pole at $$\frac{1}{\tau\_{e}}$$in the motor transfer function, we select the gain constants such as to cancel out this pole in the overall transfer function:

$$
\\\[8pt]G(s)=\left\[\frac{k\_{iI}}{s}\left(1+\frac{s}{k\_{iI}/k\_{pI}}\right)\right],\[V\_{DC}]\left\[\frac{\tfrac{1}{R\_{a}}}{1+\left(\tfrac{s}{1/\tau\_{e}}\right)}\right]\\\[8pt]
$$

This can be done by enforcing the condition:

$$
\\\[8pt]\frac{k\_{iI}}{k\_{pI}} = \frac{1}{\tau\_{e}}\\\[8pt]
$$

Performing this cancellation and manipulating the system’s transfer function allows for the following relationships for the gain constants to be found:

$$
\\\[8pt]k\_{iI} = \frac{\omega\_{cI} R\_{a}}{V\_{DC}} \qquad k\_{pI} = k\_{iI}\tau\_{e} = k\_{iI}\frac{L\_{a}}{R\_{a}}\\\[8pt]
$$

where $$\omega\_{cI}$$ is the selected crossover frequency in rad/s.\
For best performance, we select this value to be about two orders of magnitude smaller than the switching frequency of the PWM carrier signal because we wish to avoid interference in the loop from noise in the switching frequency (in our case $$f\_{PWM}$$=1980 Hz, so we could approximately choose $$f\_{cI}$$ =20 Hz).

{% hint style="info" %}
The parameter V<sub>DC</sub> is the input DC voltage of the single-phase two-level inverter, and its value is 460 V.\
More details are provided later about the parameters and ratings of the different test bench components.
{% endhint %}

## DC Motor Speed Control <a href="#dc-motor-speed-control" id="dc-motor-speed-control"></a>

The idea for speed control is similar to current control, except that the input to the control loop is the reference speed N\*.\
The output of the speed controller yields a torque reference T\* which is multiplied by a gain *K* to become the reference input current to the current PI controller (see figure 8).\
In other words, the speed control forms the outer loop and current control is the inner loop of the overall system.\
The actual machine speed is fed back into the PI speed regulator to correct for errors.&#x20;

<figure><img src="https://4054096626-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYbyVjpgEQX9nfCkpYoFP%2Fuploads%2F5uqNiYl2qR0PNoxqFg0l%2F476accd5-0e0f-439a-9085-3a2885ce604d.png?alt=media&amp;token=3fe50cfa-401a-4707-8ac4-2fce108f40b2" alt=""><figcaption><p><strong>Figure 8</strong>: Closed-Loop Speed Control</p></figcaption></figure>

{% hint style="info" %}
The gain *K* is the inverse of the back-emf constant: *K* = 1/K<sub>e</sub>.
{% endhint %}


---

# 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/courseware/electric-courseware/electric-motor-drives/brushed-dc-motor-dcm-drive/virtual-test-bench-overview.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.
