function ui

global hF
global hTextField1 hTextField2 hTextField3 hTextField4 hTextField5 hTextField6 hTextField7
global hEditableLabel1 hEditableLabel2 hEditableLabel3 hEditableLabel4 hEditableLabel5 hEditableLabel6 hEditableLabel7 hEditableLabel8 hEditableLabel9 hEditableLabel10
global array_system_rn array_line_rn array_csu array_time L_array M_array n


% создаем графическое окно 
hF = figure('Name', 'Система Массового Обслуживания', 'NumberTitle', 'off',...
    'MenuBar', 'none', 'Units', 'characters');
set(hF, 'Position', [50 10 100 50]); 


%[A,cmp] = imread('1test_fig5.bmp');
%colormap(cmp);
%image(A);

uicontrol( hF, 'Style','text', ...
                         'Units','normalized', ...
                         'Position',[0.0 0.95 0.25 0.04], ...
                         'String','Входные параметры:');
                     
%device count (VS & VA)
hLabel1=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.0 0.90 0.25 0.03], ...
                      'String','Количество устройств',...
                      'HorizontalAlignment','left');
                  
hTextField1=uicontrol( hF,'Style','edit', ...
                     'HorizontalAlignment','left', ...
                     'Units','normalized', ...
                     'Position',[0.30 0.90 0.1 0.03], ...
                     'String','1',...
                     'Enable','on',...
                     'Callback','but');  
%a avg (VS & VA)                
hLabel2=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.0 0.85 0.40 0.03], ...
                      'String','Среднее время поступления',...
                      'HorizontalAlignment','left');
                  
hTextField2=uicontrol( hF,'Style','edit', ...
                     'HorizontalAlignment','left', ...
                     'Units','normalized', ...
                     'Position',[0.30 0.85 0.1 0.03], ...
                     'String','10',...
                     'Enable','on',...
                     'Callback','but');  
%s avg (VS & VA)                
hLabel3=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.0 0.80 0.40 0.03], ...
                      'String','Среднее время обработки',...
                      'HorizontalAlignment','left');
                  
hTextField3=uicontrol( hF,'Style','edit', ...
                     'HorizontalAlignment','left', ...
                     'Units','normalized', ...
                     'Position',[0.30 0.80 0.1 0.03], ...
                     'String','50',...
                     'Enable','on',...
                     'Callback','but');  
%Gen A (VS & VA)                
hLabel4=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.0 0.75 0.40 0.03], ...
                      'String','A Gen',...
                      'HorizontalAlignment','left');
                  
hTextField4=uicontrol( hF,'Style','edit', ...
                     'HorizontalAlignment','left', ...
                     'Units','normalized', ...
                     'Position',[0.30 0.75 0.1 0.03], ...
                     'String','120',...
                     'Enable','on',...
                     'Callback','but');  
%Gen S (VS & VA)                
hLabel5=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.0 0.70 0.40 0.03], ...
                      'String','S Gen',...
                      'HorizontalAlignment','left');
                  
hTextField5=uicontrol( hF,'Style','edit', ...
                     'HorizontalAlignment','left', ...
                     'Units','normalized', ...
                     'Position',[0.30 0.70 0.1 0.03], ...
                     'String','250',...
                     'Enable','on',...
                     'Callback','but');                   
%Count runs (VS & VA)               
hLabel6=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.0 0.65 0.40 0.03], ...
                      'String','Количество циклов',...
                      'HorizontalAlignment','left');
                  
hTextField6=uicontrol( hF,'Style','edit', ...
                     'HorizontalAlignment','left', ...
                     'Units','normalized', ...
                     'Position',[0.30 0.65 0.1 0.03], ...
                     'String','100',...
                     'Enable','on',...
                     'Callback','but');  
                 
%Queue length  (VS & VA)             
hLabel7=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.0 0.60 0.40 0.03], ...
                      'String','Емкость носителя',...
                      'HorizontalAlignment','left');
                  
hTextField7=uicontrol( hF,'Style','edit', ...
                     'HorizontalAlignment','left', ...
                     'Units','normalized', ...
                     'Position',[0.30 0.60 0.1 0.03], ...
                     'String','12',...
                     'Enable','on',...
                     'Callback','but');

%rel Intensity (VS & VA)
hLabel15=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.0 0.45 0.30 0.05], ...
                      'String','Оносительная пропускная способность',...
                      'HorizontalAlignment','left');

hEditableLabel8=uicontrol( hF,'Style','text', ...
                     'Units','normalized', ...
                     'Position',[0.4 0.45 0.15 0.03], ...
                     'String','',...
                     'HorizontalAlignment','left');             
                 
%abs Intenstiy (VS & VA)
hLabel16=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.0 0.4 0.30 0.05], ...
                      'String','Абсолютная пропускная способность',...
                      'HorizontalAlignment','left');

hEditableLabel9=uicontrol( hF,'Style','text', ...
                     'Units','normalized', ...
                     'Position',[0.4 0.40 0.15 0.03], ...
                     'String','',...
                     'HorizontalAlignment','left');     
            
                 
                 
%MIDDLE COLUMN (VS & VA)

uicontrol( hF, 'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.5 0.95 0.26 0.04], ...
                      'String','Процесс:');
                     
%left (VS & VA)
hLabel8=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.5 0.90 0.30 0.03], ...
                      'String','Осталось циклов',...
                      'HorizontalAlignment','left');
                  
hEditableLabel1=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.75 0.90 0.06 0.03], ...
                      'String','',...
                      'HorizontalAlignment','left'); 	

%reject (VS & VA)
hLabel9=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.5 0.85 0.20 0.03], ...
                      'String','Отказы',...
                      'HorizontalAlignment','left');

hEditableLabel2=uicontrol( hF,'Style','text', ...
                     'Units','normalized', ...
                     'Position',[0.75 0.85 0.06 0.03], ...
                     'String','',...
                     'HorizontalAlignment','left'); 
                 
%reject % (VS & VA)
hLabel17=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.5 0.80 0.20 0.03], ...
                      'String','Отказы %',...
                      'HorizontalAlignment','left');

hEditableLabel10=uicontrol( hF,'Style','text', ...
                     'Units','normalized', ...
                     'Position',[0.75 0.80 0.06 0.03], ...
                     'String','',...
                     'HorizontalAlignment','left');    
                 
%usage koeff (VS & VA)
hLabel10=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.5 0.75 0.25 0.03], ...
                      'String','Коэф. Использования',...
                      'HorizontalAlignment','left');

hEditableLabel3=uicontrol( hF,'Style','text', ...
                     'Units','normalized', ...
                     'Position',[0.75 0.75 0.15 0.03], ...
                     'String','',...
                     'HorizontalAlignment','left');  
%avg delay in queue (VS & VA)
hLabel11=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.5 0.70 0.25 0.03], ...
                      'String','Ср. задержка в очереди',...
                      'HorizontalAlignment','left');

hEditableLabel4=uicontrol( hF,'Style','text', ...
                     'Units','normalized', ...
                     'Position',[0.75 0.70 0.15 0.03], ...
                     'String','',...
                     'HorizontalAlignment','left');  
 %avg expect (VS & VA)
hLabel12=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.5 0.65 0.25 0.03], ...
                      'String','Ср. время ожидания',...
                      'HorizontalAlignment','left');

hEditableLabel5=uicontrol( hF,'Style','text', ...
                     'Units','normalized', ...
                     'Position',[0.75 0.65 0.15 0.03], ...
                     'String','',...
                     'HorizontalAlignment','left');  
%avg requsts in queue (VS & VA)
hLabel13=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.5 0.6 0.3 0.04], ...
                      'String','Ср. число требований в системе',...
                      'HorizontalAlignment','left');

hEditableLabel6=uicontrol( hF,'Style','text', ...
                     'Units','normalized', ...
                     'Position',[0.75 0.60 0.15 0.03], ...
                     'String','',...
                     'HorizontalAlignment','left');  
 
%avg requsts in system (VS & VA)
hLabel14=uicontrol( hF,'Style','text', ...
                      'Units','normalized', ...
                      'Position',[0.5 0.53 0.3 0.05], ...
                      'String','Ср. число требований в очереди ',...
                      'HorizontalAlignment','left');

hEditableLabel7=uicontrol( hF,'Style','text', ...
                     'Units','normalized', ...
                     'Position',[0.75 0.55 0.15 0.03], ...
                     'String','',...
                     'HorizontalAlignment','left'); 
                 
                 
hBtnPlot1 = uicontrol('Style', 'pushbutton', 'Units', 'normalized',...
    'Position', [0.05 0.25 0.4 0.1],...
    'String', 'Старт', 'Callback', {@BtnPlotCallback});

%hBtnResult1 = uicontrol('Style', 'pushbutton', 'Units', 'normalized',...
 %   'Position', [0.50 0.10 0.4 0.1],...
  %  'String', 'Показать Результаты', 'Callback', {@BtnResPlotCallback});

function BtnPlotCallback(src, evt, h)
    mainrun(0);
%function BtnResPlotCallback(src, evt, h)
 %   results(array_system_rn, array_line_rn, array_csu, array_time, L_array, M_array, n);
