> 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/simulation-and-analysis/use-the-phasor-simulation-method.md).

# Use the Phasor Simulation Method

## Introduction

In this section, you

* apply the phasor simulation method to a simple linear circuit
* learn advantages and limitations of this method

Up to now you have used two methods to simulate electrical circuits:

* simulation with variable time steps using the continuous Simulink® solvers
* simulation with fixed time steps using a discretized system

This section explains how to use a third simulation method, the phasor solution method.

## When to use the phasor solution

The phasor solution method is mainly used to study electromechanical oscillations of power systems consisting of large generators and motors. An example of this method is the simulation of a multimachine system in [Three-Phase Systems and Machines](https://www.opal-rt.com/docs/smart-power-simulation-software-sps/library-specific-guides/machines/three-phase-systems-and-machines.md). However, this technique is not restricted to the study of transient stability of machines. It can be applied to any linear system.

If, in a linear circuit, you are interested only in the changes in magnitude and phase of all voltages and currents when switches are closed or opened, you do not need to solve all differential equations (state-space model) resulting from the interaction of R, L, and C elements. You can instead solve a much simpler set of algebraic equations relating the voltage and current phasors. This is what the phasor solution method does. As its name implies, this method computes voltages and currents as phasors. Phasors are complex numbers representing sinusoidal voltages and currents at a particular frequency. They can be expressed either in Cartesian coordinates (real and imaginary) or in polar coordinates (amplitude and phase). As the electrical states are ignored, the phasor solution method does not require a particular solver to solve the electrical part of your system. The simulation is therefore much faster to execute. Keep in mind, however, that this faster solution technique gives the solution only at one particular frequency.

## Continuous and discrete phasor solutions

In the Simulation type parameter of a powergui block, you can choose one of two simulation methods. Phasor specifies a **continuous phasor** solution using a Simulink variable-step solver (such as ode23tb). **Discrete phasor** uses a local solver to discretize and solve the phasor model at a specified sample time. The discrete phasor simulation method allows you to use Simulink Coder™ to generate code and simulate your model in real time.

Contrary to the continuous phasor solver, which uses a full set of machine differential equations for modelling stator and rotor transients, the discrete phasor solver uses simplified three-phase synchronous and asynchronous machine models where differential equations on the stator side are replaced with algebraic equations. These lower-order machine models eliminate two states (the phid and phiq stator fluxes) to produce simulation results similar to commercial stability software.

Because of this simplification, high-frequency variations of electromagnetic torque and speed due to the DC components of transient stator currents are ignored, resulting in cleaner waveforms that are identical to those obtained with stability software. For stability studies of multi-machine systems involving low frequency electromechanical oscillations (typically in the 0.1–2 Hz range), the discrete phasor solver will produce accurate frequency and voltage variations with sample times in the 2–8 ms range, but which may differ slightly from those obtained with the continuous phasor solver. For models containing no machines, the phasor and discrete phasor solvers will produce identical results.

The larger sample times allowed for the discrete phasor solver allows you to simulate much larger systems than with the discrete solver (when the Simulation type parameter is set to *Discrete*). The discrete phasor solver has also several additional advantages:

* It uses a robust solution method that allows it to eliminate machine parasitic loads.
* It eliminates voltage glitches that occur with the continuous phasor solver during fault clearing because small time constants are used in machine models to break algebraic loops.
* It simulates multi-machine systems faster than the continuous phasor solver.
* It allows you to use Simulink Coder to generate code and simulate your model in real time. With the continuous phasor solver, real-time simulation works only if the model contains no machines.

## Continuous phasor simulation of a circuit transient

You now apply the phasor solution method to a simple linear circuit. Open the [Transient Analysis of a Linear Circuit](https://www.opal-rt.com/docs/smart-power-simulation-software-sps/example-models/get-started-with-sps/transient-analysis-of-a-linear-circuit.md) example.

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

This circuit is a simplified model of a 60 Hz, 230-kV three-phase power system where only one phase is represented. The equivalent source is modeled by a voltage source (230 kV RMS / sqrt(3) or 132.8 kV RMS, 60 Hz) in series with its internal impedance (Rs Ls). The source feeds an RL load through a 150-km transmission line modeled by a single PI section (RL1 branch and two shunt capacitances, C1 and C2). A circuit breaker is used to switch the load (75 MW, 20 MVAr) at the receiving end of the transmission line. Two measurement blocks are used to monitor the load voltage and current.

The powergui block at the lower-left corner indicates that the model is continuous. Select the I\_load and V\_line signals. From the Simulation Data Inspector, select **Log Selected Signals**. Start the simulation and observe transients in voltage and current waveforms when the load is first switched off at t = 0.0333 s (2 cycles) and switched on again at t = 0.1167 s (7 cycles).

{% stepper %}
{% step %}

### Invoking the phasor solution in the Powergui block

You now simulate the same circuit using the phasor simulation method. This option is accessible through the powergui block. Open the powergui block. Set the Simulation type parameter to *Phasor*. Specify the frequency used to solve the algebraic network equations. A default value of 60 Hz should already be entered in the **Frequency (Hz)** field. Close the Powergui and notice that the words *Phasor 60 Hz* now appear on the Powergui icon, indicating that the Powergui now applies this method to simulate your circuit. Before restarting the simulation, specify the appropriate format for the two signals sent to the Scope block.
{% endstep %}

{% step %}

### Selecting phasor signal measurement formats

If you now double-click the Voltage Measurement block or the Current Measurement block, you see that the **Output Signal** parameter allows you to output phasor signals in four different formats: *Complex* (default choice), *Real-Imag*, *Magnitude-Angle*, or just *Magnitude*. The *Complex* format is useful when you want to process complex signals. Note that the Scope block does not accept complex signals. Select *Magnitude* format for both the Line Voltage and the Load Current Measurement blocks. This allows you to observe the magnitude of the voltage and current phasors.

Restart the simulation. Open the Simulation Data Inspector. Waveforms obtained from the continuous simulation and the phasor simulation are superimposed in this plot.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-3e7feb1669d7b34305dc2a5e9bcf00e5570734d3%2Fex_continuousphasor_results.png?alt=media" alt=""><figcaption><p><strong>Waveforms Obtained with the Continuous and Phasor Simulation Methods</strong></p></figcaption></figure>

Note that with continuous simulation, the opening of the circuit breaker occurs at the next zero crossing of current following the opening order; whereas for the phasor simulation, this opening is instantaneous. This is because there is no concept of zero crossing in the phasor simulation.
{% endstep %}

{% step %}

### Processing voltage and current phasors

To use the Discrete phasor solution method, open the powerguiPreview block and set **Simulation type** to `Discrete phasor`. Set **Sample time (s)** to `1e-3` sec. Run the simulation. The voltage and current magnitude waveforms should compare with the continuous phasor model, except that the resolution for the breaker switching times is now 1 ms.

The `Complex` format allows the use of complex operations and processing of phasors without separating real and imaginary parts. Suppose, for example, that you need to compute the power consumption of the load (active power `P` and reactive power `Q`). The complex power `S` is obtained from the voltage and current phasors as

$$
\overline{S} = P + jQ = \frac{1}{2} \cdot V \cdot I^\*
$$

where *I*\* is the conjugate of the current phasor. The 1/2 factor is required to convert magnitudes of voltage and current from peak values to RMS values.

Select the *Complex* format for both current and voltage and, using blocks from the Simulink Math library, implement the power measurement as shown.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-406f7d463dffa941c2215de1965ab71b3d6036db%2Fex_power_computation_complex_voltage_current.png?alt=media" alt=""><figcaption><p><strong>Power Computation Using Complex Voltage and Current</strong></p></figcaption></figure>

The Complex to Magnitude-Angle blocks are required to convert complex phasors to magnitudes before sending them to the scope.

Note that the Power (phasor) block available in the **SPS** > **Control & Measurements** > **Measurements** library implements the above complex equation for measuring active power (P) and reactive power (Q). Connect the complex outputs of the voltage and current measurement blocks to the **V** and **I** inputs of the Power (phasor) block.
{% endstep %}
{% endstepper %}


---

# 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/simulation-and-analysis/use-the-phasor-simulation-method.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.
