simulating_a_time-varying_inductor_in_spice
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
simulating_a_time-varying_inductor_in_spice [2024/09/09 08:00] – bm | simulating_a_time-varying_inductor_in_spice [2024/09/10 09:01] (current) – bm | ||
---|---|---|---|
Line 21: | Line 21: | ||
< | < | ||
.subckt inductor + - params: IL0=0 | .subckt inductor + - params: IL0=0 | ||
- | .func L(time) {1m*(1+0.8*sin(2*pi*50k*time))} | + | .func L(time) {5m+3m*sin(2*pi*100k*time)} |
gcurr + - value={(sdt(V(+, | gcurr + - value={(sdt(V(+, | ||
.ends | .ends | ||
</ | </ | ||
- | The current through the inductor (see equation above) is modeled via a G-type current source | + | The current through the inductor (see equation above) is modeled via a G-type current source |
+ | First, we save the code for this subcircuit into a .txt-file and, for example, place this file in the same folder as your SPICE circuit file. | ||
+ | Next, open the text file in LT Spice, right click on the first word " | ||
+ | |||
+ | The program asks you if you wish to automatically create a symbol. Click " | ||
+ | |||
+ | To use the time-varying inductor in a circuit, click " | ||
+ | |||
+ | Plotting the value of the inductance in SPICE in function of time is not straightforward. Let us just check some individual times: we compare the value of the current through and voltage over the inductor (i) in the case of the time-varying inductor at time $t_i$ (after the transition period), and (ii) in the case of a static inductor with value $L(t_i)$. | ||
+ | |||
+ | Case (i): We apply a high frequency source in order to create an envelope facilitating comparison between both cases. | ||
+ | |||
+ | |||
+ | {{: | ||
+ | |||
+ | At a certain time, e.g., t=50µs, the value of the inductor equals $L$(50µs)= 5 mH + 3 mH.sin(2π.100 kHz.50 µs)=5 mH. | ||
+ | If we then zoom in at the simulation at t=50µs, we find the peak value of voltage over and current through the inductor. | ||
+ | |||
+ | Case (ii): We compare this value with a static inductor of 5 mH: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | We find that both the current and voltage correspond to case (i). | ||
+ | |||
+ | We do the same for a lot of other values of time, and always find a correspondence between both cases. This is not a rigid proof, but it gives us sufficient confidence that the inductor was modeled correctly in SPICE. | ||
simulating_a_time-varying_inductor_in_spice.1725868805.txt.gz · Last modified: by bm