function [output] = smo(devices, avg_request_time, avg_processing_time, e_request, e_processing, quant, c)
 	
	% кол-во устройств
	% devices
	
	% среднее время поступления заявки
	% avg_request_time 
	
	% среднее время обработки заявки
	% avg_processing_time
	
	% Генераторы
	% e_request 
	% e_processing 
	
	% Квант времени
	% quant
	
	% Количество экспреиментов
	% с
	
	for l=1:1:c
	
	% количество измерений
	n = 1000;
	
	counter = 0;
		
	% начальное время поступления заявки
	request_time = rp_gen(e_request, avg_request_time);
	
	for i=1:1:devices
		device(i) = 0;
		device_processig_request(i) = 0;
		device_processing_time(i) = 0;
		device_bwt(i) = 0;
		device_twt(i) = 0;
	end;
	
	for i=1:1:n
		request_processing_time(i) = 0;
		
		array_system_rn(i) = 0;
		array_line_rn(i) = 0;
		array_time(i) = 0;
	end;
	
	line = 0;
	
	line_trn = 0;
	
	delay = 0;
	
	time = 0;
	
	k = 1;
	
	pt_sum = 0;
	
	while k ~= n	
	
	% ОПРЕДЕЛЕНИЕ СВОБОДНЫХ УСТРОЙСТВ И ПОМЕЩЕНИЕ ЗАЯВКИ НА ОБРАБОТКУ
	flag = 0;
	for i=1:1:devices
		if (device(i) == 0) 
			if ((line == 0) && (request_time == time) && flag == 0)
				device(i) = 1;
				device_bwt(i) = time;
				
				e_processing = initial_v_gen(e_processing);
				new_processing_time = rp_gen(e_processing, avg_processing_time);
				
				pt_sum = pt_sum + new_processing_time;
							
				request_processing_time(k) = new_processing_time;
				device_processig_request(i) = k;
							
				if (new_processing_time <= quant)
					device_processing_time(i) = time + new_processing_time;
				else
					device_processing_time(i) = time + quant;
				end;
				
				device_twt(i) = device_twt(i) + device_processing_time(i) - time;
				
				flag = 1;
			end;
		end;
	end;
	for i=1:1:devices
		if (device(i) == 0)
			if (line ~= 0)
				device(i) = 1;
				device_bwt(i) = time;
				
				new_processing_time = line_rpt(1);
				device_processig_request(i) = line_rn(1);
				request_processing_time(line_rn(1)) = line_rpt(1);
				
				if (new_processing_time <= quant)
					device_processing_time(i) = time + new_processing_time;
				else
					device_processing_time(i) = time + quant;
				end;
				
				device_twt(i) = device_twt(i) + device_processing_time(i) - time;
				
				line_trn = line_trn + 1;
				line_tlt(line_trn) = time - line_rjt(1);
				
				for i=1:1:line-1
					line_rn(i) = line_rn(i + 1);
					line_rjt(i) = line_rjt(i + 1);
					line_rpt(i) = line_rpt(i + 1);
				end;
				
				line_rn(line) = 0;
				line_rjt(line) = 0;
				line_rpt(line) = 0;
				line = line - 1;
			end;
		end;
	end;
	
	% ВЫЧИСЛЕНИЕ ВРЕМЕНИ ПОСТУПЛЕНИЯ ЗАЯВКИ
	if (request_time == time) 
		k = k + 1;
		e_request = initial_v_gen(e_request);
		new_request_time = rp_gen(e_request, avg_request_time);
		request_time = request_time + new_request_time;
	end;
	
	% ВЫЧИСЛЕНИЕ МИНИМАЛЬНОГО ВРЕМЕНИ ОБРАБОТКИ  "time_tick"
	time_tick = 0;
	tmp = 0;

	
	tmp = max(device_processing_time);
	for i=1:1:devices
		if ((device_processing_time(i) < tmp) && (device_processing_time(i) ~= 0))
			tmp = device_processing_time(i);
		end;
	end;
	time_tick = tmp;
	
	if (time_tick > time + quant)
		time_tick = time + quant;
	end;
		
	% ВЫЧИСЛЕНИЕ ВРЕМЕНИ ЗАДЕРЖКИ "delay"
	if ((request_time < time_tick) && (time_tick ~= 0))
		delay = (request_time - time) * line + delay;
	else
		if ((request_time > time_tick) && (time_tick ~= 0))
			delay = (time_tick - time) * line + delay;
		end;
	end;
	
	% ВЫЧИСЛЕНИЕ СИСТЕМНОГО ВРЕМЕНИ "time"
	flag  = 0;
	for i=1:1:devices
		if (device_processing_time(i) ~= 0)
			flag = flag + 1;
		end;
	end;
	
	if ((flag == devices) || ((flag ~= devices) && (line == 0)))
		time = time_tick;
	end;
	if ((flag ~= devices) && (line ~= 0))
		time = time;
	end;
	if (((flag == 0) && (line == 0)) || (request_time <= time_tick))
		time = request_time;
	end;
	
	
	% ФОРМИРОВАНИЕ ОЧЕРЕДИ "line"
	flag = 0;
	
	for i=1:1:devices
		if (device(i) ~= 0)
			flag = flag + 1;
		end;
	end;
	
	if ((flag == devices) && (request_time == time)) 
		e_processing = initial_v_gen(e_processing);
		
		new_processing_time = rp_gen(e_processing, avg_processing_time);
		
		pt_sum = pt_sum + new_processing_time;
		
		line = line + 1;
		line_rn(line) = k;
		line_rjt(line) = time;
		line_rpt(line) = new_processing_time;
	end;
	
	% СНЯТИЕ ЗАЯВКИ С ОБРАБОТКИ И РЕАЛИЗАЦИЯ ЦИКЛИЧЕСКОЙ ОБРАБОТКИ
	for i=1:1:devices
		if (device(i) == 1)
			if (device_processing_time(i) == time) 
				request_processing_time(device_processig_request(i)) = request_processing_time(device_processig_request(i)) - quant;
				if (request_processing_time(device_processig_request(i)) <= quant)
					time = time + request_processing_time(device_processig_request(i));
					device(i) = 0;
					device_processig_request(i) = 0;
					device_processing_time(i) = 0;
					device_bwt(i) = 0;
				else
					line = line + 1;
					line_rn(line) = device_processig_request(i);
					line_rjt(line) = time;
					line_rpt(line) = request_processing_time(device_processig_request(i));
					
					device(i) = 0;
					device_processig_request(i) = 0;
					device_processing_time(i) = 0;
					device_bwt(i) = 0;
				end;
			end;
		end;
	end;
	
	
	
	% ВЫВОД ДАННЫХ В ИНТЕРФЕЙС И В КОНСОЛЬ
	
	% среднее число требований в очереди
	M = delay / time;
	fprintf('\nсреднее число требований в очереди = %f\n', M);
	
	%коэффициент использования системы
	csu = 0;
	for i=1:1:devices
		csu = csu + device_twt(i);
	end;
	csu = csu / (devices * time);
	fprintf('коэффициент использования системы = %f\n', csu);
	
	
	% время в очереди
	ld = 0; 
	for i=1:1:line_trn
		ld = ld + line_tlt(i);
	end;	
	
	% средняя задержка в очереди
	av_ld = 0;
	if (line_trn ~= 0)
		av_ld = ld / line_trn;
	end;
	fprintf('средняя задержка в очереди = %f\n', av_ld);
	
	% среднее время ожидания
	av_wt = pt_sum; 
	for i=1:1:line_trn
		av_wt = av_wt + line_tlt(i);
	end;
	av_wt = av_wt/n;
	fprintf('среднее время ожидания = %f\n', av_wt);
	
	L = (av_wt * n) / time;	   
		
		
	% для while
	end; 
	
	array_csu(l) = csu;
	
	M_array(l) = M; 
	
	av_ld_array(l) = av_ld;
	
	L_array(l) = L;
	
	av_wt_array(l) = av_wt;
	
	% для for
	end;
	
	array_csu
	
	M_array
	
	av_ld_array
	
	L_array
    
    av_wt_array
    
	m_su = val_mx(c, array_csu)	
	m_ld = val_mx(c, av_ld_array)
	m_wt = val_mx(c, av_wt_array)
	m_rl = val_mx(c, M_array)
	m_sr = val_mx(c, L_array)
	
	d_su = val_dx(c, array_csu, m_su)	
	d_ld = val_dx(c, av_ld_array, m_ld)
	d_wt = val_dx(c, av_wt_array, m_wt)
	d_rl = val_dx(c, M_array, m_rl)
	d_sr = val_dx(c, L_array, m_sr)