function varargout = rankineCycle(varargin)
% RANKINECYCLE M-file for rankineCycle.fig
% RANKINECYCLE, by itself, creates a new RANKINECYCLE or raises the existing
% singleton*.
%
% H = RANKINECYCLE returns the handle to a new RANKINECYCLE or the handle to
% the existing singleton*.
%
% RANKINECYCLE('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in RANKINECYCLE.M with the given input arguments.
%
% RANKINECYCLE('Property','Value',...) creates a new RANKINECYCLE or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before rankineCycle_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to rankineCycle_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 rankineCycle
% Last Modified by GUIDE v2.5 28-Mar-2006 15:44:49
% Copyright 2006-2009 The MathWorks, Inc.
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @rankineCycle_OpeningFcn, ...
'gui_OutputFcn', @rankineCycle_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 rankineCycle is made visible.
function rankineCycle_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 rankineCycle (see VARARGIN)
% Choose default command line output for rankineCycle
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes rankineCycle wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = rankineCycle_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 p1_Callback(hObject, eventdata, handles)
% hObject handle to p1 (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 p1 as text
% str2double(get(hObject,'String')) returns contents of p1 as a double
p1 = str2double(get(hObject,'String'));
setappdata(gcf, 'p1', p1);
% --- Executes during object creation, after setting all properties.
function p1_CreateFcn(hObject, eventdata, handles)
% hObject handle to p1 (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 p2_Callback(hObject, eventdata, handles)
% hObject handle to p2 (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 p2 as text
% str2double(get(hObject,'String')) returns contents of p2 as a double
p2 = str2double(get(hObject,'String'));
setappdata(gcf, 'p2', p2);
% --- Executes during object creation, after setting all properties.
function p2_CreateFcn(hObject, eventdata, handles)
% hObject handle to p2 (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 Wd_Callback(hObject, eventdata, handles)
% hObject handle to Wd (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 Wd as text
% str2double(get(hObject,'String')) returns contents of Wd as a double
Wd = str2double(get(hObject,'String'));
setappdata(gcf, 'Wd', Wd);
% --- Executes during object creation, after setting all properties.
function Wd_CreateFcn(hObject, eventdata, handles)
% hObject handle to Wd (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 t2_Callback(hObject, eventdata, handles)
% hObject handle to t2 (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 t2 as text
% str2double(get(hObject,'String')) returns contents of t2 as a double
t2 = str2double(get(hObject,'String'));
setappdata(gcf, 't2', t2);
% --- Executes during object creation, after setting all properties.
function t2_CreateFcn(hObject, eventdata, handles)
% hObject handle to t2 (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 t3_Callback(hObject, eventdata, handles)
% hObject handle to t3 (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 t3 as text
% str2double(get(hObject,'String')) returns contents of t3 as a double
t3 = str2double(get(hObject,'String'));
setappdata(gcf, 't3', t3);
% --- Executes during object creation, after setting all properties.
function t3_CreateFcn(hObject, eventdata, handles)
% hObject handle to t3 (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 mu_Callback(hObject, eventdata, handles)
% hObject handle to mu (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 mu as text
% str2double(get(hObject,'String')) returns contents of mu as a double
% --- Executes during object creation, after setting all properties.
function mu_CreateFcn(hObject, eventdata, handles)
% hObject handle to mu (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 md_Callback(hObject, eventdata, handles)
% hObject handle to md (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 md as text
% str2double(get(hObject,'String')) returns contents of md as a double
% --- Executes during object creation, after setting all properties.
function md_CreateFcn(hObject, eventdata, handles)
% hObject handle to md (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 bwr_Callback(hObject, eventdata, handles)
% hObject handle to bwr (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 bwr as text
% str2double(get(hObject,'String')) returns contents of bwr as a double
% --- Executes during object creation, after setting all properties.
function bwr_CreateFcn(hObject, eventdata, handles)
% hObject handle to bwr (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 Qdin_Callback(hObject, eventdata, handles)
% hObject handle to Qdin (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 Qdin as text
% str2double(get(hObject,'String')) returns contents of Qdin as a double
% --- Executes during object creation, after setting all properties.
function Qdin_CreateFcn(hObject, eventdata, handles)
% hObject handle to Qdin (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 Qdout_Callback(hObject, eventdata, handles)
% hObject handle to Qdout (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 Qdout as text
% str2double(get(hObject,'String')) returns contents of Qdout as a double
% --- Executes during object creation, after setting all properties.
function Qdout_CreateFcn(hObject, eventdata, handles)
% hObject handle to Qdout (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 mdcw_Callback(hObject, eventdata, handles)
% hObject handle to mdcw (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 mdcw as text
% str2double(get(hObject,'String')) returns contents of mdcw as a double
% --- Executes during object creation, after setting all properties.
function mdcw_CreateFcn(hObject, eventdata, handles)
% hObject handle to mdcw (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 pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get the data from the input fields
in.p1 = str2double(get(handles.p1,'String'));
in.p2 = str2double(get(handles.p2,'String'));
in.Wd = str2double(get(handles.Wd,'String'));
in.t2 = str2double(get(handles.t2,'String'));
in.t3 = str2double(get(handles.t3,'String'));
% Compute the answers
out = rankine(in) ;
% Write the output data to the apropriate regions
set(handles.mu , 'String', num2str(out.mu ) );
set(handles.md , 'String', num2str(out.md ) );
set(handles.bwr , 'String', num2str(out.bwr ) );
set(handles.Qdin , 'String', num2str(out.Qdin ) );
set(handles.Qdout , 'String', num2str(out.Qdout ) );
set(handles.mdcw , 'String', num2str(out.mdcw ) );
% Save the input data to file
save('stored_data.mat', 'in');
% --- Executes on button press in Load.
function Load_Callback(hObject, eventdata, handles)
% hObject handle to Load (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in load.
function load_Callback(hObject, eventdata, handles)
% hObject handle to load (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
load rankine_data;
setappdata(gcf, 'p1', in.p1 );
setappdata(gcf, 'p2', in.p2 );
setappdata(gcf, 'Wd', in.Wd );
setappdata(gcf, 't2', in.t2 );
setappdata(gcf, 't3', in.t3 );
set(handles.p1 , 'String', num2str(in.p1) );
set(handles.p2 , 'String', num2str(in.p2) );
set(handles.Wd , 'String', num2str(in.Wd) );
set(handles.t2 , 'String', num2str(in.t2) );
set(handles.t3 , 'String', num2str(in.t3) );
function myname_Callback(hObject, eventdata, handles)
% hObject handle to myname (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 myname as text
% str2double(get(hObject,'String')) returns contents of myname as a double
% --- Executes during object creation, after setting all properties.
function myname_CreateFcn(hObject, eventdata, handles)
% hObject handle to myname (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
myname = (get(hObject,'String'));
setappdata(gcf, 'myname', myname);