// This GUI file is generated by guibuilder version 2.2
//////////
funcprot(0)
function Modelo_MMSN(handles, arch) //agregar para el menu
archivo=arch;
f=figure('figure_position',[230,20],'figure_size',[900,700],'auto_resize','on','background',[33],'figure_name','Graphic window number %d');
//////////
delmenu(f.figure_id,gettext('File'))
delmenu(f.figure_id,gettext('?'))
delmenu(f.figure_id,gettext('Tools'))
toolbar(f.figure_id,'off')
handles.dummy = 0;
handles.marco_1=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.03,0.55,0.3,0.288],'Relief','ridge','SliderStep',[0.01,0.1],'String','','Style','frame','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','marco_1','Callback','')

handles.marco_2=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.03,0.13,0.375,0.37],'Relief','ridge','SliderStep',[0.01,0.1],'String','','Style','frame','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','marco_2','Callback','')

//Botones-------------------------------------------------------------------------
handles.btnCalcular=uicontrol(f,'unit','normalized','BackgroundColor',[0.6,0.6,0.6],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.02,0.05,0.15,0.06],'Relief','raised','SliderStep',[0.01,0.1],'String','Calcular','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','btnCalcular','Callback','btnCalcular_MM1N(handles)')
handles.btnLimpiar=uicontrol(f,'unit','normalized','BackgroundColor',[0.6,0.6,0.6],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.25,0.05,0.15,0.06],'Relief','raised','SliderStep',[0.01,0.1],'String','Limpiar','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','btnLimpiar','Callback','btnLimpiar_callback(handles)')
handles.btnSalir=uicontrol(f,'unit','normalized','BackgroundColor',[0.6,0.6,0.6],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.7507042,0.057381,0.1492958,0.0674603],'Relief','raised','SliderStep',[0.01,0.1],'String','Men√∫','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','btnSalir','Callback','btnSalir_callback(handles)')
handles.btnAyuda=uicontrol(f,'unit','normalized','BackgroundColor',[0.6,0.6,0.6],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[24],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.9,0.9,0.05,0.06],'Relief','raised','SliderStep',[0.01,0.1],'String','?','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','btnAyuda','Callback','btnAyuda_MMSN(handles)')
//--------------------------------------------------------------------------------
handles.texttitulo=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[24],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.3371831,0.9027778,0.2828169,0.077619],'Relief','flat','SliderStep',[0.01,0.1],'String','Modelo M/M/S/N','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','texttitulo','Callback','')
handles.textTituloGrafica=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[14],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.5,0.79,0.2828169,0.05],'Relief','flat','SliderStep',[0.01,0.1],'String','W(t) en Azul y Wq(t) en Verde','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textTituloGrafica','Callback','')
handles.textParam=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[14],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.0585915,0.8035714,0.11,0.065],'Relief','flat','SliderStep',[0.01,0.1],'String','-Parametros-','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textParam','Callback','')
handles.textResultados=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[14],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.05,0.48,0.11,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','-Resultados-','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textResultados','Callback','')
//--------------------------------------------------------------------------------
// parametros
handles.tetxLambda=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.77,0.08,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','Lambda:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','tetxLambda','Callback','')
handles.editLambda=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.12,0.77,0.05,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editLambda','Callback','')

handles.textMiu=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.72,0.11,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','Miu:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textMiu','Callback','')
handles.editMiu =uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.12,0.72,0.05,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editMiu','Callback','')

handles.textServidores=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.67,0.12,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','s:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textServidores','Callback','')
handles.editServ=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.12,0.67,0.05,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editServ','Callback','')

handles.textN=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.62,0.12,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','N:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textN','Callback','')
handles.editN=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.12,0.62,0.05,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editN','Callback','')

handles.textClientes=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.57,0.12,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','n:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textClientes','Callback','')
handles.editClientes=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.12,0.57,0.05,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editClientes','Callback','')

// tiempo 1
handles.textTitulo=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.2,0.67,0.1,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','-Para la Grafica-','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textTitulo','Callback','')
handles.text1=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.2,0.62,0.03,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','t1:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','text1','Callback','')
handles.edit1=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.23,0.62,0.05,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','edit1','Callback','')
// tiempo 2
handles.text2=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.2,0.57,0.03,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','t2:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','text2','Callback','')
handles.edit2=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.23,0.57,0.05,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','edit2','Callback','')

//resultados-----------------------------------------------------------------------
//columna 1
handles.textRho=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.4,0.04,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','Rho:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textRho','Callback','')
handles.editRho=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.09,0.4,0.07,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editRho','Callback','')

handles.tPo=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.35,0.04,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','Po:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','tPo','Callback','')
handles.ePo=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.09,0.35,0.07,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','ePo','Callback','')

handles.tL=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.3,0.04,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','L:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','tL','Callback','')
handles.eL=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.09,0.3,0.07,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','eL','Callback','')

handles.tW=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.25,0.04,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','W:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','tW','Callback','')
handles.eW=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.09,0.25,0.07,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','eW','Callback','')
//columna 2
handles.tLambdaMedia=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.18,0.4,0.08,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','E(Lambda):','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','tLambdaMedia','Callback','')
handles.eLambdaMedia=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.26,0.4,0.12,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','eLambdaMedia','Callback','')

handles.tPn=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.18,0.35,0.12,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','Pn:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','tPn','Callback','')
handles.ePn=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.26,0.35,0.12,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','ePn','Callback','')

handles.tLq=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.18,0.3,0.12,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','Lq:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','tLq','Callback','')
handles.eLq=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.26,0.3,0.12,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','eLq','Callback','')

handles.tWq=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.18,0.25,0.12,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','Wq:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','tWq','Callback','')
handles.eWq=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.26,0.25,0.12,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','eWq','Callback','')

handles.teficiencia=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.15,0.2,0.12,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','Eficiencia:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','teficiencia','Callback','')
handles.eEficiencia=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.26,0.2,0.12,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','eEficiencia','Callback','')
// W(t)
handles.textW_t=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.05,0.15,0.04,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','W(t):','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textW_t','Callback','')
handles.editW_t=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.09,0.15,0.1,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editW_t','Callback','')
// Wq(t)
handles.textWq_t=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.22,0.15,0.04,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','Wq(t):','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textWq_t','Callback','')
handles.editWq_t=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.26,0.15,0.12,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editWq_t','Callback','')

handles.grafica= newaxes();handles.grafica.margins = [ 0 0 0 0];handles.grafica.axes_bounds = [0.47,0.2214984,0.4740741,0.4923127];handles.grafica.auto_clear="on";
handles=resume(handles);
endfunction

//////////
// Callbacks are defined as below. Please do not delete the comments as it will be used in coming version
//////////

function btnAyuda_MMSN(handles)
//Write your callback for  btnAyuda  here
archivo=archivo+"Manuales/Manual_de_Usuario_Modelo_MMSN.pdf"
    if isfile(archivo) then
        winopen(archivo);
    else
        messagebox("No se Encontro el Archivo",'ADVERTENCIA','info')
    end

endfunction


function btnCalcular_MMSN(handles)

    miu = evstr(get(handles.editMiu,'String'));
    lambda = evstr(get(handles.editLambda,'String'));
    t1=evstr(get(handles.edit1, 'string'));
    t2=evstr(get(handles.edit2, 'string'));
    N = evstr(get(handles.editN,'string'));
    n = evstr(get(handles.editClientes,'string'));
    s = evstr(get(handles.editServ,'string'));
    rho = lambda/(miu*s);
    //CALCULO DE Po
    Po = 0.0;
    aux1=0.0;
    aux2=0.0;
    for I=0:s-1
        aux1 = aux1 + ((factorial(N)/(factorial(N-I)*factorial(I)))*(rho)^I);
    end
    for I=s:N
        aux2 = aux2 + ((factorial(N)/(factorial(N-I)*factorial(s)*s^(n-s)))*(rho)^I);
    end
    Po = 1/(aux1+aux2);
    //CALCULO DE Pn
    Pn = 0.0;
    if n <= s then
        Pn = (factorial(N)/(factorial(N-n)*factorial(n)))*((rho)^n)*Po;
    end
    if n>=s & n<=N then
        Pn = ((factorial(N)/(factorial(N-n)*factorial(s)*s^(n-s)))*(rho)^n)*Po;
    end
    if n>N then
        Pn = 0;
    end
    //CALCULO DE Lq
    Lq=0.0;
    for i=s:N
        Lq = Lq + (n-s)*Pn;
    end
    //CALCULO DE L
    aux=0.0;
    a=0.0;
    for I=0:s-1
        aux = aux + (factorial(N)/(factorial(N-n)*factorial(n)))*((rho)^n)*Po;//sumatoria de los Pn
        a=a+n*((factorial(N)/(factorial(N-n)*factorial(n)))*((rho)^n)*Po);
    end
    L = a + Lq +s*(1-aux);
    //CALCULANDO LAMBDA MEDIA
    lambdaMedia = lambda*(N-L);
    //CALCULO DE W
    W = L/lambdaMedia;
    //CALCULO DE Wq
    Wq = Lq/lambdaMedia;
    //CALCULO DE LA EFICIENCIA
    eficiencia = miu * W;
    
    set(handles.editRho,'String',string(rho));
    set(handles.ePo,'String',string(Po));
    set(handles.ePn,'String',string(Pn));
    set(handles.eL,'String',string(L));
    set(handles.eLq,'String',string(Lq));
    set(handles.eW,'String',string(W));
    set(handles.eWq,'String',string(Wq));
    set(handles.eLambdaMedia,'String',string(lambdaMedia));
    set(handles.eEficiencia,'String',string(eficiencia));
    //    Graficar W y Wq
    Grafica_MMSN(lambda,miu,N,s);

endfunction

function Grafica_MMSN(lambda,miu,N,s)
    
    c=ones(1,s);
    for i=2:s
      c(i)=c(i-1)*lambda/(miu*(i-1));
    end
   
    ro=(lambda/(miu*s));
    if (ro == 1) //ro igual a 1
       c_mayor_s=c(s)*(N+1);
    else //ro distinto de 1
       c_mayor_s=c(s)*(ro-(ro^(N+2)))/(1-ro);
    end
    vector_p=ones(1,N+s+1);
    vector_p(1)=1/(sum(c)+c_mayor_s);
   
    for i=2:s
       vector_p(i)=c(i)*vector_p(1);
    end
   
    for i=s+1:N+s+1
       vector_p(i)=ro*vector_p(i-1);
    end
    x=linspace(1,3, 100);
    //n2 es un vector 0,1,...k+s-1
    n2=linspace(0,N+s-1,N+s);   
    vector_q=vector_p(n2+1)/(1-vector_p(N+s+1));
    
    variable_a_wqt=ones(1,length(x));
    variable_s_wqt=ones(1,length(x));
    if (N==0)
        variable_b_wqt=0;
    else
        variable_b_wqt=vector_q(s+1)*ones(1,length(x));
    end
   
    for variable_n_wqt=s+1:N+s-1
        variable_a_wqt=variable_a_wqt.*(miu*x*s/(variable_n_wqt-s));
        variable_s_wqt=variable_s_wqt+variable_a_wqt;
        variable_b_wqt=variable_b_wqt+vector_q(variable_n_wqt+1)*variable_s_wqt;
    end
    //Calcula Wq(t)
    wq_t=1-variable_b_wqt.*exp(-miu*x*s);
    
    //Calcular W(t)
    w_t = 1-exp(-(miu - lambda)*x);
    for i=1:length(w_t)
        if (w_t(i)<0)
            w_t(i)=0;
        end
    end
    
    for i=1:length(wq_t)
        if (wq_t(i)<0)
            wq_t(i)=0;
        end
    end
    set(handles.editWq_t,'String',string(wq_t(100)));
    set(handles.editW_t,'String',string(w_t(1)));
    plot(x,w_t,x,wq_t);
    xgrid;
    
endfunction

function btnLimpiar_callback(handles)
   
   set(handles.editServ, 'String',"");
   set(handles.edit3,'string',"");
   set(handles.editLambda, 'String',"");
   set(handles.editMiu, 'String',"");
   set(handles.edit1, 'String',"");
   set(handles.edit2,'String',"");
   set(handles.editN, 'String',"");
   set(handles.editClientes, 'String',"");
   set(handles.ePo, 'String',"");
   set(handles.ePn, 'String',"");
   set(handles.eL, 'String',"");
   set(handles.eLq, 'String',"");
   set(handles.eW, 'String',"");
   set(handles.eWq, 'String',"");
   set(handles.eLambdaMedia, 'String',"");
   set(handles.eEficiencia, 'String',"");
   set(handles.editRho, 'String',"");

endfunction


function btnSalir_callback(handles)
//Write your callback for  btnSalir  here
    close();

endfunction
