clear;
close all
%%value for TC4080
kV = 9.3; % back EMV konstant of motor in rpm per Volt
kT = 9.5492966 /kV;
L= 0 /1000000 ; % motor inductance in Henry
m_R = 89 /1000; % motor resistance in Ohm
m_eddy_trq = 0.00031415927; % eddy current torque in Nm per rpm
m_hyst_trq = 1.66; % hysterisis torque in Nm
m_cur_lim = 150; % maximum allowed motor current in Ampere
bat_volt_nom= 48; %the unloaded nominal battery voltage
m_rpm_length = 100; %% length of motor speed vector
m_rpm = 0:kV*bat_volt_nom/m_rpm_length:(kV*bat_volt_nom); % motor speed vektor in rpm
bat_volt = bat_volt_nom*ones(1,max(size(m_rpm))); %% vector of actual loaded battery voltage over motor rpm
bat_cur_lim = 50;
m_mags = 46; %% motor poles or number of permanent magnets
m_frequ = m_rpm*m_mags/2/60; % commutation of field frequiency in Hz over rpm
m_volt = m_rpm/kV; % back EMF Voltage in Volt-RMS of the motor over rpm
m_Xl = 2*pi*m_frequ*L; % motor reactance over rpm
m_Z = sqrt(m_Xl.^2+m_R^2); % motor impedance over rpm
c_volt = m_volt./2+sqrt(m_volt.^2./4+m_Z.*bat_volt.*bat_cur_lim);%*m_Z);_ % controller output voltage in Volt-RMS
for i=1:m_rpm_length+1
if c_volt(i) > bat_volt (i)
c_volt(i) = bat_volt(i);
end
end
m_cur = (c_volt-m_volt)./m_Z;
for i=1:m_rpm_length+1
if m_cur(i) > m_cur_lim
m_cur(i) = m_cur_lim;
end
end
duty = c_volt./bat_volt*100;
bat_cur = m_cur .* duty ./100;
bat_power = c_volt.*m_cur;
bat_power2 = bat_volt.*bat_cur;
m_torque = (m_cur)*kT - m_eddy_trq*m_rpm -m_hyst_trq;
m_power = m_torque .* m_rpm /9.5492966;
eta = m_power./bat_power*100;
%% Vehicle
v_dia= 26; %% wheel diameter in inch
v_circ = v_dia *0.0254 *pi; %% wheel circumference in meters
v_reduction = 1; %reduction ratio of the drive
v_rpm = m_rpm/v_reduction;
v_spd = m_rpm/60 * v_circ; % vehicle speed in meters per second
v_kph = v_spd *3.6; % vehicle speed in kph
v_cw = 0.7; % Drag Coefficent
v_A = 0.8 ; % Face Area
v_cwA = v_cw *v_A; % Combined Coefficient cwA=cw*A
v_rho = 1.275; % desity of air
v_drag_force = (v_spd.^2) .*v_rho .*v_cwA ./2; % drag force in newton: ?*cwA*(vms)²/2
v_drag_power = v_drag_force .* v_spd; % drag power in Watt
v_drive_torque = m_torque* v_reduction; % drive torque in Newton Meter
v_drive_force = v_drive_torque /(v_dia *0.0254/2);
%% Plot
x = m_rpm;
y1 = eta;
y2 = m_power;
y3 = duty;
y4 = v_drive_torque;
figure;
grid on;
%grid minor;
ylabel = ('gude');
ax1 = gca;
%get(ax1,'Position');
set(ax1,'XColor','k',...
'YColor','b',...
'YLim',[0,100],...
'YTick',[0, 20, 40, 60, 80, 100]);
line(x, y1, 'Color', 'b', 'LineStyle', '-', 'Marker', 'none', 'Parent', ax1)
str2 = '\leftarrow sin(3\pi/4) = 0.71';
text(-75, 60, 'efficiency','Color', 'b')
text(8,115,['\fontsize{12}{\color{red}\epsilon:= zf}'])
ax2 = axes('Position',get(ax1,'Position'),...
'XAxisLocation','bottom',...
'YAxisLocation','left',...
'Color','none',...
'XColor','k',...
'YColor','r',...
'YLim',[0,3000],...
'YTick',[300, 900, 1500, 2100, 2700],...
'XTick',[],'XTickLabel',[]);
line(x, y2, 'Color', 'r', 'LineStyle', '-', 'Marker', 'none', 'Parent', ax2)
text(-75, 60, 'power out','Color', 'r')
ax3 = axes('Position',get(ax1,'Position'),...
'XAxisLocation','bottom',...
'YAxisLocation','right',...
'Color','none',...
'XColor','k',...
'YColor','g',...
'YLim',[0,100],...
'YTick',[0, 20, 40, 60, 80, 100],...
'XTick',[],'XTickLabel',[]);
line(x, y3, 'Color', 'g', 'LineStyle', '-', 'Marker', 'none', 'Parent', ax3)
text(75, 25, 'duty cycle [%]','Color', 'g')
ax4_lim = 200;
ax4 = axes('Position',get(ax1,'Position'),...
'XAxisLocation','bottom',...
'YAxisLocation','right',...
'Color','none',...
'XColor','k',...
'YColor','c',...
'YLim',[0,200],...
'YTick',[20, 60, 100, 140, 180],...
'XTick',[],'XTickLabel',[]);
line(x, y4, 'Color', 'black', 'LineStyle', '-', 'Marker', 'none', 'Parent', ax4)
text(-75, 35, 'torque [Nm]','Color', 'black')
text(150, 150, 'TC4080','Color', 'black')