## 2 Materials and Methods
### Structure of the Automatic Gain Control  
The main role of the AGC corrector system is to select a suitable value for the gain of the output signal from the current transducer, and thereby increase measurement accuracy. For this purpose, electronic circuits (i.e., a DAC converter) were used. This system operates on the basis of the value of two input signal peaks and its derivative. On the basis of these signals, the AGC system generates appropriate gains and sends this value through feed-back loops to the amplifying stage. The input signal should be close to 80% of the level of its dynamic range. Figure 3 shows two different electric circuits used to correct the gain of the output signal (\(V_{olV}\)) from the current transducer. Each of the systems contains a separate ADC\({}_{\text{MI}}\) or ADC\({}_{\text{M2}}\) converter, which is used to measure the current signal. Measurement outputs are marked as (ch\({}_{1,\text{agc1}}\)/ch\({}_{1,\text{agc2}}\)). Figure 2: Waveform of (**a**) the input \(V_{inPGA}\) output voltage \(V_{outPGA}\) from the PGA amplifier connected to the current transducer; (**b**) the gain of the PGA amplifier controlled by the microprocessor system. The AGC corrector system is equipped with isolation amplifiers, shown in Figure 3 as Iso1. Their main role is to provide galvanic isolation between the circuits of the current converter (IV) and the digital circuits of the current meter and the AGC corrector. The current converter converts the measured \(I_{sh}\) current into a proportional low-voltage \(V_{oIV}\) signal. The first realization procedure for determining the desired value of the voltage gain (\(A_{d}\)) relies on measurement of the peak input voltage \(V_{oIV}\) by an auxiliary circuit (auxiliary channel aux_c with a \(\mathrm{ADC_{IA}}\) converter (Figure 3a) or \(\mathrm{ADC_{d}}\)). The obtained information is transmitted to the microprocessor unit (MCU1) memory. Once the values for a few voltage samples \(V_{oIV}(nT)\) have been measured (where \(n\) is the sample number and \(T\) is the sampling interval), their derivative is determined (where \(*\) is the crisp value (input or output signal from the fuzzy controller), derivative operator of the \(I^{th}\) order). These values are provided at the inputs of the fuzzy system implemented in the microprocessor (MCU1). According to expert knowledge given via rules, the fuzzy controller generates the required gain. This value is converted into an analogue signal (\(A_{d}\)) by the digital-to-analogue converter (\(\mathrm{DAC_{1}}\)). The required conversion factor of the current measurement circuit (ch_agc1) in the analog form and \(V_{oIV}\) are applied to the input terminal of the analog multiplier MULT (Figure 3a). The multiplier performs an output function \(V_{oIV}*A_{d}\). Consequently, the ranges between the current converter (IV) output and the current input channel ch_agc1 are matched. The main problems with the proposed fuzzy collector AGC system (shown in Figure 3a) are the high voltage of the \(\mathrm{DAC_{1}}\) converter, which has limited ability to generate a voltage signal on its output (e.g., the output range for the AD5540 converter is equal 60 V), and the small range of input voltages for the analog multiplier (e.g., for the MPY 634 multiplier the input range is 10 V). The \(\mathrm{DAC_{1}}\) is connected to the input of the multiplier. For this reason, the same fuzzy controller was used in the AGC system as had been implemented in the CPU of the microprocessor (MCU2, see Figure 3b). The value of the desired gain (limited  
Figure 3: Fuzzy AGC controller circuit: (**a**) Using the analog multiplier (MULT); (**b**) using only the microcontroller (MCU2). to the floating-point number range: float or double defined in the IEEE 754 standard) is sent to the memory of the microprocessor system. The ADC\({}_{d}\) converter (Figure 3b) from the structure of the microprocessor was used to measure the \(V_{oIV}\) signal.