clc;clear;close all; Ts = 0.00002; load('Vetores03112017_I_V.csv') tempo = Vetores03112017_I_V(:,1); %armazena tempo Ia = Vetores03112017_I_V(:,2); %armazena corrente Vel = Vetores03112017_I_V(:,4)/0.269; %vel corrigida p cte de velocidade Va = Vetores03112017_I_V(:,3)*0.5;%*0.9047; %V corrigida por PWM Red = 1/12.52; Redeletr= 12.52; Wmed=[tempo Vel]; %Velocidade medida do degrau rad/s Vamed=[tempo Va]; %Tensao de armadura Volts Iamed=[tempo Ia]; %Corrente de armadura Volts %-------------------------------------------------------------------------- %Parametros do Motor BLDC Ra = 0.1501; % Resistência de armadura [Ohm] La = 0.000150; % Indutância de armadura [H] K = 0.087; % Kt=Ke para este motor: Constante de torque [N-m/A] ou Constante f.c.e.m [V-s/rad] J = 0.00050804; % Momento de inércia [N-m-s^2/rad] B = 0.0006; % Coeficiente de atrito viscoso [N-m-s/rad] % %Parametros do Motor BLDC % Ra = IteracoesReL(1);%114.833e-3; % Resistência de armadura [ohm] % La = IteracoesReL(2); %101.2e-6; % Indutância de armadura [H] % K = 1; % Verificando a premissa de que Kt=Ke para este motor % J = IteracoesReL(4); % Momento de inércia [N-m-s^2/rad] % B1 = IteracoesReL(3);%1; % Coeficiente de atrito viscoso [N-m-s/rad] %IterMARLBJKe6e6= [Ra, La, B, J, K] %% load('pwm.csv'); pwm_r=pwm(:,2)/0.65; tempo2=0:0.25:499.75; tempo2=tempo2'; subplot(2,2,1) plot(tempo2,pwm_r,'k','linewidth',2) grid on title(['\fontsize{15} a)']) axis([0 500 -2 7]) xlabel('Tempo [us]','FontSize',15) ylabel('Tensão [V]','FontSize',15) tvelocidade=0.5:0.5:1000; subplot(2,2,2) plot(tempo,Vel,'k','linewidth',2) grid on axis([-0.05 0.56 -1 14]) %title(['\fontsize{18}','Resposta da velocidade angular ao degrau de tensão']) title(['\fontsize{15}','b)']) xlabel('Tempo [s]','FontSize',15) ylabel('velocidade [rad/s]','FontSize',15) subplot(2,2,3) plot(tempo,Ia,'k','linewidth',1.5) grid on axis([-0.05 0.56 -5 30]) %title(['\fontsize{18}','Resposta da corrente de fase ao degrau de tensão']) title(['\fontsize{18}','c)']) xlabel('Tempo [s]','FontSize',15) ylabel('Corrente [A]','FontSize',15) % subplot(2,2,4) plot(tempo,Va,'k','linewidth',2) grid on axis([-0.05 0.56 0 20]) %title(['\fontsize{18}','Forma de onda da tensão da fonte']) title(['\fontsize{18}','d)']) xlabel('Tempo [s]','FontSize',15) ylabel('Tensão [V]','FontSize',15) figure() grid on plot(Iam_out,'k','linewidth',2) title(['\fontsize{15}','Corrente estimada vs Corrente real']) xlabel('Tempo [s]','FontSize',15) ylabel('Corrente [A]','FontSize',15) figure() grid on plot(Vel_out1,'k','linewidth',2) title(['\fontsize{15}','Velocidade estimada vs velocidade real']) xlabel('Tempo [s]','FontSize',15) ylabel('Corrente [A]','FontSize',15) %% yyaxis left plot(correntereg_vbat,'k','linewidth',2) ylabel('Corrente [A]','FontSize',17,'Color','k') hold on yyaxis right % plot(x02(:,1),x02(:,3),'r','linewidth',2) ylabel(' Tensão [V]','FontSize',17) grid on; legend('Corrente', 'tensão'); axis([-0.018 0.222 -20 30]) xlabel('Tempo [s]','FontSize',17) lgd = legend('show'); lgd.FontSize = 15; lgd.Location = 'best'; plt = gca; plt.YAxis(1).Color = 'k'; % change color of RHS y-axis to black plt.YAxis(2).Color = 'r'; % change color of RHS y-axis to red