## 2 Materials and Methods  
The main reason for using gain correction circuits in measurement systems is to increase the resolution. This section describes the AGC structures used in different implementations. Metrological problems are caused by the change in the measured values across the entire measuring range. In this case, low-peak signals are not measured accurately, due to the lack of appropriate signal amplification. For example, a 12-bit ADC powered by 5 V reference voltage can measure an input voltage equal to 0.0048 V. The appropriate gain of this signal allows the signal to be recorded using more digital levels. To accomplish this task, computer analysis was performed on various AGC systems. On the basis of the results, a system of signal gain control using a fuzzy controller was selected. To achieve high measurement resolution, the measured signal should be amplified to the upper limit of the dynamic range of the ADC converter. Due to the measurement error of the AGC system and the rapidly changing values, the input range was reduced to 80% of the reference voltage value.  
Programmable amplifiers are the most common AGC structures used in measurement systems. These amplifiers are controlled digitally, based on an algorithm implemented in a microprocessor system. The algorithm determines the gain value and selects the closest value from the available gain in the PGA amplifier, in such a way that the measurement signal reaches the maximum value in the ADC range. The operation of a programmable amplifier in a loop is presented in Figure 1 and the tasks are listed below.  
In an AGC PGA, electronic circuits need time to perform the following tasks:  
* The PGA amplifier measures the input voltage over time (\(t_{p}\)) in \(V_{inPGA}(t_{p})\);
* The ADC converter supplies conversion data (\(t_{ADC}\)) in (\(V_{inPGA}(t_{p}+t_{ADC})\));
* Determine the gain value (\(A_{PGA}\)) in MCU (\(t_{alg}\));
* Send the order from MCU to the PGA amplifier (\(t_{conv}\)).  
Figure 1: Signal processing in the structure of an AGC based on PGA amplifiers.  
According to the signal processing times given in the AGC system, the input signal \(V_{inPGA}(t_{p})\) is amplified after the time \(t_{k}=t_{p}+t_{alg}+t_{conv}\) has elapsed. For this reason, a 20% reduction in the measuring range protects against information loss due to too much amplification of the measured signal. The algorithm implemented in MCU (Figure 1) determines the gain value and selects the closest value from the available gain in the PGA amplifier. The main disadvantage of this system is its inability to generate any gain value. Digital regulation of the conversion factor of the measuring current in the power inverter using the PGA circuit or amplifier with a fixed gain factor does not allow the measurement signal to reach the upper limit of the dynamic range of the ADC converter.  
The waveforms in Figure 2a were obtained in a computer simulation of voltage response \(V_{outPGA}\) of the PGA amplifier for the input signal \(V_{inPGA}\).  
Figure 2b shows the voltage gain generated by the PGA amplifier controlled by a microprocessor system. The large discrepancy between the available gain in the PGA amplifier and the calculated gain does not allow the desired increase in the resolution of the measurement of current in the power inverter.