Skip to content

Commit

Permalink
improved user feedback in GUI when fitting fails due to incomplete data
Browse files Browse the repository at this point in the history
  • Loading branch information
teasit committed Oct 9, 2022
1 parent 148e633 commit 4756c7b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
44 changes: 33 additions & 11 deletions src/MagicFormulaTyreTool.m
Original file line number Diff line number Diff line change
Expand Up @@ -418,12 +418,12 @@ function onStartFittingRequested(app, ~, ~)

fig = app.UIFigure;
title = 'Tyre Model Fitter';
message = sprintf(['To start fitting, the following conditions ' ...
msg = sprintf(['To start fitting, the following conditions ' ...
'must be met:' newline() ...
'\t- Tyre model loaded' newline() ...
'\t- Tyre data loaded' newline() ...
'\t- Fit modes selected (Fx0, Fy0, Fx, ...)']);
showUserFail = @(x) uialert(fig, message, title, 'Icon', 'error');
showUserFail = @(x) uialert(fig, msg, title, 'Icon', 'error');

tyreModel = app.TyreModel;
if isempty(tyreModel)
Expand All @@ -446,10 +446,10 @@ function onStartFittingRequested(app, ~, ~)
fitter.Measurements = measurements;
fitter.FitModes = fitmodes;

message = 'Starting Fitter...';
msg = 'Starting Fitter...';
dlg = uiprogressdlg(fig, ...
'Title', title, ...
'Message', message, ...
'Message', msg, ...
'Indeterminate','on', ...
'Cancelable', 'on');

Expand All @@ -472,28 +472,50 @@ function onStartFittingRequested(app, ~, ~)
close(dlg)

if cancelByUser
message = 'Fitting process aborted by user.';
msg = 'Fitting process aborted by user.';
icon = 'info';
else
message = 'Fitting process successful.';
msg = 'Fitting process successful.';
icon = 'success';
end
message = [message newline() ...
msg = [msg newline() ...
'Parameters of last iteration written to table.' ...
newline() newline() ...
'Details printed to logfile/console.'];
uialert(fig, message, title, 'icon', icon)
uialert(fig, msg, title, 'icon', icon)
catch ME
paramsFitted = magicformula.v62.Parameters.empty;
e = events.TyreModelFitterFinished(paramsFitted);
notify(app.TyreModelPanel, 'TyreModelFitterFinished', e)

close(dlg)

message = ['Fitting process FAILED!' newline()...
'Details printed to logfile/console.'];
uialert(fig, message, title, 'icon', 'error')
cause = ME.cause;
if iscell(cause)
cause = cause{1};
end

msg = ['Fitting process FAILED!' newline() newline()];
switch class(cause)
case 'exceptions.NoMeasurementForFitMode'
fitmode = cause.FitMode;
msg = [msg 'Cause:' newline() ...
'Loaded measurements do not contain ' ...
'data for selected fitmode ''%s''. ' ...
newline() newline() ...
'Troubleshooting:' newline() ...
'Note that to fit ''Fx0'' ' ...
'you require data that includes slip ratio ' ...
'sweeps. Fitting ''Fx'' also requires slip ' ...
'angle to be present during those sweeps. ' ...
'Similarly, fitting ''Fy0'' requires slip ' ...
'angle sweeps and ''Fy'' also requires ' ...
'those sweeps at interval-fixed slip ratios.'];
msg = sprintf(msg, fitmode);
otherwise
msg = [msg 'Details printed to logfile/console.'];
end
uialert(fig, msg, title, 'icon', 'error')
rethrow(ME)
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/magic-formula-tyre-library
Submodule magic-formula-tyre-library updated 36 files
+64 −0 +tests/TydexImportExport.m
+1 −1 CHANGELOG.md
+3 −1 README.md
+5 −4 ToolboxPackager.prj
+ doc/examples/Example_TYDEX_FSAETTC.mlx
+ doc/images/fit_example.png
+ doc/images/magic_formula_library_socialpreview.png
+ doc/images/toolboximage.png
+2 −0 resources/project/EEtUlUb-dLAdf0KpMVivaUlztwA/sI0y8sSxq-6eX4Vf8iAHf7_8sg0d.xml
+2 −0 resources/project/EEtUlUb-dLAdf0KpMVivaUlztwA/sI0y8sSxq-6eX4Vf8iAHf7_8sg0p.xml
+6 −0 resources/project/K8n7x319OeTFz8Nn-G7frbbV3Cc/-OfkMA-R4LRenWCI7-5pK5tIdYMd.xml
+2 −0 resources/project/K8n7x319OeTFz8Nn-G7frbbV3Cc/-OfkMA-R4LRenWCI7-5pK5tIdYMp.xml
+6 −0 resources/project/LwDCyDiaEj0e2eEVUCvZwzv_yO0/EhJtJg6kX48QxCSj0Bft4cIkG4od.xml
+2 −0 resources/project/LwDCyDiaEj0e2eEVUCvZwzv_yO0/EhJtJg6kX48QxCSj0Bft4cIkG4op.xml
+6 −0 resources/project/LwDCyDiaEj0e2eEVUCvZwzv_yO0/bsRCbBvn1zj916J1p1VAG8t71c4d.xml
+2 −0 resources/project/LwDCyDiaEj0e2eEVUCvZwzv_yO0/bsRCbBvn1zj916J1p1VAG8t71c4p.xml
+6 −0 resources/project/LwDCyDiaEj0e2eEVUCvZwzv_yO0/q-Kjva0LtnQQMY7xNCJfKkuc26cd.xml
+2 −0 resources/project/LwDCyDiaEj0e2eEVUCvZwzv_yO0/q-Kjva0LtnQQMY7xNCJfKkuc26cp.xml
+6 −0 resources/project/LwDCyDiaEj0e2eEVUCvZwzv_yO0/si522hVLVZAOCmVtdqaYuHVadY4d.xml
+2 −0 resources/project/LwDCyDiaEj0e2eEVUCvZwzv_yO0/si522hVLVZAOCmVtdqaYuHVadY4p.xml
+0 −2 resources/project/VWPAcV6YDIkJABXWADY_FI8Bds0/-q5xJOstBe8BbtOhucMe2sBupccp.xml
+0 −0 resources/project/VWPAcV6YDIkJABXWADY_FI8Bds0/Un_XKE6WxhmgShZNEckvAdIFkpkd.xml
+2 −0 resources/project/VWPAcV6YDIkJABXWADY_FI8Bds0/Un_XKE6WxhmgShZNEckvAdIFkpkp.xml
+0 −2 resources/project/VWPAcV6YDIkJABXWADY_FI8Bds0/YoofOxyiuzHwImN-BeGCagh552Yp.xml
+0 −0 resources/project/VWPAcV6YDIkJABXWADY_FI8Bds0/naIANTFxayTifiNSBaKzN6Ehd90d.xml
+2 −0 resources/project/VWPAcV6YDIkJABXWADY_FI8Bds0/naIANTFxayTifiNSBaKzN6Ehd90p.xml
+2 −0 resources/project/q138eJA8Ym4eSfM3RFMVvg63QtU/ulE9PYd_TlaqYfhxJlcxk9uZKPwd.xml
+2 −0 resources/project/q138eJA8Ym4eSfM3RFMVvg63QtU/ulE9PYd_TlaqYfhxJlcxk9uZKPwp.xml
+2 −0 resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/q138eJA8Ym4eSfM3RFMVvg63QtUd.xml
+2 −0 resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/q138eJA8Ym4eSfM3RFMVvg63QtUp.xml
+4 −0 src/+exceptions/NoMeasurementForFitMode.m
+13 −0 src/+tydex/FileInterface.m
+209 −0 src/+tydex/FileReader.m
+194 −0 src/+tydex/FileWriter.m
+7 −196 src/+tydex/Measurement.m
+23 −0 src/+tydex/ModelParameter.m

0 comments on commit 4756c7b

Please sign in to comment.