nahue-passano commited on
Commit
7c09abf
·
verified ·
1 Parent(s): e47f915

Update core.py

Browse files
Files changed (1) hide show
  1. core.py +7 -1
core.py CHANGED
@@ -73,6 +73,11 @@ def simulate_loudspeaker(
73
  ),
74
  )[:, 0]
75
 
 
 
 
 
 
76
  # Acoustical response
77
  air_impedance = acoustical_constants.air_density * acoustical_constants.sound_speed
78
  wave_number_array = angular_freq_array / acoustical_constants.sound_speed
@@ -88,7 +93,7 @@ def simulate_loudspeaker(
88
  ZM_rad_imag_array = (
89
  Sd_value * air_impedance * (1j * (struve(2 * ka_array) / ka_array))
90
  )
91
- ZM_rad_array = ZM_rad_real_array + ZM_rad_imag_array
92
  ZM_rad_tmatrix = np.array(
93
  [[np.ones(n_bins), ZM_rad_array], [np.zeros(n_bins), np.ones(n_bins)]]
94
  )
@@ -139,6 +144,7 @@ def simulate_loudspeaker(
139
  "electrical_impedance": electrical_impedance_shorted_output,
140
  "mechanical_force": mechanical_force,
141
  "mechanical_velocity": mechanical_velocity,
 
142
  "acoustical_pressure": acoustical_pressure,
143
  "selectivity_params": {
144
  "fs": np.round(mechanical_fs, 2),
 
73
  ),
74
  )[:, 0]
75
 
76
+ mechanical_displacement = mechanical_velocity / (
77
+ 1j * angular_freq_array
78
+ ) # [(m/s) / (rad/s)] = [m/rad]
79
+ mechanical_displacement = mechanical_displacement * 2 * np.pi * 1000 # [mm]
80
+
81
  # Acoustical response
82
  air_impedance = acoustical_constants.air_density * acoustical_constants.sound_speed
83
  wave_number_array = angular_freq_array / acoustical_constants.sound_speed
 
93
  ZM_rad_imag_array = (
94
  Sd_value * air_impedance * (1j * (struve(2 * ka_array) / ka_array))
95
  )
96
+ ZM_rad_array = (ZM_rad_real_array + 1j * ZM_rad_imag_array).astype(np.complex128)
97
  ZM_rad_tmatrix = np.array(
98
  [[np.ones(n_bins), ZM_rad_array], [np.zeros(n_bins), np.ones(n_bins)]]
99
  )
 
144
  "electrical_impedance": electrical_impedance_shorted_output,
145
  "mechanical_force": mechanical_force,
146
  "mechanical_velocity": mechanical_velocity,
147
+ "mechanical_displacement": mechanical_displacement,
148
  "acoustical_pressure": acoustical_pressure,
149
  "selectivity_params": {
150
  "fs": np.round(mechanical_fs, 2),