> 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/power-converters/space-vector-pwm-modulator.md).

# Space-Vector PWM modulator

This example shows the open-loop speed control of an induction motor using constant V/Hz principle and a space vector (SV) PWM technique.

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

## Description

A 3-phase squirrel-cage motor rated 3 HP, 220 V, 60 Hz, 1725 rpm is fed by a 3-phase MOSFET inverter connected to a DC voltage source of 325 V. The inverter is modeled using the "Universal Bridge" block and the motor by the "Asynchronous Machine" block. Its stator leakage inductance Lls is set to twice its actual value to simulate the effect of a smoothing reactor placed between the inverter and the machine. The load torque applied to the machine's shaft is constant and set to its nominal value of 11.9 N·m.

The firing pulses to the inverter are generated by the "Space-Vector PWM modulator" block of the SPS library. The chopping frequency is set to 1980 Hz and the input reference vector to "Magnitude-Angle".

Speed control of the motor is performed by the "Constant V/Hz" block. The magnitude and frequency of the stator voltages are set based on the speed setpoint. By varying the stator voltages magnitude in proportion with frequency, the stator flux is kept constant.

## Simulation

Start the simulation. Since the initial states have been automatically loaded, the simulation should start in steady-state. The initial motor speed should be 1720 RPM and the rms value of the stator voltages should be 220 V @ 60 Hz.

At 0.1 s, the speed setpoint is changed from 1725 to 1300 RPM. You can observe the system dynamic by looking inside Scope 1. When the motor reaches a constant speed of 1275 RPM, the stator voltage rms value is down to 165.8 V and the frequency to 45.2 Hz.

Stator voltage (phase AB) and phase A current waveforms can be observed in the "V-I Stator" Scope. You can do a FFT of these two quantities using the powergui FFT Analysis.

### Regenerate Initial Conditions

The initial states required to start this model in steady state with a 1725 rpm reference speed and an 11.9 N·m load torque have been saved in the "SVPWMConverterInit.mat" file. When you open this model, the InitFcn callback (in the Model Properties/Callbacks) automatically loads into your workspace the contents of this .mat file ("xInitial" variable).

If you modify this model, or change parameter values of power components, the initial conditions stored in the "xInitial" variable will no longer be valid and Simulink® will issue an error message. To regenerate the initial conditions for your modified model, follow the steps below:

{% stepper %}
{% step %}
**Disable initial state export**

In the Simulation → Configuration Parameters → Data Import/Export Parameters menu, clear the "Initial state" parameter.
{% endstep %}

{% step %}
**Prevent the speed setpoint change**

Double click on the Step block labeled "Speed Setpoint (RPM)" and temporarily disable the change of reference speed by multiplying the Step time by 100.
{% endstep %}

{% step %}
**Use Accelerator mode**

Change the Simulation Mode from "Normal" to "Accelerator".
{% endstep %}

{% step %}
**Run simulation to steady state**

Start simulation. When simulation is completed, verify that steady state has been reached by looking at waveforms displayed on the scopes. The final states which have been saved in the "xFinal" structure with time can be used as initial states for future simulations.

Execute the following commands to copy the final conditions into "xInitial" and save this variable in a new file (myModel\_init.mat):

{% code lineNumbers="true" %}

```matlab
>> xInitial=xFinal;
>> save myModel_init xInitial
```

{% endcode %}
{% endstep %}

{% step %}
**Update InitFcn callback**

In File → Model Properties → Callbacks → InitFcn window, change the name of the initialization file from "SVPWMConverterInit" to "myModel\_init". Next time you open this model, the variable xInitial saved in the myModel\_init.mat file will be loaded in your workspace.
{% endstep %}

{% step %}
**Re-enable initial state export**

In the Simulation → Configuration Parameters menu, check "Initial state".
{% endstep %}

{% step %}
**Verify the model starts in steady-state**

Start simulation and verify that your model starts in steady-state.
{% endstep %}

{% step %}
**Restore the speed setpoint change**

Double click on the Step block labeled "Speed Setpoint (RPM)" and re-enable the change of reference speed at t=0.1 s (remove the 100 multiplication factor in the Step time).
{% endstep %}

{% step %}
**Return to Normal mode and save**

Change the Simulation Mode back to Normal and save your model.
{% endstep %}
{% endstepper %}

## Command

Example model name: power\_svpwm

{% code lineNumbers="true" %}

```matlab
open('power_svpwm')
```

{% 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/power-converters/space-vector-pwm-modulator.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.
