function varargout = GUI_planta_piloto(varargin)
% GUI_PLANTA_PILOTO MATLAB code for GUI_planta_piloto.fig

% Last Modified by GUIDE v2.5 06-Oct-2016 19:24:23

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @GUI_planta_piloto_OpeningFcn, ...
                   'gui_OutputFcn',  @GUI_planta_piloto_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before GUI_planta_piloto is made visible.
function GUI_planta_piloto_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to GUI_planta_piloto (see VARARGIN)

find_system('Name','EstanqueSim');%busca arvhivo
open_system('EstanqueSim');%abre archivo

imagen = imread('Logo_Udec.jpg'); %Leer imagen
axes(handles.imagen1); %Carga la imagen en background
axis off;
imshow(imagen); %Presenta la imagen

        set_param('EstanqueSim/swam_n','sw','1')
        set_param('EstanqueSim/swam_f','sw','1')
        set(handles.slider_carga,'Enable','on')
        set(handles.slider_descarga,'Enable','on')
        set(handles.slider_spn,'Enable','off')
        set(handles.slider_spf,'Enable','off')
        
        set(handles.edit_carga,'Visible','on')
        set(handles.edit_descarga,'Visible','on')
        set(handles.edit_spn,'Visible','off')
        set(handles.edit_spf,'Visible','off')


aux=get_param('EstanqueSim/Valvula Carga','Value');
set(handles.slider_carga, 'Value', str2double(aux));
set(handles.edit_carga, 'String', aux);

aux=get_param('EstanqueSim/Valvula Descarga','Value');
set(handles.slider_descarga, 'Value', str2num(aux));
set(handles.edit_descarga, 'String', aux);

aux=get_param('EstanqueSim/SP_N','Value');
set(handles.slider_spn, 'Value', str2num(aux));
set(handles.edit_spn, 'String', aux);

aux=get_param('EstanqueSim/SP_F','Value');
set(handles.slider_spf, 'Value', str2num(aux));
set(handles.edit_spf, 'String', aux);

% Ejecución Inicial del Timer
handles.timer = timer(...
    'ExecutionMode', 'fixedRate', ...   % Run timer repeatedly
    'Period', 0.1, ...                % Initial period is 0.1 sec.
    'TimerFcn', {@actualizar_datos,handles}); % Specify callback
start(handles.timer);

% Choose default command line output for GUI_planta_piloto
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes GUI_planta_piloto wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = GUI_planta_piloto_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;



function edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double


% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in checkbox_control.
function checkbox_control_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox_control (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox_control
fun =get(handles.checkbox_control,'Value');
switch fun
    case 1
        set_param('EstanqueSim/swam_n','sw','0')
        set_param('EstanqueSim/swam_f','sw','0')
        set(handles.slider_carga,'Enable','off')
        set(handles.slider_descarga,'Enable','off')
        set(handles.slider_spn,'Enable','on')
        set(handles.slider_spf,'Enable','on')
        
        set(handles.edit_carga,'Visible','off')
        set(handles.edit_descarga,'Visible','off')
        set(handles.edit_spn,'Visible','on')
        set(handles.edit_spf,'Visible','on')
        
    case 0
        set_param('EstanqueSim/swam_n','sw','1')
        set_param('EstanqueSim/swam_f','sw','1')
        set(handles.slider_carga,'Enable','on')
        set(handles.slider_descarga,'Enable','on')
        set(handles.slider_spn,'Enable','off')
        set(handles.slider_spf,'Enable','off')
        
        set(handles.edit_carga,'Visible','on')
        set(handles.edit_descarga,'Visible','on')
        set(handles.edit_spn,'Visible','off')
        set(handles.edit_spf,'Visible','off')
end

% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu1
fun =get(handles.popupmenu1,'Value');
switch fun
    case 1
        set(handles.panel_nivel,'visible','on')
        set(handles.panel_flujo,'visible','off')
    case 2
        set(handles.panel_nivel,'visible','off')
        set(handles.panel_flujo,'visible','on')
end
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on slider movement.
function slider_carga_Callback(hObject, eventdata, handles)
% hObject    handle to slider_carga (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
valor = get(hObject,'Value');
set_param('EstanqueSim/Valvula Carga','Value',num2str(valor))
set(handles.edit_carga, '3String', num2str(valor));
guidata(hObject, handles); %Final

% --- Executes during object creation, after setting all properties.
function slider_carga_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider_carga (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


% --- Executes on slider movement.
function slider_descarga_Callback(hObject, eventdata, handles)
% hObject    handle to slider_descarga (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
valor = get(hObject,'Value');
set_param('EstanqueSim/Valvula Descarga','Value',num2str(valor))
set(handles.edit_descarga, 'String', num2str(valor));
guidata(hObject, handles); %Final

% --- Executes during object creation, after setting all properties.
function slider_descarga_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider_descarga (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end



function edit_p_Callback(hObject, eventdata, handles)
% hObject    handle to edit_p (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_p as text
%        str2double(get(hObject,'String')) returns contents of edit_p as a double


% --- Executes during object creation, after setting all properties.
function edit_p_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_p (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit_i_Callback(hObject, eventdata, handles)
% hObject    handle to edit_i (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_i as text
%        str2double(get(hObject,'String')) returns contents of edit_i as a double


% --- Executes during object creation, after setting all properties.
function edit_i_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_i (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit_d_Callback(hObject, eventdata, handles)
% hObject    handle to edit_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_d as text
%        str2double(get(hObject,'String')) returns contents of edit_d as a double
valor=str2num(get(hObjecto,'string'));
set_param('modelo/PID Controller','D',valor)
guidata(hObject, handles); %Final
% --- Executes during object creation, after setting all properties.
function edit_d_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on slider movement.
function slider_spn_Callback(hObject, eventdata, handles)
% hObject    handle to slider_spn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
valor = get(hObject,'Value');
set_param('EstanqueSim/SP_N','Value',num2str(valor))
set(handles.edit_spn, 'String', num2str(valor));
guidata(hObject, handles); %Final
% --- Executes during object creation, after setting all properties.
function slider_spn_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider_spn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


% --- Executes on slider movement.
function slider_spf_Callback(hObject, eventdata, handles)
% hObject    handle to slider_spf (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
valor = get(hObject,'Value');
set_param('EstanqueSim/SP_F','Value',num2str(valor))
set(handles.edit_spf, 'String', num2str(valor));
guidata(hObject, handles); %Final
% --- Executes during object creation, after setting all properties.
function slider_spf_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider_spf (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end



function edit_spn_Callback(hObject, eventdata, handles)
% hObject    handle to edit_spn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_spn as text
%        str2double(get(hObject,'String')) returns contents of edit_spn as a double
valor = get(hObject,'String');
set_param('EstanqueSim/SP_N','Value',valor);
set(handles.slider_spn,'value',str2double(valor));
guidata(hObject, handles); %Final

% --- Executes during object creation, after setting all properties.
function edit_spn_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_spn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit_spf_Callback(hObject, eventdata, handles)
% hObject    handle to edit_spf (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_spf as text
%        str2double(get(hObject,'String')) returns contents of edit_spf as a double
valor = get(hObject,'String');
set_param('EstanqueSim/SP_F','Value',valor);
set(handles.slider_spf,'value',str2double(valor));
guidata(hObject, handles); %Final

% --- Executes during object creation, after setting all properties.
function edit_spf_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_spf (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit_carga_Callback(hObject, eventdata, handles)
% hObject    handle to edit_carga (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_carga as text
%        str2double(get(hObject,'String')) returns contents of edit_carga as a double

valor = get(hObject,'String');
set_param('EstanqueSim/Valvula Carga','Value',valor);
set(handles.slider_carga,'value',str2double(valor));
guidata(hObject, handles); %Final

% --- Executes during object creation, after setting all properties.
function edit_carga_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_carga (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit_descarga_Callback(hObject, eventdata, handles)
% hObject    handle to edit_descarga (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_descarga as text
%        str2double(get(hObject,'String')) returns contents of edit_descarga as a double
valor = get(hObject,'String');
set_param('EstanqueSim/Valvula Descarga','Value',valor);
set(handles.slider_descarga,'value',str2double(valor));
guidata(hObject, handles); %Final

% --- Executes during object creation, after setting all properties.
function edit_descarga_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_descarga (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in push_inicio.
function push_inicio_Callback(hObject, eventdata, handles)
% hObject    handle to push_inicio (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
find_system('Name','EstanqueSim');
open_system('EstanqueSim');
set_param(gcs,'SimulationCommand','Start');
if strcmp(get(handles.timer, 'Running'), 'off')
    start(handles.timer);
end
guidata(hObject, handles); %Final
% --- Executes on button press in push_detener.
function push_detener_Callback(hObject, eventdata, handles)
% hObject    handle to push_detener (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
open_system('EstanqueSim');
set_param(gcs,'SimulationCommand','Stop');
if strcmp(get(handles.timer, 'Running'), 'on')
    stop(handles.timer);
end
stop(handles.timer);
guidata(hObject, handles); %Final



function edit_d_n_Callback(hObject, eventdata, handles)
% hObject    handle to edit_d_n (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_d_n as text
%        str2double(get(hObject,'String')) returns contents of edit_d_n as a double
Val=get(hObject,'String');
set_param('EstanqueSim/PID NIVEL','D',Val)
guidata(hObject, handles); %Final


% --- Executes during object creation, after setting all properties.
function edit_d_n_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_d_n (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit_i_n_Callback(hObject, eventdata, handles)
% hObject    handle to edit_i_n (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_i_n as text
%        str2double(get(hObject,'String')) returns contents of edit_i_n as a double
Val=get(hObject,'String');
set_param('EstanqueSim/PID NIVEL','I',Val)
guidata(hObject, handles); %Final

% --- Executes during object creation, after setting all properties.
function edit_i_n_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_i_n (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit_p_n_Callback(hObject, eventdata, handles)
% hObject    handle to edit_p_n (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_p_n as text
%        str2double(get(hObject,'String')) returns contents of edit_p_n as a double
Val=get(hObject,'String');
set_param('EstanqueSim/PID NIVEL','P',Val)
guidata(hObject, handles); %Final

% --- Executes during object creation, after setting all properties.
function edit_p_n_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_p_n (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit_p_f_Callback(hObject, eventdata, handles)
% hObject    handle to edit_p_f (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_p_f as text
%        str2double(get(hObject,'String')) returns contents of edit_p_f as a double
Val=get(hObject,'String');
set_param('EstanqueSim/PID FLUJO','P',Val)
guidata(hObject, handles); %Final

% --- Executes during object creation, after setting all properties.
function edit_p_f_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_p_f (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit_i_f_Callback(hObject, eventdata, handles)
% hObject    handle to edit_i_f (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_i_f as text
%        str2double(get(hObject,'String')) returns contents of edit_i_f as a double
Val=get(hObject,'String');
set_param('EstanqueSim/PID FLUJO','I',Val)
guidata(hObject, handles); %Final

% --- Executes during object creation, after setting all properties.
function edit_i_f_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_i_f (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit_d_f_Callback(hObject, eventdata, handles)
% hObject    handle to edit_d_f (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_d_f as text
%        str2double(get(hObject,'String')) returns contents of edit_d_f as a double
Val=get(hObject,'String');
set_param('EstanqueSim/PID FLUJO','D',Val)
guidata(hObject, handles); %Final

% --- Executes during object creation, after setting all properties.
function edit_d_f_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_d_f (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

%% ------------ FUNCIONES TIMER ------------ %%
% Función del Timer
function actualizar_datos(obj, event, handles)
%
datos_n= get_param('EstanqueSim/nivel','RuntimeObject');
datos_n = datos_n.InputPort(1).Data;
set(handles.valor_nivel, 'String', num2str(datos_n(1)));

datos_f= get_param('EstanqueSim/flujo descarga','RuntimeObject');
datos_f = datos_f.InputPort(1).Data;
set(handles.valor_flujo, 'String', num2str(datos_f(1)));

datos_c= get_param('EstanqueSim/valvula c','RuntimeObject');
datos_c = datos_c.InputPort(1).Data;
set(handles.valor_c, 'String', num2str(datos_c(1)));

datos_d= get_param('EstanqueSim/valvula d','RuntimeObject');
datos_d = datos_d.InputPort(1).Data;
set(handles.valor_d, 'String', num2str(datos_d(1)));



