PLECS 3.0 Online Help

Analysis Tools

This section applies only to the PLECS Blockset.

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.

The PLECS Steady-State Analysis tool implements a special algorithm for calculating the steady-state solution of a periodic system without simulating all of the transients. An analysis is defined and started using the Steady-State Analysis block from the Extras library.

Algorithm

The steady-state analysis is based on a quasi-Newton method with Broyden's update [Maksimović]. 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 after a time T  . Evaluating f(x)   or FT(x)   therefore involves running a simulation over a time-span T  . 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. Because this is computationally expensive, only the first Jacobian is actually computed this way. In subsequent iterations, the Jacobian is updated using a special rule 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.

Calculation of the Jacobian Matrix

As mentioned above, the Jacobian matrix is calculated numerically using finite differences. This requires a total of n+ 1   simulation runs, where n   is the number of state variables. 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

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.

Parameters

This table lists and describes the parameters of the Steady-State Analysis block. The Parameter column lists 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.



Parameter

Description



TimeSpan

For a fixed system period, the period length; 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 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.

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

Transfer functions play an important role in controller design. PLECS features two analysis tools to obtain different transfer functions of a system. The AC Sweep block determines arbitrary open-loop transfer functions such as the control-to-output transfer function or the output impedance of a converter. The Loop-Gain Analysis block determines the closed-loop gain of a feedback system.

Algorithm

An AC analysis is based on time-domain simulations to evaluate a transfer function 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. 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.

Parameters

This table lists and describes the parameters of the AC Sweep block and the Loop-Gain Analysis block. The Parameter column lists 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.



Parameter

Description



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 ditributed 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 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

An alternative and faster method to determine the 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. This method is implemented in the Impulse Response Analysis block.

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.
  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.

Parameters

This table lists and describes the parameters of the Impulse Response Analysis block. The Parameter column lists 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.



Parameter

Description



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 ditributed 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 Amplitude at first freq 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 during the initial steady-state analysis. 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 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

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.