function start_Callback(hObject, eventdata, handles)
set(handles.stop,'userdata',0);
set(handles.pause,'userdata',0);
set(handles.emergency_stop,'userdata',0);
set(handles.reset,'userdata',0);
if get(handles.reset,'userdata')
title('Process is reset')
return;
end
axis([-10 10 -15 15])
for loop2=1:3
title('stop button is applied')
if get(handles.stop,'userdata')
set(handles.stop,'userdata',1);
break;
end
if get(handles.pause,'userdata')
uiwait(handles.figure1);
title(' process is paused')
end
if get(handles.emergency_stop,'userdata')
title('process is stopped as Emergency')
break;
end
x=[2.1 8];
y=[9.5 9.5];
plot(x,y,'Color','yellow','LineWidth',7)
...
x1=[2.3 2.3];
y1=[9.5 7];
plot(x1,y1,'Color','yellow','LineWidth',7)
...
x1=[2.3 2.3];
y1=[0 7];
plot(x1,y1,'--','Color','yellow','LineWidth',7)
level=0;
level_h= randi(1)*25;
pause(0.001)
for i=1:level_h
pause(0.001)
if get(handles.pause,'userdata')
uiwait(handles.figure1);
end
if get(handles.reset,'userdata')
break;
end
level=level+0.15;
patch([-4.4 4.15 4.15 -4.4],[ 0 0 level level]-7.05,'yellow');
x5=[0 0];
y5=[-4 11];
plot(x5,y5,'Color','black','LineWidth',12)
hold on
x6=[-2 2];
y6=[-4 -4];
plot(x6,y6,'Color','black','LineWidth',12)
hold on
rectangle('Position',[-3 -5 2 2.25],'FaceColor','black')
rectangle('Position',[1 -5 2 2.25],'FaceColor','black')
pause(0.001)
W=8;
L=8;
H=level;
V=(W*L*H);
disp(V);
set(handles.text1,'String',V);
title(['Filling Tank// Vlave1 is open:',num2str(level_h),'%']);
drawnow
end
pause(0.001)
level_h=randi(1)*75;
...
x=[2.1 8];
y=[9.5 9.5];
plot(x,y,'Color','blue','LineWidth',7)
...
x1=[2.3 2.3];
y1=[9.5 7];
plot(x1,y1,'Color','blue','LineWidth',7)
...
x1=[2.3 2.3];
y1=[0 7];
plot(x1,y1,'--','Color','white','LineWidth',7)
...
x=[-2.1 -8];
y=[9.5 9.5];
plot(x,y,'Color','cyan','LineWidth',7)
...
x1=[-2.3 -2.3];
y1=[9.5 7];
plot(x1,y1,'Color','cyan','LineWidth',7)
...
x1=[-2.3 -2.3];
y1=[0 7];
plot(x1,y1,'--','Color','cyan','LineWidth',7)
pause(0.01)
pause(2);
for i=6:level_h
if get(handles.pause,'userdata')
uiwait(handles.figure1);
end
if get(handles.emergency_stop,'userdata')
title('process is stopped as Emergency')
break;
end
level=(level+0.150);
patch([-4.4 4.15 4.15 -4.4],[ 0 0 level-3.60 level-3.60]-3.70,'cyan');
x5=[0 0];
y5=[-4 11];
plot(x5,y5,'Color','black','LineWidth',12)
x6=[-2 2];
y6=[-4 -4];
plot(x6,y6,'Color','black','LineWidth',12)
rectangle('Position',[-3 -5 2 2.25],'FaceColor','black')
rectangle('Position',[1 -5 2 2.25],'FaceColor','black')
if get(handles.reset,'userdata')
break;
end
pause(0.001)
H=level;
W=8;
L=8;
V=((W*L*H));
disp(V);
set(handles.text1,'String',V);
title(['Filling Tank//valve1 closed// Valve2 is open//Mixer is ON:',num2str(level_h),'%']);
drawnow
rectangle('Position',[-3 -5 2 2.25],'FaceColor','red');
rectangle('Position',[1 -5 2 2.25],'FaceColor','red');
pause(0.01)
rectangle('Position',[-3 -5 2 2.25],'FaceColor','black');
rectangle('Position',[1 -5 2 2.25],'FaceColor','black');
drawnow
end
pause(1);
title('EMPTY TANK// Valve2,valve1 are closed ,Drain valve is open now')
for i=10:level_h
if get(handles.pause,'userdata')
uiwait(handles.figure1);
end
if get(handles.emergency_stop,'userdata')
break;
end
if get(handles.reset,'userdata')
break;
end
H=level;
W=8;
L=8;
V=((W*L*H));
disp(V);
...
x=[-2.1 -8];
y=[9.5 9.5];
plot(x,y,'Color','blue','LineWidth',7)
...
x1=[-2.3 -2.3];
y1=[9.5 7];
plot(x1,y1,'Color','blue','LineWidth',7)
...
x2=[0 0];
y2=[-10 -7.05];
plot(x2,y2,'--','Color','green','LineWidth',7)
...
x3=[-0.2 8];
y3=[-10 -10];
plot(x3,y3,'--','Color','green','LineWidth',7)
pause(0.01)
patch([-4.4 4.15 4.15 -4.4],[0 0 level level]-7.05,[1 1 1],'Edgecolor','white');
level=level-0.2150;
patch([-4.4 4.15 4.15 -4.4],[0 0 level level]-7.05,'green');
H=level;
W=8;
L=16;
V=((W*L*H));
disp(V);
set(handles.text1,'String',V);
x5=[0 0];
y5=[-4 11];
plot(x5,y5,'Color','black','LineWidth',12)
hold on
x6=[-2 2];
y6=[-4 -4];
plot(x6,y6,'Color','black','LineWidth',12)
hold on
rectangle('Position',[-3 -5 2 2.25],'FaceColor','black')
rectangle('Position',[1 -5 2 2.25],'FaceColor','black')
pause(0.001)
drawnow
end
title(' Drain-valve closed-End of Process')
...
x2=[0 0];
y2=[-10 -7.05];
plot(x2,y2,'Color','blue','LineWidth',12)
...
x3=[-0.1 8];
y3=[-10 -10];
plot(x3,y3,'Color','blue','LineWidth',12)
clc;
if get(handles.emergency_stop,'userdata')
title('process is stopped as Emergency')
break;
end
if get(handles.reset,'userdata')
title('Process is reset')
break;
end
drawnow
end
return;