Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Translate this MATLAB code to Excel VBA if app.DieselButton.Value = = true if string ( app . ThrottleTypeSwitch.Value ) = = WOT if string
Translate this MATLAB code to Excel VBAÂ
 if app.DieselButton.Value true
if stringappThrottleTypeSwitch.Value "WOT"
if stringappStrokeSwitch.Value
if app.NaturallyAspiratedButton.Value true
DIESEL WOTHROTTLE STROKE NATURALLYASPIRATED
nst;
Vdenvolnoc; displacement volume in m
Vc Vdrc; clearence volume in m
SVdbtspi; stroke length in m
BbtsS; bore length in m
V Vd Vc; v in m
V Vc; v in m
P Prck; p in kPa
T Trck; t in K
mPVRT; m in kg
maafafexrm; mass of air in kg
mfafexrm; mass of fuel in kg
mexexrm; mass of exhaust in kg
TmfhvncmcvT; t in K
PP; p in kPa
VVTT;
VV;
TTVVk; t in K
PPVVk; p in kPa
TlinspaceTT;
TlinspaceTT;
AppiB;
p;
VlinspaceVV;
VlinspaceVV;
PPVVk;
PPVVk;
Qinmfhvnc;
QoutmcvTT;
WmRTTk;
WmRTTk;
WnetWW;
ntTT;
imepWnetVV;
WdotiWnetrpmnstnoc;
UpavgSrpm;
WdotbnmWdoti;
WiWdotinstrpm;
WbWinm;
WfWiWb;
WdotfWdotiWdotb;
bmepnmimep;
Torquebmepenvolnstpi;
BSPWdotbApnoc;
OPDWdotbenvolnoc;
bsfcmfrpmWdotbnoc;
nvmapVd;
VV;
VV;
WPVV;
WPVV;
TT T T T T;
PP P P P P;
VV V V V V V V V;
TTT T;
VV V;
PP P;
TTT T;
VV V;
PP P;
Bore B;
Stroke S;
a Stroke ;
r conrod ;
r ra;
figure
semilogyV VP PcVPbVPrVPgVPy
ylim
xlabelVolume m
ylabelPressure Pa
tethaalinspace;
figure
plottethaaP
titleCrank angle vs pressure'
xlabelCrank Angle'
ylabelpressure
tethablinspace;
figure
plottethabV
titleCrank angle vs Volume'
xlabelCrank Angle'
ylabelVolume
Uones;
Hones;
tetha::;
for tetha::
pistonspeed pisindtethacosdtethasqrtrsindtethaUpavg;
pistonposition acosdtetha sqrtrasindtetha;
Utetha pistonspeed;
Htetha pistonposition;
end
figure
plottethaU
titleCrank angle vs Piston speed'
xlabelCrank Angle'
ylabelPiston speed'
figure
plottethaH
titleCrank angle vs Piston Position'
xlabelCrank Angle'
ylabelPiston Position'
app.OutputValuesTextArea.Valuesprintf Tf K
Tf K
Tf K
Tf K
Pf kPa
Pf kPa
Pf kPa
Pf kPa
Vf m
Vf m
Vf m
V
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Here is the equivalent Excel VBA code vba Sub CalculateEnginePerformance Dim app As Object Set app CreateObjectappapplication If appDieselButtonValue True Then If appThrottleTypeSwitchValue WOT Then I...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started