Table of Contents

Class OverloadRunFold

Namespace
Hi.MachiningProcs
Assembly
HiMech.dll

Internal Use Only. Folds the built steps of a play, in step order, into the runs of spindle torque overload, of spindle power overload and of stress overload — the consecutive steps whose ratio is above 1 — and records the step range of every rapid line the RapidCutMonitor reports: the sparse tables behind the six step properties of StepKeys (step coloring p08). One instance per MachiningActRunner (OverloadRunFold), kept for the session with the strip: nothing is kept on the step (0 B a step) and nothing is read from the step cache — a run is one OverloadRunTable.Run (24 B), a flushed run's boundary one int, and the memory follows the number of runs and plays, not the number of steps.

A run: consecutive steps whose ratio is above 1 — the max spindle torque ratio for a run of spindle torque overload, the max spindle power ratio for one of spindle power overload (the two read in one go, MaxSpindleRatios(MachiningStep, out double, out double)), the stress ratio for one of stress overload. A step whose ratio is 1 or below, or unknown (NaN), and a rapid step close the run and are in none; so does a gap in the step order (a position whose step was never built: a step that faulted, the steps a stop dropped), and the flush at the start and the end of an outermost run. A change of spindle speed does not close it, every step adds its own revolutions (RevolutionsOf(MachineMotionStep): speed × duration / 2π, the seconds times the rpm over 60). Every step of a closed run reads the run's total revolutions and its peak ratio; a step of the open run reads the total so far, a lower bound. The torque and the power are two causes — the peak torque in a revolution, the mean power over it — and fold apart: a step may be in a run of either, of both or of neither. The runs are of the ratios as the play computed them, or as the last step-physics recompute recomputed them: an edit of the spindle capability or the ambient reaches the ratio getters at once and the runs with the next recompute, as the card rules for an in-place edit (recompute after the edit).

One writer at a time. During a play the sequential post-physics stage observes every step (Observe(in Sample, out int, out int), through the runner's ObserveOverloadRun, after the step's channels are written and before the step-built hook fills its inspecting slot) and notes the rapid lines the monitor reports (NoteRapidCutLine(int, int, out int, out int)). The player thread, after the runner's WaitAll(), flushes at the start of an outermost run and at the end of a run that reaches its closing action (Flush(out int, out int): the open runs close, so a run of one play is never folded into the next; a nested run — an NC-embedded script's play — is part of the run around it and flushes nothing, though its closing action still notes the rapid line it closes), refolds the three run tables after a step-physics recompute (Refold(int, Func<int, Sample?>), from the rewritten channels, at the flush boundaries recorded; the rapid-cut ranges stay, the recompute does not change the removal) and resets with the strip (Reset()). A stop at a pace point has no drained point to flush at: the open runs stay open and read the total so far until the next outermost run starts or the runtime is reset; a cancellation the runner sees between blocks reaches the closing action and flushes. Readers — the step getters, a color tree, the inspecting-slot scan, the export, a request's poll — read on any thread without a lock (TryGet(int, out Run), Contains(int)); the publication order is the tables' own.

When a run closes or a rapid line is noted, the steps of that range read new values: the methods answer the range as [revisedBegin, revisedEnd), and the runner raises InternalStepsRevised with it, so the host refills those steps' inspecting slots and recolors them (the fold itself raises nothing, as the RapidCutMonitor emits nothing). A step observed and then not published (its step-built handler threw) stays in the live fold's run, where a refold skips the position: a difference in how a run is cut, on a step no reader can reach.

public sealed class OverloadRunFold
Inheritance
OverloadRunFold
Inherited Members
Extension Methods

Properties

RapidCutRanges

The step ranges of the rapid lines the RapidCutMonitor reported, in step order.

public RapidCutRangeTable RapidCutRanges { get; }

Property Value

RapidCutRangeTable

SpindlePowerRuns

The runs of spindle power overload: the max spindle power ratio above 1.

public OverloadRunTable SpindlePowerRuns { get; }

Property Value

OverloadRunTable

SpindleTorqueRuns

The runs of spindle torque overload: the max spindle torque ratio above 1.

public OverloadRunTable SpindleTorqueRuns { get; }

Property Value

OverloadRunTable

StepKeys

The keys of the six step properties read off this fold: SpindleTorqueOverloadRevolutions, SpindleTorqueOverloadPeakRatio, SpindlePowerOverloadRevolutions, SpindlePowerOverloadPeakRatio, StressOverloadRevolutions and IsRapidCut: what the HiNc host's gate for refilling the inspecting slots of the revised steps reads (LocalProjectService.InspectingKeyMayReadOverloadRuns; its conditions are that method's).

public static IReadOnlySet<string> StepKeys { get; }

Property Value

IReadOnlySet<string>

StressRuns

The runs of stress overload: the stress ratio above 1.

public OverloadRunTable StressRuns { get; }

Property Value

OverloadRunTable

Methods

Closing(int)

A sample that closes every run and is in none (unknown ratios, not rapid, no revolutions).

public static OverloadRunFold.Sample Closing(int stepIndex)

Parameters

stepIndex int

The step's index.

Returns

OverloadRunFold.Sample

Flush(out int, out int)

Closes the open runs of every kind and records the boundary (the first step after the last one observed) for a later Refold(int, Func<int, Sample?>): the session's call at the start of an outermost run and at a run's closing action, on the player thread after the runner's WaitAll(). Nothing closes when none is open; a boundary is recorded once per stretch of observed steps.

public bool Flush(out int revisedBegin, out int revisedEnd)

Parameters

revisedBegin int

The first step whose values changed; 0 when none did.

revisedEnd int

One past the last step whose values changed; 0 when none did.

Returns

bool

True when a run closed.

NoteRapidCutLine(int, int, out int, out int)

Records the step range of a rapid line the RapidCutMonitor reported (StepIndex through LastTouchedStepIndex, inclusive): the touched rapid steps in it read IsRapidCut true from now on. The lines are reported in step order and their ranges do not overlap.

public void NoteRapidCutLine(int firstTouchedStepIndex, int lastTouchedStepIndex, out int revisedBegin, out int revisedEnd)

Parameters

firstTouchedStepIndex int

The line's first touching step.

lastTouchedStepIndex int

The line's last touching step (inclusive).

revisedBegin int

The first step whose values changed: firstTouchedStepIndex.

revisedEnd int

One past the last step whose values changed: lastTouchedStepIndex + 1.

Observe(in Sample, out int, out int)

Feeds one built step, in step order. A ratio above 1 opens or extends that kind's run; a ratio of 1 or below, an unknown one (NaN), a rapid step and a gap in the step order (the step does not follow the last one observed) close it. When the step closed a run, the steps of the closed run(s) read new values: their range comes back as [revisedBegin, revisedEnd) (the union when more than one kind closed at once).

public bool Observe(in OverloadRunFold.Sample sample, out int revisedBegin, out int revisedEnd)

Parameters

sample OverloadRunFold.Sample

The step, see SampleOf(MachiningStep, StepPhysicsChannelReader).

revisedBegin int

The first step whose values changed; 0 when none did.

revisedEnd int

One past the last step whose values changed; 0 when none did.

Returns

bool

True when a run closed.

Refold(int, Func<int, Sample?>)

Folds the three run tables again over the whole strip and replaces them whole: the end of a step-physics recompute (StepPhysicsRecomputer), whose rewritten channels moved the ratios of the rewritten steps. sampleAt answers the sample of every strip position in order (SampleOf(MachiningStep, StepPhysicsChannelReader)), or null for a position without a step, which is skipped as the live fold never observed it (the next step then closes the runs as a gap). The runs close where the live fold flushed (Flush(out int, out int)), so a run of one play stays apart from the next play's; a run that reaches the last position without a flush after it stays open — a play going on after the recompute extends it, the next outermost run's start closes it — and the run that was open before is dropped with the old tables. The rapid-cut ranges are left as they are. On the writer's thread, no step in flight.

public void Refold(int count, Func<int, OverloadRunFold.Sample?> sampleAt)

Parameters

count int

The number of strip positions.

sampleAt Func<int, OverloadRunFold.Sample?>

The sample of the position at an index, 0 to count − 1; null for a position without a step.

Exceptions

ArgumentNullException

sampleAt is null.

Reset()

Session reset (ResetStateAndClStrip(StepDiagnosticProgress, IProgress<IMessage>)): the four tables are replaced by empty ones, the boundaries and the last observed step forgotten; nothing is reported.

public void Reset()

RevolutionsOf(MachineMotionStep)

The spindle revolutions of a motion step: SpindleSpeed_radds (the modal speed, unsigned — the direction is SpindleDirection) × StepDuration in seconds / 2π, the seconds times the rpm over 60; the absolute value guards a signed speed all the same. 0 for a null step and for a product that is not finite. A step with the spindle stopped keeps its modal speed here, but has no force brief and so is in no run.

public static double RevolutionsOf(MachineMotionStep motion)

Parameters

motion MachineMotionStep

The motion step; may be null.

Returns

double

SampleOf(MachiningStep, StepPhysicsChannelReader)

The fold's view of a built step whose channels are written: the revolutions off its motion step, the three ratios off reader (NaN for a step the reader does not hold or without a force brief, 0 on a no-cut step) and whether it is rapid. A step without a motion step reads 0 revolutions, NaN spindle ratios and not rapid.

public static OverloadRunFold.Sample SampleOf(MachiningStep step, StepPhysicsChannelReader reader)

Parameters

step MachiningStep

A built step.

reader StepPhysicsChannelReader

The reader of the runner's resident channels; null reads the three ratios as NaN.

Returns

OverloadRunFold.Sample