Professional Documents
Culture Documents
CHE 492 HW 7 Bader Alghamdi
CHE 492 HW 7 Bader Alghamdi
1. Objective:
This problem asks to develop an app useful for chemical engineers. MATLAB App Designer
is used to develop an app that helps in the study of a simple heat exchanger design and
provides the user with interactive cells for design inputs as well as data calculation and visual
representation of the design outputs throughout a graph. A statement showing the successful
or unsuccessful execution of the test run’s calculation.
2. Methods:
The app is designed in such a way that enables the user to input the overall heat transfer
coefficient “U”, the heat flow area “A”, and the log mean temperature difference “LMTD”.
An if statement is used to check whether the value of the input parameters are within
logical engineering range standards. If the values inserted into the input cells were within
acceptable range, pressing the Plot button would perform algorithmic calculations involved
in the design of the heat exchanger as follows:
Q
HEAT EXCHANGER AREA =
U∗LMTD
The heat exchanger area (y-axis) is then plotted vs the overall heat transfer Q (x-axis) using
the plot function and a statement representing the successful calculation is shown.
However, if these inputs were out of range, a Retry button and error statement would
appear by using the app.RetryButton.Visible='on' and
app.Error.Visible='on' statements respectively. After the Retry button is pushed its
visibility is set to 'off' as well as the error statement while the Plot button is turned back
'on'. The design view of the app can be seen in Figure 1 below. The full MATALAB script
of the app created to study a simple design of a heat exchanger can be found in Appendix A.
1
Figure 1. Design view of the app created to study a simple design of a heat exchanger
3. Results:
I ran the app through several trials and tested a variety of inputs that a chemical engineer
would provide. The app ran flawlessly where it provided the user with correct results when
the inputs were right and directed him to reconfigure his inputs if they were out of logical
range. I performed two test runs that can be seen in Figures 2 and 3 below; the first
representing a successful run and the second representing an unsuccessful one.
Figure 2 represents a successful run of the app where all the inputs are valid and have a positive
value. On the other hand, Figure 3 represent an unsuccessful run of the app where the heat flow
area has a negative value. The Retry button appears in this run as can be seen in Figure 3 above.
4. Discussion
The app delivered satisfactory results considering its preliminary design level. However, further
development can be made to this app by introducing several heat exchanger design parameters
such as pressure drops and heat exchanger type. Such design would require further inputs and
more complex coding but would provide the user with more reliable results saving time and effort
and contributing to the development and advancement of the chemical industry and technology.
3
New Question:
Create an application to help user in the configuration of a rigorous chemical reactor design.
4
Appendix A
A.1: Full script of the app used to study a simple design of a heat
exchanger.
A.1: Full script of the app used to study a simple design of a heat exchanger:
classdef heatexchanger < matlab.apps.AppBase
end
app.RetryButton.Visible='off';
app.Error.Visible='off';
app.PlotButton.Enable='on';
end
% Component initialization
methods (Access = private)
% Create GridLayout
app.GridLayout = uigridlayout(app.UIFigure);
app.GridLayout.ColumnWidth = {1014, '1x'};
app.GridLayout.RowHeight = {'1x'};
app.GridLayout.ColumnSpacing = 0;
app.GridLayout.RowSpacing = 0;
app.GridLayout.Padding = [0 0 0 0];
3A
app.GridLayout.Scrollable = 'on';
% Create LeftPanel
app.LeftPanel = uipanel(app.GridLayout);
app.LeftPanel.Layout.Row = 1;
app.LeftPanel.Layout.Column = 1;
% Create PlotButton
app.PlotButton = uibutton(app.LeftPanel, 'push');
app.PlotButton.ButtonPushedFcn = createCallbackFcn(app, @PlotButtonPushed, true);
app.PlotButton.Position = [292 180 100 22];
app.PlotButton.Text = 'Plot';
% Create HeatFlowAreaAEditFieldLabel
app.HeatFlowAreaAEditFieldLabel = uilabel(app.LeftPanel);
app.HeatFlowAreaAEditFieldLabel.HorizontalAlignment = 'right';
app.HeatFlowAreaAEditFieldLabel.Position = [167 296 110 22];
app.HeatFlowAreaAEditFieldLabel.Text = 'Heat Flow Area = A';
% Create HeatFlowAreaAEditField
app.HeatFlowAreaAEditField = uieditfield(app.LeftPanel, 'numeric');
app.HeatFlowAreaAEditField.ValueChangedFcn = createCallbackFcn(app,
@HeatFlowAreaAEditFieldValueChanged, true);
app.HeatFlowAreaAEditField.Position = [292 296 100 22];
% Create OverallheattransferUEditFieldLabel
app.OverallheattransferUEditFieldLabel = uilabel(app.LeftPanel);
app.OverallheattransferUEditFieldLabel.HorizontalAlignment = 'right';
app.OverallheattransferUEditFieldLabel.Position = [144 352 133 22];
app.OverallheattransferUEditFieldLabel.Text = 'Overall heat transfer =U';
% Create OverallheattransferUEditField
app.OverallheattransferUEditField = uieditfield(app.LeftPanel, 'numeric');
app.OverallheattransferUEditField.ValueChangedFcn = createCallbackFcn(app,
@OverallheattransferUEditFieldValueChanged, true);
app.OverallheattransferUEditField.Position = [292 352 100 22];
% Create LMTDEditFieldLabel
app.LMTDEditFieldLabel = uilabel(app.LeftPanel);
app.LMTDEditFieldLabel.HorizontalAlignment = 'right';
app.LMTDEditFieldLabel.Position = [239 235 38 22];
app.LMTDEditFieldLabel.Text = 'LMTD';
4A
% Create LMTDEditField
app.LMTDEditField = uieditfield(app.LeftPanel, 'numeric');
app.LMTDEditField.Position = [292 235 100 22];
% Create UIAxes
app.UIAxes = uiaxes(app.LeftPanel);
title(app.UIAxes, 'Graph')
xlabel(app.UIAxes, 'X')
ylabel(app.UIAxes, 'Y')
app.UIAxes.Position = [545 89 403 350];
% Create labelLabel
app.labelLabel = uilabel(app.LeftPanel);
app.labelLabel.Position = [545 16 279 41];
app.labelLabel.Text = 'label';
% Create HEATEXCHANGERCALCULATIONLabel
app.HEATEXCHANGERCALCULATIONLabel = uilabel(app.LeftPanel);
app.HEATEXCHANGERCALCULATIONLabel.HorizontalAlignment = 'center';
app.HEATEXCHANGERCALCULATIONLabel.FontName = 'Baskerville Old Face';
app.HEATEXCHANGERCALCULATIONLabel.FontSize = 30;
app.HEATEXCHANGERCALCULATIONLabel.FontWeight = 'bold';
app.HEATEXCHANGERCALCULATIONLabel.FontColor = [1 0 0];
app.HEATEXCHANGERCALCULATIONLabel.Position = [104 508 720 37];
app.HEATEXCHANGERCALCULATIONLabel.Text = 'HEAT EXCHANGER
CALCULATION';
% Create Error
app.Error = uilabel(app.LeftPanel);
app.Error.Position = [167 102 203 22];
app.Error.Text = 'The value you input are inacceptable';
% Create RetryButton
app.RetryButton = uibutton(app.LeftPanel, 'push');
app.RetryButton.ButtonPushedFcn = createCallbackFcn(app,
@RetryButtonPushed, true);
app.RetryButton.Position = [208 68 100 22];
app.RetryButton.Text = 'Retry';
% Create RightPanel
app.RightPanel = uipanel(app.GridLayout);
app.RightPanel.Layout.Row = 1;
app.RightPanel.Layout.Column = 2;
5A
% Construct app
function app = heatexchanger
if nargout == 0
clear app
end
end