circuitsascode.simple.v_div module¶
This module provides both resistive and capacitive voltage dividers.
The only required parameter is the ratio of the output voltage w.r.t the input voltage. The resistance/capacitance of each leg of the divider is computed using this ratio.
- Optional parameters include:
the total resistance/capacitance of both legs of the divider,
the resistor/capacitor tolerance as given by the E series (https://www.wikiwand.com/en/E_series_of_preferred_numbers),
and a resistor/capacitor part template that’s used to instantiate both legs of the divider.
- circuitsascode.simple.v_div.v_div_c(ratio, c_total=1000 * units.nanofarad, e_series='E12', c_temp=Part('Device', 'C', dest=TEMPLATE, footprint='Capacitor_SMD:C_0603_1608Metric'))[source]¶
Creates a capacitor voltage divider.
- Parameters
ratio (float) – Voltage division ratio in the range [0, 1].
c_total (float, optional) – Total capacitance of both legs of the divider. Defaults to 1000 nanofarads.
e_series (string, optional) – E-series of capacitor values (E3, E6, E12, E24, E48, E96, E192). Defaults to “E12” (10%).
c_temp (Part) – Part template for creating divider capacitors. Defaults to two-pin, surface-mount 0603 footprint.
- Returns
- An Interface object with the following I/O
vin: Input voltage to top leg of divider.
vout: Output voltage from junction of upper & lower legs of divider.
gnd: Reference voltage (usually ground) to bottom leg of divider.
- Return type
Interface
Example
>>> from circuitsascode.simple.v_div import * >>> div1 = v_div_c(ratio=0.3, c_total=100*units.nanofarad, e_series='E24') >>> vin = Net("VIN") >>> vout = Net("VOUT") >>> gnd = Net("GND") >>> div1["vin vout gnd"] += vin, vout, gnd >>> generate_netlist() '(... >>> len(vin) 1 >>> len(vout) 2 >>> len(gnd) 1
- circuitsascode.simple.v_div.v_div_r(ratio, r_total=10 * units.kohm, e_series='E24', r_temp=Part('Device', 'R', dest=TEMPLATE, footprint='Resistor_SMD:R_0603_1608Metric'))[source]¶
Creates a resistor voltage divider.
- Parameters
ratio (float) – Voltage division ratio in the range [0, 1].
r_total (float, optional) – Total resistance of both legs of the divider. Defaults to 10 KOhm.
e_series (string, optional) – E-series of resistor values (E3, E6, E12, E24, E48, E96, E192). Defaults to “E24” (5%).
r_temp (Part) – Part template for creating divider resistors. Defaults to two-pin, surface-mount 0603 footprint.
- Returns
- An Interface object containing the following I/O
vin: Input voltage to top leg of divider.
vout: Output voltage from junction of upper & lower legs of divider.
gnd: Reference voltage (usually ground) to bottom leg of divider.
- Return type
Interface
Example
>>> from circuitsascode.simple.v_div import * >>> div1 = v_div_r(ratio=0.3, r_total=100*units.kohm, e_series='E12') >>> vin = Net("VIN") >>> vout = Net("VOUT") >>> gnd = Net("GND") >>> div1["vin vout gnd"] += vin, vout, gnd >>> generate_netlist() '(... >>> len(vin) 1 >>> len(vout) 2 >>> len(gnd) 1