8.15.1. Resistor Bridge

#r# This example shows the computation of the DC biases in a resistor bridge.

####################################################################################################

import PySpice.Logging.Logging as Logging
logger = Logging.setup_logging()

####################################################################################################

from PySpice.Spice.Netlist import Circuit
from PySpice.Unit import *

####################################################################################################

#f# circuit_macros('resistor-bridge.m4')

circuit = Circuit('Resistor Bridge')

circuit.V('input', 1, circuit.gnd, 10@u_V)
circuit.R(1, 1, 2, 2@u_kΩ)
circuit.R(2, 1, 3, 1@u_kΩ)
circuit.R(3, 2, circuit.gnd, 1@u_kΩ)
circuit.R(4, 3, circuit.gnd, 2@u_kΩ)
circuit.R(5, 3, 2, 2@u_kΩ)

simulator = circuit.simulator(temperature=25, nominal_temperature=25)
analysis = simulator.operating_point()

for node in analysis.nodes.values():
    print('Node {}: {:4.1f} V'.format(str(node), float(node))) # Fixme: format value + unit
#o#

This example shows the computation of the DC biases in a resistor bridge.

import PySpice.Logging.Logging as Logging
logger = Logging.setup_logging()


from PySpice.Spice.Netlist import Circuit
from PySpice.Unit import *
../../_images/resistor-bridge.png
circuit = Circuit('Resistor Bridge')

circuit.V('input', 1, circuit.gnd, 10@u_V)
circuit.R(1, 1, 2, 2@u_kΩ)
circuit.R(2, 1, 3, 1@u_kΩ)
circuit.R(3, 2, circuit.gnd, 1@u_kΩ)
circuit.R(4, 3, circuit.gnd, 2@u_kΩ)
circuit.R(5, 3, 2, 2@u_kΩ)

simulator = circuit.simulator(temperature=25, nominal_temperature=25)
analysis = simulator.operating_point()

for node in analysis.nodes.values():
    print('Node {}: {:4.1f} V'.format(str(node), float(node))) # Fixme: format value + unit
2019-03-10 18:51:25,090 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Warning - approaching max data size: current size =  823.523 MB, limit =  507.367 MB

2019-03-10 18:51:25,092 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Warning - approaching max data size: current size =  823.523 MB, limit =  507.367 MB

2019-03-10 18:51:25,092 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Warning - approaching max data size: current size =  823.523 MB, limit =  507.367 MB

2019-03-10 18:51:25,093 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Warning - approaching max data size: current size =  823.523 MB, limit =  507.367 MB

2019-03-10 18:51:25,094 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Warning - approaching max data size: current size =  823.523 MB, limit =  507.367 MB

2019-03-10 18:51:25,094 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Warning - approaching max data size: current size =  823.547 MB, limit =  507.367 MB

2019-03-10 18:51:25,095 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Warning - approaching max data size: current size =  823.668 MB, limit =  507.367 MB

2019-03-10 18:51:25,096 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Warning - approaching max data size: current size =  823.828 MB, limit =  507.367 MB

2019-03-10 18:51:25,097 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Warning - approaching max data size: current size =  823.891 MB, limit =  507.367 MB

2019-03-10 18:51:25,097 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Warning - approaching max data size: current size =  823.922 MB, limit =  507.367 MB

2019-03-10 18:51:25,098 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Warning - approaching max data size: current size =  823.973 MB, limit =  507.367 MB

2019-03-10 18:51:25,099 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Warning - approaching max data size: current size =  823.973 MB, limit =  507.367 MB

2019-03-10 18:51:25,103 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Warning - approaching max data size: current size =  824.238 MB, limit =  507.367 MB

2019-03-10 18:51:25,105 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Warning - approaching max data size: current size =  824.238 MB, limit =  507.367 MB

2019-03-10 18:51:25,106 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Warning - approaching max data size: current size =  824.238 MB, limit =  507.367 MB

2019-03-10 18:51:25,113 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Warning - approaching max data size: current size =  824.441 MB, limit =  507.367 MB

Node 3:  6.0 V
Node 2:  4.0 V
Node 1: 10.0 V