Table of Contents

Class SetupAngleEstimation

Namespace
Hi.MillingForces.Training
Assembly
HiNc.dll

Estimates the cutter setup angle from smart-holder moment samples and a known cutting parameter.

Physics: for a cutter whose flutes are all alike, mounting it turned by φ inside the holder changes the spindle-rotation-frame transverse moment series in two ways only — every (Mx, My) vector rotates by φ and the series shifts by φ along the rotation angle. The per-step begin-angle alignment the training pipeline already performs absorbs the shift, so φ survives solely as a constant planar rotation of the model's (Mx, My) against the measured (Mx, My); Mz, Fz and the workpiece-frame forces carry no information about it. The estimate is therefore a rotation-plus-scale (complex gain) Procrustes fit shared by all steps, with the begin-angle hypothesis chosen per step by brute force.

Identifiability: the angle is determined only modulo the flute pitch (360/N for N uniform flutes) and only when the transverse envelope is modulated within a revolution — light side cuts or intermittent contact; a full slot with several flutes engaged at once leaves the objective flat, which Contrast exposes.

public static class SetupAngleEstimation
Inheritance
SetupAngleEstimation
Inherited Members

Fields

MaxAlternations

Upper bound on begin-angle / gain alternations per pass.

public const int MaxAlternations = 30

Field Value

int

MaxTrimRounds

Upper bound on outlier-trim rounds (trim, re-solve, re-score).

public const int MaxTrimRounds = 4

Field Value

int

Properties

EnergyCapOverMedian

A step whose measured energy exceeds this multiple of the median is weighted down to it.

public static double EnergyCapOverMedian { get; set; }

Property Value

double

GridStep_deg

Angle grid step (deg) of the global search; the closed-form refinement makes the estimate sub-grid.

public static double GridStep_deg { get; set; }

Property Value

double

LowContrastThreshold

Objective contrast (see Contrast) below which the estimate is reported as unconstrained.

public static double LowContrastThreshold { get; set; }

Property Value

double

MaxScatterToApply_deg

Per-step angle scatter (Scatter_deg) above which an automatic application refuses the estimate. The sim replay scatters about 1°, a 3 dB recording about 2°; the inconclusive 2024 holder recording scattered 19.5° with a flat contrast.

public static double MaxScatterToApply_deg { get; set; }

Property Value

double

MinDeltaToApply_deg

Rotation (deg, folded into ±half the period) below which an automatic application does nothing: the estimate's begin-angle grid is 2°, so a residual under a quarter of that is noise — writing it would only rerun the force kernel on every touched step of the tool for no visible change (an armed estimate followed by the explicit form sees such a residual).

public static double MinDeltaToApply_deg { get; set; }

Property Value

double

MirrorPreferenceRatio

The mirrored-frame hypothesis is reported as preferred when its objective falls below this fraction of the plain hypothesis' objective.

public static double MirrorPreferenceRatio { get; set; }

Property Value

double

RotationSignConvention

Sign relating the estimate to the tool's MillingTool.SetupAngle_deg: the setup angle to enter is current + RotationSignConvention · Angle_deg. Pinned by the sim replay test (a cutter exported at a known setup angle must be recovered with this sign).

public static int RotationSignConvention { get; set; }

Property Value

int

Methods

Estimate(IEnumerable<KeyValuePair<int, List<List<TrainingSample>>>>, double[], SampleFlag, int, double, double, IProgress<IMessage>, CancellationToken)

Estimates the setup angle from gathered angle-hypothesis samples (the GatherSampleByAngle structure: hypothesis list b at instance i pairs the model row of angle (b+i) mod N with the measured value at instance i).

public static SetupAngleEstimate Estimate(IEnumerable<KeyValuePair<int, List<List<TrainingSample>>>> stepIndexToAngleSamples, double[] paraVector, SampleFlag sampleFlags, int fluteNum, double period_deg, double outlierRatio, IProgress<IMessage> messageProgress, CancellationToken cancellationToken)

Parameters

stepIndexToAngleSamples IEnumerable<KeyValuePair<int, List<List<TrainingSample>>>>

Gathered samples per step.

paraVector double[]

The known cutting parameter as an element vector (the gather's template order).

sampleFlags SampleFlag

Channels gathered; must include Mx and My. Mz, when present, only helps the begin-angle choice.

fluteNum int

Flute count of the cutter.

period_deg double

Ambiguity period of the angle (360/N for uniform fluting).

outlierRatio double

Fraction of the worst-fitting steps trimmed before the final estimate.

messageProgress IProgress<IMessage>

Message sink.

cancellationToken CancellationToken

Cancellation token.

Returns

SetupAngleEstimate

GetApplyRefusal(SetupAngleEstimate, double)

The gate of an automatic application (the online command): the reason estimate must not be written to the tool, or null when it may. A failed estimate, a contrast below LowContrastThreshold (the cut does not constrain the angle), a scatter above maxScatter_deg (the steps disagree) and a preferred mirror (the sensor axes look swapped, not rotated — never flagged for two flutes) are refused; an explicit EstimateSetupAngle(.., applyToTool: true) is the operator's own decision and does not go through here.

public static string GetApplyRefusal(SetupAngleEstimate estimate, double maxScatter_deg)

Parameters

estimate SetupAngleEstimate

The estimate to gate.

maxScatter_deg double

Largest scatter let through.

Returns

string

The refusal, or null when the estimate passes.