This commit is contained in:
2026-09-09 17:35:23 +08:00
parent 2a98ae7556
commit 161af68fe3
1271 changed files with 58251 additions and 98639 deletions
@@ -235,6 +235,7 @@ LoadCuttingParaByFile("Material.mp");
<li><strong>Physics-based constraints</strong> (spindle power, torque, thermal yield, preferred force)</li>
</ol>
<p>When constraints at the same priority conflict, the lowest feed rate is used.</p>
<p>A floor above the ceiling neither fails nor lowers the feed: where the composed minimum feed per tooth exceeds the composed maximum — a minimum feed rate, a minimum feed per tooth or the cutter's minimum uncut chip thickness sitting above the maximum — the boundary collapses onto the <strong>minimum</strong>, and the step is solved there.</p>
<h3 id="script-command-example">Script Command Example</h3>
<pre><code class="lang-csharp">OptEnableFeedrate = true;
OptEnableInterpolation = true;
@@ -282,20 +283,161 @@ N0160 X-3.555 Y43.338 (;@EndPreserve();)
<pre><code class="lang-csharp">OptimizeToFiles(&quot;Cache/Opt-[NcName]&quot;);
</code></pre>
<p>The <code>[NcName]</code> template is replaced with each input NC file name.</p>
<h3 id="what-the-run-reports">What the Run Reports</h3>
<p>An optimization reports itself to the <strong>Shell</strong> tab of the Session Messages panel, as a fixed
sequence of rows:</p>
<table>
<thead>
<tr>
<th>Row</th>
<th>Stage</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Start NC optimization.</code></td>
<td>the pass opens</td>
</tr>
<tr>
<td><code>Computing Optimized Feed by indivisual step..</code></td>
<td>the per-step feed solve</td>
</tr>
<tr>
<td><code>Optimization Feedrate built.</code></td>
<td>the feed solve closed</td>
</tr>
<tr>
<td><code>Constrain feedrate By expaneded segment..</code></td>
<td>the extended-distance constraint</td>
</tr>
<tr>
<td><code>Constrain Feedrate By Acceleration..</code></td>
<td>the acceleration constraint</td>
</tr>
<tr>
<td><code>Build Compensation..</code></td>
<td>the compensation build</td>
</tr>
<tr>
<td><code>Regenerate NC commands..</code></td>
<td>the NC text is rewritten</td>
</tr>
<tr>
<td><code>File optimized: &lt;path&gt;</code></td>
<td>one row per written file</td>
</tr>
<tr>
<td><code>Total N files optimized.</code></td>
<td>the pass is over</td>
</tr>
<tr>
<td><code>optimization cache cleared.</code></td>
<td>the step cache is released</td>
</tr>
</tbody>
</table>
<p>Two of those stages tick while they work, and they are the only instrument for telling a slow
optimization from a stopped one. The feed solve adds <code>Computing Optimized Feed by indivisual step.. FileNo:&lt;n&gt;, LineNo:&lt;m&gt;</code> every thousand steps solved — <code>StepIndex:&lt;i&gt;</code> instead, for a step that
carries no source line — and the writer adds <code>Now optimizing to: FileNo.&lt;n&gt;, LineNo.&lt;m&gt;</code> every
thousand lines written. Each names the source file and line the run has reached, so a ladder whose
last row keeps advancing is a run still moving through the program, and one that has gone quiet
without reaching <code>Total N files optimized.</code> is not. A stage with fewer than a thousand steps or
lines to get through announces its start and then says nothing until it ends, so a short program
crosses the whole ladder in near-silence.</p>
<p><strong>Stop reaches inside an optimization.</strong> The transport's Stop is tested between every pair of
stages, inside the per-step feed solve, and once per destination piece while files are written, so a
stopped optimization halts at the next step or piece boundary rather than running to the end. The
Shell ladder says so twice: the feed solve closes with <code>Optimization Feed Process canceled.</code> in
place of <code>Optimization Feedrate built.</code>, and an <code>optimization canceled.</code> row is added before the
pass ends.</p>
<div class="IMPORTANT">
<h5>Important</h5>
<p>A stopped optimization still ends on the green <code>Total N files optimized.</code> row a completed one ends
on. That row is not a statement that the optimization finished — read the row above it. <code>N</code> counts
the files the run had begun writing, so a Stop during the feed solve ends on
<code>Total 0 files optimized.</code>, and a Stop during writing counts the file it was in the middle of,
which is left short.</p>
</div>
<hr>
<h2 id="5-verify-optimization-results">5. Verify Optimization Results</h2>
<h3 id="optimization-logs">Optimization Logs</h3>
<p>Enable the per-step log to see which constraint limited each step:</p>
<pre><code class="lang-csharp">EnableIndividualStepAdjustmentLog = true;
<p>The per-step log is written by default. Every optimization drops one <code>.IndependentStepAdjustment.log</code>
beside each optimized NC file that had steps to solve, named after that optimized file, and it
records which constraint limited each step.
<a class="xref" href="../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_EnableIndividualStepAdjustmentLog">EnableIndividualStepAdjustmentLog</a> is the switch that stops it
being written:</p>
<pre><code class="lang-csharp">EnableIndividualStepAdjustmentLog = false;
</code></pre>
<p>The <code>.IndependentStepAdjustment.log</code> file records per-step calculations including:</p>
<ul>
<li><code>FrtByPreferedForce_mm</code> — feed per tooth from target force</li>
<li><code>FrtByYieldingStressRatio_mm</code> — feed per tooth from yielding stress</li>
<li><code>FrtBySpindleTorqueRatio_mm</code> — feed per tooth from spindle torque</li>
<li><code>FrtBySpindlePowerRatio_mm</code> — feed per tooth from spindle power</li>
<li><code>FrtByThermalYieldingRatio_mm</code> — feed per tooth from thermal yield</li>
</ul>
<p>A stopped or failed optimization leaves that file short. Its buffered tail is written out only when
the feed solve runs to completion; when the pass is cut off, the lines still in the buffer are
dropped, and so is any step line held back in the ordering window waiting for a lower step index
that never arrived. Batches reach the file at most once a second, so the missing tail can cover the
last second of solving as well as the steps that were never reached. Read the log as a complete
record only for a run whose feed solve closed with <code>Optimization Feedrate built.</code></p>
<p>Each row of the <code>.IndependentStepAdjustment.log</code> file opens with the source NC file and line, the step index and the cutter location, then lists the feed per tooth every active criterion allowed:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Criterion</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>FrtByPreferedForce_mm</code></td>
<td>target cutting force</td>
</tr>
<tr>
<td><code>FrtByYieldingStressRatio_mm</code></td>
<td>yielding stress</td>
</tr>
<tr>
<td><code>FrtBySpindleTorqueRatio_mm</code></td>
<td>spindle torque</td>
</tr>
<tr>
<td><code>FrtBySpindlePowerRatio_mm</code></td>
<td>spindle power</td>
</tr>
<tr>
<td><code>FrtByThermalYieldingRatio_mm</code></td>
<td>thermal yield</td>
</tr>
<tr>
<td><code>FrtByCustom_mm(n)</code></td>
<td>the n-th custom criterion the script registered</td>
</tr>
<tr>
<td><code>FrtByReliefAngle_mm</code></td>
<td>relief-face contact — see <a class="xref" href="../technique/milling-physics/relief-face-avoidance.html">Relief Face Avoidance</a></td>
</tr>
</tbody>
</table>
<p>The step's feed per tooth is the <strong>lowest</strong> of the first six; the relief-angle pass then runs on that value, so its row is the last word rather than one vote among the others.</p>
<p>Every row carries the solver's status for that criterion in brackets: <code>Solved</code> when the binary solve converged, <code>Singular</code> / <code>OverIteration</code> / <code>Iterating</code> when it did not, and — on the relief-angle row only — <code>Acceptable</code>, which means the relief face was clear at the feed already chosen, so that row states the feed instead of a limit on it. A criterion with no row at all was switched off (its safety factor is <code>0</code>) or was not evaluable for that tool.</p>
<p>Three rows replace that list rather than joining it:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>FrtByUnTouched: inf</code></td>
<td>the step cuts nothing, so no physical criterion applies</td>
</tr>
<tr>
<td><code>FeedrateByNoData_mmdmin: &lt;feed&gt;</code></td>
<td>no tool or no milling coefficients on the step; it keeps its feed</td>
</tr>
<tr>
<td><code>StepFailed: &lt;exception&gt;</code></td>
<td>the solve threw; the step keeps its simulated feed and is reported as an error — see <a href="../technique/nc-optimization/nc-optimization-principles.html#when-a-step-cannot-be-solved">When a Step Cannot Be Solved</a></td>
</tr>
</tbody>
</table>
<h3 id="embedded-log-comments">Embedded Log Comments</h3>
<p>Control embedded log verbosity with <a class="xref" href="../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_EmbeddedLogMode_">EmbeddedLogMode</a>:</p>
<table>
@@ -320,16 +462,34 @@ N0160 X-3.555 Y43.338 (;@EndPreserve();)
</tr>
</tbody>
</table>
<p>Example output: <code>G01 X10.0 Y20.0 F500 (src(LineNo: 140, StepIndex: 256))</code></p>
<div class="IMPORTANT">
<h5>Important</h5>
<p>The mode is read by the legacy optimization path. While
<a class="xref" href="../api/Hi.MachiningProcs.LocalProjectService.html#Hi_MachiningProcs_LocalProjectService_EnableSoftNcRunner">EnableSoftNcRunner</a> is on and the session holds played
NC — the default — the optimizer writes the <code>SimpleLog</code> shape whatever the mode says: every
re-interpolated fragment carries its <code>StepIndex</code>, the last fragment of each source line adds that
line's <code>LineNo</code>, and a line the optimizer did not split carries no note.</p>
</div>
<p>The note is written in the controller's comment grammar, so the optimized file stays legal for the
control that reads it. On the Fanuc family it is parenthesized:</p>
<pre><code>G01 X10.0 Y20.0 F500 (src(LineNo: 140, StepIndex: 256))
</code></pre>
<p>On Heidenhain it is a <code>;</code> comment, because a TNC reads parentheses as code:</p>
<pre><code>120 L X+35 Y-11.7 R0 F500 ;src(LineNo: 140, StepIndex: 256)
</code></pre>
<p>On a Heidenhain project a feed word the optimizer has to insert is also placed in the element order
a TNC enforces — after the coordinate words, after the rotation direction <code>DR+</code> / <code>DR-</code>, and after
the radius compensation <code>RL</code> / <code>RR</code> / <code>R0</code>. A block that read <code>L X+10 Y+20 RL</code> comes back as
<code>L X+10 Y+20 RL F500</code>.</p>
<h3 id="tracking-individual-step-constraints">Tracking Individual Step Constraints</h3>
<p>To isolate which physical quantity limits each step, disable smoothing:</p>
<pre><code class="lang-csharp">OptMaxAcceleration_mmds2 = double.PositiveInfinity;
OptFeedrateAssignmentRatio = 0;
OptExtendedPreDistance_mm = 0;
OptExtendedPostDistance_mm = 0;
EnableIndividualStepAdjustmentLog = true;
EmbeddedLogMode = NcOptimizationEmbeddedLogMode.FullLog;
</code></pre>
<p>The four smoothing settings are what this block changes. The per-step log is already on, and
<code>EmbeddedLogMode</code> does not reach the pipeline that runs by default — see above.</p>
<h3 id="post-optimization-simulation-differences">Post-Optimization Simulation Differences</h3>
<p>Optimized feed rates produce different interpolation points, causing:</p>
<ul>
@@ -339,7 +499,7 @@ EmbeddedLogMode = NcOptimizationEmbeddedLogMode.FullLog;
<p>Simulated physical quantities after optimization may be slightly above target values due to these differences.</p>
<div class="TIP">
<h5>Tip</h5>
<p>For abnormally low optimized feed rates at corners, refer to <a href="../manual/analysis/corner-behavior.html">Corner Feed Rate Optimization</a>.</p>
<p>For abnormally low optimized feed rates at corners, refer to <a class="xref" href="../technique/nc-optimization/corner-behavior.html">Corner Feed Rate Optimization</a>.</p>
</div>
<hr>
<h2 id="tool-breakage-solutions">Tool Breakage Solutions</h2>
@@ -374,11 +534,11 @@ WriteStepFiles(&quot;Output/[NcName].step.csv&quot;);
</code></pre>
<h2 id="see-also">See Also</h2>
<ul>
<li><a href="../manual/analysis/nc-optimization-principles.html">NC Optimization (Concepts)</a> — theory and objectives</li>
<li><a href="../manual/analysis/corner-behavior.html">Corner Feed Rate Optimization</a></li>
<li><a class="xref" href="../technique/nc-optimization/nc-optimization-principles.html">NC Optimization (Concepts)</a> — theory and objectives</li>
<li><a class="xref" href="../technique/nc-optimization/corner-behavior.html">Corner Feed Rate Optimization</a></li>
<li><a class="xref" href="force-training.html">Workflow: Milling Force Parameter Training</a> — prerequisite: training cutting parameters</li>
<li><a class="xref" href="basic-simulation.html">Workflow: Basic Machining Simulation</a> — basic simulation setup</li>
<li><a class="xref" href="../manual/runtime/session-shell.html">Glossary: SessionShell Quick-Reference</a> — SessionShell quick-reference</li>
<li><a class="xref" href="../technique/scripting/session-shell.html">SessionShell</a> — SessionShell quick-reference</li>
</ul>
</article>