func admit(n)
  if(#(cpuq)+#(q1)+#(q2)+#(q3)<n)
	1
  else
	0
  end
end

func throughput()
  0.05*Rate(tcpu)
end


srn work(M,n)

*places 
cpuq 	0
q1 	0
q2	0
q3	0
pimm	0
preq	M
qreq	0
end

*timed transitions
tcpu	ind 	89.3
tq1	ind	44.6
tq2	ind	26.8
tq3	ind	13.4
treq	placedep preq	1/15
end

*immediate transitions
t0	ind 	0.05
t1	ind	0.5
t2	ind	0.3
t3	ind	0.15
t4	ind 	1	guard	admit(n)
end

*input arcs
cpuq	tcpu	1
pimm	t0	1
pimm	t1	1
pimm	t2	1
pimm	t3	1
q1	tq1	1
q2	tq2	1
q3	tq3	1
preq	treq	1
qreq	t4	1
end

*output arcs
tcpu	pimm	1
t0	preq	1
t1	q1	1
t2	q2	1
t3	q3	1
tq1	cpuq	1
tq2	cpuq	1
tq3	cpuq	1
treq	qreq	1
t4	cpuq	1
end
end

*expr srn_exrss(work;throughput;3,2)
*expr srn_exrss(work;throughput;6,1)
*expr 1-etok(work,preq; 10,4)
*


loop n,4,8,1
  loop M,10,60,10
    * expr srn_exrss(work; throughput; M,4)
    * expr (1-etok(work,preq; M,4))/srn_exrss(work;throughput;M,4)
    expr (M-etok(work,preq; M,4))/(tput(work,tcpu;M,4)*.05)
  end
end 


end


