Table of Contents

Class PhysicsInputFingerprintTable

Namespace
Hi.MachiningProcs
Assembly
HiMech.dll

Per-session table of the physics input fingerprints the steps were computed with, keyed by tool id plus the workpiece and the environment. The workpiece and the tool are recorded on the shell thread at every run start (RunNcLines(INcRunner, string, IEnumerable<string>, CancellationToken)) and at every tool change, the tool whenever the session builds its physics pack (GetToolPhysicsPack(int) — the moment the pack freezes what the steps compute with); the environment is recorded twice per step a play issues (on the shell thread as the step is issued, with the value its spindle-speed cache is built or kept under, and on the sequential worker once its sequential physics has run, with the capability values, coolant fields and wear switch of that moment – the step's ambient temperature and coolant object are the ones it was issued with; MachiningParallelProc), since the play reads it live on every step; a recompute (StepPhysicsRecomputer) hashes it at every step of its chain and writes every environment it ran with at its end. Read by the step-physics recompute to classify which inputs differ from what the steps carry, and written by it at its end: a completed recompute makes the table current (Overwrite(IReadOnlyDictionary<int, ToolPhysicsFingerprint>, WorkpiecePhysicsFingerprint, EnvironmentPhysicsFingerprint, int)), one that left steps on other inputs adds the inputs it wrote with beside the earlier ones (RecordBesideEarlier(WorkpiecePhysicsFingerprint, EnvironmentPhysicsFingerprint)). Thread-safe.

Every entry keeps each DISTINCT value recorded since the table was last made current (Overwrite(IReadOnlyDictionary<int, ToolPhysicsFingerprint>, WorkpiecePhysicsFingerprint, EnvironmentPhysicsFingerprint, int) after a completed recompute, or Clear()), not only the latest: an input edited during a play leaves steps on more than one value — the tool and the cutting parameter stay frozen in the running pack until the next invalidation point, while the material is read by every step from the edit on — and a later record (the tool mounted again, the next run start, the next step with the environment set back) must not hide the steps that were computed with the earlier value. The same goes for a recompute that rewrote some steps and not the others: one cancelled after it wrote, and the workpiece of one scoped to a tool, which rebuilt that tool's results alone. The recompute reruns a change class when ANY recorded value differs from the current one. The record starts at the strip's count when the session began (RecordedFromStepIndex): the steps below it were played before, and no record here speaks for them — what the session records later (the next run start, a tool change, a pack build) takes the inputs as they are then, which vouch for the session's own steps alone.

A tool entry can also hold a value no step carries: an NC optimization after the play (OptimizeNcFiles(string, string, ICuttingPara, IProgress<IMessage>, CancellationToken, ReadBulkDelegate<StepLuggage>, ReadBulkDelegate<StepBrief>)) drops the session's packs before its solve, and the builds that follow record the tool as it is then beside the play's value, until a completed recompute with the tool in scope replaces the entry (the default scope takes every tool on the strip; a recompute scoped to another tool leaves it) or the table is cleared — an input put back to the play's value meanwhile still reads as changed to such a recompute. And no workpiece record is taken per step: a value written in place on the workpiece's material or cutting parameter and written back between two records of the workpiece (a run start, a tool change, a recompute that rewrote steps) is on no record, though steps may have been computed with it — the material is read by every step as its physics runs, and the parameter's values are taken by the pack at its build (the minimum uncut chip thickness, at the tool's first step) and by its native sessions at the first force step and the first thermal step the pack serves.

public sealed class PhysicsInputFingerprintTable
Inheritance
PhysicsInputFingerprintTable
Inherited Members
Extension Methods

Properties

Environment

The most recently recorded environment fingerprint; null until an environment is recorded – by a step, or by a completed recompute – and again after Clear().

public EnvironmentPhysicsFingerprint Environment { get; }

Property Value

EnvironmentPhysicsFingerprint

EnvironmentHistory

Every distinct environment fingerprint recorded since the table was last made current, oldest first.

public IReadOnlyList<EnvironmentPhysicsFingerprint> EnvironmentHistory { get; }

Property Value

IReadOnlyList<EnvironmentPhysicsFingerprint>

RecordedFromStepIndex

The strip index this table's record starts at: the steps below it were on the strip when the session began – a session begun without a runtime reset keeps the strip – and no record here speaks for them. The classification takes their tools as unrecorded, and the workpiece and the environment as changed while any such step is on the strip, whatever is recorded later: the next play's run start and every pack build record the tools' CURRENT inputs, which vouch for the steps played under this session alone. 0 for a session begun on an empty strip, and again after Clear() (the host clears the table as it clears the steps); a completed recompute (Overwrite(IReadOnlyDictionary<int, ToolPhysicsFingerprint>, WorkpiecePhysicsFingerprint, EnvironmentPhysicsFingerprint, int)) leaves it, as does RecordBesideEarlier(WorkpiecePhysicsFingerprint, EnvironmentPhysicsFingerprint).

public int RecordedFromStepIndex { get; }

Property Value

int

StaleChainFromStepIndex

The step index below which a bitwise match with the stored sequential chain proves nothing about the rest of it; -1 when no recompute that stopped half-way is outstanding. A recompute that stops after it wrote — cancelled at a chunk boundary, or ended by a fault — leaves a mark at the end of what it wrote (NoteStoppedRecompute(int)): the steps below the mark, back to where that run's chain started, carry that run's output, the step at the mark still the chain from before it. This is the largest mark left, and the recomputer's convergence stop is trusted only at or beyond it. A completed recompute takes away the marks at or beyond the step its chain started at (Overwrite(IReadOnlyDictionary<int, ToolPhysicsFingerprint>, WorkpiecePhysicsFingerprint, EnvironmentPhysicsFingerprint, int)): it went through every one of them. A mark below that step stays for the run that will go through it. Clear() takes them all away.

public int StaleChainFromStepIndex { get; }

Property Value

int

Tools

A snapshot of the most recently recorded fingerprint of every tool id.

public IReadOnlyDictionary<int, ToolPhysicsFingerprint> Tools { get; }

Property Value

IReadOnlyDictionary<int, ToolPhysicsFingerprint>

Workpiece

The most recently recorded workpiece fingerprint; null until the first run start.

public WorkpiecePhysicsFingerprint Workpiece { get; }

Property Value

WorkpiecePhysicsFingerprint

WorkpieceHistory

Every distinct workpiece fingerprint recorded since the table was last made current, oldest first.

public IReadOnlyList<WorkpiecePhysicsFingerprint> WorkpieceHistory { get; }

Property Value

IReadOnlyList<WorkpiecePhysicsFingerprint>

Methods

BeginRecordAt(int)

Sets RecordedFromStepIndex: the session calls it as it is created, with the count of the strip positions then (MachiningSession's constructor). A negative count is 0.

public void BeginRecordAt(int stripStepCount)

Parameters

stripStepCount int

Clear()

Forgets everything (the steps were cleared): the record starts at step 0 again.

public void Clear()

GetToolHistory(int)

Every distinct fingerprint recorded for a tool id since the table was last made current, oldest first; empty when none was recorded.

public IReadOnlyList<ToolPhysicsFingerprint> GetToolHistory(int toolId)

Parameters

toolId int

Returns

IReadOnlyList<ToolPhysicsFingerprint>

NoteStoppedRecompute(int)

Leaves a mark where a recompute that had written steps stopped, cancelled or ended by a fault (endStepIndex, exclusive), with the rest of the chain untouched.

public void NoteStoppedRecompute(int endStepIndex)

Parameters

endStepIndex int

Overwrite(IReadOnlyDictionary<int, ToolPhysicsFingerprint>, WorkpiecePhysicsFingerprint, EnvironmentPhysicsFingerprint, int)

Makes the table current after a completed recompute: the given tool entries, and the workpiece and environment when non-null, are replaced by the single value the steps now carry — the earlier values stop counting.

public void Overwrite(IReadOnlyDictionary<int, ToolPhysicsFingerprint> toolFingerprints, WorkpiecePhysicsFingerprint workpiece, EnvironmentPhysicsFingerprint environment, int chainStartStepIndex = 0)

Parameters

toolFingerprints IReadOnlyDictionary<int, ToolPhysicsFingerprint>

The tool entries to replace, by tool id; the other tools' entries are left as they are. May be null.

workpiece WorkpiecePhysicsFingerprint

The workpiece fingerprint every step now carries; null leaves the workpiece record as it is.

environment EnvironmentPhysicsFingerprint

The environment fingerprint every step now carries; null leaves the environment record as it is.

chainStartStepIndex int

The step the completed run's sequential chain started at. The run went through every mark at or beyond that step — its convergence stop is not trusted below StaleChainFromStepIndex, the largest of them — so those marks are taken away. A mark below that step (the run was scoped to a tool mounted past it) stays: the steps between it and this run's start are still on the chain from before the run that stopped there.

RecordBesideEarlier(WorkpiecePhysicsFingerprint, EnvironmentPhysicsFingerprint)

Records what a recompute wrote with when it rewrote some steps and not the others — a run that stopped after it wrote, the workpiece of a run scoped to one tool: each fingerprint is added beside the earlier ones of its kind, as RecordWorkpieceAndEnvironment(WorkpiecePhysicsFingerprint, EnvironmentPhysicsFingerprint) adds it. A kind that has no record yet is left without one: nothing on record says what the other steps carry, the classification takes a kind without a record as changed, and a first record made here would say that every step carries this value.

public void RecordBesideEarlier(WorkpiecePhysicsFingerprint workpiece, EnvironmentPhysicsFingerprint environment)

Parameters

workpiece WorkpiecePhysicsFingerprint

The workpiece fingerprint the rewritten steps carry; null adds none.

environment EnvironmentPhysicsFingerprint

The environment fingerprint the rewritten steps carry; null adds none.

RecordEnvironment(EnvironmentPhysicsFingerprint)

Records an environment fingerprint, kept beside the earlier ones when it differs from every one of them and made the most recent one either way: called with the environment a step runs with, twice per played step whose sequential physics runs: as the step is issued on the shell thread (the environment its spindle-speed cache is built or kept under) and once its sequential physics has run (the capability values, coolant fields and wear switch of that moment), which differ when an edit lands between the two. A recompute hashes the environment at every step of its chain and writes every one it ran with at its end, through Overwrite(IReadOnlyDictionary<int, ToolPhysicsFingerprint>, WorkpiecePhysicsFingerprint, EnvironmentPhysicsFingerprint, int) and RecordBesideEarlier(WorkpiecePhysicsFingerprint, EnvironmentPhysicsFingerprint). Null records nothing.

public void RecordEnvironment(EnvironmentPhysicsFingerprint environment)

Parameters

environment EnvironmentPhysicsFingerprint

RecordTool(int, IMachiningTool)

Records the physics inputs of the tool under toolId as they are now.

public void RecordTool(int toolId, IMachiningTool tool)

Parameters

toolId int
tool IMachiningTool

RecordTool(int, ToolPhysicsFingerprint)

Records a tool fingerprint: kept beside the earlier ones when it differs from every one of them, and made the most recent one either way.

public void RecordTool(int toolId, ToolPhysicsFingerprint fingerprint)

Parameters

toolId int
fingerprint ToolPhysicsFingerprint

RecordWorkpiece(Workpiece)

Records the workpiece as it is now (a null workpiece is the null workpiece's fingerprint), leaving the environment record as it is.

public void RecordWorkpiece(Workpiece workpiece)

Parameters

workpiece Workpiece

RecordWorkpieceAndEnvironment(WorkpiecePhysicsFingerprint, EnvironmentPhysicsFingerprint)

Records a workpiece and an environment fingerprint, each kept beside the earlier ones when it differs from every one of them; a null fingerprint records nothing for its kind.

public void RecordWorkpieceAndEnvironment(WorkpiecePhysicsFingerprint workpiece, EnvironmentPhysicsFingerprint environment)

Parameters

workpiece WorkpiecePhysicsFingerprint
environment EnvironmentPhysicsFingerprint

RecordWorkpieceAndEnvironment(Workpiece, MachiningEquipment, MachiningActRunnerConfig)

Records the workpiece and the environment as they are now.

public void RecordWorkpieceAndEnvironment(Workpiece workpiece, MachiningEquipment equipment, MachiningActRunnerConfig config)

Parameters

workpiece Workpiece
equipment MachiningEquipment
config MachiningActRunnerConfig

TryGetTool(int, out ToolPhysicsFingerprint)

Gets the most recently recorded fingerprint of a tool id.

public bool TryGetTool(int toolId, out ToolPhysicsFingerprint fingerprint)

Parameters

toolId int
fingerprint ToolPhysicsFingerprint

Returns

bool