soft4pes.model.grid#

Grid models.

Submodules#

Classes#

BaseGrid

Base values for a grid.

LCLFilterParameters

Parameters for an LCL-filter.

RLGridLCLFilter

Model of a grid with stiff voltage source, RL impedance and an LC(L) filter in alpha-beta frame.

RLGrid

Model of a grid with a voltage source and an RL impedance in alpha-beta frame. The state of the

RLGridParameters

Parameters for a grid with a voltage source and an RL impedance. The grid voltage can be given

Package Contents#

class soft4pes.model.grid.BaseGrid(Vg_R_SI, Ig_R_SI, fg_R_SI)[source]#

Base values for a grid.

The class computes the base values for a grid based on the rated values.

Parameters:
  • Vg_R_SI (float) – Rated voltage [V] (line-to-line rms voltage).

  • Ig_R_SI (float) – Rated current [A] (line rms current).

  • fg_R_SI (float) – Rated frequency [Hz].

V#

Base voltage [V].

Type:

float

I#

Base current [A].

Type:

float

w#

Base angular frequency [rad/s].

Type:

float

S#

Base apparent power [VA].

Type:

float

Z#

Base impedance [Ohm].

Type:

float

L#

Base inductance [H].

Type:

float

C#

Base capacitance [F].

Type:

float

class soft4pes.model.grid.LCLFilterParameters(L_fc_SI, C_SI, base, L_fg_SI=0, R_fc_SI=0, R_c_SI=0, R_fg_SI=0)[source]#

Parameters for an LCL-filter.

Parameters:
  • L_fc_SI (float) – Inductance of the converter side filter inductor [H].

  • C_SI (float) – Capacitance of the filter capacitor [F].

  • base (base value object) – Base values.

  • L_fg_SI (float, optional) – Inductance of the grid side filter inductor [H].

  • R_fc_SI (float, optional) – Resistance of the converter side filter inductor [Ohm].

  • R_c_SI (float, optional) – Resistance of the filter capacitor [Ohm].

  • R_fg_SI (float, optional) – Resistance of the grid side filter inductor [Ohm].

X_fc#

Reactance of the converter side filter inductor [p.u.].

Type:

float

R_fc#

Resistance of the converter side filter inductor [p.u.].

Type:

float

Xc#

Reactance of the filter capacitor [p.u.].

Type:

float

Rc#

Resistance of the filter capacitor [p.u.].

Type:

float

X_fg#

Reactance of the grid side filter inductor [p.u.].

Type:

float

R_fg#

Resistance of the grid side filter inductor [p.u.].

Type:

float

base#
Type:

base value object

class soft4pes.model.grid.RLGridLCLFilter(par_grid, par_lcl_filter, conv, base)[source]#

Bases: soft4pes.model.grid.rl_grid.RLGrid

Model of a grid with stiff voltage source, RL impedance and an LC(L) filter in alpha-beta frame. If the grid side inductance is not provided, the filter is in LC configuration.

The state of the system is the converter current, the capacitor voltage and the grid current in the alpha-beta frame, i.e. x = [i_conv^T, ig^T, vc^T]^T. The system input is the converter three-phase switch position or modulating signal. The grid voltage is considered to be a disturbance. The positive current direction is from the converter to the filter and from the filter to the grid for i_conv and ig, respectively. Knowledge of the grid impedance is required, and given to the model in the parent class RLGrid.

Parameters:
  • par_grid (RLGridParameters) – Parameters of the grid.

  • par_lcl_filter (LCLFilterParameters) – Parameters of the LCL filter.

  • conv (converter object) – Converter object.

  • base (base value object) – Base values.

data#

Namespace for storing simulation data.

Type:

SimpleNamespace

par#

Combined RLGridParameters and LCLFilterParameters.

Type:

System parameters

conv#

Converter object.

Type:

converter object

x#

Current state of the grid [p.u.].

Type:

1 x 6 ndarray of floats

base#

Base values.

Type:

base value object

cont_state_space#

The continuous-time state-space model of the system.

Type:

SimpleNamespace

state_map#

A dictionary mapping states to elements of the state vector.

Type:

dict

set_initial_state(**kwargs)[source]#

Set the initial state of the system to zero.

get_continuous_state_space()[source]#

Get the continuous-time state-space model of the system in alpha-beta frame.

Returns:

A SimpleNamespace object containing matrices F, G1 and G2 of the continuous-time state-space model.

Return type:

SimpleNamespace

class soft4pes.model.grid.RLGrid(par, conv, base, ig_ref_init=None)[source]#

Bases: soft4pes.model.common.system_model.SystemModel

Model of a grid with a voltage source and an RL impedance in alpha-beta frame. The state of the system is the grid current (same as the converter current). The system input is the converter three-phase switch position or modulating signal. The grid voltage is considered to be a disturbance and the magnitude of the grid voltage is configurable as a function of time using a Sequence object.

This class can be used as a base class for other grid models.

Parameters:
  • par (RLGridParameters) – Grid parameters in p.u.

  • conv (converter object) – Converter object.

  • base (base value object) – Base values.

  • ig_ref_init (1 x 2 ndarray of floats, optional) – Reference at discrete time instant kTs = 0 for starting simulation from steady state.

data#

Namespace for storing simulation data.

Type:

SimpleNamespace

par#

Grid parameters in p.u.

Type:

RLGridParameters

conv#

Converter object.

Type:

converter object

x#

Current state of the grid [p.u.].

Type:

1 x 2 ndarray of floats

base#

Base values.

Type:

base value object

cont_state_space#

The continuous-time state-space model of the system.

Type:

SimpleNamespace

state_map#

A dictionary mapping states to elements of the state vector.

Type:

dict

set_initial_state(**kwargs)[source]#

Set the initial state of the system based on the grid current reference, if provided.

Parameters:

ig_ref_init (1 x 2 ndarray of floats, optional) – Reference at discrete time instant kTs = 0 for starting simulation from steady state.

get_continuous_state_space()[source]#

Calculate the continuous-time state-space model of the system.

Returns:

A SimpleNamespace object containing matrices F, G1 and G2 of the continuous-time state-space model.

Return type:

SimpleNamespace

get_grid_voltage(kTs)[source]#

Get the grid voltage at a specific discrete time instant.

Parameters:

kTs (float) – Current discrete time instant [s].

Returns:

Grid voltage in alpha-beta frame [p.u.].

Return type:

1 x 2 ndarray of floats

get_next_state(matrices, u_abc, kTs)[source]#

Calculate the next state of the system.

Parameters:
  • u_abc (1 x 3 ndarray of floats) – Converter three-phase switch position or modulating signal.

  • matrices (SimpleNamespace) – A SimpleNamespace object containing the state-space model matrices.

  • kTs (float) – Current discrete time instant [s].

Returns:

The next state of the system.

Return type:

ndarray of floats

get_measurements(kTs)[source]#

Update the measurement data of the system.

Parameters:

kTs (float) – Current discrete time instant [s].

Returns:

A SimpleNamespace object containing the grid voltage in alpha-beta frame.

Return type:

SimpleNamespace

class soft4pes.model.grid.RLGridParameters(Vg_SI, fg_SI, Rg_SI, Lg_SI, base)[source]#

Parameters for a grid with a voltage source and an RL impedance. The grid voltage can be given as a constant or as a function of time using a Sequence object.

Parameters:
  • Vg_SI (float or Sequence) – Grid voltage [V] (line-to-line rms voltage).

  • fg_SI (float) – Grid frequency [Hz].

  • Rg_SI (float) – Resistance [Ohm].

  • Lg_SI (float) – Inductance [H].

  • base (base value object) – Base values.

Vg#

Grid voltage [p.u.] (line-to-line rms voltage).

Type:

float or Sequence

wg#

Angular frequency [p.u.].

Type:

float

Rg#

Resistance [p.u.].

Type:

float

Xg#

Reactance [p.u.].

Type:

float