Академический Документы
Профессиональный Документы
Культура Документы
Voltaje de armadura(V)
Ra
Resistencia de la armadura ()
La
Ia
Eb
Tm
Jm
Bm
Kt
Kb
Donde la relacin del rotor y la velocidad cuando se aplica un voltaje da como funcin de transferencia
la siguiente:
Cdigo en Matlab:
% Captura de voltaje en tiempo real con Arduino
% Jorge Garca Tscar
%% Apertura del serie (COM)
close all; clear all; clc
%borrar previos
delete(instrfind({'Port'},{'/dev/ttyS101'}));
%crear objeto serie
s = serial('/dev/ttyS101','BaudRate',9600,'Terminator','CR/LF');
warning('off','MATLAB:serial:fscanf:unsuccessfulRead');
%abrir puerto
fopen(s);
%% Preparar medida
% parmetros de medidas
tmax = 10; % tiempo de captura en s
rate = 33; % resultado experimental (comprobar)
% preparar la figura
f = figure('Name','Captura');
a = axes('XLim',[0 tmax],'YLim',[0 5.1]);
l1 = line(nan,nan,'Color','r','LineWidth',2);
l2 = line(nan,nan,'Color','b','LineWidth',2);
xlabel('Tiempo (s)')
ylabel('Voltaje (V)')
%title('Captura de voltaje en tiempo real con Arduino')
grid on
hold on
%% Bucle
% inicializar
v1 = zeros(1,tmax*rate);
v2 = zeros(1,tmax*rate);
i = 1;
t = 0;
% ejecutar bucle cronometrado
tic
while t<tmax
t = toc;
% leer del puerto serie
a = fscanf(s,'%d,%d')';
v1(i)=a(1)*5/1024;
v2(i)=a(2)*5/1024;
% dibujar en la figura
x = linspace(0,i/rate,i);
set(l1,'YData',v1(1:i),'XData',x);
set(l2,'YData',v2(1:i),'XData',x);
drawnow
% seguir
i = i+1;
end
Ahora obtenemos datos de Matlab, esto nos genera la siguiente adquisicin de datos:
>> v1
v1 =
Columns 1 through 9
0
Columns 10 through 18
0
0.0732
Columns 19 through 27
0
0.0049
Columns 28 through 36
0
Columns 37 through 45
0
0.0293
Columns 46 through 54
0
Columns 55 through 63
0.0049
2.4072
2.5977
Columns 64 through 72
0
Columns 73 through 81
0
3.8135
3.8623
Columns 82 through 90
3.9551
3.9795
3.9941
3.9893
3.9893
3.9941
3.9990
3.9893
3.9746
3.9307
3.9502
3.9502
3.9795
3.9600
3.9697
3.9746
3.9795
3.8672
3.9453
4.0332
3.9746
3.8818
3.8574
3.9795
4.0137
3.9941
3.9844
3.9648
3.9404
3.9648
4.0186
3.9844
3.9746
3.9697
3.9551
3.9746
4.0723
3.9697
3.8818
3.9746
3.9795
3.9746
3.9844
3.9697
3.9600
3.9697
3.9893
3.9795
3.9844
3.9844
3.9941
3.9746
3.9697
3.9697
3.9941
3.9795
3.9697
Columns 91 through 99
3.9307
3.9307
3.9355
3.9600
3.9844
3.9941
3.9697
3.9893
3.9795
3.9600
3.9453
3.9990
3.9893
3.9795
3.9844
3.9453
4.0381
3.9746
3.9746
4.0771
3.9795
3.9600
3.9795
3.9893
3.9648
3.9795
3.9697
3.9893
4.0039
3.9697
3.9941
3.9648
3.9941
3.9893
3.9844
3.9600
3.9795
3.9697
3.9795
3.9795
3.9551
3.9697
3.9648
4.0039
4.0918
4.0039
3.9844
3.9844
3.9746
3.9746
3.9502
3.9746
4.0918
3.9648
3.9990
3.9795
3.9746
3.9941
4.0527
3.9844
3.9746
3.9648
4.0088
3.9844
3.9795
3.9453
3.9844
3.9746
3.9795
3.9746
3.9746
3.9648
3.9941
4.0039
3.9941
3.9697
3.9697
3.9795
3.9502
3.9502
3.9551
3.9648
3.9600
3.9990
4.0088
3.9893
3.9746
3.9844
3.9844
3.9844
3.9844
3.9648
4.0723
3.9648
3.9990
3.9746
3.9990
3.9795
3.9893
3.9746
3.9844
3.9746
3.9600
3.9746
3.9844
3.9893
3.9844
3.9453
3.9893
3.9648
3.9648
3.9697
3.9844
3.9746
3.8867
4.0137
3.9844
4.0039
3.9844
4.0967
3.9893
3.9844
3.9746
4.1553
3.9648
3.9746
3.9551
3.9746
3.9844
3.9746
3.9746
3.9600
4.0918
3.9551
3.9893
3.9600
3.9746
3.9844
3.9844
4.0430
3.9844
3.9844
3.9746
3.9795
3.9844
3.9648
3.9648
3.9844
3.9795
3.9600
3.9844
3.9551
3.9648
3.9795
3.9648
3.9844
3.9404
4.0869
3.9648
4.0625
3.9844
3.9697
3.9697
3.9648
3.9746
3.9697
3.9746
3.9795
3.9746
3.9697
3.9697
3.9795
3.9795
3.9746
3.9795
3.9648
3.9746
3.9844
3.9746
3.9746
3.9502
3.9600
3.9844
3.9746
3.9697
3.9746
3.9746
3.9307
3.9697
3.9844
4.0967
3.9893
3.9844
3.9795
3.9648
3.9648
3.9697
3.9697
3.9893
3.9893
3.9795
3.9844
3.9551
3.9697
3.9697
3.9648
3.9697
3.9697
3.9697
3.9893
4.0234
3.9844
3.9697
3.9697
3.9648
3.9648
3.9600
3.9941
3.9648
3.9844
3.9551
3.9795
3.9795
3.9648
3.9746
3.9844
3.9844
3.9795
3.9844
3.9795
3.9746
3.9600
3.9795
3.9844
3.9648
3.9600
3.9551
3.9697
3.9648
3.9746
3.9551
3.9844
3.9746
3.9795
3.9648
3.9600
3.9844
3.9795
3.9600
3.9746
3.9600
3.9795
3.9014
3.9844
3.9746
3.9697
3.9453
3.9600
6.019e-05
---------------------------s^2 + 0.004007 s + 0.0001288
Arreglando la funcion de transferencia nos queda: