function varargout = si_engine_simulation(varargin)
% SI_ENGINE_SIMULATION M-file for si_engine_simulation.fig
% SI_ENGINE_SIMULATION, by itself, creates a new SI_ENGINE_SIMULATION
% or raises the existing
% singleton*.
%
% H = SI_ENGINE_SIMULATION returns the handle to a new SI_ENGINE_SIMULATION or the handle to
% the existing singleton*.
%
% SI_ENGINE_SIMULATION('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in SI_ENGINE_SIMULATION.M with the given input arguments.
%
% SI_ENGINE_SIMULATION('Property','Value',...) creates a new SI_ENGINE_SIMULATION or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before si_engine_simulation_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to si_engine_simulation_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 si_engine_simulation
% Last Modified by GUIDE v2.5 04-Apr-2013 11:12:16
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @si_engine_simulation_OpeningFcn, ...
'gui_OutputFcn', @si_engine_simulation_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 si_engine_simulation is made visible.
function si_engine_simulation_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 si_engine_simulation (see VARARGIN)
% Choose default command line output for si_engine_simulation
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes si_engine_simulation wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = si_engine_simulation_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;
% --- Executes on button press in run_sim.
function run_sim_Callback(hObject, eventdata, handles)
% hObject handle to run_sim (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%% Compete Non-Adiabatic Engine
%%
%%%%%%%%%%% Compression Ratio loop inputs %%%%%%%%%%%
rc_max = str2num(get(handles.cmp_ratio, 'String')) + 2;
rc_min = str2num(get(handles.cmp_ratio, 'String')) - 2;
%%%%%%%%%%% Compression Ratio loop inputs %%%%%%%%%%%
%%%%%%%%%%% Ignition Onset loop inputs %%%%%%%%%%%
ths_max = str2num(get(handles.ign_onset, 'String')) + 3; % 153.4 163.4
ths_min = str2num(get(handles.ign_onset, 'String')) - 3;
%%%%%%%%%%% Ignition Onset loop inputs %%%%%%%%%%%
rpm = str2num(get(handles.eng_rpm, 'String')); %6000; % Engine (rpm)
optimized_eng = get(handles.normal_sim, 'Value');
cratio_effect_on_eng = get(handles.cr_effect_sim, 'Value');
ign_onset_effect_on_eng = get(handles.ign_on_eff_sim, 'Value');
%startValue:increment:endValue
%rc = str2num(get(handles.cmp_ratio, 'String')); %11; % Compression Ratio
%ths = (pi/180) * str2num(get(handles.ign_onset, 'String')); %0.88 * pi; % Ignition Onset (158.4 Deg)
if(optimized_eng == 1)
startValue = 1;
increment = 1;
endValue = 1;
rc = str2num(get(handles.cmp_ratio, 'String')); %11; % Compression Ratio
ths = (pi/180) * str2num(get(handles.ign_onset, 'String'));
elseif(cratio_effect_on_eng == 1)
startValue = 1;
increment = 1;
endValue = (rc_max - rc_min) + 1;
rc = rc_min;
ths = (pi/180) * str2num(get(handles.ign_onset, 'String'));
elseif(ign_onset_effect_on_eng == 1)
startValue = 1;
increment = 1;
endValue = (ths_max - ths_min) + 1;
rc = str2num(get(handles.cmp_ratio, 'String')); %11; % Compression Ratio
ths = ths_min * (pi/180);
else
startValue = 1;
increment = 1;
endValue = 1;
msgbox('Select one of the simulation type','Warning');
end
for type_sim = startValue:increment:endValue
eng_sim
Temprature(:,type_sim) = T;
CrankAngle(:,type_sim) = th;
Pressure(:,type_sim) = P;
Volume(:,type_sim) = V;
EngWork(:,type_sim) = W;
MassFlow(:,type_sim) = mc;
assignin('base','EngWork',EngWork);
assignin('base','Volume',Volume);
assignin('base','Pressure',Pressure);
assignin('base','MassFlow',MassFlow);
assignin('base','CrankAngle',CrankAngle);
assignin('base','Temprature',Temprature);
if(ign_onset_effect_on_eng == 1)
ths = (pi/180) * (ths_min + type_sim); %0.88 * pi; % Ignition Onset (158.4 Deg)
rc = str2num(get(handles.cmp_ratio, 'String')); %11; % Compression Ratio
elseif(cratio_effect_on_eng == 1)
ths = (pi/180) * str2num(get(handles.ign_onset, 'String')); %0.88 * pi; % Ignition Onset (158.4 Deg)
rc = rc_min + type_sim; %11; % Compression Ratio
else
ths = (pi/180) * str2num(get(handles.ign_onset, 'String')); %0.88 * pi; % Ignition Onset (158.4 Deg)
rc = str2num(get(handles.cmp_ratio, 'String')); %11; % Compression Ratio
end
end
function edit31_Callback(hObject, eventdata, handles)
% hObject handle to edit31 (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 edit31 as text
% str2double(get(hObject,'String')) returns contents of edit31 as a double
% --- Executes during object creation, after setting all properties.
function edit31_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit31 (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 exh_vlv_open_Callback(hObject, eventdata, handles)
% hObject handle to exh_vlv_open (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 exh_vlv_open as text
% str2double(get(hObject,'String')) returns contents of exh_vlv_open as a double
% --- Executes during object creation, after setting all properties.
function exh_vlv_open_CreateFcn(hObject, eventdata, handles)
% hObject handle to exh_vlv_open (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 exh_vlv_clsd_Callback(hObject, eventdata, handles)
% hObject handle to exh_vlv_clsd (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 exh_vlv_clsd as text
% str2double(get(hObject,'String')) returns contents of exh_vlv_clsd as a double
% --- Executes during object creation, after setting all properties.
function exh_vlv_clsd_CreateFcn(hObject, eventdata, handles)
% hObject handle to exh_vlv_clsd (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 exh_vlv_port_dia_Callback(hObject, eventdata, handles)
% hObject handle to exh_vlv_port_dia (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 exh_vlv_port_dia as text
% str2double(get(hObject,'String')) returns contents of exh_vlv_port_dia as a double
% --- Executes during object creation, after setting all properties.
function exh_vlv_port_dia_CreateFcn(hObject, eventdata, handles)
% hObject handle to exh_vlv_port_dia (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 exh_vlv_stem_dia_Callback(hObject, eventdata, handles)
% hObject handle to exh_vlv_stem_dia (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 exh_vlv_stem_dia as text
% str2double(get(hObject,'String')) returns contents of exh_vlv_stem_dia as a double
% --- Executes during object creation, after setting all properties.
function exh_vlv_stem_dia_CreateFcn(hObject, eventdata, handles)
% hObject handle to exh_vlv_stem_dia (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 exh_vlv_max_lift_Callback(hObject, eventdata, handles)
% hObject handle to exh_vlv_max_lift (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 exh_vlv_max_lift as text
% str2double(get(hObject,'String')) returns contents of exh_vlv_max_lift as a double
% --- Executes during object creation, after setting all properties.
function exh_vlv_max_lift_CreateFcn(hObject, eventdata, handles)
% hObject handle to exh_vlv_max_lift (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 intk_press_Callback(hObject, eventdata, handles)
% hObject handle to intk_press (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 intk_press as text
% str2double(get(hObject,'String')) returns contents of intk_press as a double
% --- Executes during object creation, after setting all properties.
function intk_press_CreateFcn(hObject, eventdata, handles)
% hObject handle to intk_press (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 exhst_press_Callback(hObject, eventdata, handles)
% hObject handle to exhst_press (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 exhst_press as text
% str2double(get(hObject,'String')) returns contents of exhst_press as a double
% --- Executes during object creation, after setting all properties.
function exhst_press_CreateFcn(hObject, eventdata, handles)
% hObject handle to exhst_press (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 inlet_temp_Callback(hObject, eventdata, handles)
% hObject handle to inlet_temp (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 inlet_temp as text
% str2double(get(hObject,'String')) returns contents of inlet_temp as a double
% --- Executes during object creation, after setting all properties.
function inlet_temp_CreateFcn(hObject, eventdata, handles)
% hObject handle to inlet_temp (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 bair_gas_const_Callback(hObject, eventdata, handles)
% hObject handle to bair_gas_const (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 bair_gas_const as text
% str2double(get(hObject,'String')) returns contents of bair_gas_const as a double
% --- Executes during object creation, after setting all properties.
function bair_gas_const_CreateFcn(hObject, eventdata, handles)
% hObject handle to bair_gas_const (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 bair_cp_Callback(hObject, eventdata, handles)
% hObject handle to bair_cp (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 bair_cp as text
% str2double(get(hObject,'String')) returns contents of bair_cp as a double
% --- Executes during object creation, after setting all properties.
function bair_cp_CreateFcn(hObject, eventdata, handles)
% hObject handle to bair_cp (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 bair_sp_ht_ratio_Callback(hObject, eventdata, handles)
% hObject handle to bair_sp_ht_ratio (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 bair_sp_ht_ratio as text
% str2double(get(hObject,'String')) returns contents of bair_sp_ht_ratio as a double
% --- Executes during object creation, after setting all properties.
function bair_sp_ht_ratio_CreateFcn(hObject, eventdata, handles)
% hObject handle to bair_sp_ht_ratio (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 bair_zero_deg_enth_Callback(hObject, eventdata, handles)
% hObject handle to bair_zero_deg_enth (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 bair_zero_deg_enth as text
% str2double(get(hObject,'String')) returns contents of bair_zero_deg_enth as a double
% --- Executes during object creation, after setting all properties.
function bair_zero_deg_enth_CreateFcn(hObject, eventdata, handles)
% hObject handle to bair_zero_deg_enth (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 ubair_gas_const_Callback(hObject, eventdata, handles)
% hObject handle to ubair_gas_const (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 ubair_gas_const as text
% str2double(get(hObject,'String')) returns contents of ubair_gas_const as a double
% --- Executes during object creation, after setting all properties.
function ubair_gas_const_CreateFcn(hObject, eventdata, handles)
% hObject handle to ubair_gas_const (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 ubair_cp_Callback(hObject, eventdata, handles)
% hObject handle to ubair_cp (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 ubair_cp as text
% str2double(get(hObject,'String')) returns contents of ubair_cp as a double
% --- Executes during object creation, after setting all properties.
function ubair_cp_CreateFcn(hObject, eventdata, handles)
% hObject handle to ubair_cp (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 ubair_sp_ht_ratio_Callback(hObject, eventdata, handles)
% hObject handle to ubair_sp_ht_ratio (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 ubair_sp_ht_ratio as text
% str2double(get(hObject,'String')) returns contents of ubair_sp_ht_ratio as a double
% --- Executes during object creation, after setting all properties.
function ubair_sp_ht_ratio_CreateFcn(hObject, eventdata, handles)
% hObject handle to ubair_sp_ht_ratio (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 ubair_zero_deg_enth_Callback(hObject, eventdata, handles)
% hObject handle to ubair_zero_deg_enth (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 ubair_zero_deg_enth as text
% str2double(get(hObject,'String')) returns contents of ubair_zero_deg_enth as a double
% --- Executes during object creation, after setting all properties.
function ubair_zero_deg_enth_CreateFcn(hObject, eventdata, handles)
% hObject handle to ubair_zero_deg_enth (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 inlt_vlv_open_Callback(hObject, eventdata, handles)
% hObject handle to inlt_vlv_open (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 inlt_vlv_open as text
% str2double(get(hObject,'String')) returns contents of inlt_vlv_open as a double
% --- Executes during object creation, after setting all properties.
function inlt_vlv_open_CreateFcn(hObject, eventdata, handles)
% hObject handle to inlt_vlv_open (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 inlt_vlv_clsd_Callback(hObject, eventdata, handles)
% hObject handle to inlt_vlv_clsd (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 inlt_vlv_clsd as text
% str2double(get(hObject,'String')) returns contents of inlt_vlv_clsd as a double
% --- Executes during object creation, after setting all properties.
function inlt_vlv_clsd_CreateFcn(hObject, eventdata, handles)
% hObject handle to inlt_vlv_clsd (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 inlt_vlv_port_dia_Callback(hObject, eventdata, handles)
% hObject handle to inlt_vlv_port_dia (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 inlt_vlv_port_dia as text
% str2double(get(hObject,'String')) returns contents of inlt_vlv_port_dia as a double
% --- Executes during object creation, after setting all properties.
function inlt_vlv_port_dia_CreateFcn(hObject, eventdata, handles)
% hObject handle to inlt_vlv_port_dia (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 inlt_vlv_stem_dia_Callback(hObject, eventdata, handles)
% hObject handle to inlt_vlv_stem_dia (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 inlt_vlv_stem_dia as text
% str2double(get(hObject,'String')) returns contents of inlt_vlv_stem_dia as a double
% --- Executes during object creation, after setting all properties.
function inlt_vlv_stem_dia_CreateFcn(hObject, eventdata, handles)
% hObject handle to inlt_vlv_stem_dia (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 inlt_vlv_max_lift_Callback(hObject, eventdata, handles)
% hObject handle to inlt_vlv_max_lift (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 inlt_vlv_max_lift as text
% str2double(get(hObject,'String')) returns contents of inlt_vlv_max_lift as a double
% --- Executes during object creation, after setting all properties.
function inlt_vlv_max_lift_CreateFcn(hObject, eventdata, handles)
% hObject handle to inlt_vlv_max_lift (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 cmp_ratio_Callback(hObject, eventdata, handles)
% hObject handle to cmp_ratio (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 cmp_ratio as text
% str2double(get(hObject,'String')) returns contents of cmp_ratio as a double
% --- Executes during object creation, after setting all properties.
function cmp_ratio_CreateFcn(hObject, eventdata, handles)
% hObject handle to cmp_ratio (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 cr_stroke_ratio_Callback(hObject, eventdata, handles)
% hObject handle to cr_stroke_ratio (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 cr_stroke_ratio as text
% str2double(get(hObject,'String')) returns contents of cr_stroke_ratio as a double
% --- Executes during object creation, after setting all properties.
function cr_stroke_ratio_CreateFcn(hObject, eventdata, handles)
% hObject handle to cr_stroke_ratio (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 max_cyl_vol_Callback(hObject, eventdata, handles)
% hObject handle to max_cyl_vol (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 max_cyl_vol as text
% str2double(get(hObject,'String')) returns contents of max_cyl_vol as a double
% --- Executes during object creation, after setting all properties.
function max_cyl_vol_CreateFcn(hObject, eventdata, handles)
% hObject handle to max_cyl_vol (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 ign_onset_Callback(hObject, eventdata, handles)
% hObject handle to ign_onset (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 ign_onset as text
% str2double(get(hObject,'String')) returns contents of ign_onset as a double
% --- Executes during object creation, after setting all properties.
function ign_onset_CreateFcn(hObject, eventdata, handles)
% hObject handle to ign_onset (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 brn_dur_Callback(hObject, eventdata, handles)
% hObject handle to brn_dur (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 brn_dur as text
% str2double(get(hObject,'String')) returns contents of brn_dur as a double
% --- Executes during object creation, after setting all properties.
function brn_dur_CreateFcn(hObject, eventdata, handles)
% hObject handle to brn_dur (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 eng_rpm_Callback(hObject, eventdata, handles)
% hObject handle to eng_rpm (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 eng_rpm as text
% str2double(get(hObject,'String')) returns contents of eng_rpm as a double
% --- Executes during object creation, after setting all properties.
function eng_rpm_CreateFcn(hObject, eventdata, handles)
% hObject handle to eng_rpm (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 shw_graph.
function shw_graph_Callback(hObject, eventdata, handles)
% hObject handle to shw_graph (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
show_pv_digram = get(handles.pv_diagram, 'Value');
show_temp_ca = get(handles.temp_crnk_angle, 'Value');
show_mass_theta = get(handles.cyl_mass_theta, 'Value');
show_work_vol = get(handles.wrk_vol, 'Value');
show_press_ca = get(handles.press_crnk_angle, 'Value');
%optimized_eng = get(handles.normal_sim, 'Value');
cratio_effect_on_eng = get(handles.cr_effect_sim, 'Value');
ign_onset_effect_on_eng = get(handles.ign_on_eff_sim, 'Value');
%Engine_Performace = get(handles.eng_perf, 'Value');
%if(Engine_Performace == 1)
if(show_pv_digram == 1)
figure (1)
hold on
if (cratio_effect_on_eng == 1)
pv_plot = plot(evalin('base','Volume(:,1)'),evalin('base','Pressure(:,1)'),'-b', ...
evalin('base','Volume(:,2)'),evalin('base','Pressure(:,2)'),'--r', ...
evalin('base','Volume(:,3)'),evalin('base','Pressure(:,3)'),':k', ...
evalin('base','Volume(:,4)'),evalin('base','Pressure(:,4)'),'-g', ...
evalin('base','Volume(:,5)'),evalin('base','Pressure(:,5)'),'--m' ...
);
legend('CR - 9 ','CR - 10','CR - 11','CR - 12','CR - 13',5);
elseif (ign_onset_effect_on_eng == 1)
pv_plot = plot(evalin('base','Volume(:,1)'),evalin('base','Pressure(:,1)'), ...
evalin('base','Volume(:,2)'),evalin('base','Pressure(:,2)'), ...
evalin('base','Volume(:,3)'),evalin('base','Pressure(:,3)'), ...
evalin('base','Volume(:,4)'),evalin('base','Pressure(:,4)'), ...
evalin('base','Volume(:,5)'),evalin('base','Pressure(:,5)'), ...
evalin('base','Volume(:,6)'),evalin('base','Pressure(:,6)'), ...
evalin('base','Volume(:,7)'),evalin('base','Pressure(:,7)') ...
);
legend('SA - 155.4','SA - 156.4','SA - 157.4','SA - 158.4','SA - 159.4', ...
'SA - 160.4','SA - 161.4',7);
else
pv_plot = plot(evalin('base','V'),evalin('base','P'));
end
title ('P-V Diagram');
ylabel ('Pressure(KPa)');
xlabel ('Volume[m^3]');
axis auto
grid on
hold off
end
%%%%%%%%%%%%%
if(show_temp_ca == 1)
figure (2)
hold on
if (cratio_effect_on_eng == 1)
tca_plot = plot(evalin('base','th'),evalin('base','Temprature(:,1)'),'-b', ...
evalin('base','th'),evalin('base','Temprature(:,2)'),'--r', ...
evalin('base','th'),evalin('base','Temprature(:,3)'),':k', ...
evalin('base','th'),evalin('base','Temprature(:,4)'),'-g', ...
evalin('base','th'),evalin('base','Temprature(:,5)'),'--m' ...
);
legend('CR - 9 ','CR - 10','CR - 11','CR - 12','CR - 13',5);
elseif (ign_onset_effect_on_eng == 1)
tca_plot = plot(evalin('base','th'),evalin('base','Temprature(:,1)'), ...
evalin('base','th'),evalin('base','Temprature(:,2)'), ...
evalin('base','th'),evalin('base','Temprature(:,3)'), ...
evalin('base','th'),evalin('base','Temprature(:,4)'), ...
evalin('base','th'),evalin('base','Temprature(:,5)'), ...
evalin('base','th'),evalin('base','Temprature(:,6)'), ...
evalin('base','th'),evalin('base','Temprature(:,7)') ...
);
legend('SA - 155.4','SA - 156.4','SA - 157.4','SA - 158.4','SA - 159.4', ...
'SA - 160.4','SA - 161.4',7);
else
tca_plot = plot(evalin('base','th'),evalin('base','T'));
end
title ('Temp - Crank Angle Variation');
ylabel ('Temperature(K)');
xlabel ('Crank Angle[rad]');
axis auto
grid on
hold off
end
%%%%%%%%%%%%%
if(show_mass_theta == 1)
figure (3)
hold on
if (cratio_effect_on_eng == 1)
mca_plot = plot(evalin('base','th'),evalin('base','MassFlow(:,1)'),'-b', ...
evalin('base','th'),evalin('base','MassFlow(:,2)'),'--r', ...
evalin('base','th'),evalin('base','MassFlow(:,3)'),':k', ...
evalin('base','th'),evalin('base','MassFlow(:,4)'),'-g', ...
evalin('base','th'),evalin('base','MassFlow(:,5)'),'--m' ...
);
legend('CR - 9 ','CR - 10','CR - 11','CR - 12','CR - 13',5);
elseif (ign_onset_effect_on_eng == 1)
mca_plot = plot(evalin('base','th'),evalin('base','MassFlow(:,1)'), ...
evalin('base','th'),evalin('base','MassFlow(:,2)'), ...
evalin('base','th'),evalin('base','MassFlow(:,3)'), ...
evalin('base','th'),evalin('base','MassFlow(:,4)'), ...
evalin('base','th'),evalin('base','MassFlow(:,5)'), ...
evalin('base','th'),evalin('base','MassFlow(:,6)'), ...
evalin('base','th'),evalin('base','MassFlow(:,7)') ...
);
legend('SA - 155.4','SA - 156.4','SA - 157.4','SA - 158.4','SA - 159.4', ...
'SA - 160.4','SA - 161.4',7);
else
mca_plot = plot(evalin('base','th'),evalin('base','MassFlow'));
end
title ('Crank Angle - Mass folw Variation');
ylabel ('Mass Flow(kg/s)');
xlabel ('Crank Angle[rad]');
axis auto
grid on
hold off
end
%%%%%%%%%%%%%
if(show_work_vol == 1)
figure (4)
hold on
if (cratio_effect_on_eng == 1)
wv_plot = plot(evalin('base','Volume(:,1)'),evalin('base','EngWork(:,1)'),'-b', ...
evalin('base','Volume(:,2)'),evalin('base','EngWork(:,2)'),'--r', ...
evalin('base','Volume(:,3)'),evalin('base','EngWork(:,3)'),':k', ...
evalin('base','Volume(:,4)'),evalin('base','EngWork(:,4)'),'-g', ...
evalin('base','Volume(:,5)'),evalin('base','EngWork(:,5)'),'--m' ...
);
legend('CR - 9 ','CR - 10','CR - 11','CR - 12','CR - 13',5);
elseif (ign_onset_effect_on_eng == 1)
wv_plot = plot(evalin('base','Volume(:,1)'),evalin('base','EngWork(:,1)'), ...
evalin('base','Volume(:,2)'),evalin('base','EngWork(:,2)'), ...
evalin('base','Volume(:,3)'),evalin('base','EngWork(:,3)'), ...
evalin('base','Volume(:,4)'),evalin('base','EngWork(:,4)'), ...
evalin('base','Volume(:,5)'),evalin('base','EngWork(:,5)'), ...
evalin('base','Volume(:,6)'),evalin('base','EngWork(:,6)'), ...
evalin('base','Volume(:,7)'),evalin('base','EngWork(:,7)') ...
);
legend('SA - 155.4','SA - 156.4','SA - 157.4','SA - 158.4','SA - 159.4', ...
'SA - 160.4','SA - 161.4',7);
else
wv_plot = plot(evalin('base','V'),evalin('base','W'));
end
title ('Work - Volume Variation');
ylabel ('Work(J)');
xlabel ('Volume[m^3]');
axis auto
grid on
hold off
end
if(show_press_ca == 1)
figure (5)
hold on
if (cratio_effect_on_eng == 1)
pca_plot = plot(evalin('base','th'),evalin('base','Pressure(:,1)'),'-b', ...
evalin('base','th'),evalin('base','Pressure(:,2)'),'--r', ...
evalin('base','th'),evalin('base','Pressure(:,3)'),':k', ...
evalin('base','th'),evalin('base','Pressure(:,4)'),'-g', ...
evalin('base','th'),evalin('base','Pressure(:,5)'),'--m' ...
);
legend('CR - 9 ','CR - 10','CR - 11','CR - 12','CR - 13',5);
elseif (ign_onset_effect_on_eng == 1)
pca_plot = plot(evalin('base','th'),evalin('base','Pressure(:,1)'), ...
evalin('base','th'),evalin('base','Pressure(:,2)'), ...
evalin('base','th'),evalin('base','Pressure(:,3)'), ...
evalin('base','th'),evalin('base','Pressure(:,4)'), ...
evalin('base','th'),evalin('base','Pressure(:,5)'), ...
evalin('base','th'),evalin('base','Pressure(:,6)'), ...
evalin('base','th'),evalin('base','Pressure(:,7)') ...
);
legend('SA - 155.4','SA - 156.4','SA - 157.4','SA - 158.4','SA - 159.4', ...
'SA - 160.4','SA - 161.4',7);
else
pca_plot = plot(evalin('base','th'),evalin('base','P'));
end
title ('Pressure - Crank Angle Variation');
ylabel ('Pressure(KPa)');
xlabel ('Crank Angle[rad]');
axis auto
grid on
hold off
end
%end
% --- Executes during object creation, after setting all properties.
function shw_graph_CreateFcn(hObject, eventdata, handles)
% hObject handle to shw_graph (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on button press in pv_diagram.
function pv_diagram_Callback(hObject, eventdata, handles)
% hObject handle to pv_diagram (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of pv_diagram
% --- Executes during object creation, after setting all properties.
function pv_diagram_CreateFcn(hObject, eventdata, handles)
% hObject handle to pv_diagram (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on button press in temp_crnk_angle.
function temp_crnk_angle_Callback(hObject, eventdata, handles)
% hObject handle to temp_crnk_angle (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of temp_crnk_angle
% --- Executes during object creation, after setting all properties.
function temp_crnk_angle_CreateFcn(hObject, eventdata, handles)
% hObject handle to temp_crnk_angle (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on button press in cyl_mass_theta.
function cyl_mass_theta_Callback(hObject, eventdata, handles)
% hObject handle to cyl_mass_theta (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of cyl_mass_theta
% --- Executes during object creation, after setting all properties.
function cyl_mass_theta_CreateFcn(hObject, eventdata, handles)
% hObject handle to cyl_mass_theta (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on button press in wrk_vol.
function wrk_vol_Callback(hObject, eventdata, handles)
% hObject handle to wrk_vol (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of wrk_vol
% --- Executes during object creation, after setting all properties.
function wrk_vol_CreateFcn(hObject, eventdata, handles)
% hObject handle to wrk_vol (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
function cyl_bore_Callback(hObject, eventdata, handles)
% hObject handle to cyl_bore (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 cyl_bore as text
% str2double(get(hObject,'String')) returns contents of cyl_bore as a double
% --- Executes during object creation, after setting all properties.
function cyl_bore_CreateFcn(hObject, eventdata, handles)
% hObject handle to cyl_bore (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 stroke_Callback(hObject, eventdata, handles)
% hObject handle to stroke (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 stroke as text
% str2double(get(hObject,'String')) returns contents of stroke as a double
% --- Executes during object creation, after setting all properties.
function stroke_CreateFcn(hObject, eventdata, handles)
% hObject handle to stroke (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 crod_length_Callback(hObject, eventdata, handles)
% hObject handle to crod_length (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 crod_length as text
% str2double(get(hObject,'String')) returns contents of crod_length as a double
% --- Executes during object creation, after setting all properties.
function crod_length_CreateFcn(hObject, eventdata, handles)
% hObject handle to crod_length (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 normal_sim.
function normal_sim_Callback(hObject, eventdata, handles)
% hObject handle to normal_sim (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of normal_sim
% --- Executes on button press in cr_effect_sim.
function cr_effect_sim_Callback(hObject, eventdata, handles)
% hObject handle to cr_effect_sim (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of cr_effect_sim
% --- Executes on button press in ign_on_eff_sim.
function ign_on_eff_sim_Callback(hObject, eventdata, handles)
% hObject handle to ign_on_eff_sim (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of ign_on_eff_sim
% --- Executes on button press in press_crnk_angle.
function press_crnk_angle_Callback(hObject, eventdata, handles)
% hObject handle to press_crnk_angle (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of press_crnk_angle
% --- Executes during object creation, after setting all properties.
function press_crnk_angle_CreateFcn(hObject, eventdata, handles)
% hObject handle to press_crnk_angle (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called