32 lines
860 B
Python
32 lines
860 B
Python
import matplotlib.pyplot as plt
|
|
import numpy as np
|
|
|
|
n_motor = np.arange(0, 3100, 100) # rpm
|
|
cpr = np.array([200, 300, 500, 1000, 2000]) # clicks/rev
|
|
fSampleo = 26e3 # Frecuencia de sampleo (Hz)
|
|
|
|
parPolos = np.arange(1,10)
|
|
|
|
gradoMecanico = 360/cpr
|
|
|
|
fig, ax = plt.subplots(1,2)
|
|
|
|
for i in cpr:
|
|
fEncoder = n_motor * i / 60 # Frecuencia del encoder (Hz)
|
|
ax[0].plot(n_motor, fEncoder, label=f'CPR = {i}')
|
|
|
|
ax[0].axhline(fSampleo/2, color='red', linestyle='--')
|
|
ax[0].set_xlabel('Velocidad rotor [rpm]')
|
|
ax[0].set_ylabel('Frecuencia señal [Clicks/s]')
|
|
ax[0].legend()
|
|
|
|
for i in parPolos:
|
|
gradoElectrico = gradoMecanico * i
|
|
ax[1].plot(cpr, gradoElectrico, label=f'{i} Pares de Polos')
|
|
|
|
ax[1].set_xlabel('CPR [clicks por Revolucion]')
|
|
ax[1].set_ylabel('Precision del angulo Electrico')
|
|
ax[1].legend()
|
|
|
|
plt.tight_layout()
|
|
plt.show() |