proyecto (aplicacion de la programacion a un sistema de control)
es te es un ejercicio propuesto con el cual se pretende poner en practica todo lo aprendido con python hasta ahora
este es el codigo que se desarrollo para que se pueda cumplir con los requerimientos de la empresa:
from pylab import *
lcs=[]
lci=[]
lc=[]
lri=[]
lrs=[]
con=0
listarangos=[]
listaprag=[]
suma=0
listavalores=[]
listaprom=[]
sumrang=0
sumprom=0
datablaA={"2A2":1.880,"3A2":1.023,"4A2":0.729,"5A2":0.577,"6A2":0.483,"7A2":0.419,"8A2":0.373,"9A2":0.377,"10A2":0.308,"11A2":0.285,"12A2":0.266,"13A2":0.249,"14A2":0.235,"15A2":0.223}
datablaD3={"2D3":0,"3D3":0,"4D3":0,"5D3":0,"6D3":0,"7D3":0.076,"8D3":0.136,"9D3":0.184,"10D3":0.223,"11D3":0.256,"12D3":0.284,"13D3":0.308,"14D3":0.329,"15D3":0.348}
datablaD4={"2D4":3.268,"3D4":2.574,"4D4":2.282,"5D4":2.114,"6D4":2.004,"7D4":1.924,"8D4":1.864,"9D4":1.816,"10D4":1.777,"11D4":1.744,"12D4":1.717,"13D4":1.692,"14D4":1.671,"15D4":1.652}
vc=int(input("dame el valor central de las mediciones "))
l=int(input("dame el numero de muestras "))
d=int(input("dame el numero de datos por muestra "))
res=int(input("dame la tolerancia de las muestras "))
d1=str(d)
dA=d1+"A2"
dD3=d1+"D3"
dD4=d1+"D4"
dD4d=datablaD4[dD4]
dD3d=datablaD3[dD3]
dAd=datablaA[dA]
for i in range(0,l):
for j in range(0,d):
print ("dame el dato ",j+1," de la muestra ",i+1, end="")
r=int(input(":"))
listavalores.append(r)
suma=r+suma
print ()
prom=suma/d
listaprom.append(prom)
suma=0
#print (listavalores)
#print (listaprom)
for z in range(0,l):
ma=0
mi=3000
for x in range(0,d):
if listavalores[con]<mi:
mi=listavalores[con]
if listavalores[con]>ma:
ma=listavalores[con]
con=con+1
rang=ma-mi
listarangos.append(rang)
c=0
stdato=((8*d)-6)//2
sp=" "
spdt=stdato*sp
stdatores=(8*d)-2
spdtsal= stdatores*sp
print("N "+spdt+"datos "+spdt+" prom"+" rang")
for i in range(0,l):
print ('%2d'%(i+1),end="")
for j in range(0,d):
print ('%8d'%(listavalores[c]),end="")
c=c+1
print ('%8.1f'%(listaprom[i]),end="")
print ('%8.1f'%listarangos[i])
"""for p in range(0,l):
sp=sp+(listaprom[p])
pp=sp/d"""
for q in range(0,l):
lc.append(vc)
"""print (lc)
"""
for w in range(0,l):
sumrang=sumrang+listarangos[w]
promrang=sumrang/l
for o in range(0,l):
sumprom=sumprom+listaprom[o]
promprom=sumprom/l
li= promprom-(dAd*promrang)
for t in range(0,l):
lci.append(li)
ls= promprom + (dAd*promrang)
for u in range (0,l):
lcs.append(ls)
for y in range (0,l):
listaprag.append(res)
lir= (dD3d)*(promrang)
for k in range (0,l):
lri.append(lir)
lsr= (dD4d)*(promrang)
for n in range (0,l):
lrs.append(lsr)
print(spdtsal+"prom",end="")
print('%8.1f'%(promprom),end="")
print('%8.1f'%(promrang))
print(spdtsal+" lci",end="")
print('%8.1f'%(li),end="")
print('%8.1f'%(lir))
print(spdtsal+" lcs",end="")
print('%8.1f'%(ls),end="")
print('%8.1f'%(lsr))
"""print("lci de promedios: ",li,"lci de rangos: ",lir)
print("lcs de promedios: ",ls,"lcs de rangos: ",lsr)
"""
"""print (listarangos)
"""
plt.title("promedios")
plt.plot(lc, label="v central",linestyle='-.')
plt.plot(lcs, label="lcs",linestyle=':')
plt.plot(lci, label="lci",linestyle=':')
plt.plot(listaprom, label="promedios",marker='o')
plt.legend(loc="lower center")
plt.show()
plt.title("rangos")
plt.plot(listarangos, label="rangos",marker='o')
plt.plot(listaprag, label="v tolerancia",linestyle="-.")
plt.plot(lri,label="lci", linestyle=":")
plt.plot(lrs, label="lcs", linestyle=":")
plt.legend(loc="lower center")
plt.show()
este es el codigo que se desarrollo para que se pueda cumplir con los requerimientos de la empresa:
from pylab import *
lcs=[]
lci=[]
lc=[]
lri=[]
lrs=[]
con=0
listarangos=[]
listaprag=[]
suma=0
listavalores=[]
listaprom=[]
sumrang=0
sumprom=0
datablaA={"2A2":1.880,"3A2":1.023,"4A2":0.729,"5A2":0.577,"6A2":0.483,"7A2":0.419,"8A2":0.373,"9A2":0.377,"10A2":0.308,"11A2":0.285,"12A2":0.266,"13A2":0.249,"14A2":0.235,"15A2":0.223}
datablaD3={"2D3":0,"3D3":0,"4D3":0,"5D3":0,"6D3":0,"7D3":0.076,"8D3":0.136,"9D3":0.184,"10D3":0.223,"11D3":0.256,"12D3":0.284,"13D3":0.308,"14D3":0.329,"15D3":0.348}
datablaD4={"2D4":3.268,"3D4":2.574,"4D4":2.282,"5D4":2.114,"6D4":2.004,"7D4":1.924,"8D4":1.864,"9D4":1.816,"10D4":1.777,"11D4":1.744,"12D4":1.717,"13D4":1.692,"14D4":1.671,"15D4":1.652}
vc=int(input("dame el valor central de las mediciones "))
l=int(input("dame el numero de muestras "))
d=int(input("dame el numero de datos por muestra "))
res=int(input("dame la tolerancia de las muestras "))
d1=str(d)
dA=d1+"A2"
dD3=d1+"D3"
dD4=d1+"D4"
dD4d=datablaD4[dD4]
dD3d=datablaD3[dD3]
dAd=datablaA[dA]
for i in range(0,l):
for j in range(0,d):
print ("dame el dato ",j+1," de la muestra ",i+1, end="")
r=int(input(":"))
listavalores.append(r)
suma=r+suma
print ()
prom=suma/d
listaprom.append(prom)
suma=0
#print (listavalores)
#print (listaprom)
for z in range(0,l):
ma=0
mi=3000
for x in range(0,d):
if listavalores[con]<mi:
mi=listavalores[con]
if listavalores[con]>ma:
ma=listavalores[con]
con=con+1
rang=ma-mi
listarangos.append(rang)
c=0
stdato=((8*d)-6)//2
sp=" "
spdt=stdato*sp
stdatores=(8*d)-2
spdtsal= stdatores*sp
print("N "+spdt+"datos "+spdt+" prom"+" rang")
for i in range(0,l):
print ('%2d'%(i+1),end="")
for j in range(0,d):
print ('%8d'%(listavalores[c]),end="")
c=c+1
print ('%8.1f'%(listaprom[i]),end="")
print ('%8.1f'%listarangos[i])
"""for p in range(0,l):
sp=sp+(listaprom[p])
pp=sp/d"""
for q in range(0,l):
lc.append(vc)
"""print (lc)
"""
for w in range(0,l):
sumrang=sumrang+listarangos[w]
promrang=sumrang/l
for o in range(0,l):
sumprom=sumprom+listaprom[o]
promprom=sumprom/l
li= promprom-(dAd*promrang)
for t in range(0,l):
lci.append(li)
ls= promprom + (dAd*promrang)
for u in range (0,l):
lcs.append(ls)
for y in range (0,l):
listaprag.append(res)
lir= (dD3d)*(promrang)
for k in range (0,l):
lri.append(lir)
lsr= (dD4d)*(promrang)
for n in range (0,l):
lrs.append(lsr)
print(spdtsal+"prom",end="")
print('%8.1f'%(promprom),end="")
print('%8.1f'%(promrang))
print(spdtsal+" lci",end="")
print('%8.1f'%(li),end="")
print('%8.1f'%(lir))
print(spdtsal+" lcs",end="")
print('%8.1f'%(ls),end="")
print('%8.1f'%(lsr))
"""print("lci de promedios: ",li,"lci de rangos: ",lir)
print("lcs de promedios: ",ls,"lcs de rangos: ",lsr)
"""
"""print (listarangos)
"""
plt.title("promedios")
plt.plot(lc, label="v central",linestyle='-.')
plt.plot(lcs, label="lcs",linestyle=':')
plt.plot(lci, label="lci",linestyle=':')
plt.plot(listaprom, label="promedios",marker='o')
plt.legend(loc="lower center")
plt.show()
plt.title("rangos")
plt.plot(listarangos, label="rangos",marker='o')
plt.plot(listaprag, label="v tolerancia",linestyle="-.")
plt.plot(lri,label="lci", linestyle=":")
plt.plot(lrs, label="lcs", linestyle=":")
plt.legend(loc="lower center")
plt.show()
Comentarios
Publicar un comentario