Home > m > gui > gltpda > progressBar.m

progressBar

PURPOSE ^

Progress bar for the LTPDA GUI.

SYNOPSIS ^

function progressBar(varargin)

DESCRIPTION ^

 Progress bar for the LTPDA GUI.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 This function is called whenever the user starts an analysis by clicking
 on the 'Start' button in the LTPDA GUI.
 It calculates how many blocks in the current Simulink model are
 M-S-function blocks calling 'ltpdasim.m', ie. how many LTPDA analysis
 blocks are present.
 This excludes all 'service' blocks which do not perform any real
 calculation, such as the input 'Object from list' block or the output
 'Send to output' block: the execution of these blocks is almost immediate
 and there would be non sense in considering them for the sake of the
 'progress bar'.

 Actually, the progress bar do NOT provide an estimate of the remaining
 time, since this would be impossible to achieve (the time required by
 every function/block is different and depending on its relative input,
 so there's no way to estimate it). It only shows how many blocks there
 are, how many have already been executed and how many to go.
 Its primary purpose thus is provide the user with a perception of how the
 analysis is going, and in case which block requires too much time to be
 executed.

 $Id: progressBar.m,v 1.3 2008/03/25 16:21:00 nicola Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function progressBar(varargin)
0002 % Progress bar for the LTPDA GUI.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % This function is called whenever the user starts an analysis by clicking
0007 % on the 'Start' button in the LTPDA GUI.
0008 % It calculates how many blocks in the current Simulink model are
0009 % M-S-function blocks calling 'ltpdasim.m', ie. how many LTPDA analysis
0010 % blocks are present.
0011 % This excludes all 'service' blocks which do not perform any real
0012 % calculation, such as the input 'Object from list' block or the output
0013 % 'Send to output' block: the execution of these blocks is almost immediate
0014 % and there would be non sense in considering them for the sake of the
0015 % 'progress bar'.
0016 %
0017 % Actually, the progress bar do NOT provide an estimate of the remaining
0018 % time, since this would be impossible to achieve (the time required by
0019 % every function/block is different and depending on its relative input,
0020 % so there's no way to estimate it). It only shows how many blocks there
0021 % are, how many have already been executed and how many to go.
0022 % Its primary purpose thus is provide the user with a perception of how the
0023 % analysis is going, and in case which block requires too much time to be
0024 % executed.
0025 %
0026 % $Id: progressBar.m,v 1.3 2008/03/25 16:21:00 nicola Exp $
0027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0028 
0029   close(findobj('Name','LTPDA Progress Bar'));
0030 
0031 
0032   funcBlocks = find_in_models(bdroot,'LookUnderMasks','all','FunctionName','ltpdasim');
0033      
0034   screenSize = get(0,'ScreenSize');
0035   backColor   = [0.98 , 0.98 , 0.98];
0036   
0037   position   = [(screenSize(3)-400)/2,(screenSize(4)-200)/2,400,180];
0038 progressWind = figure('Position',position,'Name','LTPDA Progress Bar','Resize','off','NumberTitle','off','Toolbar','none','Menubar','none');
0039 
0040   barBackSize      = [position(3)-20,14];
0041   barBackDimension = [(position(3)-barBackSize(1))/2 , (position(4)-barBackSize(2))/2-25 , barBackSize];
0042 progressBack  = axes('Parent',progressWind,'Units','pixels','Position',barBackDimension);
0043   image(imread('progressbarg.jpg'),'Parent',progressBack);
0044   axis off;
0045   barSize      = [1,14];
0046   barDimension = [(position(3)-barBackSize(1))/2 , (position(4)-barBackSize(2))/2-25 , barSize];
0047 progressBar   = axes('Parent',progressWind,'Units','pixels','Position',barDimension);
0048   image(imread('progressbar.jpg'),'Parent',progressBar);
0049   set(progressBar,'Tag','progressaxes')
0050   set(progressBar,'UserData',barBackDimension)
0051   axis off;
0052   
0053 % Total number of blocks
0054 uicontrol('Parent',progressWind,'BackgroundColor',backColor,'HorizontalAlignment','center','Position',[0 position(4)-40 position(3) 20],'String',['Total number of blocks to compute: ',num2str(numel(funcBlocks))],'FontName','Arial','FontSize',9,'FontWeight','normal','Visible','on','Tag','blockstotal','UserData',numel(funcBlocks),'Style','text');
0055 
0056 % Currently executed block
0057 uicontrol('Parent',progressWind,'BackgroundColor',backColor,'HorizontalAlignment','center','Position',[0 position(4)-70 position(3) 20],'String','','FontName','Arial','FontSize',9,'FontWeight','bold','Visible','on','Tag','currentexec','Style','text');
0058 
0059 % Blocks done
0060 uicontrol('Parent',progressWind,'BackgroundColor',backColor,'HorizontalAlignment','left','Position',[10 (position(4)-barBackSize(2))/2-5 60 14],'String','Done: 0','FontName','Arial','FontSize',8,'FontWeight','normal','Visible','on','Tag','done','UserData',0,'Style','text');
0061 
0062 % Blocks to go
0063 uicontrol('Parent',progressWind,'BackgroundColor',backColor,'HorizontalAlignment','right','Position',[position(3)-60-10 (position(4)-barBackSize(2))/2-5 60 14],'String',['To go: ',num2str(numel(funcBlocks))],'FontName','Arial','FontSize',8,'FontWeight','normal','Visible','on','Tag','togo','UserData',numel(funcBlocks),'Style','text');
0064 
0065 % Press X to stop
0066 uicontrol('Parent',progressWind,'BackgroundColor',backColor,'HorizontalAlignment','center','Position',[0 20 position(3) 20],'String','Press X to stop the analysis','FontName','Arial','FontSize',9,'FontWeight','normal','Visible','on','Style','text');
0067 
0068 end

Generated on Mon 31-Mar-2008 13:54:54 by m2html © 2003