Skip to content

Add pytta.fourpole with two-port matrices of lumped elements - #106

Open
aguirreSL wants to merge 1 commit into
PyTTaMaster:developmentfrom
aguirreSL:dev-fourpole
Open

aguirreSL wants to merge 1 commit into
PyTTaMaster:developmentfrom
aguirreSL:dev-fourpole

Conversation

@aguirreSL

Copy link
Copy Markdown

Adds pytta.fourpole, the four-pole (two-port) matrices of lumped mechanical and acoustic elements that itaFourpole and ita_make_fourpole of the ITA-Toolbox provide. The transmission matrix A relates force and velocity at the input to those at the output, [F1, v1] = A [F2, v2], and the matrices are arrays of shape (nFreqs, 2, 2):

  1. element(kind, value, freqs): the matrix of a mass, a spring (by its compliance), a dashpot, an impedance in series or to ground, a transformer or a gyrator, with the conventions of ita_make_fourpole.
  2. chain(*matrices): elements connected one after the other.
  3. input_impedance(A, load=None): F1 / v1 with a load at the output, blocked by default.
  4. a_to_z(A) and z_to_a(Z): the impedance matrix with both velocities entering the element, as itaFourpole.A2Z and Z2A.

The ITA code was read for its semantics only and nothing was copied.

The tests in tests/test_fourpole.py print the measured differences:

  1. A mass on a grounded spring has the input impedance jωm + 1 / (jωn) (2.0e-15), and with a free output only the mass is left (1.1e-16).
  2. A chain of a mass, a dashpot, a spring and a shunt impedance has Z12 = Z21 (1.7e-14), and A comes back from Z (1.9e-16).
  3. A gyrator twice is the identity, and a transformer of ratio t shows a load Z as t² Z.

Checked with Python 3.12, numpy 1.26 and scipy 1.17. The 7 failures of development (3 in test_h5io.py, 4 in test_pyttasave.py) are the same with and without this change.

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant