Package 'TPMplt'

Title: Tool-Kit for Dynamic Materials Model and Thermal Processing Maps
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.
Authors: Chen Zhang [aut, cre, cph] , Huakang Bian [ctb], Kenta Yamanaka [ths] , Akihiko Chiba [ths]
Maintainer: Chen Zhang <[email protected]>
License: GPL-3
Version: 0.1.6
Built: 2025-02-28 03:47:28 UTC
Source: https://github.com/cubiczebra/tpmplt

Help Index


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 <[email protected]>

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

VBTree, ggplot2, rgl

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)

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)

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 epsExtract.

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

VBTree, epsExtract

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)

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 VBTree style. Pay attention, all factors in column names should be separated by "-" symbol, and factors for temperatures and strain rates should be saved in pure numeric style.

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 lyIDdetector for automatical completion this vector.

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

VBTree, lyIDdetector

Examples

require(VBTree)
# Find locations for temperature and strain rate:
dl2vbt(chrvec2dl(colnames(TPMdata)))
epsExtract(TPMdata, eps = 0.7, lyT = 2, lySR = 3)

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 VBTree style. Pay attention, all factors in column names should be separated by "-" symbol, and factors for temperatures and strain rates should be saved in pure numeric style.

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 lyIDdetector for automatic completion.

...

The arguments dV and dW passed on to dlmModPoly in the function dlmSmooth.

Value

A data frame with the identical shape as input data, but with the smoothed stress values.

See Also

VBTree, dlmModPoly, dlmSmooth

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))

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 VBTree style. Pay attention, all factors in column names should be separated by "-" symbol, and factors for temperatures and strain rates should be saved in pure numeric style.

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

VBTree, TPMplt

Examples

require(VBTree)
chrvec2dl(colnames(TPMdata))
lyIDdetector(TPMdata)

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 VBTree style. Pay attention, all factors in column names should be separated by "-" symbol, and factors for temperatures and strain rates should be saved in pure numeric style.

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 lyIDdetector automatically fill this argument.

legendscale

A positive value to determine the scale of legend. Default value is 0.7

...

Arguments be passed to par for plots arrangements. mfrow and mfcol are recommanded.

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 DMMprocess.

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

DMMprocess

Examples

epstable <- epsExtract(TPMdata, 0.7, 2, 3)
DMM <- DMMprocess(epstable)
PLTbd <- SVRModel(DMM)
PLTbd

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 VBTree style. Pay attention, all factors in column names should be separated by "-" symbol, and factors for temperatures and strain rates should be saved in pure numeric style.

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 lyIDdetector for automatical completion this vector.

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)

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 VBTree style. Pay attention, all factors in column names should be separated by "-" symbol, and factors for temperatures and strain rates should be saved in pure numeric style.

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 lyIDdetector for automatical completion this vector.

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 API4TMZ.

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 SVRModel.

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 SVRModel.

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)