# How to inject harmonic currents in DQ frame?

With MANATEE software it is possible to inject harmonic currents in DQ or ABC frame. This additional harmonic is overlaid to the current waveform computed using the equivalent circuit.

The current injection in DQ frame can be activated by defining in the simulation project:

```Input.Simu.type_injection = 1;  % 0 for no current injection                                % 1 for current injection in DQH frame                                % 2 for current injection in ABC frame```

Several harmonics can be injected by filling the following vectors:

```Input.Simu.A_Idinj = ;       % RMS amplitude of Id current harmonics to be injected [1, Nharm] [A] Input.Simu.Phi_Idinj = ;     % phase of Id current harmonics to be injected [1, Nharm] [rad] Input.Simu.kfreq_Idinj = ;   % frequency order of Id current harmonics to be injected [1, Nharm] (6 for 6*freq0) [] Input.Simu.A_Iqinj = ;       % RMS amplitude of Iq current harmonics to be injected [1, Nharm] [A] Input.Simu.Phi_Iqinj = [10*pi/180];     % phase of Iq current harmonics to be injected [1, Nharm] [rad] Input.Simu.kfreq_Iqinj = ;   % frequency order of Iq current harmonics to be injected [1, Nharm] (6 for 6*freq0) []```

In this example, a 6-th harmonics is injected along Q axis with 10 A RMS magnitude and 10° phase. Note that injecting 6 times the electrical frequency, the ABC phase currents contain 5 and 7 times the electrical frequencies, which create additional magnetic forces at 4, 6, and 8 times the electrical frequency.

The effect of the current injection magnitude, phase or frequency on the magnetic vibration and noise can be easily carried using MANATEE sensitivity analysis tool. As an example the following code in the simulation project will sweep the phase of the Q-axis current harmonic from 5 to 15° with 20 different values:

```Input.Simu.type_sensitivity = 1;        Input.Simu.names_var={'Phi_Iqinj'};       Input.Simu.types_var=;                 Input.Simu.bds_contvar={[5*pi/180 15*pi/180]};         Input.Simu.type_sampling=0;       Input.Simu.Nval_contvar=;               Input.Simu.set_discvar= {}; Input.Simu.names_resp={'LwrA'};     ```