Page MenuHomec4science

exp1.py
No OneTemporary

File Metadata

Created
Tue, Nov 19, 14:20
import math
Tp = 955 + 273.0
Tm = 19 + 273.0
dTp = 5.0
dTm = 0.05
Vp = 184.45
Vm = 10.57
dVp = 21.36
dVm = 2.47
c = 2.5
a = [15, 17, 18, 20, 23, 25]
da = [3, 2, 1, 0.5, 0.5, 0.5]
F = [1.2, 0.55, 0.21, 0.16, 0.1, 0.06]
dF = [0.1, 0.05, 0.01, 0.01, 0.01, 0.01]
w = [252.6, 318.4, 373.2, 387.95, 396.6, 406.85]
dw = [1.7, 4.7, 0.1, 0.05, 2.3, 1.85]
R = 0.04
dR = 0.0005
U = 14.53
dU = 0.005
I = 14.04
dI = 0.005
D = 390
dD = 10
DT = 4.15
dDT = 0.05
# adjustments
for i in range(len(F)):
a[i] *= math.pi / 180.0
da[i] *= math.pi / 180.0 # rad
w[i] *= 2 * math.pi / 60.0 # rad/s
dw[i] *= 2 * math.pi / 60.0
D *= 1e-6 / 60.0
dD *= 1e-6 / 60.0
#functions
def flux_2(U, I):
return U * I
def errFlux_2(U, I, dU, dI):
return I * dU + U * dI
c_eau = 4185
rho_eau = 1000
def flux_1(D, DT):
return c_eau * rho_eau * D * DT
def errFlux_1(D, DT, dD, dDT):
return c_eau * rho_eau * (dD * DT + D * dDT)
def rend_empFlux(D, DT, U, I):
return 1 - flux_1(D, DT) / (U * I)
def errRend_empFlux(D, DT, U, I, dD, dDT, dU, dI):
return errFlux_1(D, DT, dD, dDT) / (U * I) + flux_1(D, DT) * (dU * I + U * dI) / (U * I)**2
def rend_emp(W, U, I):
return W / flux_2(U, I)
def errRend_emp(W, U, I, dW, dU, dI):
return dW / flux_2(U, I) + W * errFlux_2(U, I, dU, dI) / flux_2(U, I)**2
def errV(h, d, dh, dd):
return math.pi * ((d/2)**2 * dh + math.pi/2 * h * d * dd)
def errSigma(Tp, Tm, dTp, dTm):
return dTm / Tp + Tm / Tp**2 * dTp
def errPhi(Vp, Vm, dVp, dVm):
return dVp / Vp + dVm / Vm
def sigma(Tp, Tm):
return 1 - (Tm / Tp)
def phi(Vp, Vm):
return math.log(Vp/Vm)
def rend(Tp, Tm, Vp, Vm, c):
return 1.0 / (1 / sigma(Tp, Tm) + c / phi(Vp, Vm))
def errRend(Tp, Tm, dTp, dTm, Vp, Vm, dVp, dVm, c):
return rend(Tp, Tm, Vp, Vm, c)**2 * \
(errSigma(Tp, Tm, dTp, dTm) / sigma(Tp, Tm)**2 + c * errPhi(Vp, Vm, dVp, dVm) / phi(Vp, Vm)**2)
def puiss(F, R, w, a):
return F * R * w * math.cos(a)
def errPuiss(F, R, w, a, dF, dR, dw, da):
cos = math.cos(a)
return R * cos * w * dF + \
F * cos * w * dR + \
F * R * cos * dw + \
F * R * w * math.sin(a) * da
def couple(F, R, a):
return F * R * math.cos(a)
def errCouple(F, R, a, dF, dR, da):
return F * dR * math.cos(a) + dF * R * math.cos(a) + F * R * math.sin(a) * da
eta = rend(Tp, Tm, Vp, Vm, c)
d_eta = errRend(Tp, Tm, dTp, dTm, Vp, Vm, dVp, dVm, c)
print "eta_th = ", eta, " +- ", d_eta
P = []
dP = []
M = []
dM = []
Eta = []
dEta = []
Eta_flux = rend_empFlux(D, DT, U, I)
dEta_flux = errRend_empFlux(D, DT, U, I, dD, dDT, dU, dI)
print "eta (flux) = ", Eta_flux, " +- ", dEta_flux
for i in range(len(F)):
P.append(puiss(F[i], R, w[i], a[i]))
dP.append(errPuiss(F[i], R, w[i], a[i], dF[i], dR, dw[i], da[i]))
M.append(couple(F[i], R, a[i]))
dM.append(errCouple(F[i], R, a[i], dF[i], dR, da[i]))
Eta.append(rend_emp(P[i], U, I))
dEta.append(errRend_emp(P[i], U, I, dP[i], dU, dI))
print "puissance =", P[i], " +- ", dP[i]
print "Eta =", Eta[i], " +- ", dEta[i]
out_table = open("mesure1.dat", 'w')
out_table.write("%s %s %s %s %s %s\n" % ("w", "dw", "M", "dM", "Eta", "dEta"))
for i in range(len(P)):
out_table.write("%f %f %f %f %f %f\n" % (w[i], dw[i], M[i], dM[i], Eta[i] * 100, dEta[i] * 100))
out_table.close()

Event Timeline