Type: | Package |
Title: | Tool-Kit for Dynamic Materials Model and Thermal Processing Maps |
Version: | 0.1.6 |
Date: | 2024-10-01 |
Description: | Provides a simple approach for constructing dynamic materials modeling suggested by Prasad and Gegel (1984) <doi:10.1007/BF02664902>. It can easily generate various processing-maps based on this model as well. The calculation result in this package contains full materials constants, information about power dissipation efficiency factor, and rheological properties, can be exported completely also, through which further analysis and customized plots will be applicable as well. |
License: | GPL-3 |
URL: | https://github.com/CubicZebra/TPMplt |
BugReports: | https://github.com/CubicZebra/TPMplt/issues |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.2.3 |
Imports: | VBTree, methods, ggplot2, metR, rgl, e1071, grDevices, graphics, stats, utils, RColorBrewer, dlm |
Depends: | R (≥ 2.10) |
Suggests: | testthat, knitr, rmarkdown |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2024-10-01 07:23:45 UTC; Chen |
Author: | Chen Zhang |
Maintainer: | Chen Zhang <chen.zhang_06sept@foxmail.com> |
Repository: | CRAN |
Date/Publication: | 2024-10-01 13:20:05 UTC |
Read multiple files exported from Thermec Master-Z tester
Description
Read data from multiple files with structurized file names, then generate a summary table. It will also be available for the files from other tester apparatus by correct setting.
Usage
API4TMZ(Cdl, wd, ftype = ".csv", Straincln = 7, Stresscln = 8, startrow = 29)
Arguments
Cdl |
An handmade double list to determine selected conditions. |
wd |
Work directory. |
ftype |
File type to be read. Default value is ".csv". |
Straincln |
An integer to specify column for Strain in your data. Default value is 7 means the 7th column contains strain data, in the files exported from Thermec Master-Z tester. |
Stresscln |
An integer to specify column for Strain in your data. Default value is 8 means the 8th column contains stress data, in the files exported from Thermec Master-Z tester. |
startrow |
An integer to ignore the prefix rows for testing conditions. Default value is 29. |
Value
A matrix-like summary table for all input files.
Examples
variable1 <- c("factor11", "factor12", "factor13")
variable2 <- c("factor21", "factor22")
variable3 <- c("factor31", "factor32", "factor33", "factor34")
conditions <- list(variable1, variable2, variable3)
## Not run:
SummaryTable <- API4TMZ(conditions, "/Your_Data_Directory/")
## End(Not run)
Tool-Kit for Dynamic Materials Model and Thermal Processing Maps
Description
Provides a simple approach for constructing dynamic materials modeling (DMM) suggested by Prasad and Gegel. It can easily generate various processing-maps based on this model as well. The calculation result in this package contains full materials constants, information about power dissipation efficiency factor, and rheological properties, can be exported completely also, through which further analysis and customized plots will be applicable as well.
Details
Input data should be of the data frame with "VBTree" style. Full calculation result returned from the function DMMprocess builds the dynamic material model. 2D and 3D thermal processing-maps can be generated based on this model. 2D plots are built using ggplot2 while 3D plots are constructed by rgl. Especially, 3D plots will separately generate two 3D surfaces, for power dissipation efficiency eta, and rheological stability coefficient xi, respectively.
Author(s)
Chen Zhang
Maintainer: Chen Zhang <chen.zhang_06sept@foxmail.com>
References
Prasad, YVRK, Gegel, HL, Doraivelu, SM, Malas, JC, Morgan, JT, Lark, KA & Barker, DR (1984). Modeling of dynamic material behavior in hot deformation: forging of Ti-6242. Metallurgical Transactions A, 15, 1883-1892.
Prasad, YVRK, Rao, KP & Sasidhar, S (2015). Hot working guide: a compendium of processing maps. ASM international
See Also
Examples
# Check the factors in column names of input data:
# Note: Temperature in layer2, Strain Rate in layer3.
require(VBTree)
vbt <- dl2vbt(chrvec2dl(colnames(TPMdata)))
vbt
# Export Strain Rate-Temperature table based on
# given strain condition (epsilon):
epstable <- epsExtract(TPMdata, 0.7, 2, 3)
# Build dynamic materials model (DMM) from Strain
# Rate-Temperature table:
DMM <- DMMprocess(epstable)
# Choose regression method for plots:
PLTbd <- SVRModel(DMM)
# 2D processing-map through selected regression method:
TPM2dplt(PLTbd)
# 3D processing-map through selected regression method:
TPM3dplt(PLTbd)
Dynamic material modeling from strain rate temperature table
Description
Dynamic material modeling based on strain rate-temperature table returned from
the function epsExtract
. Material constants as well as power
dissipation efficiency factors and rheological stability coefficients in current conditions
will be returned.
Usage
DMMprocess(
x,
lgbase = 10,
InteractMode = FALSE,
ConsFunc = FALSE,
legendcex = 0.65,
legendloc = "bottomright"
)
Arguments
x |
A strain rate-temperature table, returned from |
lgbase |
A numeric value to specify the base of the logarithm calculations for processing map. The default value uses 10. |
InteractMode |
A boolean value to control figures' output and the printout of related constants during calculations. Default value FALSE means all fitting plots will not be outputed. If these outputs are necessary, set this parameter as TRUE then follow the prompt messages. |
ConsFunc |
A boolean value to determine whether calculating for constructive equation. The default value uses FALSE. |
legendcex |
A numeric value to determine the legend scale. It is activated only when the parameter InteractMode is TRUE. The default value is 0.65. |
legendloc |
A character object to determine the location of legend. It is activated only when the parameter InteractMode is TRUE. The defualt value is "bottomright". |
Value
Serial material constants, constructive function, eta table and xi table through dynamic material model developed by Gegel and Prasad.
See Also
Examples
require(VBTree)
dl2vbt(chrvec2dl(colnames(TPMdata)))
epstable <- epsExtract(TPMdata, 0.7, 2, 3)
# Without calculation for constitutive equation
DMM <- DMMprocess(epstable)
message(DMM)
# Calculating for constitutive equation but
# Without plots printout.
DMM <- DMMprocess(epstable, ConsFunc=TRUE)
message(DMM)
# Calculating for constitutive equation and
# required fitting plots printout. (message and selection in prompt)
## Not run:
DMMprocess(epstable, InteractMode=TRUE, ConsFunc=TRUE)
## End(Not run)
Enhanced Kalman filter to reduce the noise of raw data
Description
Kalman filter reducing the noise in raw data if it is necessary.
Usage
KFprocess(x, manual = NULL, ...)
Arguments
x |
A data frame with |
manual |
An integer vector with the length of 3 where the 1st element denotes the layer for Stress and
Strain, the 2nd and 3rd elements represent the levels for Strain and Stress, respectively. The default setting is
NULL, which can call the function |
... |
The arguments dV and dW passed on to |
Value
A data frame with the identical shape as input data, but with the smoothed stress values.
See Also
Examples
# raw data without smoothing:
SSplots(TPMdata, 2, mfrow=c(2, 2))
# Smoothing to reduce the noise:
KFdt <-KFprocess(TPMdata, dV = 0.3, dW = 0.006)
SSplots(KFdt, 2, mfrow=c(2, 2))
Make grid mesh for plots
Description
Make a grid for ploting thermal processing map.
Usage
MakeGrid(x, seqby = 80)
Arguments
x |
A calculation result returned from the function |
seqby |
A numeric value to specify the grid density. The default value used is 80, namely the default mesh used 80*80 for original plot. |
Value
A grid table with the ranges for logarithm strain rate and temperature.
Examples
epstable <- epsExtract(TPMdata, 0.7, 2, 3)
DMM <- DMMprocess(epstable)
prdptr <- MakeGrid(DMM)
prdptr
Automatic completion for Stress-Strain plots
Description
Automatic completion for Stress-Strain plots
Usage
SSplots(x, grpby, manual = NULL, legendscale = 0.7, ...)
Arguments
x |
A data frame with |
grpby |
Layer for variables to be grouped. |
manual |
A positive integer vector with length 3. The first value is layer for Stress and Strain, the sencond value
is for Strain's level in this layer, and the third is Stress's level. Default setting is NULL, to call
|
legendscale |
A positive value to determine the scale of legend. Default value is 0.7 |
... |
Arguments be passed to |
Value
Multiple Stress-Strain plots according to specified group methods.
Examples
require(VBTree)
# Find locations for temperature and strain rate:
# temperature in layer2, strain rate in layer3;
# Strain in layer1 level1, Stress in layer1 level2.
dl2vbt(chrvec2dl(colnames(TPMdata)))
# Attention: Zoom your Plots panes large enough to ensure
# correct output!
# Plot multiple Stress-Strain curves, grouped by strain rate:
SSplots(TPMdata, 3, mfrow=c(3, 3))
# Plot multiple Stress-Strain curves, grouped by temperature:
SSplots(TPMdata, 2, mfrow=c(2, 2))
# Manual setting, for Stress-Stain plots:
SSplots(TPMdata, 2, manual=c(1, 1, 2), mfrow=c(2, 2))
Build support vector regression result
Description
Return a table with continuous values for eta and xi, based on prediction built by support vector regression model (SVR). The kernel function in SVR is radial basis.
Usage
SVRModel(x, seqby = 80)
Arguments
x |
The calculation result returned from the function |
seqby |
A numeric value to specify the grid density. Default value is 80, namely the default mesh for original plot uses 80*80. |
Value
A data frame including continuous values for eta and xi, calculated based on the discrete values for
eta and xi returned from DMMprocess
. The strain condition in current calculation
is also included.
See Also
Examples
epstable <- epsExtract(TPMdata, 0.7, 2, 3)
DMM <- DMMprocess(epstable)
PLTbd <- SVRModel(DMM)
PLTbd
Adiabatic heating effect correction
Description
Adiabatic heating effect correction
Usage
TCorrect(
x,
lyT,
lySR,
eta,
rho,
c,
StrainSeq,
ACorrect = 1,
manual = NULL,
Amplifier = 1000
)
Arguments
x |
A data frame with |
lyT |
An integer to specify the layer for temperature attribute in the vector binary tree. |
lySR |
An integer to specify the layer for strain rate attribute in the vector binary tree. |
eta |
Efficiency of deformation heating. |
rho |
Density of materials, unit is g/cm^3. |
c |
Heat capacity of materials, unit is J/(kg*K). |
StrainSeq |
A vector to specify the sequence for flow strain. |
ACorrect |
Coefficient to modify for density or heat capacity using different units. Default value is 1. |
manual |
An integer vector with the length of 3 where the 1st element denotes the layer for Stress and Strain,
the 2nd and 3rd elements represent the levels for Strain and Stress, respectively. The default setting is NULL, which
can call the function |
Amplifier |
Amplifier for linear fitting. Default value is 1000. |
Value
A data frame with VBTree
style including the adiabatic heating corrected
flow stress using the StrainSeq as conditions.
Examples
# Constants of steels as example:
dt_TC <- TCorrect(TPMdata, 2, 3, 0.9, 7.8, 502.416, seq(0, 0.9, 0.005))
# Data without adiabatic heating correction
SSplots(TPMdata, 2, mfrow=c(2, 2))
# Data with adiabatic heating correction
SSplots(dt_TC, 2, mfrow=c(2, 2))
Read multiple files exported from Thermec Master-Z tester
Description
Read data from multiple files with structurized file names, then generate a summary data frame. It will also be available for the files from other tester apparatus by correct setting.
Usage
TMZdatainput(makeidx = FALSE, ...)
Arguments
makeidx |
A boolean value to control the index column, inserted in the first column. Default setting is FALSE. |
... |
Arguments to be passed to |
Value
A summary data frame for all input files.
Examples
variable1 <- c("factor11", "factor12", "factor13")
variable2 <- c("factor21", "factor22")
variable3 <- c("factor31", "factor32", "factor33", "factor34")
conditions <- list(variable1, variable2, variable3)
## Not run:
SummaryTable <- TMZdatainput(Cdl=conditions, wd="/Your_Data_Directory/")
## End(Not run)
Plot 2d thermal process maps
Description
Plot a 2d thermal process maps: logarithm strain rate as y axis while celsius temperature as x axis. Contours denotes the power dissipation efficiency factor, while the background with gradual colors represents rheological stability.
Usage
TPM2dplt(x, xloc = 0.09, yloc = 0.03, clrctrl = rev(rainbow(7))[-1])
Arguments
x |
Regression results from modeling functions such as |
xloc |
Location for annotatin in x axis. The default value is 0.09. |
yloc |
Location for annotatin in y axis. The default value is 0.03. |
clrctrl |
Colour vector to control eta background, the default value uses rainbow palette. |
Value
A 2d thermal processing-map with logarithm strain rate as its y axis while celsius temperature as its x axis. Strain conditon is showed in top-left in the figure. Power dissipation efficiency factor eta is denoted by gradient blue contours, and the rheological stability coefficient are represented by gradient background.
Examples
epstable <- epsExtract(TPMdata, 0.7, 2, 3)
DMM <- DMMprocess(epstable)
PLTbd <- SVRModel(DMM)
TPM2dplt(PLTbd)
Plot 3d thermal processing-maps
Description
Return a 3d thermal process result consisted of 3d surfaces for power dissipation efficiency eta and rheological stability coefficient xi respectively.
Usage
TPM3dplt(x, dvs = 5, etaclr = "heat", xiclr = "cm")
Arguments
x |
Regression results from modeling functions such as |
dvs |
A positive integer to set the divisions for x, y and z labels in two 3d surface plots. The default value is 5. |
etaclr |
Colour control for eta. Optional value are "rainbow", "heat", "terrain", "topo" and "cm". "heat" is default value. |
xiclr |
Colour control for xi. Optional value are "rainbow", "heat", "terrain", "topo" and "cm". "cm" is default value. |
Value
Two 3d surface plots: the left one denotes power dissipation efficiency factor eta, while the right one is for rheological stability xi. A zero plane, z=0, for xi value is added in the right plots for determining unstable region.
Examples
epstable <- epsExtract(TPMdata, 0.7, 2, 3)
DMM <- DMMprocess(epstable)
PLTbd <- SVRModel(DMM)
TPM3dplt(PLTbd)
A test data structurized column names.
Description
A test data with 56 different columns.
Usage
TPMdata
Format
A data frame with 3939 rows and 56 columns
Details
* 'data type': numeric values, for Strain or Stress.
* 'temperature': from 900 to 1200 celsius, with 50 degrees interval.
* 'strain rate': from slow to speedy: 0.001, 0.01, 0.1, 1.
* 'working rate': 60 percent only.
Calculating the adiabatic heating effect.
Description
Calculating the adiabatic heating effect.
Usage
T_get(x, eta1, rho1, c1, ACorrect1 = 1, manual1 = NULL)
Arguments
x |
A data frame with |
eta1 |
Efficiency of deformation heating. |
rho1 |
Density of materials, unit is g/cm^3. |
c1 |
Heat capacity of materials, unit is J/(kg*K). |
ACorrect1 |
Coefficient to modify for density or heat capacity using different units. Default value is 1. |
manual1 |
An integer vector with the length of 3 where the 1st element denotes the layer for Stress and Strain,
the 2nd and 3rd elements represent the levels for Strain and Stress, respectively. The default setting is NULL, which
can call the function |
Value
A data frame with the identical shape as input data. The values of stress was replaced by adiabatic heating effect.
Examples
# Constants of steels as example:
T_get(TPMdata, 0.9, 7.8, 502.416)
3D plots without labels
Description
3D plots without labels
Usage
basic3d(
x,
gain = 100,
division = 5,
clrctrl = c("heat", "terrain", "topo", "cm", "rainbow"),
zeroplane = TRUE
)
Arguments
x |
An "PLTbuilder" object. |
gain |
A positive integer to gain gradual colours. Default value is 100. |
division |
Subdivision numbers for x, y and z axises. |
clrctrl |
Color control. Optinal value are "rainbow", "heat", "terrain", "topo" and "cm". |
zeroplane |
Boolean value to control for adding the plane of z=0. Default setting is TRUE. |
Value
A surface 3d plot.
Examples
epstable <- epsExtract(TPMdata, 0.7, 2, 3)
DMM <- DMMprocess(epstable)
PLTbd <- SVRModel(DMM)
PLT3dbd <- surfacebld(PLTbd, "eta")
basic3d(PLT3dbd, clrctrl="cm")
Auto output for strain rate vs. temperature table
Description
Automatically output the strain rate vs. temperature table, by a specified strain condition.
Usage
epsExtract(data, eps, lyT, lySR, manual = NULL)
Arguments
data |
A data frame with |
eps |
A numeric value to specify strain condition. |
lyT |
An integer to specify the layer for temperature attribute in the vector binary tree. |
lySR |
An integer to specify the layer for strain rate attribute in the vector binary tree. |
manual |
An integer vector with the length of 3 where the 1st element denotes the layer for Stress and Strain,
the 2nd and 3rd elements represent the levels for Strain and Stress, respectively. The default setting is NULL, which
can call the function |
Value
A list consist of a matrix table arranged by rows for strain rates while columns for temperatures, and a numeric value as strain condition for this strain rate-temperature table.
See Also
Examples
require(VBTree)
# Find locations for temperature and strain rate:
dl2vbt(chrvec2dl(colnames(TPMdata)))
epsExtract(TPMdata, eps = 0.7, lyT = 2, lySR = 3)
Tidy eta table for further process
Description
Tidy the table of power dissipation efficiency factor eta, with different logarithm strain rates and temperature for further analysis, based on the given dynamic material model.
Usage
etatidy(x)
Arguments
x |
A calculation result returned from the function |
Value
A matrix with melted temperatures, logarithm strain rates and values of power dissipation factor in respective columns.
See Also
Examples
epstable <- epsExtract(TPMdata, 0.7, 2, 3)
DMM <- DMMprocess(epstable)
etaM <- etatidy(DMM)
etaM
Detecting locations for Strain and Stress
Description
Function for detecting the locations for Strain and Stress in data frame. It is an key component for automatic
completion in the function of epsExtract
.
Usage
lyIDdetector(data, patterns = "[Ss][Tt][Rr]")
Arguments
data |
A data frame with |
patterns |
A regex object to determine layer of Strain and Stress. The default pattern uses "[Ss][Tt][Rr]". |
Value
A list consisted of the layer, and the levels in this layer for Strain and Stress respectively.
See Also
Examples
require(VBTree)
chrvec2dl(colnames(TPMdata))
lyIDdetector(TPMdata)
Build matrix for 3D plots
Description
Build matrix for 3D plots
Usage
surfacebld(x, grp = c("eta", "xi"))
Arguments
x |
An "PLTbuilder" object. |
grp |
"eta" or "xi" to determine which group is extracted as the subset. |
Value
A matrix for 3d surface plot.
Examples
epstable <- epsExtract(TPMdata, 0.7, 2, 3)
DMM <- DMMprocess(epstable)
PLTbd <- SVRModel(DMM)
surfacebld(PLTbd, "eta")
Tidy xi table for further process
Description
Tidy the table of xi values, with different logarithm strain rates and temperatures for further analysis, based on the given dynamic material model.
Usage
xitidy(x)
Arguments
x |
A calculation result returned from the function |
Value
A matrix with melted temperatures, logarithm strain rates and values of xi values in respective columns.
See Also
Examples
epstable <- epsExtract(TPMdata, 0.7, 2, 3)
DMM <- DMMprocess(epstable)
xiM <- xitidy(DMM)
xiM