PLECS 3.1 Online Help

Analysis Tools

Steady-State Analysis

Many specifications of a power electronic system are often given in terms of steady-state characteristics. A straight-forward way to obtain the steady-state operating point of a system is to simulate over a sufficiently long time-span until all transients have faded out. The drawback of this brute-force approach is that it can be very time consuming. Usually a system has time constants that are much longer than the switching period. This applies in particular to electro-thermal models.

Algorithm

The steady-state analysis of a periodic system is based on a quasi-Newton method with Broyden's update. In this approach the problem is formulated as finding the roots of the function

f(x) = x - FT(x)

where x   is an initial vector of state variables and FT(x)   is the final vector of state variables one period T   later.

Evaluating f(x)   or FT (x)   therefore involves running a simulation from tstart   to tstart + T  . The period, T  , must be the least common multiple of the periods of all sources (signal or electrical) in the model.

The above problem can be solved iteratively using

                                       ||
xk+1 = xk - J-k 1⋅f(xk)   ,    Jk = ∂f(x)-||
                                   ∂x  xk

The Jacobian J   is calculated numerically using finite differences. If n   is the number of state variables, calculating the Jacobian requires n + 1   simulation runs where each state variable in turn is slightly perturbed and the difference between the perturbed and unperturbed solution is computed to obtain one column of J  :

    f(x + Δxi)- f(x)
ji = -----|Δx--|------   ,    i = 1...n
            i

Because this is computationally expensive, only the first Jacobian is actually computed this way. In subsequent iterations, the Jacobian is updated using Broyden's method, which does not require any additional simulations.

The convergence criterion of the iterations is based on the requirement that both the maximum relative error in the state variables and the maximum relative change from one iteration to the next are smaller than a certain limit rtol  :

|         |
||xk+1-- xk-||< rtol   and    --|fi(x)|--< rtol  for all i = 1,...,n
|   xk    |                max |xi(τ)|

A steady-state analysis comprises the following steps:

  1. Simulate until the final switch positions after one cycle are equal to the initial switch positions. This is called a circular topology.
  2. Calculate the Jacobian matrix J
 0   for the initial state.
  3. Iterate until the convergence criterion is satisfied. If during the iterations the final switch positions after one cycle differ from the initial switch positions, go back to step 1.

Fast Jacobian Calculation for Thermal States

To reduce the number of simulation runs and thus save computation time PLECS can calculate the Jacobian matrix entries pertaining to thermal states directly from the state-space matrices rather than using finite differences.

There is a certain error involved with this method since it neglects the feedback from the thermal states to the electrical states (or Simulink states). While this will not affect the accuracy of the final result of the steady-state analysis it may slow down the convergence. Normally, however, the overall performance will be much faster than calculating the full Jacobian matrix.

The calculation method is controlled by the parameter JacobianCalculation (see below).

Limitations

Hidden state variables

In the PLECS Blockset, the steady-state analysis depends on the fact that a model can be completely initialized with the InitialState parameter of the sim command. However, certain Simulink blocks that clearly have an internal memory do not store this memory in the state vector and therefore cannot be initialized. Among these blocks are the Memory block, the Relay block, the Transport Delay block and the Variable Transport Delay block. If a model contains any block with hidden states, the algorithm may be unable to find a solution.

State variable windup

If the effect of a state variable on the system is limited in some way but the state variable itself is not limited, it might wind up towards infinity. In this case the algorithm may fail to converge or return a false solution. In order to avoid this problem you should limit the state variable itself, e.g. by enabling the Limit output checkbox of an Integrator block.

Reference

D. Maksimović, "Automated steady-state analysis of switching power converters using a general-purpose simulation tool", Proc. IEEE Power Electronics Specialists Conference, June 1997, pp. 1352-1358.

AC Analysis

The AC Analysis uses the Steady-State Analysis to compute the transfer function of a periodic system at discrete analysis frequencies. For each frequency the following steps are executed:

  1. Apply a sinusoidal perturbation to the system under study.
  2. Find the periodic steady-state operating point of the perturbed system.
  3. Extract the system response at the perturbation frequency using Fourier analysis.

The perturbation frequencies are defined by specifying the sweep range and the number of points to be placed within this range on a linear or logarithmic scale.


Note  The period length of the perturbed system is the least common multiple of the unperturbed system period and the perturbation period. In order to keep this number and thus the simulation time small the algorithm may slightly adjust the individual perturbation frequencies.

Impulse Response Analysis

An alternative and faster method to determine the open loop transfer function of a system is the Impulse Response Analysis. Instead of perturbing a system with sinusoidal stimuli of different frequencies, one at a time, a single impulse is applied when the system is in steady state. The system transfer function can then be calculated very efficiently over a wide frequency range (from zero to half the system frequency) by computing the Laplace transform of the transient impulse response.

Algorithm

The impulse response analysis is performed in three steps:

  1. Find the steady-state operating point of the system under study.
  2. Apply a perturbation in form of a discrete impulse for the duration of one period.
  3. Calculate the Laplace transform of the transient impulse response.

Compensation for Discrete Pulse

Theoretically, in order to compute the system transfer function from the Laplace transform of the system response, the system must be perturbed with a unit Dirac impulse (also known as delta function). This is not practical for numerical analysis, so the algorithm applies a finite rectangular pulse instead. For transfer functions such as the line-to-output transfer function or the output impedance this can be compensated for by dividing the Laplace transform of the system response by the Laplace transform of the rectangular pulse. This is achieved by setting the parameter Compensation for discrete pulse to discrete pulse, which is the default.

However, when calculating control-to-output transfer functions that involve the duty cycle of a switched converter, the rectangular input signal interferes with the sampling of the modulator. In this case the compensation type should be set to external reference. This causes the Impulse Response Analysis block to have two input signals that should be connected as shown in this figure.

pict

Finally, you can set the compensation type to none which means that the computed transfer function is taken as is. Use this setting if the modulator uses regular sampling and the sampling period is identical to the system period.

Reference

D. Maksimović, "Automated small-signal analysis of switching power converters using a general-purpose time-domain simulator", Proc. Applied Power Electronics Conference, February 1998.

Usage in PLECS Standalone

In PLECS Standalone all analyses are managed in the Analysis Tools Dialog shown below. To open the dialog, select Analysis tools... from the Simulation menu of the schematic editor.

[Picture]

The left hand side of the dialog window shows a list of the analyses that are currently configured for the model. To add a new analysis, click the button marked + below the list and select the desired analysis type. To remove the currently selected analysis, click on the button marked -.

The right hand side of the dialog window shows the parameter settings of the currently selected analysis. Each analysis must have a unique Description. The other parameters available for the different analysis types are described further below.

The button Start analysis/Abort analysis starts the currently selected analysis or aborts the analysis that is currently running. The button Show log/Hide log shows or hides a log window that displays the progress of an analysis and diagnostic messages.

Steady-State Analysis

System period
The system period is the least common multiple of the periods of all sources (signal or electrical) in the model. If the parameter setting does not reflect the true system period or an integer multiple thereof, the analysis will yield meaningless results or fail to converge altogether.
Simulation start time
The start time tstart    to be used in the transient simulation runs. Simulations run from tstart    to tstart + T  , where T   is the system period specified above. The default is 0.
Show steady-state cycles
The number of steady-state cycles, for which a transient simulation is run at the end of an analysis. The default is 1.
Number of init. cycles
The number of cycle-by-cycle simulations to be performed before the Newton iterations are started. When an analysis fails to converge because the starting point was too far from the steady-state solution, this parameter can help to get better starting conditions. The default is 0.
Termination tolerance
The relative error bound. The analysis continues until both the maximum relative error in the state variables and the maximum relative change from one iteration to the next are smaller than this bound for each state variable.
Max. number of iterations
Maximum number of Newton iterations allowed.
Rel. perturbation for Jacobian
Relative perturbation of the state variables used to calculate the approximate Jacobian matrix.
Jacobian calculation
Controls whether Jacobian matrix entries for thermal state variables are calculated via finite differences (full) or directly from the state-space matrices (fast). The default is fast.

AC Sweep

In order to perform an AC sweep, you need to insert a Small Signal Perturbation and a Small Signal Response block in order to define the points at which the perturbation is injected and the response is measured. The Small Signal Gain block can be used to obtain the closed loop gain of a feedback loop.

At the end of an analysis, a scope window will open and display the Bode diagram of the transfer function. You can also open the scope manually by clicking one Show results button.

System period
The system period is the least common multiple of the periods of all sources (signal or electrical) in the model. If the parameter setting does not reflect the true system period or an integer multiple thereof, the analysis will yield meaningless result or fail to converge altogether.
Frequency range
A vector containing the lowest and highest perturbation frequency.
Amplitude
The amplitude of the perturbation signal.
Perturbation
The Small Signal Perturbation block that will be active during the analysis. All other perturbations block will output 0.
Response
The Small Signal Response block that will record the system response during the analysis.
Simulation start time
The start time tstart    to be used in the transient simulation runs. Simulations run from tstart    to tstart + T  , where T   is the system period specified above. The default is 0.
Frequency scale
Specifies whether the sweep frequencies should be distributed on a linear or logarithmic scale.
Number of points
The number of automatically distributed frequencies.
Additional frequencies
A vector specifying frequencies to be swept in addition to the automatically distributed frequencies.

For a description of the steady-state options please refer to Steady-State Analysis.

Impulse Response Analysis

In order to perform an impulse response analysis, you need to insert a Small Signal Perturbation and a Small Signal Response block in order to define the points at which the perturbation is injected and the response is measured.

At the end of an analysis, a scope window will open and display the Bode diagram of the transfer function. You can also open the scope manually by clicking one Show results button.

For a description of the parameters please refer to AC Sweep. In an impulse response analysis, the computational effort for an individual frequency is very cheap. Therefore, the parameter Additional frequencies is omitted; instead, the Number of points can be set to a large value in order obtain smooth curves.

Application Example

The demo model BuckOpenLoop implements the buck converter shown below. It operates at a switching frequency of 100 kHz with a fixed duty-cycle of 15/28. To run a transient simulation from zero initial conditions, select Start from the Simulation menu.

pict

To view the analyses configured in this model select Analysis tools... from the Simulation menu. The only periodic source in the model is the carrier signal used in the modulator. Hence, the parameter System period for all analyses is specified as T = 1∕100kHz = 10-5s  .

Steady-State Operation

To view the steady-state operation of the converter, select Steady-State Analysis from the list and click on Start analysis. After the analysis has found the periodic operating point, the scope will show five steady-state cycles.

Control-to-Output Transfer Function

For the calculation of the control-to-output transfer function, a small perturbation needs to be added to the modulation index. This is done with the Small Signal Perturbation block m’, which has the Show feed-through input setting enabled. The system output in this case is defined as the output voltage of the converter. The output signal of the voltmeter is therefore connected to the Small Signal Response block vo’.

To calculate the transfer function using the AC Sweep, select Control to Output TF (AC Sweep) from the list and click on Start analysis. The analysis sweeps the frequency range between 100 Hz and 50 kHz. 21 points are placed logarithmically within this range; to obtain a smoother output, additional data points are generated between 800 and 1400 Hz.

To calculate the transfer function using the Impulse Response Analysis, select Control to Output TF (Impulse Response) from the list and click on Start analysis.

Output Impedance

For the calculation of the output impedance, a small perturbation current is injected into the converter output using a current source that is controlled by the Small Signal Perturbation block i’ and the output voltage response is measured. As above, two analyses have been configured that calculate the impedance using the AC Sweep and the Impulse Response Analysis.

Loop Gain

The demo model BuckClosedLoop implements the controlled buck converter shown below. A PID controller regulates the output voltage to 15 volts.

pict

For the calculation of the voltage loop gain, the Small Signal Gain block Loop Gain Meter has been inserted into the feedback path. If you look under the mask of the Small Signal Gain, you can see how the block both injects a small perturbation and measures the system response.

To calculate the loop gain, select Analysis tools... from the Simulation menu, then choose Closed Loop Gain from the list of analyses and click Start analysis.

Usage in the PLECS Blockset

In the PLECS Blockset, you configure analyses by copying the appropriate blocks from the Analysis Tools library in PLECS Extras into your model.

Steady-State Analysis

To perform a steady-state analysis, copy the Steady-State Analysis block into your model. An analysis can be run interactively from the block dialog or via a MATLAB command. The calling syntax is

plsteadystate(block);

where block is the Simulink handle or the full block path of the Steady-State Analysis block. The block handle or path can be followed by parameter/value pairs. Otherwise, the settings specified in the block dialog are used.

The following table lists the parameters of the Steady-State Analysis block. The Parameter column shows the parameter names to be used with the plsteadystate command. The Description column indicates whether and where you can set the value in the dialog box. Parameters that are not accessible in the dialog box can be modified using the set_param command.

ParameterDescription
TimeSpan For a fixed system period, the period length; this is the least common multiple of the periods of independent sources in the system. For a variable system period, the maximum time span during which to look for a trigger event marking the end of a period. Set by the System period length/Max simulation time span field.
TStart Simulation start time. Set by the Simulation start time field.
Tolerance Relative error tolerance used in the convergence criterion. Set by the Termination tolerance field.
MaxIter Maximum number of iterations allowed. Set by the Max number of iterations field.
Display Specifies the level of detail of the diagnostic messages displayed in the command window (iteration, final, off). Set by the Display drop-down list.
HideScopes Hide all Simulink scope windows during an analysis in order to save time.
HiddenStates Specifies how to handle Simulink blocks with `hidden' states, i.e. states that are not stored in the state vector (error, warning, none). Set by the Hidden model states drop-down list.
FinalStateName Name of a MATLAB variable used to store the steady-state vector at the end of an analysis. Set by the Steady-state variable field.
NCycles Number of steady-state cycles that should be simulated at the end of an analysis. Set by the Show steady-state cycles field.
JPert Relative perturbation of the state variables used to calculate the approximate Jacobian matrix.
JacobianCalculation Controls the way the Jacobian matrix is calculated (full, fast). The default is fast.
NInitCycles Number of cycle-by-cycle simulations that should be performed before the actual steady-state analysis. This parameter can be used to provide the algorithm with a better starting point. The default is 0.

These examples show how to run analyses for the block Steady State in the model mymodel:

plsteadystate(’mymodel/Steady State’);

starts an analysis using the parameters specified in the dialog box.

plsteadystate(’mymodel/Steady State’, ’TStart’, 0, ...
  ’FinalStateName’, ’x0’);
plsteadystate(’mymodel/Steady State’, ’TStart’, 1, ...
  ’FinalStateName’, ’x1’);

performs two analyses with different start times and assigns the resulting steady-state vectors to two different variables x0 and x1. This is useful e.g. if the model has a reference signal with a step change and you want to determine the steady state before and after the change.

AC Sweep / Loop Gain Analysis

To perform an AC sweep, copy the AC Sweep block into your model. The block outputs a perturbation signal, which must be injected into the system. The system response must be fed back into the block input.

To perform a loop gain analysis, copy the Loop Gain Analysis block into your model and insert it into the path of a feedback loop.

An analysis can be run interactively from the block dialogs or via a MATLAB command. The calling syntax is

placsweep(block);

where block is the Simulink handle or the full block path of the AC Sweep or Loop Gain Analysis block. The block handle or path can be followed by parameter/value pairs. Otherwise, the settings specified in the block dialog are used.

The following table lists the parameters of the AC Sweep and Loop Gain Analysis blocks. The Parameter column shows the parameter names to be used with the placsweep command. The Description column indicates whether and where you can set the value in the dialog box. Parameters that are not accessible in the dialog box can be modified using the set_param command.

ParameterDescription
TimeSpan Period length of the unperturbed system. Set by the System period length field.
TStart Simulation start time. Set by the Simulation start time field.
FreqRange Range of the perturbation frequencies. Set by the Frequency sweep range field.
FreqScale Specifies whether the sweep frequencies should be distributed on a linear or logarithmic scale. Set by the Frequency sweep scale field.
NPoints Number of data points generated. Set by the Number of points field.
InitialAmplitude Perturbation amplitude at the first perturbation frequency. Set by the Amplitude at first freq field.
Method Method used for obtaining the periodic steady-state operating point of the perturbed system:
Brute force simulation - start from model initial state, Brute force simulation - start from unperturbed steady state, Steady-state analysis - start from model initial state, Steady-state analysis - start from unperturbed steady state.
Set by the Method drop-down list.
Tolerance Relative error tolerance used in the convergence criterion. Set by the Termination tolerance field.
MaxIter Maximum number of iterations allowed. Set by the Max number of iterations field.
Display Specifies the level of detail of the diagnostic messages displayed in the command window (iteration, final, off). Set by the Display drop-down list.
HideScopes Hide all Simulink scope windows during an analysis in order to save time.
HiddenStates Specifies how to handle Simulink blocks with 'hidden' states, i.e. states that are not stored in the state vector (error, warning, none). Set by the Hidden model states drop-down list.
OutputName Name of a MATLAB variable used to store the transfer function at the end of an analysis. Set by the Output variable field.
BodePlot Plot a Bode diagram of the transfer function at the end of an analysis. Set by the Plot Bode diagram drop-down list.
JPert Relative perturbation of the state variables used to calculate the approximate Jacobian matrix.
NInitCycles If a steady-state analysis is used to obtain the starting point of the ac analysis (see parameter Method above), this parameter specifies the number of cycle-by-cycle simulations that should be performed before the steady-state analysis. This parameter can be used to provide the algorithm with a better starting point. The default is 0.

These examples show how to run analyses for the block AC Sweep in the model mymodel:

placsweep(’mymodel/AC Sweep’);

starts an analysis using the parameters specified in the dialog box.

placsweep(’mymodel/AC Sweep’, ’TStart’, 0, ...
  ’OutputName’, ’T0’);
placsweep(’mymodel/AC Sweep’, ’TStart’, 1, ...
  ’OutputName’, ’T1’);

performs two analyses with different start times and assigns the resulting transfer functions to two different variables T0 and T1. This is useful e.g. if the model has a reference signal with a step change and you want to determine the transfer function before and after the change.

Impulse Response Analysis

To perform an impulse response analysis, copy the Impulse Response Analysis block into your model. The block outputs a perturbation signal, which must be injected into the system. The system response must be fed back into the block input.

An analysis can be run interactively from the block dialogs or via a MATLAB command. The calling syntax is

plimpulseresponse(block);

where block is the Simulink handle or the full block path of the Impulse Resonse Analysis block. The block handle or path can be followed by parameter/value pairs. Otherwise, the settings specified in the block dialog are used.

The following table lists the parameters of the Impulse Response Analysis block. The Parameter column shows the parameter names to be used with the plimpulseresponse command. The Description column indicates whether and where you can set the value in the dialog box. Parameters that are not accessible in the dialog box can be modified using the set_param command.

ParameterDescription
TimeSpan Period length of the unperturbed system. Set by the System period length field.
TStart Simulation start time. Set by the Simulation start time field.
FreqRange Range of the perturbation frequencies. Set by the Frequency sweep range field.
FreqScale Specifies whether the sweep frequencies should be distributed on a linear or logarithmic scale. Set by the Frequency sweep scale field.
NPoints Number of data points generated. Set by the Number of points field.
Perturbation Perturbation amplitude of the discrete impulse. Set by the Perturbation field.
Compensation Specifies whether and how the effect of the sampling should be compensated (none, discrete pulse, external reference). Set by the Compensation for discrete pulse drop-down list.
Tolerance Relative error tolerance used in the convergence criterion of the initial steady-state analysis. Set by the Termination tolerance field.
MaxIter Maximum number of iterations allowed. Set by the Max number of iterations field.
Display Specifies the level of detail of the diagnostic messages displayed in the command window (iteration, final, off). Set by the Display drop-down list.
HideScopes Hide all Simulink scope windows during an analysis in order to save time.
HiddenStates Specifies how to handle Simulink blocks with 'hidden' states, i.e. states that are not stored in the state vector (error, warning, none). Set by the Hidden model states drop-down list.
OutputName Name of a MATLAB variable used to store the transfer function at the end of an analysis. Set by the Output variable field.
BodePlot Plot a Bode diagram of the transfer function at the end of an analysis. Set by the Plot Bode diagram drop-down list.
JPert Relative perturbation of the state variables used to calculate the approximate Jacobian matrix.
NInitCycles If a steady-state analysis is used to obtain the starting point of the ac analysis (see parameter Method above), this parameter specifies the number of cycle-by-cycle simulations that should be performed before the initial steady-state analysis. This parameter can be used to provide the algorithm with a better starting point. The default is 0.

Extraction of State-Space Matrices

In order to simplify other analysis methods such as state-space averaging approach, PLECS enables you to extract the state-space matrices of a circuit for any given combination of switch positions. The commands used for this purpose are listed below. In each of the commands circuit is the full Simulink path of a PLECS Circuit block.

names = plecsedit(’get’, circuit, ’StateSpaceOrder’);

returns a struct containing the names of the components associated with the circuit model's inputs, outputs, states and switches.

plecsedit(’set’, circuit, ’SwitchVector’, switchpos);

sets the vector of switch positions for the subsequent analysis to switchpos.

t = plecsedit(’get’, circuit, ’Topology’);

returns a struct with the state space matrices A, B, C, D and I for the vector of switch positions specified by the previous command. The matrix I is the identity matrix if all electrical states are independent. Otherwise it specifies the relationship between the dependent variables.

Application Example

This section demonstrates the application of the analysis tools in the PLECS Blockset for the design of the regulated buck converter system operating at a switching frequency of 100 kHz shown in the figure below. The converter shall supply a regulated 15 volts to a resistive load at a nominal load current of 5 amperes.

pict pict

The examples used in this section follow the design example in [Erickson], chapter 9. They have been implemented in the demo models plBuckSweep, plBuckImpulseResponse and plBuckLoop.

Steady-State Analysis

We first examine the open-loop behavior of the system. In order to get the desired output voltage we need to apply a fixed duty-cycle of V   ∕V  = 15V ∕28V
 out  src  . You can verify this by using the Steady-State Analysis block to obtain the steady-state waveform of the output voltage.

For this purpose you copy the block into the model and double-click it to open the dialog box. The parameter System period length is already set to the correct value, i.e. 1e-5. Set the parameter Show steady-state cycles to e.g. 10 so that you can more easily check that the system is indeed in the steady state when the analysis finishes. Then click on Start analysis. The algorithm should converge after the first iteration, and the scope should show the waveform in the figure below.

pict
Steady-state output voltage

AC Sweep

Open-loop control-to-output transfer function In order to determine the control-to-output transfer function you need to perturb the steady-state duty-cycle and measure the corresponding perturbation of the output voltage. This is achieved by connecting an AC Sweep block as shown below. The block output is the perturbation signal; it is added to the steady-state duty cycle. The block input is connected to the load voltage signal.

The initial amplitude of the perturbation is set to 1e-3 which is approx. 2/1000 of the duty cycle. We want to sweep a frequency range between 100Hz and 50kHz with a few extra points between 800Hz and 1200Hz. This is achieved by setting the parameter to [100 800:50:1200 50000]. As expected, the resulting bode plot of the transfer function shows a double pole at          √ ---
f0 = 1∕(2π LC) ≈ 1kHz   and a dc gain of G0 = 28V ≈ 29dB  .

pict pict pict
Open-loop control-to-output transfer function

Open-loop output impedance Although not required for the compensator design we will now calculate the output impedance for demonstration purposes. To do so we need to inject a small ac current into the converter output and measure the resulting perturbation of the output voltage. We therefore connect a controlled current source in parallel with the load resistor as shown below. This current source is controlled by the perturbation signal of the AC Sweep block. The block input is again connected to the load voltage signal. The average steady-state output current is 5 amperes; we therefore set the initial perturbation amplitude to 1e-2.

pict pict pict
Open-loop output impedance

Impulse Response Analysis

Alternatively you can determine the open-loop transfer functions using the Impulse Response Analysis block as shown in the figure below. In this analysis method the calculation of an individual output point is relatively inexpensive; we therefore set the number of points to 300 and extend the sweep range to [10 50000]. In order to compensate for the discrete rectangular pulse used to perturb the system, we choose the setting external reference for the control-to-output transfer function and discrete pulse for the output impedance.

pict pict
Using the Impulse Response Analysis block

Loop Gain Analysis

Compensator settings

pict
pict
PID compensator and transfer function

The compensator should attain a crossover frequency of fc = 5kHz  . At this frequency the open-loop control-to-output transfer function has a phase of nearly - 180∘ . It should be lifted by 52∘  to get a peak overshoot of 16%. This is achieved using a PD compensator with a zero at fz = 1.7kHz  , a pole at fp = 14.5kHz   and a dc gain of k = (fc∕f0)2∘fz-∕fp∕G0 ≈ 0.3  . For a zero stationary error a PI compensator with an inverted zero at fZ = 500Hz   is added. The compensator is implemented as shown above. The compensator output is limited to 0.1…0.9. In order to prevent windup problems during the steady-state analysis the integrator is limited to the same range.

Loop gain

pict pict pict
Closed-loop gain

The gain of the closed control loop is measured by inserting the Loop Gain Analysis block into the loop path. A good place is the feedback path as shown below. The average steady-state load voltage is 15 volts; the initial perturbation amplitude is therefore chosen as 1e-2. The convergence of the initial steady-state analysis can be accelerated by pre-charging the capacitor to its average steady-state voltage. The resulting bode plot of the closed-loop gain shown in the figure below. Also shown are the open-loop control-to-output function with a dashed line and the PID compensator transfer function with a dotted line. As you can see, the design goals for crossover frequency and phase margin have been reached.
State-Space Averaging

Another method for obtaining the open-loop transfer functions of a circuit is a technique called state-space averaging. This topic is fairly complex and could easily fill a book of its own. This manual therefore assumes that you are familiar with the concept and just highlights how to use PLECS in the process. The code examples given here are collected in the demo M-file plSSADemo.

The small-signal ac model of a dc converter operating in continuous conduction mode (CCM) is described by the equation system

d-~x(t)  =  A~x(t)+ B~u(t)+ {(A1 - A2)x+ (B1 - B2)u}m~(t)
dt                       {                      }
  ~y(t)  =  C~x(t) + D~u(t)+  (C1 - C2)x+ (D1 - D2)u m~(t)

where the quantities ~x(t)  , u~(t)  , ~y(t)   and ~m(t)   are small ac variation around the operating point x  , u  , y   and m  . The averaged state-space matrices A  , B  , C   and D   are defined as

A  =   mA1 + (1- m)A2
B  =   mB1 + (1- m)B2
C  =   mC1 + (1- m)C2

D  =   mD1 + (1- m)D2

where the subscript 1 denotes the interval when the switch is conducting and the diode blocking, and the subscript 2 denotes the interval when the switch is blocking and the diode conducting.

You can use PLECS to calculate the different matrices A1  , A2   etc. and from these the various transfer functions. Using the buck converter from the previous example, the first step is to determine the internal order of the switches:

load_system(’plBuckSweep’);  
names = plecsedit(’get’, ’plBuckSweep/Circuit’, ...  
  ’StateSpaceOrder’);  
names.Switches  
 
ans =  
    ’Circuit/FET’  
    ’Circuit/D’

Next you retrieve the state-space matrices for the two circuit topologies:

plecsedit(’set’, ’plBuckSweep/Circuit’, ’SwitchVector’, [1 0]);  
t1 = plecsedit(’get’, ’plBuckSweep/Circuit’, ’Topology’);  
 
plecsedit(’set’, ’plBuckSweep/Circuit’, ’SwitchVector’, [0 1]);  
t2 = plecsedit(’get’, ’plBuckSweep/Circuit’, ’Topology’);

Now you can calculate the averaged state-space matrices:

m = 15/28;  
A = t1.A*m + t2.A*(1-m);  
B = t1.B*m + t2.B*(1-m);  
C = t1.C*m + t2.C*(1-m);  
D = t1.D*m + t2.D*(1-m);

Output impedance The output impedance is the transfer function from a state-space input (the current source I_ac) to a state-space output (the voltmeter Vm). Such a transfer function is given by:

 ~
Y(s)-= C(sI- A) -1B + D
U~(s)

Since the circuit model is a MIMO (multi-input multi-output) model, you need to specify the indices of the proper elements in the input and output vector. You can identify them using the fields Inputs and Outputs of the struct names that you retrieved earlier:

names.Inputs  
 
ans =  
    ’Circuit/V_dc’  
    ’Circuit/I_ac’  
 
names.Outputs  
 
ans =  
    ’Circuit/Vm’  
    ’Circuit/Am’  
    ’Circuit/FET’  
    ’Circuit/FET’  
    ’Circuit/D’  
    ’Circuit/D’

So, the output impedance is the transfer function from input 2 to output 1. If you have the Control System Toolbox you can now display the Bode diagram:

bode(ss(A,B(:,2),C(1,:),D(1,2)), {2*pi*100, 2*pi*50000})

The figure below shows the output impedance drawn with a solid line. The dots represent the data points returned by the ac sweep.

pict
Open-loop output impedance

Open-loop control-to-output transfer function The control-to-output transfer function describes the effect of the small ac variation m~   on the system outputs. From the small-signal ac model equations we find that

~Y(s)               -1
~----= Cco(sI- Aco)  Bco +Dco
M(s)

with

A    =  A
 co     {             -1             }
Bco  =    - (A1 - A2)A  B + (B1 - B2) u
Cco  =  C
Dco  =  { - (C1 - C2)A -1B + (D1 - D2) }u

Note that B
  co   and D
 co   are column vectors since there is only one scalar input variable, ~m  . The vector u   is a column vector consisting of the dc input voltage and the small-signal ac current.

This leads to the following program code:

u = [28; 0];  
 
B_co = (-(t1.A-t2.A)*(A\B)+(t1.B-t2.B))*u;  
D_co = (-(t1.C-t2.C)*(A\B)+(t1.D-t2.D))*u;  
 
bode(ss(A,B_co,C(1,:),D_co(1)), {2*pi*100, 2*pi*50000})

The figure below shows the control-to-output transfer function drawn with a solid line. The dots represent the data points returned by the ac sweep.

pict
Open-loop control-to-output transfer function

Reference
R.W. Erickson, D. Maksimović, "Fundamentals of Power Electronics, 2nd Ed.", Kluwer Academic Publishers, 2003.