Class StepPhysicsRecomputer
- Namespace
- Hi.MachiningProcs
- Assembly
- HiMech.dll
Recomputes the step physics of the finished steps from the stored cutter-workpiece engagement with the current inputs — the engine behind RecomputeStepPhysics(StepPhysicsRecomputeOptions), and the resumable job CreateStepPhysicsRecomputeJob(StepPhysicsRecomputeOptions) hands out. One instance per call.
Order: preconditions (physics on, WaitAll, steps, tools resolvable) →
classification against the session's PhysicsInputFingerprintTable
(Classify(IReadOnlyList<StepPhysicsFacts?>, PhysicsInputFingerprintTable, IReadOnlyDictionary<int, ToolPhysicsFingerprint>, WorkpiecePhysicsFingerprint, EnvironmentPhysicsFingerprint, int?, bool, IReadOnlyCollection<int>), pure) → licence and para checks → a read-only
pre-scan of which luggage kinds the rows the plan needs hold (the stored
columns' NULL-ness, nothing decoded; the chunk loop then reads the rows
themselves), that every step of the chain has its stored briefs' row (or a
creation cache a failed flush left), and the chain's seed read from the
store → cutter cache clears, pack invalidation, pack assertions and
the thermal pre-check → the SpindleSpeedCache chain walked
from step 0 → chunks of [one range read of the chunk's luggage rows and
briefs' rows, brief phase in parallel, sequential chain, commit of the
chunk's amendments in one transaction] with a convergence stop against the
stored sequential physics states, a progress report and a drawing refresh at every
chunk boundary → last-bundle patch, drawing refresh, fingerprint overwrite.
The briefs the chain reads and compares against are the store's rows, not
the resident copies on the steps (the brief-into-DB chain's C4a); what a
chunk rewrites in memory it writes to the store before the next chunk, and
takes back out of memory when its chain or that write throws.
The work is driven from outside, one chunk per TryRunNextChunk() (the first call does everything up to and including the first chunk), so that whoever drives it can pace between the chunks: the player's pace-point queue parks it at a chunk boundary on Pause and lets it see the run's cancellation on Stop; Run() drives it to the end in one call, pacing through Pace. The state between chunks lives on the instance (the chain's previous sequential physics state and motion step, the chunk cursor, the counters). Nothing is mutated before the pre-scan passed. Published objects are never mutated: every replaced brief is a new object assigned by reference.
public sealed class StepPhysicsRecomputer
- Inheritance
-
StepPhysicsRecomputer
- Inherited Members
- Extension Methods
Fields
EnvironmentMovedWarning
Said once, under StepPhysics-Recompute–ChainWarning, by a run whose
environment moved while its chain ran (FollowTheEnvironmentOfTheMoment(int))
or, for a plan that rewrites the chain from SeqStart alone, between its
classification and the start of its chain (4.5.1): some steps carry the
earlier environment and some the later one.
public const string EnvironmentMovedWarning = "The environment (the ambient temperature, the coolant condition, the spindle capability, the wear switch or the initial spindle temperature) changed while the recompute ran: the steps before the change carry the earlier environment, the steps from it on the later one, and both are on record. Run the recompute again to bring every step to the environment of the moment."
Field Value
Properties
ChunkCount
Chunks the plan spans from the chain start to the last step; 0 until the plan exists. The job may stop short of it when the chain converges.
public int ChunkCount { get; }
Property Value
ChunksDone
Chunks run so far.
public int ChunksDone { get; }
Property Value
NextStepIndex
The first step index of the next chunk, moved past a chunk once that chunk has landed (a chunk that threw has not moved it); the step count once the chunks are through, -1 before the plan exists.
public int NextStepIndex { get; }
Property Value
ReplacedBeginStepIndex
Start of the strip range [ReplacedBeginStepIndex, ReplacedEndStepIndex) whose rows the job has replaced so far — what the store holds: a chunk that threw, in its sequential chain or in its write, is taken back out of memory first, so the two never run ahead of the store. Both 0 while no step was written (before the plan, or a job that ended without writing); after the epilogue they are the result's range. For the driver's bookkeeping after an exit that leaves no Result — a fault, or Abandon(): the steps in the range carry the inputs of the moment, the rest their previous values.
public int ReplacedBeginStepIndex { get; }
Property Value
ReplacedEndStepIndex
End (exclusive) of the replaced range; see ReplacedBeginStepIndex.
public int ReplacedEndStepIndex { get; }
Property Value
Result
The outcome; null until the job has finished (TryRunNextChunk() returned false, or Run() returned), and null for good after a fault or Abandon().
public StepPhysicsRecomputeResult Result { get; }
Property Value
Methods
Abandon()
Ends the job now, between two chunks, as a fault exit does — for a driver whose pace point failed outright (a disposed player, a handler that threw): no further chunk runs and no epilogue, the bookkeeping of a fault is left behind (the record of a partial rewrite, the bundle's spindle-speed cache given up on a changed environment, the drawing flagged for the replaced range), Result stays null and every later TryRunNextChunk() returns false. ReplacedBeginStepIndex and ReplacedEndStepIndex say what the job had written. Nothing on a job that is over; never throws.
public void Abandon()
Cancel()
Ends the job as Canceled at the next TryRunNextChunk() — no further chunk runs, the epilogue does — as if the token had been cancelled at that boundary. For a driver whose pace point threw OperationCanceledException between two chunks (the run was stopped); a pace point that failed outright is Abandon().
public void Cancel()
Run()
Runs the recompute to its end in one call, pacing between the chunks through Pace (a pace point that throws OperationCanceledException cancels the recompute at that chunk boundary). See the class summary for the order.
public StepPhysicsRecomputeResult Run()
Returns
TryRunNextChunk()
Runs the next chunk. The first call does everything before the chunks — the preconditions, the classification, the pre-scan, the pack and chain setup — and, when the plan proceeds, the first chunk; every further call runs one more chunk. A call that returns false has finished the job (the epilogue ran, Result is set: Done, Canceled at the boundary after a chunk that saw CancellationToken, or an early NoChange / NeedsReplay / Refused) and does nothing on any later call. Between two calls that returned true the strip carries the chunks run so far, the drawing is flagged and a progress message was reported; the caller paces there. A fault (a luggage store or a session failure) propagates and ends the job, after the same record was left as after a cancel when steps were already rewritten: a mark where the job stopped and the inputs it wrote with. After a fault or Abandon() every call returns false and Result stays null.
public bool TryRunNextChunk()
Returns
- bool
True when a further chunk remains; false when the job is over.