-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
Here is a basic triode amplifier stage,
from lcapy import *
a = Circuit("""
TVtriode 1 2 3 100 1.6e-3 3e-12 3e-12; up
Ra 1 4; up
Rk 3 0; down
V1 5 0 ac V_s; down
W 5 2; right
Ca 1 6; right
Rl 6 0; down
V2 7 0 dc V_HT; down
W 7 4; right
; autoground=true, label_ids=false, draw_nodes=connections
""")
a.draw("triode.png")
Ignore the layout (which is probably my fault anyway #63 ) I was hoping to do analysis like voltages and current at different nodes as well as finding the input and output impedance.
At the moment basic things are failing, for example, requesting the voltage at the cathode,
a[3].VGenerates an attribute error
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[44], line 1
----> 1 a[3].V
File ~/.pyenv/versions/3.9.18/lib/python3.9/site-packages/lcapy/node.py:74, in Node.V(self)
70 @property
71 def V(self):
72 """Node voltage with respect to ground."""
---> 74 return self.cct.get_Vd(self.name, '0')
File ~/.pyenv/versions/3.9.18/lib/python3.9/site-packages/lcapy/netlist.py:319, in Netlist.get_Vd(self, Np, Nm, **kwargs)
316 """Voltage drop between nodes (time-domain)"""
318 Np, Nm = self._check_nodes(Np, Nm)
--> 319 return self._get_Vd(Np, Nm, **kwargs)
File ~/.pyenv/versions/3.9.18/lib/python3.9/site-packages/lcapy/netlist.py:306, in Netlist._get_Vd(self, Np, Nm, nowarn)
303 """This does not check nodes."""
305 self._add_ground()
--> 306 subs = self._subs_make(nowarn=nowarn)
308 result = SuperpositionVoltage()
309 for sub in subs.values():
File ~/.pyenv/versions/3.9.18/lib/python3.9/site-packages/lcapy/netlist.py:114, in Netlist._subs_make(self, nowarn)
111 sub = TransformDomains()
113 for kind, sources in groups.items():
--> 114 sub[kind] = SubNetlist(cct, kind)
116 if sub == {} and not nowarn:
117 warn('Netlist has no sources')
File ~/.pyenv/versions/3.9.18/lib/python3.9/site-packages/lcapy/subnetlist.py:45, in SubNetlist.__init__(self, netlist, kind)
41 def __init__(self, netlist, kind):
42 """ kind can be 't', 'dc', 's', 'time', 'ivp', 'n*' or omega,
43 where 'n*' is a noise identifer and omega is an angular frequency."""
---> 45 self.mna = MNA(self, self.solver_method)
File ~/.pyenv/versions/3.9.18/lib/python3.9/site-packages/lcapy/mna.py:115, in MNA.__init__(self, cct, solver_method)
113 for elt in self.cct.elements.values():
114 if not elt.nosim:
--> 115 elt._stamp(self)
117 # Augment the admittance matrix to form A matrix.
118 self._A = self._G.row_join(self._B).col_join(self._C.row_join(self._D))
File ~/.pyenv/versions/3.9.18/lib/python3.9/site-packages/lcapy/mnacpts.py:1460, in TVtriode._stamp(self, cct)
1458 def _stamp(self, cct):
-> 1460 n1, n2, n3 = self.node_indexes
1461 m1 = self.cct._branch_index(self.name + 'X')
1462 m2 = self.branch_index
AttributeError: 'TVtriode' object has no attribute 'node_indexes'
Do you have any advice I could follow to implemet this or does it require too much knowledge of the internals of lcapy?
Metadata
Metadata
Assignees
Labels
No labels