nahue-passano commited on
Commit
7f8cc46
·
verified ·
1 Parent(s): 28e7489

Update core.py

Browse files
Files changed (1) hide show
  1. core.py +14 -1
core.py CHANGED
@@ -105,7 +105,7 @@ def simulate_loudspeaker(
105
  * acoustical_constants.measurement_distance
106
  * np.exp(1j * wave_number_array * acoustical_constants.measurement_distance)
107
  )
108
- Z_delay = 1j * np.exp(
109
  -1j * wave_number_array * acoustical_constants.measurement_distance
110
  ) # Phase rotation due air propagation time
111
 
@@ -128,11 +128,24 @@ def simulate_loudspeaker(
128
  / acoustical_constants.reference_pressure
129
  )
130
 
 
 
 
 
 
 
 
131
  loudspeaker_responses = {
132
  "electrical_impedance": electrical_impedance_shorted_output,
133
  "mechanical_force": mechanical_force,
134
  "mechanical_velocity": mechanical_velocity,
135
  "acoustical_pressure": acoustical_pressure,
 
 
 
 
 
 
136
  }
137
 
138
  return loudspeaker_responses
 
105
  * acoustical_constants.measurement_distance
106
  * np.exp(1j * wave_number_array * acoustical_constants.measurement_distance)
107
  )
108
+ Z_delay = np.exp(
109
  -1j * wave_number_array * acoustical_constants.measurement_distance
110
  ) # Phase rotation due air propagation time
111
 
 
128
  / acoustical_constants.reference_pressure
129
  )
130
 
131
+ # fmt: off
132
+ mechanical_fs = 1 / (2*np.pi*(thiele_small_params["Mm"]*thiele_small_params["Cm"])**(1/2))
133
+ Qm = 2*np.pi*mechanical_fs*(thiele_small_params["Mm"]+0.00092)/thiele_small_params["Rm"]
134
+ Qe = 2*np.pi*mechanical_fs*(thiele_small_params["Mm"]+0.00092)/(thiele_small_params["Bl"]**2/thiele_small_params["Re"])
135
+ Qt = (Qm*Qe) / (Qm+Qe)
136
+ # fmt: on
137
+
138
  loudspeaker_responses = {
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),
145
+ "Qm": np.round(Qm, 2),
146
+ "Qe": np.round(Qe, 2),
147
+ "Qt": np.round(Qt, 2),
148
+ },
149
  }
150
 
151
  return loudspeaker_responses