%Simulation of webserver in overload situations
dt=0.1;t=0:dt:80;x0=0;

% Generate plots for r = 2
[t,x]=ode45('admcontrol_p',t,x0, [], 2);
subplot(321)
pl=plot(t,x);
set(pl,'Linewidth',1.5)
ylabel('x')
grid on;

k=1;
%k=1000;
v=k*(2-x);
u=min(1,max(0,v));
subplot(323)
pl=plot(t,u);
set(pl,'Linewidth',1.5)
xlabel('t');
ylabel('u');
grid on;

amprint('queue-admcontrol-pi-r2.eps');

% Generate plots for r = 5
[t,x]=ode45('admcontrol',t,x0, [], 2);
subplot(321)
pl=plot(t,x);
set(pl,'Linewidth',1.5)
ylabel('x')
grid on;

k=1;
v=k*(2-x);
u=min(1,max(0,v));
subplot(323)
pl=plot(t,u);
set(pl,'Linewidth',1.5)
xlabel('t');
ylabel('u');
grid on;

amprint('queue-admcontrol-pi-r5.eps');
