Sunteți pe pagina 1din 15

DEPARTAMENTO DE ENERGÍA Y MECÁNICA

INGENIERÍA MECATRÓNICA

INSTRUMENTACIÓN INDUSTRIAL MECÁNICA


TRABAJO TERMOPAR J
NIVEL: 6to “A”

TÍTULO:

CODIFICACIÓN DE TERMOPAR TIPO J EN MATLAB

AUTOR:

OCAÑA PAÑORA LANDO STEPHEN

ING. PATRICIA CONSTANTE

LATACUNGA
2018
TERMOPAR TIPO J EN MATLAB

Figure 1 Interfaz Gráfica del programa termoparJ

function varargout = termoparJ(varargin)


% TERMOPARJ MATLAB code for termoparJ.fig
% TERMOPARJ, by itself, creates a new TERMOPARJ or raises the existing
% singleton*.
%
% H = TERMOPARJ returns the handle to a new TERMOPARJ or the handle to
% the existing singleton*.
%
% TERMOPARJ('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in TERMOPARJ.M with the given input arguments.
%
% TERMOPARJ('Property','Value',...) creates a new TERMOPARJ or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before termoparJ_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to termoparJ_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 termoparJ

% Last Modified by GUIDE v2.5 12-Dec-2018 19:47:55

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @termoparJ_OpeningFcn, ...
'gui_OutputFcn', @termoparJ_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 termoparJ is made visible.


function termoparJ_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to termoparJ (see VARARGIN)

% Choose default command line output for termoparJ


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);

% UIWAIT makes termoparJ wait for user response (see UIRESUME)


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = termoparJ_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 infem_Callback(hObject, eventdata, handles)
% hObject handle to infem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of infem as text


% str2double(get(hObject,'String')) returns contents of infem as a double

% --- Executes during object creation, after setting all properties.


function infem_CreateFcn(hObject, eventdata, handles)
% hObject handle to infem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in calctemp.


function calctemp_Callback(hObject, eventdata, handles)

% Coeficientes d para un cammpo de medida de -210 a 0 °C.


D=[0.0000000E+00 1.9528268E+01 -1.2286185E+00 -1.0752178E+00 -5.9086933E-01 -1.7256713E-01 -
2.8131513E-02 -2.3963370E-03 -8.3823321E-05];
% Coeficientes d para un cammpo de medida de 0 a 760 °C.
D1=[0.000000E+00 1.978425E+01 -2.001204E-01 1.036969E-02 -2.549687E-04 3.585153E-06 -5.344285E-08
5.099890E-10 0.000000E+00];
% Coeficientes d para un cammpo de medida de 760 a 1200 °C.
D2=[-3.11358187E+03 3.00543684E+02 -9.94773230E+00 1.70276630E-01 -1.43033468E-03 4.73886084E-06
0.00000000E+00 0.00000000E+00 0.00000000E+00];
t2=get(handles.infem,'String');
v = str2double(t2);
C=[1;v;v^2;v^3;v^4;v^5;v^6;v^7;v^8];
if v >= -8.095 && v < 0
tempe=D*C;
else
if v >= 0 && v < 42.919
tempe=D1*C;
end
if v >=42.919 && v <= 69.553
tempe=D2*C;
end
end
set(handles.outtemp,'String',tempe);
% hObject handle to calctemp (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
function outtemp_Callback(hObject, eventdata, handles)
% hObject handle to outtemp (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of outtemp as text


% str2double(get(hObject,'String')) returns contents of outtemp as a double

% --- Executes during object creation, after setting all properties.


function outtemp_CreateFcn(hObject, eventdata, handles)
% hObject handle to outtemp (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function intemp_Callback(hObject, eventdata, handles)


% hObject handle to intemp (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of intemp as text


% str2double(get(hObject,'String')) returns contents of intemp as a double

% --- Executes during object creation, after setting all properties.


function intemp_CreateFcn(hObject, eventdata, handles)
% hObject handle to intemp (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in calcfem.


function calcfem_Callback(hObject, eventdata, handles)

% coeficientes para un cammpo de medida de -210 a 760 °C.


A=[0.000000000000E+00 0.503811878150E-01 0.304758369300E-04 -0.856810657200E-07 0.132281952950E-
09 -0.170529583370E-12 0.209480906970E-15 -0.125383953360E-18 0.156317256970E-22];
% coeficientes para un cammpo de medida de 760 a 1200 °C.
A1=[0.296456256810E+03 -0.149761277860E+01 0.317871039240E-02 -0.318476867010E-05
0.157208190040E-08-0.306913690560E-14];
t1=get(handles.intemp,'String');
t = str2double(t1)
B=[1;t;t^2;t^3;t^4;t^5;t^6;t^7;t^8]
B1=[1;t;t^2;t^3;t^4;t^5]
if t >= (-210) && t < 760
mv=A*B;
else t >= 760 && t <= 1200
mv=A1*B1;
end
set(handles.outfem,'String',mv);

% hObject handle to calcfem (see GCBO)


% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

function outfem_Callback(hObject, eventdata, handles)


% hObject handle to outfem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of outfem as text


% str2double(get(hObject,'String')) returns contents of outfem as a double

% --- Executes during object creation, after setting all properties.


function outfem_CreateFcn(hObject, eventdata, handles)
% hObject handle to outfem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in limpiar.


function limpiar_Callback(hObject, eventdata, handles)
set(handles.outfem,'String','');
set(handles.outtemp,'String','');
set(handles.intemp,'String','');
set(handles.infem,'String','');

% hObject handle to limpiar (see GCBO)


% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

Published with MATLAB® R2017b


Figure 2 Captura 1 del programa
Figure 3 Tabla de termopar J a 30°C
Figure 4 Tabla termopar J a -2.150 mV
Figure 5 Captura 2 del programa termoparJ
Figure 6 Tabla termopar J a 600°C
Figure 7 Tabla termoparJ a 30.559 mV
Figure 8 Captura 3 del programa termoparj
Figure 9 Tabla de termopar J a -75°C
Figure 10 Tabla de termopar J a 50mV

Conclusión:

Se comprobó mediante tablas los resultados del programa termopar J.

S-ar putea să vă placă și