mph- / lcapy

Lcapy is a Python package for symbolic linear circuit analysis and signal processing. It uses SymPy for symbolic mathematics.
GNU Lesser General Public License v2.1
245 stars 46 forks source link

state space ss.X representation is not working as mentioned in doc #83

Closed floke9 closed 9 months ago

floke9 commented 2 years ago

From the doc https://lcapy.readthedocs.io/en/latest/circuits.html#state-space-analysis

After creating the circuit:

from lcapy import Circuit a = Circuit(""" V 1 0 {v(t)}; down R1 1 2; right L 2 3; right=1.5, i=i_L R2 3 03; down=1.5, i=i{R2}, v=v_{R2} W 0 0_3; right W 3 3_a; right C 3_a 0_4; down, i=i_C, v=v_C W 0_3 0_4; right""")

ss = a.ss

printing of time domain representation is working fine:

ss.x Matrix([[i_L(t)], [v_C(t)]])

but for laplace domain representation:

ss.X

it gives an Atribute error:

File c:\python\lib\site-packages\lcapy\statespace.py:70, in StateSpace.X(self) 67 @property 68 def X(self): 69 """Laplace transform of state-variable vector.""" ---> 70 return LaplaceDomainMatrix(self.x.laplace())

AttributeError: 'Vector' object has no attribute 'laplace'

used version:

Python: 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] SymPy: 1.10.1 NumPy: 1.22.4 Matplotlib: 3.5.2 SciPy: 1.8.1 Lcapy: 1.5

mph- commented 2 years ago

That bug snuck under the unit tests. Thanks for letting me know. The patch I've pushed should fix this.