This example shows how to identify a frequency domain model using a pseudorandom binary sequence (PRBS) for a power electronics system modeled in Simulink® using Simscape™ Electrical™ components. This example addresses the frequency response estimation process in the controller design workflow using a PRBS as the input signal.
Typically, power electronics systems cannot be linearized because they use high-frequency switching components, such as pulse-width modulation (PWM) generators. However, most Simulink® Control Design™ PID tuning tools design PID gains based on a linearized plant model. To obtain such a model for a power electronics model that cannot be linearized, you can estimate the plant frequency response over a range of frequencies as shown in this example. To collect frequency response data, you can:
Estimate the plant frequency response at the command line.
Estimate the plant frequency response using the Model Linearizer app.
This example uses a boost converter model as an example of a power electronics system. A boost converter circuit converts one DC voltage to another, typically higher, DC voltage by controlled chopping or switching of the source voltage.
mdl = 'scdboostconverter'; open_system(mdl)
In this model, a MOSFET driven by a pulse-width modulation (PWM) signal is used for switching. The output voltage should be regulated to the reference value . A digital PID controller adjusts the PWM duty cycle, , based on the voltage error signal. For this example, you estimate the frequency response from the PWM duty cycle to the load voltage .
Simscape Electrical software contains predefined blocks for many power electronics systems. This model contains a variant subsystem with two versions of the boost converter model:
Boost converter circuit constructed using electrical power components. The parameters of the circuit components are based on .
Boost converter block configured to have the same parameters as the boost converter circuit. For more information on this block, see Boost Converter (Simscape Electrical).
To use the Boost Converter block version of the subsystem, in the model, click Boost Converter Block or use the following command.
set_param([bdroot '/Simscape Power Systems Boost Converter'],... 'OverrideUsingVariant','block_boost_converter');
To estimate the frequency response for the boost converter, you must first determine the steady-state operating point at which you want the converter to operate. For more information on finding operating points, see Find Steady-State Operating Points for Simscape Models. For this example, use an operating point estimated from a simulation snapshot at
opini = findop(mdl,0.045);
Initialize the model with the computed operating point.
A pseudorandom binary signal (PRBS) is a periodic, deterministic signal with white-noise-like properties that shifts between two values. A PRBS is an inherently periodic signal with a maximum period length of
n is the PRBS order.
Create a PRBS with the following configuration.:
To use a nonperiodic PRBS set the number of periods to
Use a PRBS order of
12, producing a signal of length
4095. To obtain an accurate frequency response estimation, the length of the PRBS must be sufficiently large.
Set the injection frequency of the PRBS to 200kHz to match the sample time in the model.
To ensure that the system is properly excited, set the perturbation amplitude to
0.05. If the input amplitude is too large, the boost converter operates in discontinuous-current mode. If the input amplitude is too small, the PRBS is indistinguishable from ripples in the power electronic circuits.
in_PRBS = frest.PRBS('Order',12,'NumPeriods',1,'Amplitude',0.05,'Ts',5e-6);
To collect frequency response data, you can estimate the plant frequency response at the command line. To do so, first get the input and output linear analysis points from the model.
io = getlinio(mdl);
Specify the operating point using the model initial condition.
op = operpoint(mdl);
Find all source blocks in the signal paths of the linearization outputs that generate time-varying signals. Such time-varying signals can interfere with the signal at the linearization output points and produce inaccurate estimation results.
srcblks = frest.findSources(mdl,io);
To disable the time-varying source blocks, create an
frestimateOptions option set and specify the
opts = frestimateOptions; opts.BlocksToHoldConstant = srcblks;
Estimate the frequency response using the PRBS input signal.
sysest_prbs = frestimate(mdl,io,op,in_PRBS,opts);
Compare the estimation results when using PRBS signal to those found using a sinestream input signal. Compare the signals across the
15 logarithmically-spaced frequencies used for the sinestream ranging from
50 Hz to
load frdSinestream wbode = estsysSinestream.Frequency; bode(sysest_prbs,'b-'); hold on bode(estsysSinestream,'ro--',wbode(1:end-2)); legend('PRBS estimation result','Sinestream estimation result',... 'Location','northeast') grid on
Alternatively, you can use the Model Linearizer app to collect frequency response data from the same model using a PRBS input signal. To collect frequency response data for a PRBS signal, in the Model Linearizer, on the Estimation tab, under Input Signal, select PRBS Pseudorandom Binary Sequence.
In the Create PRBS input dialog box, configure the PRBS parameters.
Click OK. The software adds the PRBS signal to the Linear Analysis Workspace.
To estimate and plot the frequency response, on the Estimation tab, click Bode.
In the Model Linearizer, you can also compare the frequency response data with the result obtained using a sinestream signal. The following figure compares the system estimated using a PRBS input signal (
estsys1) with the result obtained using a sinestream signal (
The frequency response using the PRBS input signal shows discrepancies from the result obtained using a sinestream input signal. To improve the frequency response estimation result, you can use a different sample time other than the sample time in the original boost converter model. To do so, modify the model to use a constant block at the input analysis point and a Rate Transition block at the output analysis point.
For both the Constant block and the Rate Transition block, use a sample time of
5e-5 s, which is ten times slower than the original sample time of
Create a PRBS input signal using the new sample time.
in_PRBS = frest.PRBS('Order',12,'NumPeriods',1,'Amplitude',0.05,'Ts',5e-5);
With the new PRBS input signal, you can obtain an improved frequency response that more closely matches the sinestream result.
The ability to change the sample time of the PRBS input signal time provides an additional degree of freedom in the frequency response estimation process. Using a larger sample time than in the original model, you can obtain a higher resolution frequency response estimation result over the low-frequency range.
Close the model.