1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
| function varargout = Untitled100(varargin)
% UNTITLED100 MATLAB code for Untitled100.fig
% UNTITLED100, by itself, creates a new UNTITLED100 or raises the existing
% singleton*.
%
% H = UNTITLED100 returns the handle to a new UNTITLED100 or the handle to
% the existing singleton*.
%
% UNTITLED100('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in UNTITLED100.M with the given input arguments.
%
% UNTITLED100('Property','Value',...) creates a new UNTITLED100 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Untitled100_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Untitled100_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help Untitled100
% Last Modified by GUIDE v2.5 26-Jun-2011 10:42:02
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Untitled100_OpeningFcn, ...
'gui_OutputFcn', @Untitled100_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before Untitled100 is made visible.
function [TestData, Motor, Drive, Comments]=Untitled100_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
[TestData, Motor, Drive, Comments] = read_BENG_MotorTestbench;
cla(handles.axes1,'reset')
guidata(hObject, handles); %updates the handles
set (handles.text3,'string', Motor.Name);
set (handles.text4,'string', Motor.P_nom);
set (handles.text5,'string', Motor.I_nom);
set (handles.text6,'string', Motor.U_nom);
set (handles.text8,'string', Motor.RPM_nom);
set (handles.text7,'string', Motor.cos_phi);
handles.timer = timer('TimerFcn',{@timcb handles}, ...
'Period', 1.0, ...
'ExecutionMode','fixedRate');
start(handles.timer);
iconeCNRS = imread('C:\Documents and Settings\olivier.calcoen\My Documents\MATLAB\MATLAB\images[1].jpg');
axes(handles.axes4)
image(iconeCNRS)
axis off;
set(hObject,'toolbar','figure')
% --- Outputs from this function are returned to the command line.
function varargout = Untitled100_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function timcb(hObject,eventdata,handles)
set(handles.text9,'string',datestr(now,13))
% --- Executes on button press in radiobutton3.
function radiobutton3_Callback(hObject, eventdata, handles,TestData, Motor, Drive, Comments)
h = findobj(gcbf, 'style', 'radio');
set(h, 'value', 0);
set(gcbo, 'value', 1);
[TestData, Motor, Drive, Comments] = read_BENG_MotorTestbench; C'est donc ici le problème
cla(handles.axes1,'reset')
% reworking the data to plotable data formats + gridding
% -------------------------------------------------------------------------
Nmin = min(TestData.RPM);
Nmax = max(TestData.RPM);
Nsteps = Nmin:(Nmax-Nmin)/34:Nmax;
Tmin = min(TestData.Torque);
Tmax = max(TestData.Torque);
Pnom = Motor.P_nom/1000; %[kW]
Nnom = Motor.RPM_nom; %[rpm]
Tnom = Pnom*1000/(Nnom*2*pi/60); %[Nm]
P_mech = TestData.RPM.*TestData.Torque*2*pi/60;
EffDrive = TestData.P_drive.P./TestData.P_in.P;
EffMotor = P_mech./TestData.P_drive.P;
EffTotal = P_mech./TestData.P_in.P;
%Et_list = data; % [T,N,Eff]
test = Tmax/30;
[nGrid,tGrid]=meshgrid(Nsteps,(Tmin-test):test:(Tmax+test));
% [Nmat,Tmat]=meshgrid(250:(Nmax-250)/100:Nmax,0:(Tmax-0)/100:Tmax);
EffGridMotor = griddata(TestData.RPM, TestData.Torque, EffMotor ,nGrid,tGrid);
EffGridDrive = griddata(TestData.RPM, TestData.Torque, EffDrive ,nGrid,tGrid);
EffGridTotal = griddata(TestData.RPM, TestData.Torque, EffTotal ,nGrid,tGrid);
%xlswrite(['xls_2D_maps\', fileName , '_motor.xls'], [[0;tGrid(:,1)],[nGrid(1,:); effGridMotor]]);
%xlswrite(['xls_2D_maps\', fileName , '_drive.xls'], [[0;tGrid(:,1)],[nGrid(1,:); effGridDrive]]);
%xlswrite(['xls_2D_maps\', fileName , '_total.xls'], [[0;tGrid(:,1)],[nGrid(1,:); effGrid]]);
% Motor Lines
% -------------------------------------------------------------------------
torqueLine = zeros(2,10);
torqueLine(1,:) = [0:(1-0)/9:1];
torqueLine(2,:) = 1*ones(1,10);
speedLine = zeros(2,10);
speedLine(1,:) = 1*ones(1,10);
speedLine(2,:) = [0:Tmax/9:Tmax];
powerLine = zeros(2,50);
powerLine(1,:) = [1:(Nmax-1)/49:Nmax];
powerLine(2,:) = 1./powerLine(1,:);
%figure
%set(gca,'FontSize',18)
%hold on
%mesh(nGrid,tGrid,EffGridTotal)
%plot3(TestData.RPM, TestData.Torque, EffTotal,'o')
%title('Total efficiency [%]')
%xlabel('Speed [rpm]')
%ylabel('Torque [Nm]')
%figure('Name','Total Efficiency Map')
T=Pnom./(2*pi*Nsteps/60);
n = 1;
for i=Nnom:Nmax
T(n)=Pnom*1000/(2*pi*i/60);
n = n +1;
end
N=Nmin:Nnom;
axes(handles.axes1)
hold on
[C,h] = contourf(nGrid,tGrid,EffGridTotal,[10 20 30 40 50 55 60 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100]/100);
text_handle = clabel(C,h);
plot(torqueLine(1,:),torqueLine(2,:),'LineStyle','-','Color','white','LineWidth',2)
plot(speedLine(1,:),speedLine(2,:),'LineStyle','-','Color','white','LineWidth',2)
plot(powerLine(1,:),powerLine(2,:),'LineStyle','-','Color','white','LineWidth',2)
plot(N,Tnom,'--bs','LineWidth',2)
plot(Nnom:Nmax,T,'--bs','LineWidth',2)
title('Total efficiency [%]')
xlabel('N [rpm]')
ylabel('T [Nm]')
guidata(hObject, handles); %updates the handles
set(hObject);
colorbar('FontSize',10) |
Partager