This section contains the setup of the parallel resonant circuit and the band rejection filter:
ResonantCircuit
{
aux vR = 10 kOhm;
aux f0 = 10 MHz;
aux w0 = 2 * pi * f0;
aux Q = stepTbl([0.5, 1.0, 2.0, 5.0, 10.0]);
aux vL = vR / (w0 * Q);
aux vC = Q / (w0 * vR);
Iin : ~Devices.I { P = "out"; M = "gnd"; I0 = 1 A; acI0 = 1 A; }
R : ~Devices.R { N1 = "out"; N2 = "gnd"; R = ^vR; }
L : ~Devices.L { N1 = "out"; N2 = "gnd"; L = ^vL; }
C : ~Devices.C { N1 = "out"; N2 = "gnd"; C = ^vC; }
}
BandRejection
{
aux f0 = 50 Hz;
aux vC = 100 uF;
aux w0 = 2 * pi * f0;
aux Q = stepTbl([0.5, 1.0, 2.0, 5.0, 10.0]);
aux vL = 1 / (w0 * w0 * vC);
aux vR = 1 / (Q * w0 * vC);
Vdd : ~Devices.V { P = "Vin"; M = "gnd"; V0 = 1 V; acV0 = 1 V; }
R : ~Devices.R { N1 = "Vin"; N2 = "out"; R = ^vR; }
L : ~Devices.L { N1 = "out"; N2 = "ctr"; L = ^vL; }
C : ~Devices.C { N1 = "ctr"; N2 = "gnd"; C = ^vC; }
}
Since both simulations use the same Solve and Curve section, the conditional inheritance is a good choice to improve the setup. This feature can be especially employed for including several similar simulations in one input-deck. Depending on the variable resonant (which could be, for example, bound to an environment variable), either section ResonantCircuit or section BandRejection is inherited by the Circuit section.
aux resonant = yes; Circuit : ResonantCircuit ? ~resonant, BandRejection ? !~resonant;
Note, that the sources provide the following keywords: