## 3 Setup
### Current Controller  
Regarding the control of the current, the first question that arises here is whether digital or analog control is better. Although it is much easier to adapt the controller parameters to the system being measured, the time constants are very small, so that the sampling intervals of a digital control would lead to instabilities. Therefore, an analog control system that is based on operational amplifier is used. The OPA549 is used as the output operational amplifier, which can directly drive the required currents. A possible implementation using an instrumental amplifier to measure the load current \(i_{L}\) and two operational amplifier that implement a differential amplifier and a PID controller is shown in Figure 10. The main purpose of the instrumentation amplifier is to measure and amplify the differential voltage of the shunt resistor \(R_{S}\) and to reference its output voltage  
\[v_{S}(t)=(v_{A}(t)-v_{L})\cdot G_{S}=R_{S}i_{L}(t)\cdot G_{S} \tag{6}\]  
Figure 8: Schematic signal generation. Figure 9: Schematic of Sample and Hold component. to ground potential. The value \(v_{I}(t)\) sets the desired load current multiplied by \(R_{S}\) and \(G_{S}\):  
\[v_{I}(t)=i_{L,desired}\cdot R_{S}\cdot G_{S}. \tag{7}\]  
Therefore, the operational amplifier on the left-hand side implements the differential amplifier with a gain of 1 and determines the negative of the measured error \(e(t)\):  
\[v_{E}(t)=v_{S}(t)-v_{I}(t)=-e(t). \tag{8}\]  
The actual controller is implemented by the op amp on the right-hand side. As an approximation, the inputs of an operational amplifier can be regarded as current-less, so that the current flowing through \(R_{2}\) and \(C_{2}\) can be assumed to equal \(i_{1}(t)\). Therefore, \(i_{11}\) and \(i_{12}\) form two components of the regulating variable:  
\[i_{2}(t)=i_{1}(t)=i_{11}(t)+i_{12}(t) \tag{9}\]  
Due to the negative feedback, both input terminals of the operational amplifier are forced to ground potential. Therefore, the current \(i_{11}(t)\) can be calculated by  
\[i_{11}(t)=\frac{1}{R_{1}}v_{E}(t)=-\frac{1}{R_{1}}e(t). \tag{10}\]  
Furthermore, \(i_{12}\) is defined by  
\[i_{12}(t)=C_{1}\frac{d\,v_{E}(t)}{dt}=-C_{1}\frac{d\,e(t)}{dt}. \tag{11}\]  
The output voltage \(v_{A}\) is determined by the current \(i_{2}\) :  
\[v_{A}(t)=-i_{2}R_{2}-\frac{1}{C_{2}}\int i_{2}(t)\,dt. \tag{12}\]  
Inserting Equations (9) to (11) results in  
\[v_{S}(t)=(v_{A}(t)-v_{L})\cdot G_{S}=R_{S}i_{L}(t)\cdot G_{S} \tag{6}\]0  
\[v_{S}(t)=(v_{A}(t)-v_{L})\cdot G_{S}=R_{S}i_{L}(t)\cdot G_{S} \tag{6}\]1  
\[v_{S}(t)=(v_{A}(t)-v_{L})\cdot G_{S}=R_{S}i_{L}(t)\cdot G_{S} \tag{6}\]2  
Comparing the last equation with the equation of a PID controller  
\[v_{S}(t)=(v_{A}(t)-v_{L})\cdot G_{S}=R_{S}i_{L}(t)\cdot G_{S} \tag{6}\]3  
results in the following parameters:  
\[v_{S}(t)=(v_{A}(t)-v_{L})\cdot G_{S}=R_{S}i_{L}(t)\cdot G_{S} \tag{6}\]4  
\[v_{S}(t)=(v_{A}(t)-v_{L})\cdot G_{S}=R_{S}i_{L}(t)\cdot G_{S} \tag{6}\]5  
\[v_{S}(t)=(v_{A}(t)-v_{L})\cdot G_{S}=R_{S}i_{L}(t)\cdot G_{S} \tag{6}\]6In the next step the controller parameters were optimized. As the load \(R_{L}\) represents the battery under test, which cannot be described sufficiently accurately by a resistor, an equivalent circuit consisting of a voltage source, a series resistor and a RC parallel circuit was used as \(R_{L}\). The circuit simulator Microcap already includes an optimizer. During the optimization the controller parameters were tuned to minimize the expression RMS(v(VE)) when a step function is applied to the input. Thus, the root mean square of the voltage \(V_{e}\), which in turn represents the control deviation should be as small as possible. The optimized circuit was then produced on a printed circuit board. Care must be taken to ensure that the connections that drive the high current to the battery under test are sufficiently sized. First, the step response of the current controller was measured using a test impedance, whereby the target signal was generated with the aid of a function generator.