When and how to use phasor mode simulations | Simscape Electrical Modeling Practices for Fast Simulation - MATLAB & Simulink
Video Player is loading.
Current Time 0:00
Duration 9:25
Loaded: 1.75%
Stream Type LIVE
Remaining Time 9:25
 
1x
  • Chapters
  • descriptions off, selected
  • en (Main), selected
    Video length is 9:25

    When and how to use phasor mode simulations | Simscape Electrical Modeling Practices for Fast Simulation

    From the series: Simscape Electrical Modeling Practices for Fast Simulation

    This video compares a full electromagnetic transient (EMT) simulation of an AC power system to a phasor simulation. The requirements for a successful phasor mode simulation are shown, as well as how to switch the solver to phasor (called frequency and time).

    Published: 7 May 2024

    Hello, my name is Nils Hornik. I'm an application engineer for the MathWorks in the area of electrification and electrical simulation. In the next few minutes, I want to explain you when you can use phasor mode simulations with Simscape to achieve fast electrical simulations.

    For this purpose, I will use the displayed live script, which you can also find in the GitHub content link to this video. So, first of all, let's talk about different kinds of solvers for electrical simulation.

    First off, we have the classic EMT, or Electromagnetic Transient simulation. This picture indicates an approximation of a sinusoidal signal with different samples per period. So what you can directly-- 10 samples per period is far too few to accurately represent a sinusoidal signal. Then you also see 50 and 100 samples. 100 is usually a good rule of thumb as a trade-off between computational speed and sinusoidal representation.

    Different kind of simulation is what we call an RMS, Root Mean Square, or phasor simulation. Here's not the full waveform simulated but only a phasor representation of an AC signal like voltage, meaning you keeping track of the phase angle and the amplitude.

    Now, for this kind of simulation, as you can see here, it's usually favored to use a variable step solver, which is able to reduce the step size in moments of high dynamic. As you can see in the second plot, the step size in orange is reduced dramatically in this switching event. And then once things are more stable and we are in almost steady state state, the step size can be increased to achieve fast simulations.

    So what are the type of simulations you want to use or where you could consider using phasor mode simulation? First of all, you need the presence of a periodic AC signal with a fundamental frequency. Usually for electrical systems, these are the typical frequencies as 50 or 60 hertz-- might be different on onboard microgrids, but this is important that you have this common frequency.

    And then, second, the type of question you are trying to answer with the simulation study has to fall into the category of more slow moving AC signals and AC quantities like the amplitude or DC quantities like, for example, used for controls tuning for governor of a turbine but certainly not something like harmonics or the reaction to falls within one waveform because this is not suitable for RMS or phasor mode simulation.

    Talking about limitations, I also want to bring to your attention that there are certain ways to create, more or less, periodic signals in an electrical simulation, for example, having a voltage source inverter in grid forming mode, whereby the controls are-- sinusoidal voltage is injected or generated at a grid node or also a controlled voltage source, where the AC character, the sinusoidal signal, is only governed by the controls input. These components will not run in phasor mode because they're not classified as a steady frequency phasor component.

    Moreover, there are some components which cannot be transferred in a switched linear equation, which also will prevent the internal Simscape solver to use phasor representation or frequency and time, as we call it. This will be indicated by the error message and then, in this case, you have to stick to the classic time or EMT simulation. These commands will take you to the parts of our documentation for this components or examples-- unfortunately, not working is phasor mode.

    Now I want to show you how you can set up such a phasor mode simulation. So, first, let's open the model and make sure we will log all of the Simscape data. As you see, it's a fairly simple system, where we have a synchronous machine as generator. We have a system for the excitation control. And we have a control for the governor, so you could see this is the active power part and this is the reactive power controls part.

    Then on the load side, we have a constant load and two switch loads where we will switch them on and off at different point of time to test the system for step load reaction. All commands can be also done in Simulink, but I will use our Simulink and Simscape API in the following to make it more replicable.

    First of all, before we speak about any ways to make a simulation faster by reducing the accuracy were are not relevant. We need to make sure we have a high fidelity representation of the simulation saved.

    So as a base case, let's use and set the rule of thumb of 100 samples per period. So we can set our local solver to this resolution. By default, it's switched to a set to time simulation. This command will ensure-- also via APA that set to the time. And then we simulate it and record the results.

    Once the simulation is done, we will now still use the EMT, or time-based simulation, but reduce the step size to 100. This is, of course, unrealistic low, meaning we have one sample per period. It's just useful to be aware of the computational difference between this high fidelity simulation and then this with reduced step size.

    So now when we switch over to a phasor mode simulation, we will use the same sampling time, so just one sample per period. However, as you can see with this line, we switch the simulation mode from time to time and frequency. The equivalent action in the graphic editor would be to click on the solver configuration block and locate here in the first line the equation formulation to set it to frequency and time.

    Once you collected the output and the timing for this run, we can compare now, first, execution time of the three simulations, where you can see clearly our base scenario with the high resolution EMT takes by far the most time compared to the only one sample per period EMT or the phase simulation. You also noticed that using for the same sampling time, the phasor mode has a computational extra cost compared to EMT.

    But now if we compare the signals starting with the DC signals-- one voltage magnitude and also the velocity of the rotor on our turbine-- you see that the phasor mode results are much better representation to the high fidelity EMT simulation than compared to the one second sampled, which is, as I said, does not really make sense for an EMT study to use this low sampling. I just wanted to highlight how we-- this phasor is now a trade-off and taking more time than a pure EMT simulation for the same sampling time but almost having the same results as a much, much faster sampled EMT simulation.

    And what's the speciality for the Simscape phasor mode? Not only DC signals but also AC signals can be viewed. Because after the simulation is finished, Simscape solver will use the data in form of the phasor, angles, and magnitudes to reconstruct AC signals around the fundamental frequency so-- also AC waveforms of the voltage or the current can be observed.

    With this, I hope you have a better understanding how you can use phasor mode or frequency in time with Simscape to achieve fast electrical simulations. Thank you.

    Up Next:

    View full series (15 Videos)

    View more related videos