Taylor's tool life equation¶
Taylor's tool life equation describes the relationship between tool life (T) and cutting speed (Vc) in a given metal cutting process and assumes we keep all other parameters constant. $$ Vc*T^n=C $$ n and C are constants and can be solved with linear algebra linearizing the previous expression. $$ log(Vc)+nlog(T)=log(C) $$
We start by making our imports and import our dummy data set.
In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib.ticker as ticker
from matplotlib.lines import Line2D
df = pd.read_csv('data.csv')
print(df)
Linear least squares¶
Now we can solve n and C with the linear least squares.
More reading on linear least squares here: Wikipedia link
In [2]:
# Tool life, list of values
T = df['T'].to_list()
# A-matrix
T = np.log(T)
Tx = []
for i in range(len(T)):
Tx.append(-1)
A = np.matrix([T, Tx]).transpose()
# Vc, list of values
vc = df['Vc'].to_list()
# b-vector
b = np.matrix(vc).transpose()
b = -np.log(b)
# For an easy-to-read expression
M = np.linalg.inv(A.transpose()*A)
N = A.transpose()*b
# x = [n, CT]
x = M*N
n = x[0, 0]
Ct = x[1, 0]
# x_range corresponds to the tool life range that we will plot, y is the cutting speed
x_range = np.arange(10, 61, 1)
y = np.exp(Ct)*(x_range**-n)
# Make a new dataframe of our regression model
df_reg = pd.DataFrame({
'Vc': y,
'T': x_range
})
Plotting¶
Plotting of the data and the linear regression.
In [3]:
fig, ax = plt.subplots()
sns.lineplot(data=df_reg, x='T', y='Vc', color='#EE8F00', ls='--')
sns.scatterplot(data=df, x='T', y='Vc', color='#001D7A')
# Define our formatter
formatter = ticker.ScalarFormatter(useOffset=False)
formatter.set_scientific(False)
# Format x-axis
plt.xscale('log')
plt.xlabel('Tool life (min)')
ax.xaxis.set_major_formatter(formatter)
ax.xaxis.set_minor_formatter(formatter)
ax.xaxis.set_major_locator(ticker.MultipleLocator(10))
ax.xaxis.set_minor_locator(ticker.MultipleLocator(1))
ax.xaxis.set_minor_formatter(ticker.NullFormatter())
# Format y-axis
plt.yscale('log')
plt.ylabel('Cutting speed (m/min)')
ax.yaxis.set_major_formatter(formatter)
ax.yaxis.set_minor_formatter(formatter)
ax.yaxis.set_major_locator(ticker.MultipleLocator(100))
ax.yaxis.set_minor_locator(ticker.MultipleLocator(10))
ax.yaxis.set_minor_formatter(ticker.NullFormatter())
# Grid lines
ax.grid(which='major', linewidth=0.2, color='black', alpha=0.4)
# Legend
legend_label = f'Fit for $Vc*T^n=C$\nn={round(n, 3)}\nC={int(np.exp(Ct))}'
legend_elements = [Line2D([0], [0], label=legend_label, color='#EE8F00', lw=2, ls='--')]
ax.legend(handles=legend_elements)
Out[3]: