Usage in PLECS Standalone

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

../../_images/analysistools.png

Fig. 91 Analysis tools dialog

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 -. You can reorder the analyses by clicking and dragging an entry up and down in the list.

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

Operating point

This parameter defines whether the operating point of the system is periodic or non-periodic (DC). If it is periodic, the system period can be specified using the next parameter.

System period

The system period is the least common multiple of the periods of all sources (signal or electrical) in the model, in seconds \((\mathrm{s})\). 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. A setting of 0 is equivalent to defining the system as non-periodic. When set to auto, which is the default, PLECS will try to determine the system period automatically.

Simulation start time

The start time \(t_{\mathrm{start}}\) to be used in the transient simulation runs, in seconds \((\mathrm{s})\). Simulations run from \(t_{\mathrm{start}}\) to \(t_{\mathrm{start}}+T\), where \(T\) is the system period specified above. The default is 0.

Show final cycles / timespan

The number of steady-state cycles for which a transient simulation is run at the end of an analysis. Or, if the simulation is non-periodic, the duration of the final transient simulation. 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.

Max. number of threads

Specifies the maximum number of parallel threads that may be used during the analysis. When set to auto, the limit specified in the PLECS preferences is used.

AC Sweep

In order to perform an AC Sweep, you need to insert a Small Signal Perturbation block 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 loop gain of a closed 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.

Operating point

This parameter defines whether the operating point of the system is periodic or non-periodic (DC). If it is periodic, the system period can be specified using the next parameter.

System period

The system period is the least common multiple of the periods of all sources (signal or electrical) in the model, in seconds \((\mathrm{s})\). 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. A system period of 0 is equivalent to defining the system as non-periodic. When set to auto, which is the default, PLECS will try to determine the system period automatically.

Frequency range

A vector containing the lowest and highest perturbation frequency, in hertz \((\mathrm{Hz})\).

Amplitude

A vector containing the amplitudes of the perturbation signal at the lowest and highest frequency. The amplitudes at intermediate frequencies are interpolated linearly. If a scalar is entered, the amplitude will be constant for all frequencies.

Perturbation

The Small Signal Perturbation block that will be active during the analysis. All other perturbations blocks will output 0.

Response

The Small Signal Response block that will record the system response during the analysis.

Simulation start time

The start time \(t_{\mathrm{start}}\) to be used in the transient simulation runs, in seconds \((\mathrm{s})\). Simulations run from \(t_{\mathrm{start}}\) to \(t_{\mathrm{start}}+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, in hertz \((\mathrm{Hz})\).

Max. number of threads

Specifies the maximum number of parallel threads that may be used during the analysis. When set to auto, the limit specified in the PLECS preferences is used.

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

Multitone Analysis

In order to perform a multitone analysis, you need to insert a Small Signal Perturbation block 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.

Initial simulation period

The duration of an initial simulation performed before the response is measured. It is assumed that during this period, the system reaches its steady state. The total simulation duration will be the sum of this parameter and one period of the base frequency signal.

Frequency range

A vector containing the lowest and highest frequency of the multitone perturbation signal, in hertz \((\mathrm{Hz})\). The highest frequency is rounded up towards the next integer multiple of the lowest frequency.

In a multitone analysis, the frequencies are linearly spaced (see Multitone Analysis). Since the Bode plot has a logarithmic scale, PLECS thins out the higher frequency values to accelerate the analysis.

If the lowest and highest frequencies are far apart, i.e. separated by several orders of magnitude, the multitone analysis may become slow. One reason is that the simulation times become long and the simulation steps small, since they depend on the lowest and highest frequencies, respectively. You may try to speed up the analysis by specifying intermediate frequency values, i.e. by entering a frequency vector with more than two elements. Each intermediate value must be greater than ten times the preceding value. If the frequency vector contains \(n\) elements, \(n-1\) separate multitone analyses are performed and the Bode plot is composed of the respective results. Since the frequency range of each individual multitone analysis is smaller than the overall range, the total time needed may become shorter.

Amplitude

The amplitude of the perturbation signal. Note that the actual perturbation signal may have a sightly different amplitude due to its composition from the different tones.

Perturbation

The Small Signal Perturbation block that will be active during the analysis. All other perturbations blocks will output 0.

Response

The Small Signal Response block that will record the system response during the analysis.

Simulation start time

The start time \(t_{\mathrm{start}}\) to be used in the transient simulation runs, in seconds \((\mathrm{s})\). The default is 0.

Max. number of threads

Specifies the maximum number of parallel threads that may be used during the analysis. When set to auto, the limit specified in the PLECS preferences is used.

Frequency Response

In order to perform a frequency response analysis, you need to insert a Small Signal Perturbation block 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 on the Show results button.

Note

The button Show log opens the log of the analysis. It shows the progress of the analysis and other information which may help to improve the analysis result.

Initialization time span

The duration of an initial simulation performed before the sinusoidal perturbations are applied, in seconds \((\mathrm{s})\). It is assumed that the system reaches its unperturbed steady state during this period.

The initial simulation runs only once. The reached system state is then used to initialize all the following perturbed simulations.

Note

If your model contains components which do not support storing and restoring their internal state (for example certain C-Script, FMU and DLL components), set the Initialization time span to 0 and increase the Settling time span.

Settling time span

Time needed by the system to reach steady state after the sinusoidal perturbation is applied, in seconds \((\mathrm{s})\).

Frequency ranges

A scalar or vector defining the perturbation frequency or frequencies, in hertz \((\mathrm{Hz})\):

  • For a scalar value, the analysis will be executed only for a single frequency. In this case, Amplitude and Extraction cycles also must be scalar values, Number of points must be 1, and Additional frequencies must be empty.

  • A two-element vector with the lowest and highest perturbation frequencies.

  • A vector of three or more strictly monotonically increasing values which divide the frequency range into multiple sections. Each section can have different Amplitude or Extraction cycles values.

Note

If the frequency response shows unexpected results at a certain frequency, create an additional Frequency Response Analysis to investigate the behaviour of the model at that specific frequency. Then apply the improved parameters to your original frequency response analysis.

Amplitude

A scalar or vector defining the amplitudes of the perturbation signal at frequencies specified in Frequency ranges:

  • A scalar value will be used for all frequencies.

  • A vector must have the same number of elements as the Frequency ranges vector. The amplitudes at intermediate frequencies are interpolated linearly.

Extraction cycles

A scalar or vector defining the number of cycles of each sinusoidal perturbation used to compute the frequency response after the settling time span has elapsed.

  • A scalar value applies the same number of extraction cycles to all frequencies.

  • A vector which defines different number of extraction cycles per frequency section. The length of the vector must be \(n-1\), where \(n\) is the number of elements in the Frequency ranges vector.

Perturbation

The Small Signal Perturbation block that will be active during the analysis. All other perturbations blocks will output \(0\).

Response

The Small Signal Response block that will record the system response during the analysis.

Simulation start time

The start time \(t_{\mathrm{start}}\) to be used in the transient simulation runs, in seconds \((\mathrm{s})\). Simulations run from \(t_{\mathrm{start}}\) to \(t_{\mathrm{start}}+T_{init}+T_s+T_c\), where \(T_{init}\) is the Initialization time span, \(T_s\) is the Settling time span and \(T_c\) is the extraction time span depending on the frequency and the Extraction cycles. The default is the Start time specified in the PLECS Standalone Parameters.

Note

If the simulation starts from a Stored system state (see System State), the Simulation start time parameter is ignored. This is reported in the analysis log.

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, in hertz \((\mathrm{Hz})\). These frequencies must be inside the Frequency ranges.

Max. number of threads

Specifies the maximum number of parallel threads that may be used during the analysis. When set to auto, the limit specified in the PLECS preferences is used.

AC Analysis (Linearized Circuit)

In order to perform an AC Analysis (Linearized Circuit), you need to insert a Small Signal Perturbation block 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 loop gain of a closed 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.

Note

The AC Analysis (Linearized Circuit) linearizes the circuit equations at the given operating point. It is hence not suited for determination of the response function of switched systems.

Operating point

This parameter is always set to “transient”. The analysis runs a transient simulation and then linearizes the circuit at the operating point.

Frequency range

A vector containing the lowest and highest perturbation frequency, in hertz \((\mathrm{Hz})\).

Amplitude

A vector containing the amplitudes of the perturbation signal at the lowest and highest frequency. The amplitudes at intermediate frequencies are interpolated linearly. If a scalar is entered, the amplitude will be constant for all frequencies. This is used only for the determination of the standard PLECS response, not for PLECS Spice.

Perturbation

The Small Signal Perturbation block that will be active during the analysis. All other perturbations blocks will output \(0\).

Response

The Small Signal Response block that will record the system response during the analysis.

Simulation start time

The time \(t_{\mathrm{start}}\) at which to perform the circuit linearization.

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, in hertz \((\mathrm{Hz})\).

Extraction of State-Space Matrices

PLECS allows you to extract the state-space matrices describing the linear portion of a circuit model for a given combination of switch positions. The commands used for this purpose are listed below. These commands can be used both in a Simulation Script and on the Octave console. In each of the commands circuit is the name of the circuit model.

names = plecs('get', circuit, 'StateSpaceOrder');

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

plecs('set', circuit, 'SwitchVector', switchpos);

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

t = plecs('get', circuit, 'Topology');

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

These matrices can be further used for state_space averaging.

Example Model

  • See the example model “State Space Matrices”.

  • Find it in PLECS under Help > PLECS Documentation > List of Example Models.

Above commands can also be invoked via the RPC interface using analogous syntax.

Application Example

The following demo model implements the buck converter shown in Fig. 92. It operates at a switching frequency of \(100\,\mathrm{kHz}\) with a fixed duty-cycle of \(15/28\). To run a transient simulation from zero initial conditions, select Simulation > Start from the menu.

Demo Model

  • See the demo model “Buck Converter with Analysis Tools”.

  • Find it in PLECS under Window > Demo Models > Power Supplies.

../../_images/buckopenloop_schema.svg

Fig. 92 Simulation model of the open-loop buck converter

To view the analyses configured in this model, select Simulation > Analysis tools… from the schematic editor 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/100\,\mathrm{kHz} = 10^{-5}\,\mathrm{s}\).

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\,\mathrm{Hz}\) and \(50\,\mathrm{kHz}\). 21 points are placed logarithmically within this range; to obtain a smoother output, additional data points are generated between \(800\) and \(1400\,\mathrm{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 following demo model implements the controlled buck converter shown in Fig. 93. A PID controller regulates the output voltage to \(15\,\mathrm{V}\).

Demo Model

  • See the demo model “Buck Converter with Loop Gain Analysis”.

  • Find it in PLECS under Window > Demo Models > Power Supplies.

../../_images/buckclosedloop_schema.svg

Fig. 93 Simulation model of the controlled buck converter

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 block’s mask, you can see how the block, both, injects a small perturbation and measures the system response.

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