A device for generating compensating currents (I 1D, I 2D, I 3D), the device comprising: - a switch bridge, - an inductor unit, - an energy storage unit, - a control unit, - a signal input for receiving a first monitoring signal (S VIN) indicative of the voltages (V 1, V 2, V 3) of input nodes (IN1, IN2, IN3) of a three-phase alternating current network, - a signal output for controlling a switch unit, and - output nodes (T1, T2, T3) connectable to a load, wherein the control unit is configured to enable operation in a first operating mode (MODE1) when the first monitoring signal (S VIN) indicates a normal voltage situation, and the control unit is configured to enable operation in a second operating mode (MODE2) when the first monitoring signal (S VIN) indicates a voltage sag situation; wherein in the first operating mode (MODE1): - the switch bridge and the inductor unit are arranged to provide at least a first compensating current (I 1D) so as to compensate a non-active component (I 1q) of a load current (I 1L) drawn from the first output node, wherein the first compensating current (I 1D) is added to the load current (I 1L) at a first output node, and the switch bridge and the inductor unit are arranged to generate the first compensating current (I 1D) by transferring energy from the network to the energy storage unit, and by transferring energy back from the energy storage unit to the network, wherein the switch bridge and the inductor unit are arranged to compensate phase imbalance of load currents (I 1L,I 2L) by generating compensating currents (I 1D,I 2D) such that an RMS value of an input current I 1T, I 2T) of the first phase is equal to an RMS value of an input current I 1T, I 2T) of the second phase; and in the second operating mode (MODE2): - the control unit is configured to send a control signal (S SWM) to the switch unit for disconnecting the input nodes (IN1, IN2, IN3) from the output nodes (T1, T2,T3), and - the switch bridge and the inductor unit are arranged to provide at least a first auxiliary current (I 1D) so as to provide reserve power for the load during the voltage sag situation, wherein the switch bridge and the inductor unit are arranged to generate the first auxiliary current (I 1D) by transferring energy from the energy storage unit. - a switch bridge, - an inductor unit, - an energy storage unit, - a control unit, - a signal input for receiving a first monitoring signal (S VIN) indicative of the voltages (V 1, V 2, V 3) of input nodes (IN1, IN2, IN3) of a three-phase alternating current network, - a signal output for controlling a switch unit, and - output nodes (T1, T2, T3) connectable to a load, - the switch bridge and the inductor unit are arranged to provide at least a first compensating current (I 1D) so as to compensate a non-active component (I 1q) of a load current (I 1L) drawn from the first output node, wherein the first compensating current (I 1D) is added to the load current (I 1L) at a first output node, and the switch bridge and the inductor unit are arranged to generate the first compensating current (I 1D) by transferring energy from the network to the energy storage unit, and by transferring energy back from the energy storage unit to the network, wherein the switch bridge and the inductor unit are arranged to compensate phase imbalance of load currents (I 1L,I 2L) by generating compensating currents (I 1D,I 2D) such that an RMS value of an input current I 1T, I 2T) of the first phase is equal to an RMS value of an input current I 1T, I 2T) of the second phase; and - the control unit is configured to send a control signal (S SWM) to the switch unit for disconnecting the input nodes (IN1, IN2, IN3) from the output nodes (T1, T2,T3), and - the switch bridge and the inductor unit are arranged to provide at least a first auxiliary current (I 1D) so as to provide reserve power for the load during the voltage sag situation, wherein the switch bridge and the inductor unit are arranged to generate the first auxiliary current (I 1D) by transferring energy from the energy storage unit.