You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's very frustrating to work with a circuit that you can't visualize to make sure you did it right. Unfortunately, for lcapy circuits, not all circuits that are drawable are solvable, and vice versa.
These functions generate circuits that are either drawable or solvable.
def__generate_RC_filter(high_pass: bool, order: int=1, drawable: bool=False) ->Circuit:
"""Generate an RC filter circuit of the given order. If drawable is True, the circuit will be drawable when you call draw(). Otherwise, it may not. Drawable circuits may not be solvable circuits."""assertorder>0netlist=""ifdrawable:
netlist+=f""" Vin 1 "0_0"; down, v=V_{{in}} """foriinrange(order):
ifhigh_pass:
netlist+=f""" C{i}{i+1}{i+2}; right R{i}{i+2}{f"0_{(i+1)}"ifdrawableelse0}; down """else:
netlist+=f""" R{i}{i+1}{i+2}; right C{i}{i+2}{f"0_{(i+1)}"ifdrawableelse0}; down """ifdrawable:
netlist+=f""" W 0_{i} 0_{i+1}; right, ground """# if drawable:# netlist += f"""# Pout {order + 2} 0_0; down, v=V_{{out}}# """netlist+=f""" ;draw_nodes=connections, cpt_size=1 """cct=Circuit(netlist)
returncctdeflow_pass_RC_filter(order: int=1, drawable=False) ->Circuit:
"""Generate a low pass filter circuit of the given order."""assertorder>0return__generate_RC_filter(False, order, drawable)
defhigh_pass_RC_filter(order: int=1, drawable=False) ->Circuit:
"""Generate a high pass filter circuit of the given order."""assertorder>0return__generate_RC_filter(True, order, drawable)
I think it could be possible to use something like the networkx library to compute layouts for circuits automatically.
The text was updated successfully, but these errors were encountered:
This is on my list of todos. However, it is a tricky problem. Moreover, the drawing hints are not sufficient and other heuristics are required such as symmetry.
The current algorithm solves the horizontal placement and vertical placement graphs independently but I think this more sophisticated approach will require both graphs to be solved concurrently. There is another algorithm I have tried (see schemlineqplacer.py) that could be applied but again this needs some heuristics to get a tidy solution.
I welcome any suggestions of algorithms that could be used.
It's very frustrating to work with a circuit that you can't visualize to make sure you did it right. Unfortunately, for lcapy circuits, not all circuits that are drawable are solvable, and vice versa.
These functions generate circuits that are either drawable or solvable.
I think it could be possible to use something like the networkx library to compute layouts for circuits automatically.
The text was updated successfully, but these errors were encountered: