Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print_symbolic_results / print_symbolic_transfer_functions: sort key bug #79

Open
tPkl opened this issue Oct 14, 2023 · 0 comments
Open

Comments

@tPkl
Copy link

tPkl commented Oct 14, 2023

I encountered a runtime error using the cli to retrieve the symbolic solution to a relatively simple netlist I created to test out the library. Upon closer inspection, I was able to bypass the error by replacing the sort key by key=str.

Traceback:

Starting symbolic AC analysis...
Building symbolic MNA, N and x...  done.
Building equations...
Solving...
Success!
Results:
Traceback (most recent call last):
  File "/home/jsillman/.local/bin/ahkab", line 8, in <module>
    sys.exit(_cli())
  File "/home/jsillman/.local/lib/python3.10/site-packages/ahkab/__main__.py", line 155, in _cli
    ahkab.main(filename=remaning_args[0],
  File "/home/jsillman/.local/lib/python3.10/site-packages/ahkab/ahkab.py", line 953, in main
    results.update(run(circ, [an]))
  File "/home/jsillman/.local/lib/python3.10/site-packages/ahkab/ahkab.py", line 714, in run
    r = analysis[an_type](circ, **an_item)
  File "/home/jsillman/.local/lib/python3.10/site-packages/ahkab/symbolic.py", line 193, in symbolic_analysis
    printing.print_symbolic_results(sol)
  File "/home/jsillman/.local/lib/python3.10/site-packages/ahkab/printing.py", line 282, in print_symbolic_results
    keys.sort(lambda x, y: cmp(str(x), str(y)))
TypeError: sort() takes no positional arguments

After patching it in my local branch:

Starting symbolic AC analysis...
Building symbolic MNA, N and x...  done.
Building equations...
Solving...
Success!
Results:
I[V1]	 = (-GM_M1*R0_M1*V2 + GM_M1*R0_M1*V3 - V1 + V3)/(R0_M1 + RD)
I[V2]	 = 0.0
I[V3]	 = (GM_M1*R0_M1*RS*V2 - GM_M1*R0_M1*RS*V3 - R0_M1*V3 - RD*V3 + RS*V1 - RS*V3)/(RS*(R0_M1 + RD))
VGATE	 = V2
VIN	 = V3
VOUT	 = (-GM_M1*R0_M1*RD*V2 + GM_M1*R0_M1*RD*V3 + R0_M1*V1 + RD*V3)/(R0_M1 + RD)
VVDD	 = V1
Calculating small-signal symbolic transfer functions (V3))... done.
Small-signal symbolic transfer functions:
I[V1]/V3 = (GM_M1*R0_M1 + 1)/(R0_M1 + RD)
	DC: (GM_M1*R0_M1 + 1)/(R0_M1 + RD)
I[V2]/V3 = 0
	DC: 0
I[V3]/V3 = (-GM_M1*R0_M1*RS - R0_M1 - RD - RS)/(RS*(R0_M1 + RD))
	DC: (-GM_M1*R0_M1*RS - R0_M1 - RD - RS)/(RS*(R0_M1 + RD))
VGATE/V3 = 0
	DC: 0
VIN/V3 = 1
	DC: 1
VOUT/V3 = RD*(GM_M1*R0_M1 + 1)/(R0_M1 + RD)
	DC: RD*(GM_M1*R0_M1 + 1)/(R0_M1 + RD)
VVDD/V3 = 0
	DC: 0

A few details about my runtime:

  • ahkab 0.18
  • Python 3.10.12
  • WSL 1.2.5.0
  • Windows Version 10.0.19045 Build 19045

Let me know if there's any more information you need from me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant