motulator_impedance.grid#

Output admittance of grid converters.

The output admittance of the converter at the point of common coupling (PCC) is measured from simulations by a frequency sweep [1]: the PCC voltage is imposed by a stiff source, and small-signal voltage excitations are injected in the d- and q-axes one frequency at a time. The admittance is the basis of impedance-based stability analysis, e.g., through its passivity.

References

Classes#

MeasurementCfg

Configuration of the output admittance measurement.

OutputAdmittance

Measured output admittance.

Functions#

measure_output_admittance(mdl, ctrl, cfg)

Measure the output admittance of the converter.

plot_operating_point(res, base[, latex])

Plot the converter voltage, PCC voltage, grid voltage, and grid current vectors of

plot_output_admittance(res[, form, passivity_index, latex])

Plot the elements of the output admittance matrix.

Module Contents#

class motulator_impedance.grid.MeasurementCfg[source]#

Configuration of the output admittance measurement.

Parameters:
  • abs_u_e (float) – Magnitude of the voltage excitation (V) at the first frequency.

  • freqs (ndarray, optional) – Excitation frequencies (Hz, in dq-coordinates), defaults to 100 logarithmically spaced frequencies from 1 Hz to 10 kHz.

  • amplitude_multiplier (float, optional) – Excitation magnitude at the last frequency relative to the first one, defaults to 5. The magnitude changes linearly over the frequency array. Use 1 for a constant magnitude.

  • t0 (float, optional) – Stop time for initial simulating to the operating point (s), defaults to 1.0. Should be set large enough to reach steady-state. A time-varying grid frequency must be constant over the last n_periods_init periods.

  • t1 (float, optional) – Additional simulation time for reaching sinusoidal steady-state during signal injection (s), defaults to 0.05.

  • N_eval (int, optional) – Number of evenly spaced data points the solver should return for each integration interval, i.e., for each sampling period or, if carrier comparison is used, for each switching interval, defaults to 10. More points are used at high excitation frequencies, so that each excitation period has at least 10 points.

  • n_periods_excitation (int, optional) – Number of excitation signal periods used in calculating the DFT, defaults to 4. At least 3 are needed if use_window is True.

  • n_periods_init (int, optional) – Number of fundamental periods to include for calculating operating-point vectors, defaults to 1.

  • multiprocess (bool, optional) – If True, the frequencies are simulated in parallel using all available CPU cores, defaults to True. The model and the control system are copied to the worker processes, which can require pickling them. Lambda functions and nested functions (e.g., as references) cannot be pickled, but module-level functions can. In a script, call the measurement under if __name__ == “__main__”:, as in the examples.

  • use_window (bool, optional) – Whether to use window function for calculating DFT, defaults to True.

class motulator_impedance.grid.OutputAdmittance[source]#

Measured output admittance.

Contains fields for excitation signal frequency f_e, elements of the output admittance matrix [Y_dd, Y_qd; Y_dq, Y_qq], and the following operating-point vectors (in synchronous coordinates aligned with the PCC voltage): grid current i_g0, grid voltage e_g0, PCC voltage u_g0 and converter voltage u_c0. The results can be saved, e.g., by scipy.io.savemat(path, dataclasses.asdict(res)).

motulator_impedance.grid.measure_output_admittance(mdl, ctrl, cfg)[source]#

Measure the output admittance of the converter.

The system is first simulated to the operating point. Then, the output admittance of the converter is measured at the PCC: the PCC voltage is imposed by a stiff voltage source, whose magnitude and frequency equal those of the operating point, and small-signal voltage excitations are injected in the d- and q-axes. The grid impedance of mdl as well as any time variation and negative-sequence component of its source only affect the operating point, whose grid frequency is that of the source at t0. A DC bus of mdl is included in the measurement.

Parameters:
  • mdl (GridConverterSystem) – Continuous-time system model.

  • ctrl (GridConverterControlSystem) – Discrete-time control system.

  • cfg (MeasurementCfg) – Measurement configuration.

Returns:

Admittance matrix elements and the operating point.

Return type:

OutputAdmittance

Notes

With carrier-comparison PWM, background switching harmonics can bias the measured admittance at the excitation frequency. Results near switching harmonics and their sidebands may depend strongly on the excitation amplitude and its phase relative to the carrier, even when the numerical solution has converged.

motulator_impedance.grid.plot_operating_point(res, base, latex=False)[source]#

Plot the converter voltage, PCC voltage, grid voltage, and grid current vectors of the operating point.

Parameters:
  • res (OutputAdmittance) – Output admittance with the operating point.

  • base (BaseValues) – Base values for per-unit conversion.

  • latex (bool, optional) – Use latex for plots, defaults to False.

Return type:

None

motulator_impedance.grid.plot_output_admittance(res, form='re_im', passivity_index=True, latex=False)[source]#

Plot the elements of the output admittance matrix.

Parameters:
  • res (OutputAdmittance) – Output admittance.

  • form (Literal["polar", "re_im"], optional) – Form of the elements, defaults to “re_im”. Options are: - “polar”: magnitude and phase - “re_im”: real and imaginary parts

  • passivity_index (bool, optional) – Plot also the input feedforward passivity index computed from the admittance matrix, defaults to True.

  • latex (bool, optional) – Use latex for plots, defaults to False.

Return type:

None