fig1 shows preferred implementation of the first aspect of the invention . a battery ( 2 ), possibly a 12v truck battery , supplies power to a weld gun ( 3 ) via power mosfet switch ( 8 ). device 4 can measure the current , voltage and / or the power delivered to the weld gun . a reference trajectory for this measured quantity is generated by ( 6 ). with this implementation this must always be a positive number . this trajectory could be generated by a lookup table with a micro - controller or generated by analog circuitry . the pulse width modulator controller ( 5 ) switches ( 8 ) at a fixed frequency with an on / off ratio automatically adjusted so that the signal measured by device ( 4 ) is equal to the signal generated by ( 6 ). many commercially available ics are able to perform this task . diode 9 provides a low impedance path for current to flow through the weld gun while switch ( 8 ) is off . note that weld guns ( 3 ) typically appear as a load with significant inductance and will naturally provide adequate filtering for the circuit . if this is not the case for a specific implementation , an optional inductor can be inserted between diode / switch and gun . a weld - timing signal can be generated by ( 7 ) and used to enable the pulse width modulation controller . the battery charger ( 1 ) keeps the battery as close as possible to its maximum capacity . an implementation of the second aspect of the invention is shown in fig3 . parts ( 1 )-( 4 ) are the same as in fig1 the implementation of the first aspect . instead of a single switch and diode , 4 mosfet switches ( 8 )-( 11 ) control the current flow in the weld gun ( 3 ). when the reference signal generator generates a positive signal , switch ( 11 ) is activated , switch ( 9 ) and ( 10 ) are deactivated and switch ( 8 ) is switched at a predetermined frequency . switch ( 9 ) acts as a diode to provide a low impedance current path when switch ( 8 ) is off . controller ( 5 ) adjusts the ratio between the on / off time of switch ( 8 ) to ensure the difference between the measurement of device ( 4 ) and reference signal from ( 6 ) is maintained at zero or as small as possible . when the reference signal generator generates a negative signal , switch ( 9 ) is activated , switch ( 8 ) and ( 11 ) are deactivated and switch ( 10 ) is switched at a predetermined frequency . switch ( 11 ) acts as a diode to provide a low impedance current path when switch ( 10 ) is off . controller ( 5 ) adjusts the ratio between the on / off time of switch ( 10 ) to ensure the sum of the measurement of device ( 4 ) and reference signal from ( 6 ) is maintained at zero or as small as possible . it is to be understood that the present invention is not limited to the embodiment ( s ) described above and illustrated herein , but encompasses any and all variations falling within the scope of the appended claims . for example , in the above description and below in the claims , an inductor can be a conventional inductor as well as the inherent inductance of conductive elements such as wires or the weld head .