1_RL_Circuit.md 2.96 KB
 hazrmard committed Feb 13, 2019 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 ``````--- title: RC Circuit Model order: 1 --- # RC Circuit The Resistor-Capacitor circuit represents a linear first order differential equation. Mathematically: ``` i_c = C * dV_c/dt i_r = V_r / R ``` Where * `i_c` and `i_r` are the currents flowing through the capacitor and resistor, * `C` is the capacitance, * `R` is the resistance, * `V_c` and `'V_r` are the voltages across the capacitor and resistor, * `t` is time. To make the model more realistic, a parasitic capacitance has been added in parallel to the resistor. This simulates electrical effects of conductors close by such that their electrical fields interact and affect current passing through them. ![Schematic](img/1_RC_schematic.png) ## Models For this model, the inputs are the driving voltage. The measurements to be simulated/learned are the current through the circuit. Known parameters are capacitance and resistance. Parasitic effects are unaccounted for and must be learned from the data. This is a first-order model. Therefore one parameter (Capacitance) is kept fixed while the other is free to be learned from the data. Model parameters are learned from input/output measurements. In this case, the input is a ramped sine wave. ![Input Signal](img/1_input_signal.png) ### Grey box model Using [Kirchoff's voltage law][2] and the above equations, the total voltage across the circuit can be written as: ``` V_s = 1/C ∫ i dt + i R i = [- 1 / (R C)] ∫ i dt + [1 / R] V_s ``` Using the [modern control approach][1] and taking as input (`u`), state (`x`), and output (`y`) variables: ``` x = ∫ i dt, x' = i, u = V_s y = x ``` We get the state-space equation: ``` x' = [- 1 / (R C)] x + [1 / R] u y = [- 1 / (R C)] x + [1 / R] u ``` Which yeilds the state-space matrices: ``` A = C = [- 1 / (R C)] B = D = [1 / R] ``` We set `R` as the learnable parameter under various conditions (noisy inputs, with/without parasitic effects). The state-space model tries to fit observed measurements with its estimate of the parameter value. The initial estimate is `R = 500`. | SNR\Parasitic | Yes | No | |--------------- |-------- |------- | | 25 | 0.0034 | 99.99 | | 250 | 93.77 | 99.99 | *Table: `SNR` is the signal-to-noise ratio in dB. Parasitic effects are simulated by a 1uF capacitance in parallel to the resistor. Values are percentage of fit with the training data.* The results show that the model is highly susceptible to noise. The mathematical structure of the model does not account for a parasitic element, therefore the peak accuracy it is able to achieve theoretically tops out before reaching a 100%. However, the limited model still arrives at the correct estimate for `R`. The worst case for this grey-box model is under noisy training data and unaccounted-for electrical effects which reduce the model performance to 0. [1]: https://en.wikibooks.org/wiki/Control_Systems#Modern_Control_Methods [2]: https://en.wikipedia.org/wiki/Kirchhoff%27s_circuit_laws#Kirchhoff's_voltage_law_(KVL)``````