Beispiel #1
0
def cal_T(fille, visco, fillvol, l, h):
    ## CALIBRATE TORQUE READINGS
    st, mus, sp_rpms, sp_rads, gam_dot, tau, T, cu, vo, pe, Ts, sn_rpms, pv = calc_T(
        fille, fillvol, visco)

    x = pe[l:h]
    y = T[l:h]
    f, feqn, __ = fit_line(x, y, 1, "I_{ms}", "Ts")

    return x, y, f, feqn, sp_rpms[l:h], sn_rpms[l:h], pv[l:h], cu[l:h], T[
        l:h], st[l:h]
Beispiel #2
0
# Remove unwanted outlying data
min_l = 0  #10000
max_l = -1
skip = 1  #0000
cr = cr[min_l:max_l:skip]
crf = crf[min_l:max_l:skip]
cul = cul[min_l:max_l:skip]

crstd = np.std(cr)
crfstd = np.std(crf)

# Set up figure
f = plt.figure(figsize=(8, 8))
ax = f.add_subplot(111)

# Plot data and trendline: CRF vs CU
fit, fit_eqn, coeffs = fit_line(crf, cul, 1, x_name="V_{HES}", y_name="I_{ms}")

ax.errorbar(crf, cul, xerr=crfstd, marker='o', linestyle='None', color=(0,0,1,0.75), label="$Filtered\ HES\ Reading$")
ax.plot(crf, fit, 'g-', label=fit_eqn)

ax.set_xlabel("\n $V_{HES},\ Current\ Sensor\ Voltage,\ V$", ha='center', va='center', fontsize=24)
ax.set_ylabel("$I_{ms},\ Supply\ Current,\ A$\n", ha='center', va='center', fontsize=24)

plt.legend(loc=4)

plt.grid(which='both', axis='both')
plt.savefig("./fig_dual_hes_cal.png")
plt.close(f)

Beispiel #3
0
omega_maxeff_rpm = 2830.0
Ims_maxeff_A = 0.093
alt_kt = (T_maxeff_Nm * R) / (Vms_maxeff_V - (ke * omega_maxeff_rpm))

tol = 0.005
if ((1 - tol) * kt < alt_kt) and ((1 + tol) * kt > alt_kt):
    print "Calculated characteristic coefficients (+/- {} %)".format(tol * 100)
    print "\tke:", ke
    print "\tkt:", kt
else:
    print "Could not accurately calculate the motor characteristics!"
    exit()

T = kt * current

__, __, coeffs  = fit_line(omega, T, 2)
print coeffs

f = plt.figure()
plt.suptitle(ln)


fit = 0
for i in range(0, len(coeffs)):
    fit += coeffs[i] * (omega ** (len(coeffs) - 1 - i))


ax = f.add_subplot(111) #RCX
ax.plot(omega, T)
#ax.plot(omega, (np.e ** fit))
ax.plot(omega, fit)
Beispiel #4
0
    plt.grid(which='both', axis='both')
    plt.savefig("./fig_torque_cal.png")
    plt.close(f)

    ## CHECK CALIBRATION
    st, sp, tau, gam_dot, mu, av, cr, sn, pe, T = calc_v(
        "./../../logs/glycerol_long_sweep.csv", 15)
    #st, sp, tau, gam_dot, mu, av, cr, sn, pe, T = calc_v("./../../logs/glycerol_long_sweep.csv", 15)
    f = plt.figure(figsize=(8, 8))
    ax = f.add_subplot(111)

    # Plot data
    ax.plot(gam_dot[l:h], tau[l:h])

    # Get fit line
    fit, fit_eqn, coeffs = fit_line(gam_dot[l:h], tau[l:h], 1, "gamma", "tau")

    # Plot fit line
    ax.plot(gam_dot[l:h],
            fit,
            'g--',
            label="$Gradient = {:.7f}$".format(coeffs[0]))

    ax.set_xlabel("\n $Strain\ Rate,\ s^{-1}$",
                  ha='center',
                  va='center',
                  fontsize=24)
    ax.set_ylabel("$Shear\ Stress,\ Pa$\n",
                  ha='center',
                  va='center',
                  fontsize=24)
Beispiel #5
0
                min(cvf1(crmc3[i]), cvf2(cr2amc3[i]), cvf2(cr2bmc3[i])))

sv = vsvf(pv)

# Chop off outlying data
start = 10000
stop = -1
skip = 2500

sv = sv[start:stop:skip]
cu = cu[start:stop:skip]
custd = custd[start:stop:skip]

fit, fiteqn, icoilcoeffs = fit_line(sv,
                                    cu,
                                    1,
                                    x_name="V_{ms}",
                                    y_name="I_{coil}")

f = plt.figure(figsize=(8, 8))
ax = f.add_subplot(111)

ax.errorbar(sv,
            cu,
            yerr=custd,
            linestyle='None',
            marker='o',
            label="$Read\ data$")
ax.plot(sv, fit, label=fiteqn)

ax.set_xlabel("\n $V_{ms},\ Supply\ Voltage,\ V$",
Beispiel #6
0
    Tss = [
        np.average(Ts9873),
        np.average(Ts9623),
        np.average(Ts9375),
        np.average(Ts8887)
    ]
    Tstd = [np.std(Ts9873), np.std(Ts9623), np.std(Ts9375), np.std(Ts8887)]

    cuf = cus
    Tsf = Tss

    cuf = [cus[0], cus[1], cus[3]]
    Tsf = [Tss[0], Tss[2], Tss[3]]

    outp, fiteqn, eff = fit_line(cuf, Tsf, 1, x_name="I_{ms}", y_name="T")

    f = plt.figure(figsize=(8, 8))
    ax = f.add_subplot(111)
    ax.errorbar(cus,
                Tss,
                xerr=custd,
                yerr=Tstd,
                marker='o',
                linestyle='None',
                label="$Calulated\ Torque$")
    ax.plot(cuf, outp, label=fiteqn)
    ax.set_xlabel("\n $Current,\ A$", ha='center', va='center', fontsize=24)
    ax.set_ylabel("$Torque,\ N.m$\n", ha='center', va='center', fontsize=24)
    plt.legend(loc=2)
    plt.grid(which='both', axis='both')
    fit += z[i] * (xl**(len(z) - 1 - i))
    if z[i] < 0:
        cf_str = "{:.3f}".format(z[i])
    else:
        cf_str = "+{:.3f}".format(z[i])
    if (len(z) - 1 - i) > 1:
        fit_eqn += " {} \\times I_{}^{}".format(
            cf_str, "{ms}", "{" + str((len(z) - 1 - i)) + "}")
    elif (len(z) - 1 - i) == 1:
        fit_eqn += " {} \\times I_{}".format(cf_str, "{ms}")
    else:
        fit_eqn += " {}".format(cf_str)

fit_eqn += "$"

fit, fit_eqn, __ = fit_line(cu, st, 1, "I_{ms}", "Ts")

# Plot data and trendline
ststd = np.std(st)
ax.errorbar(cu,
            st,
            yerr=ststd,
            marker='o',
            linestyle='None',
            label="$Read\ Data$")
ax.plot(cu, fit, 'g-', label=fit_eqn)

ax.set_xlabel("\n $I_{ms},\ Current\ Supply,\ A$",
              ha='center',
              va='center',
              fontsize=24)