Straightforward Method to Design and Simulate with SPICE the Loop Compensation Controller for All Switching Power Supplies.

Ing. Cristoforo Baldoni

In this article we ‘ll see how to find the output power stage transfer function H(s), called the Control-to-Output function,  of the most switching power supplies: BUCK, BOOST, BUCK-BOOST, HALF-BRIDGE, FULL BRIDGE, both in voltage mode control and current mode control. In spite of the complexity of the different types of power supplies that use one or more output feedback, the output power transfer function H(s), can be reduced to a few schematic categories of general validity. We’ ll see when it’s the case to consider the effects of the RHPZ, the Right Half Plane Zero, and what it means in practical terms.
Once the components for the specific power supply have been sized, we can estimate with good approximation the transfer function which describes mathematically the output power stage. As seen in the article about the determination of POLES and ZEROS by inspection,  we ‘ll identify immediately the POLES and ZEROS which characterize the different switching categories.
We ‘ll draw the Bode plots of these functions with PSpice, and, according to their characteristics, we ‘ll choose the most suitable compensator G(s), implementing the compensation network with the operational amplifiers embedded in the microcontrollers. The SPICE simulation of the open loop transfer function G(s)*H(s), will allows us to evaluate the results for the system stability. Finally, we ‘ll apply this method in two real switching power supply: a low power flyback converter and an off-line, half-bridge switching.
This method allows us to speed up the design of the compensator G(s) in the prototyping phase before the physical measurement with the instrumentation.

It’s strongly recommended the reading of these articles:

Accessing this article you can download the following SPICE simulation files about switching power supply compensation design:

-Forward function example

-Flyback function example

-Flyback function example with a Right Half Plane ZERO

-Origin POLE compensator

-Origin POLE Transfer function implementation

-Forward function compensated example

-One ZERO two POLES compensator

-One ZERO two POLES Transfer Function Implementation

-Flyback with RHPZ compensated

-Three POLES two ZEROS compensator

-Three POLES two ZEROS Transfer Function

-Transfer function of a real Flyback converter

-Compensator for the flyback converter

-Overall compensated  transfer function of the flyback converter

-Transfer function of a real Forward converter

-Compensator for the Forward converter

-Transfer function of compensator for the Forward converter

-Overall compensated  transfer function of the Forward converter

Premium Content

Login to buy access to this content

Designing and Simulation of Industrial PID Controllers using Microcontrollers

Ing. Cristoforo Baldoni

In this article we’ll see how to pass from the design of analog PID controllers for continuous-time systems to digital controllers, replacing operational amplifiers, resistors and capacitors with microcontrollers. Digital controllers are very compact, all the controller fits on a chip, including the A/D and the D/A converters, moreover, digital controllers are not affected by the aging of the components and don’t change their values with the temperature as analog components do. We’ll see how to apply the Z-transform, the equivalent of the Laplace transform, but for discrete-time systems, we’ll see how to identify the transfer function of a process and we’ll explain, with a step by step procedure, how to apply the theoretical knowledge learnt by examining an Proteus microcontroller based project, that uses its PWM output to control an oven ‘s temperature. The microcontroller has a 10 bit A/D converter. This procedure can be easily adapted with minimal adjustments to other processes to control.



1. Digital Control-System Block Diagrams


2. Linear difference equations, Z-Transform, Inverse Z-Transform and Discrete Transfer Function.


3. Sampling and A/D Analogic to Digital Converter


4. D/A Digital to Analogic Converter and ZERO ORDER HOLD  (ZOH) : Relationship between the Continuous Transfer Function and Discrete Transfer Function of a sampled Process.


5.  Block Diagram Manipulation of Sampled Data Systems


6. Methods for designing Digital Controllers, Stability.


7. Designing  PID controllers by microcontrollers


8. Transfer Function Identification and PID Tuning using the Ziegler–Nichols Method.


9. Practical case of a temperature control system implemented with a microcontroller PIC and simulated with ISIS Proteus: Step by step explanation of how to apply the theoretical knowledge for implementing and simulating a PID controller.

Premium Content

Login to buy access to this content

Designing Industrial PID Controllers using SPICE

1. Design of PID regulators , design and test with SPICE simulation



2. Easy way to implement compensators with operational amplifiers






1. Design of PID regulators , design and test with SPICE simulation

Graphical method

Let’s examine now a graphical method for designing P.I.D. controllers. P.I.D. are Proportional-Integral-Derivative controllers and represent one of the techniques widely used to implement industrial control systems. Below the diagram block of a typical feedback system

Figure 1 – Generic feedback system

There are several types of compensators, in series, in feedback and combinations of both. The compensator in series is the most used. A compensation system is required when the closed loop system is unstable, when the system is stable but the steady state error or the dynamic behavior doesn’t meet the required specifications, or both. To compensate the system we put before the process (in series) a controller whose transfer function is R(s), as you can see in the figure below

 Figure 2 – Compensated feedback system

The generic transfer function introduced by the P.I.D. controller can be expressed as:


P.I.D. controllers can exist also as a simple P controller (KD = KI =0), as a P.D. controller (KI = 0), or as a P.I. controller (KD =0). The proportional contribute of a P controller can improve the specification about the steady state error, the derivative contribute increases the damping of the closed loop system and the integrative contribute increases the type of the system, and then can eliminate or improve the steady state error.


The simplest version is the proportional controller P. Its transfer function is:


This type of controller can improve the specification on the steady state error, but at the same time increases the bandwidth of the feedback system which means a faster response of the system to follow the reference but a decrease of the stability margins.  For a system with unitary feedback and open loop transfer function equal to F(s) the steady state error is:


multiplying by the gain Kp the new error will be


 let’s see a practical example, the open loop transfer function of a unitary feedback system is


Figure 3 – Implementation of open loop function with Laplace PART in PSpice

The bode plot of the transfer function is:


Figure 4 – Bode plot of gain and phase

The specification on the system requires, for example, a steady state error equal to 3% and a phase margin PM of 50 degrees.It’s:


we have to impose



we get KP= 388.

Plotting the compensated function we get


Figure 5 – Bode plot of function compensated with proportional controller

The phase corresponding to the crossing frequency is about -156 degrees

Figure 6 – Phase at crossing frequency

the specific on the phase margin can’t be satisfied with only the proportional compensation.

Find Poles and Zeros of Circuit by Inspection

 Ing. Cristoforo Baldoni

In this article we ‘ll see how to recognize the number of poles and zeros of a transfer function simply by inspection, also of a large linear network, avoiding to calculate the analytical expression of the transfer function.  After reading this article, you ‘ll be able to determine the number of poles at first glance . Once set the output, you ‘ll also be able to determine the number of zeros by inspection and calculate the exact symbolic transfer function, the exact values of zeros and poles with simple software tool available for free. Using the SPICE analysis, we ‘ll verify the results found. The purpose of this article is to explore the concept of poles and zeros of a transfer function, their phisical meaning, and provide useful analysis tool for analog circuit designers and control systems engineers.

How many poles has the following network?


and what about this High-Pass filter?


if your answer to the first question is 9 or 8 , or you don’t recognize a fifth order filter (five poles) in the filter’s picture you should read this article.

Premium Content

Login to buy access to this content

Control System Theory and SPICE Simulation

Ing. Cristoforo Baldoni

This article provides the principles for the design and analysis of Feedback and Control Systems. The Control Systems are everywhere in the modern industrial technological world, in the laser positioning of a CD Reader,  in the very high precision positioning system of an hard disk head, and even our body has a large number of biological control systems. After introducing the basic concepts, we’ll see how easily evaluate the Open loop Transfer Function with PSPice.




1.  Processes, Open Loop and Closed Loop Control Systems (Feedback Systems)


2. Generic closed loop schematic of Feedback Systems


3. Physycal Processes Modeling, differential equations and calculations simplification with Laplace transform


4. Transfer Function, Poles and Zeros of a Transfer Function, phisical meaning


5. Natural and Forced Response, calculating Residues, when it’s possible simplify identical Zeros and Poles, dominant poles


6. Process Stability


7. Steady State Error, Type of Systems


8. Study of Transfer Function with Bode diagram. Study the Open Loop Transfer Function with SPICE.


Premium Content

Login to buy access to this content