Example #1
0
 def test_plots(self):
     ns.circ('va a 0 dc 1')
     for ii in range(3):
         ns.operating_point()
     self.assertEqual(ns.plots(),
                      ['op3', 'op2', 'op1', 'const'])
Example #2
0
 def test_resistor(self):
     ns.circ(['va a 0 dc 1', 'r a 0 2'])
     ns.operating_point()
     self.assertEqual(ns.vectors(),
                      {'a': [1],
                       'va#branch': [-0.5]})
Example #3
0
 def test_altermod(self):
     ns.circ(['r n 0 rmodel', '.model rmodel R res = 3'])
     ns.alter_model('r', res=4)
     ns.operating_point()
     self.assertEqual(ns.vector('@r[resistance]'), 4)
Example #4
0
 def test_vsource(self):
     ns.circ('va a 0 dc 1')
     ns.operating_point()
     self.assertEqual(ns.vectors(),
                      {'a': [1],
                       'va#branch': [0]})
Example #5
0
 def test_alter(self):
     ns.circ('r n 0 1')
     ns.alter('r', resistance=2, temp=3)
     ns.operating_point()  # Necessary for resistance to be calculated
     self.assertEqual(ns.vector('@r[resistance]'), 2)
     self.assertEqual(ns.vector('@r[temp]'), 3)