I tried to reproduce your problem using a SymbolicDC analysis but then I found
a bug that made it useless if one wanted to extract currents. After fixing this
bug it's now working. So please use the latest version to run the example
below.
I think there is a misunderstanding (due to lacking documentation) on how
current probing works. In pycircuit, currents are measured at the terminals.
So for example if you have a subcircuit with a resistor R1 which has terminals
plus and minus you use the following syntax: result.i('R1.plus') to calculate
the current going *into* the terminal.
from pycircuit.circuit import *
from sympy import *
c=SubCircuit(toolkit=symbolic)
iin, iout, R1, R2, R3 = symbols('i_in i_out R1 R2 R3')
c['IS'] = IS(gnd, 1, i=iin, toolkit=symbolic)
c['VL'] = VS(3, gnd, v=0, toolkit=symbolic)
c['R1'] = R(1, 2, r=R1, toolkit=symbolic)
c['R2'] = R(2, gnd, r=R2, toolkit=symbolic)
c['R3'] = R(2, 3, r=R3, toolkit=symbolic)
res = SymbolicDC(c, toolkit=symbolic).solve()
# print current going into R2
# by the law of current division you expect R3 / (R2 + R3)
expand(res.i('R2.plus'))
Best regards,
Henrik
# Dictionary for reserved named dedicated to analysis type
ams_analysis = {
0 : 'TRAN',
1 : 'AC',
2 : 'DC',
3 : 'FFT',
4 : 'SSTAC',
5 : 'TSST',
6 : 'SSTNOISE',
7 : 'FSST',
8 : 'SSTXF',
9 : 'FMODSST',
10: 'TMODSST',
11: 'FOURSST',
12: 'NOISETRAN',
13: 'LSTB',
14: 'SSTJITTER',
15: 'SSTSTABIL',
16: 'NOISE',
17: 'EXTRACT',
18: 'SENSTRAN',
19: 'UNKNOWN'
}
file = "../henjo-pycircuit-5e66d42/pycircuit/post/jwdb/test/data/noise.wdb"
fileid = jwdb.ams_sim_open_read_file(file)
ams_analysis[jwdb.ams_sim_get_current_analysis(fileid)]
Up to ams_2010.2 this was a buggy function (a NOISE simulation gave UNKNOWN).
Mentor support was really reactive on this point. In ams_2010.2d, this was
corrected.
Regards,
Severin.