Main Content

Superposition Signal Generator

Generate superposition input signal for plant frequency response estimation

Since R2024b

  • Superposition Signal Generator Block icon

Libraries:
Simulink Control Design / Signal Generation

Description

Use this block to generate superimposed sinusoidal input perturbation signals. This block allows you to generate scalar or vector signals including three-phase sin, cos, or both (sincos) signals. Three-phase signals are helpful when you want to identify frequency response of three-phase AC power systems. For example, you can use the generated signal to measure impedance of a power inverter which connects renewable energy resources to three-phase AC power grids

This block is helpful when you want to generate perturbation signals to inject in your plant models in desktop simulation or on hardware through code generation. You can then collect the plant response data to the perturbation signal and perform custom processing to identify plant characteristics.

Examples

Ports

Input

expand all

To start and stop the signal generation process, provide a signal at the start/stop port. When the value of the signal changes from:

  • Negative or zero to positive, the signal generation starts

  • Positive to negative or zero, the signal generation stops

Typically, you can use a signal that changes from 0 to 1 to start the experiment, and from 1 to 0 to stop it. When the experiment is not running, the block does not generate a perturbation at the output port.

Generate a perturbation signal which is long enough for the algorithm to collect sufficient data for a good estimate at all frequencies it probes. The block displays a recommended experiment length in the Signal Length section of the block parameters. This value is based on the block parameters you specify. The recommended experiment length is six times the longest period.

Data Types: single | double

Supply a value for the Frequencies parameter. See the Frequencies parameter for information about how to choose frequencies.

When you supply frequencies via this port, specify the number of frequencies with the Number of frequencies parameter.

Dependencies

To enable this port, in Excitation Signal Source, select External ports.

Data Types: single | double

Supply a value for the Amplitudes parameter. See the Amplitudes parameter for details.

Dependencies

To enable this port, in Excitation Signal Source, select External Ports.

Data Types: single | double

Output

expand all

Superimposed sinusoidal perturbation signal.

Data Types: single | double

Three-phase superposition perturbation signal.

To extract each phase in the output signal, use a Demux block.

Dependencies

To enable this port, select Generate three-phase perturbation signal.

Data Types: single | double

Parameters

expand all

To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.

The block is a discrete-time block that runs at a fixed sample time, specified with this parameter. The largest frequency that you can estimate is the Nyquist frequency, π/Ts rad/s. Best practice is to use a sample time at least five times faster than the Nyquist frequency.

Ts = π/(5ωmax) ≅ 0.6/ωmax or 0.1/fmax,

Here, ωmax is the highest frequency in the Frequencies parameter in rad/s, and fmax is the highest frequency in Hz. The sample time must be small enough to estimate the fastest desired frequency, but not so small as to introduce unnecessary computational burden.

If you set the sample time to –1, then the software determines the sample time on compilation, based on the sources outside the block. Setting sample time to –1 disables the internal checks in the block that ensure your estimation frequencies are below the Nyquist frequency.

Tip

If you want to run the deployed block with different sample times in your application, set this parameter to –1 and put the block in a Triggered Subsystem. Then, trigger the subsystem at the desired sample time. If you do not plan to change the sample time after deployment, specify a fixed and finite sample time.

Specify the floating-point precision based on simulation environment or hardware requirements.

Specify whether to supply the frequencies and amplitudes of the experiment perturbation signal via block parameters or via external ports.

  • Block parameters — Select to enable the Frequencies and Amplitudes parameters.

  • External ports — Select to enable the w and amp input ports. Use this option if you want to change the frequencies and amplitudes of the perturbation signal after deployment.

Frequencies at which to estimate the frequency response of the plant. The block injects a perturbation at each of these frequencies. The highest frequency you can estimate is limited by the Nyquist frequency, π/Ts rad/s, where Ts is the value you set for the Sample time (Ts) parameter.

Tips

This parameter is not tunable. To provide frequencies after deployment, set Excitation Signal Source to External ports and use the w input port.

Dependencies

To enable this parameter, set Excitation Signal Source to Block parameters.

Specify the amplitudes of the perturbation signals injected into the plant. To use the same amplitude for all frequencies, specify a scalar value. If you know that the response changes significantly over range of frequencies to estimate, then you can use a vector to specify a different amplitude for each frequency. For instance, you can use a smaller value around known resonant frequencies and a larger value above the rolloff frequency. The vector must be the same length as the vector you provide for Frequencies.

The amplitudes must be:

  • Large enough that the perturbation overcomes any deadband in the plant actuator and generates a response above the noise level

  • Small enough to keep the plant running within the approximately linear region near the nominal operating point, and to avoid saturating the plant input or output

For superposition perturbation signals, the sinusoidal signals are superimposed with no phase shift. Thus, the maximum perturbation can exceed the amplitude of any individual component, up to the sum of all amplitudes. Make sure that the largest possible perturbation is within the range of your plant actuator. Saturating the actuator can introduce errors into the estimated frequency response.

Tip

This parameter is not tunable. To provide amplitudes after deployment, set Excitation Signal Source to External ports and use the amp input port.

Dependencies

To enable this parameter, set Excitation Signal Source to Block parameters.

When you provide the experiment frequencies via the external port w, specify the number of frequencies (the length of the vector signal at w) with this parameter.

Dependencies

To enable this parameter, set Excitation Signal Source to External ports.

Advanced Settings

Specify the waveform type of the perturbation signal as either sine, cosine, or both (sincos) at the same time.

Specify the phase shift in the waveform.

Generate a balanced three-phase perturbation signal with a phase difference of 120° between waves. Three-phase signals are helpful when you want to identify frequency response of three-phase AC power systems.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2024b