## 1 Introduction  
Current measurements play a very important role in energy management systems, as well as in vector control of electric motors. The harmonics in the current of an input power converter for a railway vehicle were presented in [1]. The harmonic spectra of traditional and modern trains were presented in [2]. Data acquired from a current pantograph of a 3 kV DC railway locomotive and a 1.5 kV metro vehicle were presented in [3]. In [4], changes in the current peak values of a DC substation were presented. An important example of the use of electronic systems to record the consumption of electrical energy is to calculate the cost of electricity consumed by business entities, such as the supplier (electricity distribution company) and the customer (e.g., an electric vehicle). These calculations are usually made using electricity meters, which are not without limitations. To determine the important operating parameters of a power converter, the current must be measured. The dynamically changing value of the current in a power circuit can affect the metrological properties of the measurement system, depending on the load of the drive system. The main challenge is to properly match the peak current to the input range of the analog-to-digital converter (ADC). When measuring the signal, a dynamic error should be expected. This dynamic error depends on the selection of measuring current transducers, and also on the signal processing procedures. The gain of the measured signal can be measured using a programmable gain amplifier (PGA) or a precision amplifier with a fixed gain factor. This method does not allow use of the upper limit of the dynamic range of the ADC, which operates at the end of the measuring circuit, and therefore does not enable high resolution measurements. Several methods that allow the value of the measured signal to be adjusted to the measurement range are discussed in the literature. An automatic gain control system has a feedback loop to control the gain factor. In modern applications, AGC circuits are equipped with microcontrollers that are compatible with many signals. An example of an AGC based on a variable gain amplifier (VGA) is given in [5]. In [6], the authors used a programmable amplifier loop control based on input signal amplitude. In [7], an AGC system is described based on a VGA connected in a cascade with a PGA. Programmable gain amplifier circuits are often used in front-end circuits, as demonstrated in [8] for quartz tuning fork (QTF) signal conditioning. The structure of a PGA system controlled by a serial interface with the control algorithm is presented in [9]. A method of designing PGA-based amplification systems using Matlab and Spice is presented in [10]. An accurate method of signal processing using programmable amplifiers can be found in [11]. Fuzzy controllers can also be used to implement an AGC system, as described in [12]. Such systems enable the creation of a hyperplane that acts as an algorithm controlling the operation of the AGC system, without the need for mathematical transformations. These capabilities have led to the implementation of fuzzy controllers into AGC systems. Intelligent current measurement systems increase the reliability of the systems in which they process signals. Smart energy meter are supported by fuzzy logic, as discussed in [13]. An example of the use of a fuzzy logic in an energy management system for food manufacturing processes is presented in [14]. Another use of fuzzy logic to minimize energy consumption in residential buildings was described in [15]. In [16] the author of the current work proposed a measurement system using a fuzzy controller. The circuit contained an analog multiplier, which caused a measurement error. An additional problem with this system was the limited output range of the high-voltage DAC. The present article is a continuation of that work. A precise AGC system is proposed that can be implemented with various algorithms.