Skip to content

transformer and laplace mesh analysis #154

@simonArchipoff

Description

@simonArchipoff

Hello, with the main branch of lcapy I came across this issue :
(I might be doing some weird things because I use lcapy to do multi-physics simulation while learning how to do it)

from lcapy import *
cct = Circuit("""
    Vs 0 1;
    TF1 0 1 2 3 {1};
    R1 2 3 1;
""")
foo = cct.laplace().mesh_analysis()

It raises an exception :

Traceback (most recent call last):
  File "main.py", line 11, in <module>
    foo = cct.laplace().mesh_analysis()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/simon/.cache/pypoetry/virtualenvs/spykersim-6fZ2i_oL-py3.12/lib/python3.12/site-packages/lcapy/netlist.py", line 859, in mesh_analysis
    return LoopAnalysis.from_circuit(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/simon/.cache/pypoetry/virtualenvs/spykersim-6fZ2i_oL-py3.12/lib/python3.12/site-packages/lcapy/loopanalysis.py", line 57, in from_circuit
    return cls(cct)
           ^^^^^^^^
  File "/home/simon/.cache/pypoetry/virtualenvs/spykersim-6fZ2i_oL-py3.12/lib/python3.12/site-packages/lcapy/loopanalysis.py", line 74, in __init__
    self._equations = self._make_equations()
                      ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/simon/.cache/pypoetry/virtualenvs/spykersim-6fZ2i_oL-py3.12/lib/python3.12/site-packages/lcapy/loopanalysis.py", line 190, in _make_equations
    result = self._process_loop(loop, mesh_currents[m],
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/simon/.cache/pypoetry/virtualenvs/spykersim-6fZ2i_oL-py3.12/lib/python3.12/site-packages/lcapy/loopanalysis.py", line 164, in _process_loop
    v = -elt.cpt.voltage_equation(current, self.kind)
         ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TF' object has no attribute 'voltage_equation'. Did you mean: 'voltage_gain'?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions