Workflow: Milling Force Parameter Training
This workflow covers the end-to-end process of training milling force coefficients from sensor data, including data mapping, coefficient training, quality evaluation, and application of the trained parameters.
Milling coefficients are essential parameters for calculating milling forces. Training derives these coefficients from experimental sensor data (dynamometer or smart tool holder) mapped to simulated toolpaths.
flowchart TD
Prereq["Prerequisites<br>(sensor data, project setup)"]
Resolution["Configure resolution & enable physics"]
Mapping["Configure data mapping"]
Simulate["Run simulation with NC file"]
Export["Export simulation data<br>(WriteShotFiles, WriteStepFiles)"]
Map["Map sensor data to simulation"]
Train["Train milling parameters"]
Evaluate["Evaluate training quality"]
Apply["Load trained parameters"]
Prereq --> Resolution --> Mapping --> Simulate --> Export
Simulate --> Map --> Train --> Evaluate --> Apply
1. Prerequisites
Before training you need:
| Item | Description |
|---|---|
| HiNC project | Machine tool, workpiece, fixture, tool house configured |
| NC file | The NC program used during the physical cutting experiment |
| Sensor data CSV | Time-stamped force/torque data from a dynamometer or smart tool holder |
| Controller data CSV (optional) | Machine controller log with FileNo, LineNo, ActualTime for two-layer mapping |
Sensor Data File Format
The CSV must contain a header row with ActualTime and at least one force/torque channel:
| Source | Headers |
|---|---|
| Dynamometer | Fx (or Workpiece.Fx), Fy, Fz |
| Smart tool holder | Mx (or Holder.Mx), My, Mz |
| Accelerometer (optional) | Ax, Ay, Az |
ActualTime,CH1,CH2,Mx,My,Mz
18:23:54.703,-0.00398,-0.00034,-0.02923,0.10733,0.00409
18:23:54.704,-0.00194,0.00285,0.04155,-0.04457,0.00448
...
Tip
Keep the completed training project archived. When the HiNC training algorithm is updated, you can re-run training from the same project.
2. Configure Resolution and Enable Physics
Resolution
Use a finer resolution than normal operation for training accuracy:
MachiningResolution_mm = 0.0625; // half or less of production resolution
MachiningMotionResolution = FeedPerTooth;
Tip
Training resolution should be ≤ 0.5× the production resolution for better accuracy.
Enable Physics
EnablePhysics must be enabled for force calculation:
EnablePhysics = true;
Milling Force Cycle Division
Set the number of angular divisions per revolution before training. Higher values yield more accurate phase alignment:
MillingForceCycleDivisionNum = 360;
Note
This must be set before executing TrainMillingPara. A larger value produces a more accurate AngleOffset result and better milling coefficients.
3. Configure Data Mapping
Depending on your data, choose one of the mapping strategies below.
3.1 Local Mapping (Anchor-Based)
For mapping sensor data to specific NC path segments:
Step A — Specify input data:
ClearTimeMappingData();
AddTimeDataByFile("lineA", "Mapping/sensor1.csv", "18:25:51.7100", "18:26:12.9910");
AddTimeDataByFile("lineB", "Mapping/sensor1.csv", "18:26:30.5750", "18:27:12.2880");
Step B — Specify NC paths (embedded in NC code comments):
X13. F20 ;@LineSelection("lineA", FirstTouch, ShiftTime_s(2), LineEnd, ShiftDistance_mm(-1));
X25. F10 ;@LineSelection("lineB", FirstTouch, null, LastTouch, null);
Anchor options: LineBegin, LineEnd, FirstTouch, LastTouch.
Offset options: null, ShiftTime_s(<seconds>), ShiftDistance_mm(<mm>).
3.2 Two-Layer Chained Mapping (Controller + Sensor)
When you have both controller data and sensor data:
PlayNcFile("NC/machining.nc");
MapSingleByCsvFile("Data/controller.csv"); // maps FileNo/LineNo → ActualTime
MapSeriesByCsvFile("Data/sensor.csv"); // maps ActualTime → sensor series
Note
Why two-layer mapping? Running the NC through the system interpreter produces more accurate simulation paths than direct CSV playback. The controller data bridges simulation steps to real time via FileNo/LineNo, and the sensor data bridges real time to force/torque readings.
4. Run Simulation
PlayNcFile("NC/file1.nc");
Warning
During training, do not:
- Adjust workpiece, tool, or controller resolution settings
- Use the NC player reset button (close the project instead)
- Save the project (system training configuration may overwrite tool resolution settings)
5. Export Simulation Data
Export step data and waveform data for analysis:
WriteStepFiles("Output/[NcName].step.csv");
WriteShotFiles("Output/[NcName].shot.csv", 1);
The shot file contains time-resolved force columns: Tool.Fx/Fy/Fz, Workpiece.Fx/Fy/Fz, Spindle.Mx/My/Mz.
For coordinate system explanations, see Milling Physics Coordinates.
6. Train Milling Parameters
TrainMillingPara (New Training)
TrainMillingPara trains new coefficients independently of any existing workpiece parameters.
TrainMillingPara(Fx|Fy|Fz, "StainlessSteel.mp");
ReTrainMillingPara (Calibration)
ReTrainMillingPara calibrates existing coefficients (10% original weight, 90% new sample weight).
ReTrainMillingPara(Fz|Mx|My|Mz, "StainlessSteel.mp");
Sample Flag Requirements
| Command | Minimum Data Types | Feed Per Tooth Requirement |
|---|---|---|
TrainMillingPara |
Fx\|Fy\|Fz (dynamometer) or Fz\|Mx\|My\|Mz (smart tool holder) |
At least one sample with different feed per tooth |
ReTrainMillingPara |
No restriction | No restriction |
Warning
Using only Mx|My|Mz without Fz loses one degree of freedom (torque = r × F loses the r-direction), making coefficient training unreliable. Always include Fz when using torque data.
Training Conditions
- Samples should have stable, repeatable waveforms for at least two spindle revolutions
- Under unstable conditions, plowing coefficients tend to be over-estimated
- Any NC path shape (slot milling, side milling, any tool shape) is acceptable when samples are stable
7. Evaluate Training Quality
After training, the system reports three quality metrics:
Correlation Coefficient (R)
A single value for the overall result. Ranges from 0 to 1; for new tools, expect 0.95–0.999.
Training Error Ratio (TrainingErrRatio)
A per-step variable registered automatically after training. Lower values indicate better step-level quality:
Angle Offset (AngleOffset)
A per-step variable representing the cutter rotation phase difference between measured and simulated data:
Tip
If AngleOffset varies significantly across segments in the same training batch, the spindle may have experienced speed changes, data gaps, or the system could not accurately analyze the samples.
8. Load Trained Parameters
After training, load the new coefficients into the workpiece:
LoadCuttingParaByFile("StainlessSteel.mp");
Warning
If the training output file path is the same as the tool's existing cutting parameter file, reload the project after training to ensure the new parameters take effect.
XML Configuration (GUI Workflow)
When using the GUI-based training workflow, configure the .hincproj file:
<MillingParaGridTrainingDestinationFile>MillingPara/trainedPara.mp</MillingParaGridTrainingDestinationFile>
<MillingParaTraining>
<IsMzEnabled>false</IsMzEnabled>
<ForceOutlierRatio>2</ForceOutlierRatio>
<LeadParaTemplate>
<RakeFaceCuttingParaMap>
<FluteFormNum>1</FluteFormNum>
<NAngleDivisionNum>0</NAngleDivisionNum>
<EcAngleDivisionNum>0</EcAngleDivisionNum>
</RakeFaceCuttingParaMap>
</LeadParaTemplate>
<ResultParaTemplate>
<RakeFaceCuttingParaMap>
<FluteFormNum>1</FluteFormNum>
<NAngleDivisionNum>0</NAngleDivisionNum>
<EcAngleDivisionNum>0</EcAngleDivisionNum>
</RakeFaceCuttingParaMap>
</ResultParaTemplate>
</MillingParaTraining>
Set IsMzEnabled to true if mapped data contains axial spindle torque from a smart tool holder.
Complete Script Example
MachiningResolution_mm = 0.0625;
EnablePhysics = true;
MillingForceCycleDivisionNum = 360;
ClearTimeMappingData();
AddTimeDataByFile("lineA", "Mapping/sensor1.csv", "18:25:51.7100", "18:26:12.9910");
AddTimeDataByFile("lineB", "Mapping/sensor1.csv", "18:26:30.5750", "18:27:12.2880");
PlayNcFile("NC/file1.nc");
TrainMillingPara(Fx|Fy|Fz, "MillingPara/trained.mp");
LoadCuttingParaByFile("MillingPara/trained.mp");
WriteStepFiles("Output/[NcName].step.csv");
WriteShotFiles("Output/[NcName].shot.csv", 1);
See Also
- Milling Physics Coordinates — coordinate system reference
- Sensor Mapping Workflow — detailed mapping workflow
- Workflow: Basic Machining Simulation — basic simulation setup
- Workflow: NC Optimization — optimization after training
- Glossary: Machining Step — step data reference
- Glossary: RuntimeApi Quick-Reference — RuntimeApi quick-reference
- Training with a Dynamometer (Example)
- Cascading Mapping (Example)