Information of Source Codes

Classes with properties, methods and functions with arguments, variables are explained.

Main

cylindrical_grinding.calc()

Class: Grinding

@grinding.analyze_data(obj)

Collect results of grinding.

Input args

None

Output args

None

Imported files

grain_past_record.txt(whole)

Calling

grinding.save_MRR grinding.save_depth_of_cut

@grinding.anim_matdata(obj)

Create animation of material removal.

Input args

None

Output args

None

Imported files
Generated files
Called from
@grinding.backCalc_pos(obj, frame_num)

Calculate rotation angle and translation of grinding wheel

Input args

frame_num

current frame number from the start of the simulation.

Output args

result

vector [axisDirection axisPoint rotangle trans] whose size is 8 x 1.

@grinding.backCalc_pos_wp(obj, frame_num)

Calculate rotation angle and translation of workpiece at specific frame.

Input args

frame_num

current frame number from the start of the simulation.

Output args

result vector

[axisDirection axisPoint rotangle] whose size is 7 x 1.

axisDirection

Direction of axis (3 x 1).

axisPoint

A point on the rotational axis of the workpiece (3 x 1).

rotangle

Rotation angle of the workpiece (rad)

Called from
@grinding.calc_AbrasiveMachining_PyramidVer(obj)

Calculation of material removal. Before calling machining method, the workpiece is divided into subsections to enable the parallel calculation. Further increase of calculation speed is necessary.

Input args

None

Output args

None

Imported files

matdata_OOO.mat

Generated files

0.mat

Calling
@grinding.calc_GrainHeat(obj)

Calculate heat generation at each grit.

Input args

None

Output args

None

Imported Files

grain_past_record.txt(whole) MRR_OOO.txt depth_of_cut_OOO.txt graindata_OOO.txt

Generated Files

heatdata_OOO.txt

Calling

grinding.calc_pri_r grinding.calc_sec_r grinding.calc_c grinding.calc_pl

@grinding.calc_c(obj, MRR)

Calculate heat for cutting.

Input args === ========= MRR removed volume of material. === =========

Output args === ========= Q_c heat generated by cutting. === =========

Called from
@grinding.calc_contact_location_tl(obj, frame_num)

Calculate the rough location of contact on grinding wheel in the initial coordinate to extract nodes. This will be helpful to extract nodes from the entire tool nodes.

Input args
frame_num

current frame number from the start of the simulation.

Output args
rog_ini

region of grinding(1x3) in the initial coordinate system.

@grinding.calc_contact_location_wp(obj, frame_num)

Calculate the rough location of contact on workpiece in the initial coordinate to extract nodes.This will be helpful to extract nodes from the entire workpiece nodes.

Input args

frame_num

current frame number from the start of the simulation.

Output args

rog_ini

region of grinding(1x3) in the initial coordinate system.

Calling

grinding.backCalc_pos_wp

@grinding.calc_grain_data(obj)

Calculate normal vector on surface of grinding wheel for each grit location.

Input arguments

None

Output arguments

None

Import files

grit_OOO.mat

Calling

grinding.save_grain_data

@grinding.calc_hmax(obj)

Calculate maximum depth of cut.

Input args

None

Output args

None

Imported files

grain_past_record.txt depth_of_cut_OOO.txt

Generated files

hmax_OOO_OOO.txt

@grinding.calc_pl(obj, MRR, alpha_deg)
Calculate heat for ploughing.

Input args ========= ================= MRR removed volume of material. alpha_deg deg of grain apex. ========= =================

Output args ==== ========= Q_pl heat generated by ploughing. ==== =========

Called from
@grinding.calc_pri_r(obj, grainnum, framenum_s, framenum_e, X_MIN, X_MAX, Y_MIN, Y_MAX)

Calculate heat for primary rubbing.

Input args

grainnum

id of grain.

framenum_s

framenum where grain starts machining.

framenum_e

framenum where grain ends machining.

X_MIN

Number used for directory name.

X_MAX

Number used for directory name.

Y_MIN

Number used for directory name.

Y_MAX

Number used for directory name.

Output args

Q_pri_r

heat generated by primary rubbing.

Imported Files
Called from
@grinding.calc_q_fine_timestep(obj)

Divide time step by 10 for finer calculation.

Input args

None

Output args

None

Imported files

heatdata_OOO.txt

Generated files

q_div_OOO_frame_OOO_OOO.txt

@grinding.calc_sec_r(obj, grainnum, depth_of_cut, framenum_s, framenum_e, X_MIN, X_MAX, Y_MIN, Y_MAX, alpha_deg)

Calculate heat for secondary rubbing.

Input args ============ ================== grainnum id of grain. depth_of_cut depth of cut of grain. framenum_s framenum where grain starts machining. framenum_e framenum where grain ends machining. X_MIN Number used for directory name. X_MAX Number used for directory name. Y_MIN Number used for directory name. Y_MAX Number used for directory name. alpha_deg deg of grain apex. ============ ==================

Output args ======= ========== Q_pri_r heat generated by secondary rubbing. ======= ==========

Imported Files
Called from
@grinding.calc_sum_MRR_heatdata(obj)

Calculate summation of removed volume and generated heat.

Input args

None

Output args

None

Imported files

grain_past_record.txt(whole) heatdata_OOO.txt MRR_OO.txt

Generated files

sum_MRR_OOO_OOO.txt sum_heatdata_OOO_OOO.txt

@grinding.calc_temperature_Pyramidver_for_loop(obj, minframe, maxframe, x_min, x_max, y_min, y_max, x_measuring, y_measuring, num_division)

Calculate temperature.

@grinding.calc_temperature_thermocouple_xy(obj)

Calculate temperature up to maxframe with finer time step.

Input args

None

Output args

None

Calling

grinding.calc_together_temperature_for_loop_for_thermocouple

@grinding.calc_together_for_anim(obj)

Create animation of material removal.

Input args

None

Output args

None

Calling

grinding.anim_matdata

@grinding.calc_together_temperature_for_loop_for_thermocouple(obj, minframe, maxframe, x_min, x_max, y_min, y_max, dx, dy, x_measuring_min, x_measuring_max, y_measuring_min, y_measuring_max, dx_measuring, dy_measuring, num_division)

Calculate temperature.

Input args

minframe

framenum where simulation starts.

maxframe

framenum wheresimulation ends.

x_min

Minimum X coordinate of the calculation region on the workpiece.

x_max

Maximum X coordinate of the calculation region on the workpiece.

y_min

Minimum Y coordinate of the calculation region on the workpiece.

y_max

Maximum Y coordinate of the calculation region on the workpiece.

dx

Width of the divided section of the workpiece surface in X direction.

dy

Width of the divided section of the workpiece surface in Y direction.

x_measuring_max

Maximum X coordinate of the temperature measuring points.

x_measuring_min

Minimum X coordinate of the temperature measuring points.

y_measuring_min

Minimum Y coordinate of the temperature measuring points.

y_measuring_max

Maximum Y coordinate of the temperature measuring points.

dx_measuring

Width of the divided section of the temperature measuring points in X direction.

dy_measuring

Width of the divided section of the temperature measuring points in Y direction.

num_division

Division of time used to calculate q and temperature.

Output args

None

Calling

grinding.extract_zpoint_Pyramidver grinding.calc_temperature_Pyramidver_for_loop grinding.link_temperature_Pyramidver

@grinding.check_folder(obj, xmin, xmax, ymin, ymax, X_MIN, X_MAX, Y_MIN, Y_MAX)

Check if folders exist. Unless they do not exist they are created.

Input args

xmin

Minimum X coordinate of the calculation region on the workpiece.

xmax

Maximum X coordinate of the calculation region on the workpiece.

ymin

Minimum Y coordinate of the calculation region on the workpiece.

ymax

Maximum Y coordinate of the calculation region on the workpiece.

X_MIN

Minimum X coordinate of the whole region on the workpiece.

X_MAX

Maximum X coordinate of the whole region on the workpiece.

Y_MIN

Minimum Y coordinate of the whole region on the workpiece.

Y_MAX

Maximum Y coordinate of the whole region on the workpiece.

Output args

None

@grinding.chk_rot_num_past(obj)

Check rotation number of the past calculation.

Imported files

rot_num_past

Generated files

None

@grinding.crt_gear(obj)

Create gear workpiece with pre-defined nodes resolution. Save nodes_info_master as “nodes_info_master.mat”.

Input args:

None

Output args:

None

Imported files:

None

Generated files:
nodes_info_master.mat

Name of variable is nodes_info_master. Whole nodes set representing the workpiece.

@grinding.crt_master_wheel(obj)

Create grinding wheel master model.

Input args

None

Output args

None

Imported files

None

Generated files
@grinding.crt_nodesinfo(obj)

Create nodes_info.txt and contact.txt (Workpiece)

Create initial “nodes_info” files

@grinding.crt_nodesinfo_cylindVer(obj)

Create nodes_info.txt and contact.txt (Workpiece, Cylindrical Grinding) Shape of workpiece is cylinder.

Input args:

None

Output args:

None

Imported files:
nodes_info_master.mat

Name of variable is nodes_info_master. Whole nodes set representing the workpiece.

Generated files:
nodes_infoOOO.mat

Name of the variable in this mat file is nodes_info_master. This includes partial nodes set representing the workpiece.

@grinding.crt_wheel(obj)

Create grit_OOO.mat for each time frame. The relative posture of wheel against workpiece is set in this method.

Imported files

mastertool_info_modified.mat

Generated files

None

Calling method

grinding.save_gritset

@grinding.delete_toolnodes_info(obj)

Delete toolnodes_info and so on of the previous rotation of workpiece.

Input args

None

Output args

None

Deleted files
  • toolnodes_info_OOO.mat

  • Files and subfolders under the directory ./pyramid/

  • Files and subfolders under the directory ./grit/

  • Files and subfolders under the directory ./grain_data/

@grinding.export_finished_rot(obj)

Save the current rot of the workpiece to the file rot_num_past. In addition, the “whole” folder is copied to the upper directory so that it is saved after running the calculation for the next rotation of workpiece.

Updated files

rot_num_past

@grinding.extract_close_grits(obj, framenum)

Extract grits that are close to the contact region.

Input args

None

Output args

None

Imported files
Generated files

None

Updated files
Calling
@grinding.extract_zpoint_Pyramidver(obj, x_min, x_max, y_min, y_max, dx, dy, x_measuring, y_measuring)

Extract height of the workpiece surface.

class @grinding.grinding

Bases: matlab.mixin.SetGet

Main class.

D_wp = None

diameter of workpiece(mm)

L_wp = None

length of workpiece (mm)

W_wp = None

width of workpiece (mm)

a = None

depth of removal (mm)

ang_offset_tl = None

Offset relative angle between workpiece and grinding wheel (rad).Called from grinding.trans_workpiece.

ang_rot_tl = None

Initial rotational angle of the wheel around the wheel center (rad)

angle_x_tl = None

xyz euler angle around x of the wheel (rad). Called from grinding.crt_wheel.

angle_x_wp = None

xyz euler angle around x of the workpiece (rad)

angle_y_tl = None

xyz euler angle around y of the wheel (rad). Called from grinding.crt_wheel.

angle_y_wp = None

xyz euler angle around y of the workpiece (rad)

angle_z_tl = None

xyz euler angle around z of the wheel (rad). Called from grinding.crt_wheel.

angle_z_wp = None

xyz euler angle around z of the workpiece (rad)

f = None

feed rate (mm/s)

f_mm_rot = None

axial feed (mm/revolution of workpiece)

filename_rot_num_past = None

file name for rot_num_past. The number of rotation of workpiece in the previous calculation.

grinding()

Grinding parameters Main grinding parameters

path = None

path to store data

res_reftl = None

average distance between nodes in reference wheel data (mm)

res_tl = None

W_tl {mustBeNumeric}%width of grinding wheel (mm)

res_wp = None

resolution of point cloud on workpiece (mm)

rot_num_past = None

Previous number of rotation of the workpiece. If this is the first calculation rot_num_past should be zero.

rot_offset_wp = None

Initial rotation of workpiece.

t_end = None

s

time_step = None

time step of calculation (s)

v = None

grinding speed (mm/s)

v_wp = None

rotate speed of workpiece(mm/s)

v_wp_no_feed = None

rotate speed of workpiece when axial feed is 0 mm/s (mm/s)

wheel_D = None

diameter of the wheel

wheel_d1 = None

ウォームの基準円直径, mm

wheel_gamma = None

基準円筒進み角, radian

wheel_h = None

tooth height

wheel_loc_init = None

initial wheel location (mm)

wheel_m_n = None

歯直角モジュール

wheel_n_starts = None

砥石の条数

wheel_p_angle_front = None

正面圧力角

wheel_p_angle_normal = None

歯直角圧力角

wheel_pitch = None

軸平面ピッチ, mm

wheel_thickness = None

D_tl {mustBeNumeric}%diameter of gridning wheel (mm)

wheel_w_bottom = None

width of tooth bottom

wp_base_d = None

grinding wheel properties

wp_height_focus = None

解析領域の高さ方向の幅

wp_loc_init = None

initial workpiece location (mm)

wp_max_d_focus = None

解析領域の最大半径

wp_pcd_normal = None

gear properties

x_max_wp = None

Maximum X coordinate of workpiece area.

x_min_wp = None

Minimum X coordinate of workpiece area.

y_max_wp = None

Maximum Y coordinate of workpiece area.

y_min_wp = None

Minimum Y coordinate of workpiece area.

@grinding.grit(obj, framenum)

Extract grits that are close to grinding region at each frame.

Input arguments

framenum

Current number of frame.

Output arguments

gritset

Size is number of grits in focus X 4. Structure is [ID of each grit, X_coordinate, Y_coordinate, Z_coordinate].

Imported files
Generated files

None

Called from
Calling
@grinding.interpolant_gearsurface_second_step(obj, framenum_specified, xmin, xmax, ymin, ymax, X_MIN, X_MAX, Y_MIN, Y_MAX)

Save sectioned point cloud of the workpiece surface before the grinding began.

Input args

framenum_specified

Specified frame number (=0).

xmin

Minimum X coordinate of the calculation region on the workpiece.

xmax

Maximum X coordinate of the calculation region on the workpiece.

ymin

Minimum Y coordinate of the calculation region on the workpiece.

ymax

Maximum Y coordinate of the calculation region on the workpiece.

X_MIN

Number used for directory name.

X_MAX

Number used for directory name.

Y_MIN

Number used for directory name.

Y_MAX

Number used for directory name.

Output args

None

Imported files
Generated files
Calling
  • ref

    grinding.save_machining_past_record<save_machining_past_record>

Input args

None

Output args

None

Imported files

grain_past_record.txt heatdata_OOO.txt

Generated files

heatdata_OOO.txt

Input args

None

Output args

None

Imported files

machining_past_record.txt

Calling

grinding.save_matdata

@grinding.machining(obj, framenum, x_min, x_max, y_min, y_max, dx, dy, dr)

Calculation of material removal.

Input args

framenum

Current frame number.

x_min

Minimum X coordinate of the calculation region on the workpiece.

x_max

Maximum X coordinate of the calculation region on the workpiece.

y_min

Minimum Y coordinate of the calculation region on the workpiece.

y_max

Maximum Y coordinate of the calculation region on the workpiece.

dx

Width of the divided section of the workpiece surface in X direction.

dy

Width of the divided section of the workpiece surface in Y direction.

dr

Margin to search for the grits near the grinding region.

Output args

None

Imported files
Generated files
Updated files
Calling
Called from:
@grinding.make_gritfile(obj)

Make files that include information of abrasive grits at each frame.

Input arguments

None

Output arguments

None

Imported files

None

Generated files

grit_OOO.txt

Calling

grinding.grit

@grinding.make_statistics_data(obj)

Configure protrusion and vertex angle for each grit. Generate random database.

Input args

None

Output args

None

Imported files

None

Generated files
@grinding.pcGen(obj, framenum)

Create point cloud of workpiece surface.

Input args

framenum

Number of current time frame.

Output args

None

Imported files
Generated files
@grinding.randomize(obj)

Randomize grits positions

Input args

None

Output args

None

Imported files
Generated files
@grinding.remake_grain_data(obj, threshold_z)

Modify the normal vector obtained in the function “calc_grain_data(obj)”. Coordinate transformation of grits to the fixed coordinate system on the rotating workpiece.

Input arguments

threshold_z

threshold_z

Output arguments

None

Imported files
Updated files
Calling
@grinding.rot_x(obj, angle_rad)

rotation matrix around X axis.

@grinding.rot_y(obj, angle_rad)

rotation matrix around Y axis.

@grinding.rot_z(obj, angle_rad)

rotation matrix around Z axis.

@grinding.save_MRR(obj, grain_past_record, X_MIN, X_MAX, Y_MIN, Y_MAX)

Save Material Removal Rate: MRR.

Input args

grain_past_record

Data in grain_past_record.txt(whole)

X_MIN

Number used for directory name.

X_MAX

Number used for directory name.

Y_MIN

Number used for directory name.

Y_MAX

Number used for directory name.

Output args

None

Imported files
Generated files
Called from
@grinding.save_data_Pyramid_Ver_ver3(obj, framenum, dx, dy, x_min, x_max, y_min, y_max, X_MIN, X_MAX, Y_MIN, Y_MAX)

Collect point cloud data surface before/after grinding and grain data.

Input args

framenum

Number of frame at current time

dx

Width of the divided section of the workpiece surface in X direction.

dy

Width of the divided section of the workpiece surface in Y direction.

x_min

Minimum X coordinate of the calculation region on the workpiece.

x_max

Maximum X coordinate of the calculation region on the workpiece.

y_min

Minimum Y coordinate of the calculation region on the workpiece.

y_max

Maximum Y coordinate of the calculation region on the workpiece.

X_MIN

Number used for directory name.

X_MAX

Number used for directory name.

Y_MIN

Number used for directory name.

Y_MAX

Number used for directory name.

Output args

None

Imported files
Generated files
Called from
@grinding.save_depth_of_cut(obj, grain_past_record, X_MIN, X_MAX, Y_MIN, Y_MAX, dx, dy)

Save depth of cut.

Input args

grain_past_record

Data in grain_past_record.txt(whole)

X_MIN

Number used for directory name.

X_MAX

Number used for directory name.

Y_MIN

Number used for directory name.

Y_MAX

Number used for directory name.

dx

Width of the divided section of the workpiece surface in X direction.

dy

Width of the divided section of the workpiece surface in Y direction.

Output args

None

Imported files
Generated files
Called from
@grinding.save_grain_data(obj, frame_num, grain_data)

Save grain_data

Input args

frame_num

Current frame number.

grain_data

set of grits that are close to the grinding region with additional information such as normal direction.

Output args

None

Imported files

None

Generated files

grain_data_OOO.mat

@grinding.save_grain_past_record(obj, dx, dy, x_min, x_max, y_min, y_max, X_MIN, X_MAX, Y_MIN, Y_MAX)

Collect grain_past_record and store it into “whole” folder.

Input args

dx

Width of the divided section of the workpiece surface in X direction.

dy

Width of the divided section of the workpiece surface in Y direction.

x_min

Minimum X coordinate of the calculation region on the workpiece.

x_max

Maximum X coordinate of the calculation region on the workpiece.

y_min

Minimum Y coordinate of the calculation region on the workpiece.

y_max

Maximum Y coordinate of the calculation region on the workpiece.

X_MIN

Number used for directory name.

X_MAX

Number used for directory name.

Y_MIN

Number used for directory name.

Y_MAX

Number used for directory name.

Output args

None

Imported files
Generated files
Called from
@grinding.save_grain_past_record_in_machining(obj, path, grain_past_record)
@grinding.save_graindata_grinding(obj, path, frame_num, r)
@grinding.save_gritset(obj, frame_num, gritset)

Save gritset

Input args

frame_num

Current frame number.

gritset

set of grits that are close to the grinding region.

Output args

None

Imported files

None

Generated files

grit_OOO.mat

@grinding.save_heatdata(obj, path, grain_num, heatdata)
@grinding.save_heatdata_each_frame(obj, path, frame_num, output)
@grinding.save_ldata(obj, path, grain_num, ldata)
@grinding.save_machining_past_record(obj, path, machining_past_record)

Save machining_past_record.mat

Input args

path

path

machining_past_record

The frame numbers at which the material is removed by each grit

Generated files
  • machining_past_record.mat

@grinding.save_matdata(obj, framenum, dx, dy, x_min, x_max, y_min, y_max, X_MIN, X_MAX, Y_MIN, Y_MAX, Table)

Collect matdata(surface point cloud on workpiece) and store it into “whole” folder.

Input args

framenum

Number of frame

dx

Width of the divided section of the workpiece surface in X direction.

dy

Width of the divided section of the workpiece surface in Y direction.

x_min

Minimum X coordinate of the calculation region on the workpiece.

x_max

Maximum X coordinate of the calculation region on the workpiece.

y_min

Minimum Y coordinate of the calculation region on the workpiece.

y_max

Maximum Y coordinate of the calculation region on the workpiece.

X_MIN

Number used for directory name.

X_MAX

Number used for directory name.

Y_MIN

Number used for directory name.

Y_MAX

Number used for directory name.

Output args

None

Imported files

matdata_OOO.mat

Generated files
Called from
@grinding.save_matdata_in_machining(obj, path, frame_num, wp_nodes)
@grinding.save_surfacedata_after_grinding(obj, path, frame_num, q)

Save surfacedata_after grinding_OOO.mat

Input args

path

Current frame number.

frame_num

set of grits that are close to the grinding region with additional information such as normal direction.

q

surface data after grinding

Output args

None

Imported files

None

Generated files

surfacedata_after_grinding_OOO.mat

@grinding.save_surfacedata_before_grinding(obj, path, frame_num, o)
@grinding.save_toolnodesinfo(obj, frame_num, nodes_extracted)
@grinding.save_wheelsurface(obj)

Save wheel surface.

Input args

None

Output args

None

Imported files

grain_data_OOO.mat

@grinding.show_histogram(obj)

Show histograms.

@grinding.show_nodes(obj, frame_num)

Show both wheel nodes (grits) and workpiece nodes close to the grinding region.

Input arguments

frame_num

Number of current time frame.

Output arguments

None

Imported files
Generated files
@grinding.trans_workpiece(obj, framenum)

Coordinate transformation to treat workpiece rotation. The grain_data is imported and its coordinate is transformed into the coordinate system where the workpiece is fixed.

Input args

framenum

Number of current frame

Output args

None

Imported files
Generated files

None

Updated files
Calling
Called from

Indices and tables