Type 3 Controller Optimization - Part 2: Phase Margin and Crossover Frequency
In the previous article we described the setup for the optimization of a buck converter with a Type 3 Controller. This workflow uses measurements from the output waveform to qualify the controller. But, what about the frequency domain characteristics? In this article we’ll show how to add Phase Margin and Crossover Frequency to the optimization workflow described in Part 1. This is done by adding a PSIM schematic with an AC sweep of the whole system to the optimization setup. (To find out more about the AC Sweep inside PSIM click here)
So that each iteration , two schematics will be executing simultaneously: the electrical simulation and the AC sweep.
Goals and Constraints
We’ll add one more goal/constraint to our previous setup now having these:
Goal | Constraint |
---|---|
Minimize Overshoot in percentage | Less than 5% |
Minimize Settling Time | Less than 10ms |
Minimize Steady State Error | Less than 1 V |
Maximize Phase Margin | Between 30 and 70 |
Measuring Phase Margin and Crossover Frequency
To measure Phase Margin and the Crossover Frequency from the AC Sweep results, two python functions were created for each measurement and added to HyperStudy. Download it here:
These functions are straight forward and do the following:
- Obtain the index of the first value after the zero crossing
- Use that index to calculate the exact point where the zero crossing would be via interpolation
- Use that point to find the interpolated value of the phase and frequency vectors
A quick description on how to add python functions to HyperStudy is described at the end of this post.
Now, let us look at how implementation looks like with PSIM and HyperStudy
PSIM Schematic
A new PSIM schematic needs to be created, we can copy the one from part 1, delete all measuring circuits and blocks (except the output voltage feedback) and add an AC Sweep block and an AC Sweep loop probe:
You can find the schematic attached here:
A new parameter file needs to be created; we can copy and paste the parameters from the example in part 1 and slightly alter their names to avoid an overlap with the variables of the original schematic.
HyperStudy Optimization Setup
We can use the study from Part 1 as a starting point; we just need to copy the previous optimization [Right click on the title > Copy > Rename].
Click on the drop-down menu of the “Definition” and go to the Define Models section to add the AC Sweep schematic and import the variables from the second parameter file:
Note: Clicking “Import Variables” button on the lower-left side of the screen will open the “PSIM-HyperStudy Connector” twice, one time for each schematic ("model"); you can close the first window to not override the parameters and bounds of the previous optimization.
In the” Define Input Variables” section, we need to link the values of the parameters from the first simulation to the ones from the second simulation. In the “Links” tab we can assign an expression to any variable. In this case we just need to assign a variable to its counterpart from the new model:
Next, we need to add the plots for amplitude, phase and frequency as “Data Sources”. We can do this from the “File Manager” opening the “.fra”:
Then, create two new output responses and use the added python functions to extract crossover frequency and phase margin:
Add the goals we set in the beginning, and we can start the optimization process, we can look at a couple of the optimized results in the area tab along with their corresponding Phase Margin and Cross Frequency values:
Plotting a set of optimized closed loop responses reveal these have a similar response :
Take a look at the following resources to learn more about these topics: