Table of Contents

Step

What Is a Step?

A MachiningStep (MachiningStep) is a single computation unit in the HiNC simulation. By default, one step corresponds to one spindle revolution, but this interval is configurable via the Basic Simulation workflow.

Each step contains data for the time interval between two consecutive steps (from the previous step to the current step). Since this represents a period rather than an instant, many fields are simplified representations using prefixes like Average (Avg), Extremes (Min, Max), Range (Delta), and Maximum Absolute Value (MaxAbs).


Registering Custom Step Variables

Beyond default properties, you can register custom step variables using RegisterStepVariable:

RegisterStepVariable(
    "ChipVolume",          // key
    "Chip Volume",         // display name
    "mm3",                 // unit
    "F2",                  // format string
    (step) => step.ChipVolume_mm3  // value function
);

PlayNcFile("NC/file1.nc");

Parameters:

  • key: Unique identifier
  • name: Display name (shown in UI)
  • unit: Physical unit (can be null)
  • formatString: .NET numeric format string (can be null)
  • variableFunction: Lambda that computes the value from a step (can be null)

Registered variables appear in the UI and in output files from WriteStepFiles.

Indexer Access

Use the this[string] indexer to read/write custom data on a step:

SessionStepBuilt += (preStep, curStep) => {
    if (curStep != null)
        curStep["MyCustomField"] = someCalculation();
};

Accessing Step Data

GetMillingStep

GetMillingStep retrieves a step by index:

var step = GetMillingStep(100);
if (step != null)
{
    Message($"ToolId={step.ToolId}, Force={step.MaxAbsForce_N} N");
}

StepCount

StepCount returns the total number of steps:

Message($"Total steps: {StepCount}");

Iterating All Steps

for (int i = 0; i < StepCount; i++)
{
    var step = GetMillingStep(i);
    // process step...
}

Step Output Files

Steps can be exported to CSV using WriteStepFiles:

WriteStepFiles("Output/[NcName].step.csv");

The CSV contains all default properties plus any registered custom variables. The file can be read back with PlayCsvFile.

For waveform-level data (sub-step time resolution), use WriteShotFiles:

WriteShotFiles("Output/[NcName].shot.csv", 1);  // 1 ms time resolution

Dynamically Registered Variables (Training)

After executing TrainMillingPara or ReTrainMillingPara, two additional step variables are automatically registered for steps within the training region:

Variable Description
TrainingErrRatio Error metric between simulation and measurement for each step
AngleOffset Cutter rotation phase difference between measured and simulated data

See Also