Use the SPWM Generators to generate sinusoidal pulse width modulated signals on the FPGA.  These signals can be mapped directly to the circuit model Switches

### SPWM Generators Section Channels

In the System Explorer window configuration tree, expand the Power Electronics Add-On custom device, then Circuit Model >> SPWM Generators to display the following subsections and custom device channels.  Assign values to the channels to configure the SPWM Generators.

 Channel Name Type Units Default Value Description SPWM Carrier Carrier Frequency Input Hz 5000 Hz Frequency of the Carrier signal. Modulation Index Input 1 Amplitude of the Modulation signal. SPWM Frequency Generators SPWM Frequency Engine X Input Hz 60 Hz Frequency of the Modulation signal. SPWM Generator X Dead Time Input Seconds 0 s Time during which both the SPWM signal and its complementary are held in an inactive state, immediately before the SPWM signal goes active. Frequency Engine Input 0 Index of the SPWM Frequency Engine used to generate the PWM signal.Setting a value of 2 will connect SPWM Frequency Engine 2 to the SPWM generator. Use the same SPWM Frequency Engine with multiple different SPWM generators to ensure that they stay phase locked in time. Phase Input Degrees 0 Phase offset of the generated SPWM signal relative to the other SPWM signals using the same frequency engine.

### SPWM Generators Description

Sine Triangle PWM is a common modulation technique for converting DC power sources into AC power sources.  In the Power Electronics Add-On, the specific implementation of the SPWM generators allows for multiple SPWM signal outputs, but only one carrier frequency and one modulation index.  Frequency Engines are responsible for storing the current phase for signals based on their frequency and a free-running clock on the FPGA represented as 'time' in equation

 Frequency~Engine~X~Phase = 2*\pi*{SPWM~Frequency~Engine~X}*time

Each SPWM Generator can select which Frequency Engine to use through the Frequency Engine channel.

 Modulation~Signal = Modulation~Index * \sin (Frequency~Engine~X~Phase + Phase)

Modulation & carrier signals are internal signals used for storing the current state of each individual SPWM generator.  The carrier signal is a triangle wave whose frequency is set by the Carrier Frequency channel.  The amplitude of the Modulation signal is set through the Modulation Index channel.

 SPWM~Signal = $\begin{cases} True & Modulation~Signal > Carrier~Signal \\ False & Modulation~Signal < Carrier~Signal \end{cases}$

When the Modulation signal is greater than the Carrier Signal, the SPWM generator outputs True, otherwise it outputs False.  The animation below shows the internal Modulation and Carrier signals with the corresponding SPWM signal.  In this example, the Modulation Index is 0.6.