fix SoftNcRunner GM code normalization.

This commit is contained in:
2026-05-06 13:21:19 +08:00
parent 0fe9497552
commit 2f57932000
1238 changed files with 69405 additions and 22511 deletions
@@ -0,0 +1,357 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Workflow: Basic Machining Simulation | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Workflow: Basic Machining Simulation | HiAPI-C# 2025 ">
<link rel="icon" href="../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="Workflow-BasicSimulation">
<h1 id="workflow-basic-machining-simulation">Workflow: Basic Machining Simulation</h1>
<p>This workflow walks through setting up and running a machining simulation from scratch, including project configuration, option tuning, NC execution, and result inspection.</p>
<pre><code class="lang-mermaid">flowchart TD
Equipment[&quot;Set machine tool &amp;&lt;br&gt;controller brand/type&quot;]
Job[&quot;Set workpiece, fixture,&lt;br&gt;tool house, NC files,&lt;br&gt;controller offsets&quot;]
Option[&quot;Tune simulation options&lt;br&gt;(resolution, physics, etc.)&quot;]
Run[&quot;Run simulation&quot;]
View[&quot;View results&quot;]
Equipment --&gt; Job --&gt; Option --&gt; Run --&gt; View
</code></pre>
<h2 id="1-set-machine-tool-and-controller">1. Set Machine Tool and Controller</h2>
<p>The machine tool and controller are fixed equipment that define the physical simulation environment.</p>
<h3 id="machine-tool">Machine Tool</h3>
<p>The machine tool (<code>.mt</code> file) provides the kinematic model and STL bodies. Once selected it rarely changes between simulations.</p>
<h3 id="controller">Controller</h3>
<p>Select the controller brand and type (e.g., Fanuc, Heidenhain, Siemens). This determines how NC code is interpreted. See <a href="../manual/setup/controller-heidenhain.html">Heidenhain Support</a> and <a href="../manual/setup/controller-iso.html">General NC Code Support</a> for details.</p>
<h3 id="gui-operation">GUI Operation</h3>
<p>Open or create a project in the HiNC application and configure machine tool and controller through the corresponding panels before setting up the job.</p>
<hr>
<h2 id="2-set-job-components">2. Set Job Components</h2>
<p>With equipment fixed, configure the job-specific components that change between simulations.</p>
<h3 id="job-components">Job Components</h3>
<table>
<thead>
<tr>
<th>Component</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Workpiece</strong></td>
<td>Geometry (STL or parametric), material, and coordinate frame</td>
</tr>
<tr>
<td><strong>Fixture</strong> (optional)</td>
<td>Fixture geometry that participates in collision detection</td>
</tr>
<tr>
<td><strong>Tool House</strong></td>
<td>One or more cutting tools with geometry and flute definitions</td>
</tr>
<tr>
<td><strong>NC Files</strong></td>
<td>The NC programs to simulate</td>
</tr>
<tr>
<td><strong>Controller Offsets</strong></td>
<td>Tool offset tables, work offset tables, and other controller-specific presets</td>
</tr>
</tbody>
</table>
<div class="TIP">
<h5>Tip</h5>
<p>All file paths used in script commands are relative to the project directory unless an absolute path is given.</p>
</div>
<h3 id="script-access">Script Access</h3>
<p>The workpiece and fixture objects are available through <a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_Workpiece">Workpiece</a><small>(API)</small> and <a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_Fixture">Fixture</a><small>(API)</small>.</p>
<pre><code class="lang-csharp">var workpiece = Workpiece;
var fixture = Fixture;
</code></pre>
<h3 id="gui-operation-1">GUI Operation</h3>
<p>Configure each component through the corresponding panels (Workpiece, Fixture, Tool House windows).</p>
<hr>
<h2 id="3-tune-simulation-options">3. Tune Simulation Options</h2>
<p>Simulation options control the trade-off between accuracy and speed.</p>
<h3 id="31-workpiece-entity-resolution">3.1 Workpiece Entity Resolution</h3>
<p><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_MachiningResolution_mm">MachiningResolution_mm</a><small>(API)</small> sets the smallest cube width of the workpiece mesh.</p>
<pre><code class="lang-csharp">MachiningResolution_mm = 0.125;
</code></pre>
<p>Valid values are <strong>powers of 2</strong> (e.g., 4, 2, 1, 0.5, 0.25, 0.125). If you supply a non-power-of-2 value the system rounds to the nearest power of 2.</p>
<div class="WARNING">
<h5>Warning</h5>
<p>Each halving of mesh width can increase computation time and RAM by up to <strong>8x</strong>. Start with a coarser resolution and refine only when needed.</p>
</div>
<h3 id="32-display-cache">3.2 Display Cache</h3>
<pre><code class="lang-csharp">DispCache_Mb = 260;
</code></pre>
<p>The display resolution depends on the cache size. Recommended value should not exceed 1000 Mb.</p>
<h3 id="33-machining-motion-resolution">3.3 Machining Motion Resolution</h3>
<p>Machining motion resolution determines the interval of each simulation step. Options:</p>
<table>
<thead>
<tr>
<th>Mode</th>
<th>Command</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Feed Per Cycle</td>
<td><code>MachiningMotionResolution = FeedPerCycle;</code></td>
<td>One step per spindle revolution</td>
</tr>
<tr>
<td>Scaled Feed Per Cycle</td>
<td><code>MachiningMotionResolution = ScaledFeedPerCycle(0.5);</code></td>
<td>One step per revolution × scale factor</td>
</tr>
<tr>
<td>Feed Per Tooth</td>
<td><code>MachiningMotionResolution = FeedPerTooth;</code></td>
<td>One step per tooth revolution (default)</td>
</tr>
<tr>
<td>Fixed Pace</td>
<td><code>MachiningMotionResolution = FixedPace(1, 15);</code></td>
<td>Fixed linear (mm) and rotary (deg) resolution</td>
</tr>
</tbody>
</table>
<div class="WARNING">
<h5>Warning</h5>
<p><strong>Do not use scaled model dimensions as a substitute for adjusting mesh width.</strong> Scaling model dimensions causes internal algorithm thresholds (minimum cuttable amount, floating-point-to-fraction range) to become invalid, producing irregular geometry artifacts. Adjust resolution settings instead.</p>
</div>
<h3 id="34-xml-configuration">3.4 XML Configuration</h3>
<p>Resolution can also be set in the <code>.hincproj</code> file or changed mid-simulation via NC code comments:</p>
<pre><code>T01 M06 (;@MachiningResolution_mm=0.03125;)
</code></pre>
<hr>
<h2 id="4-run-simulation">4. Run Simulation</h2>
<p>There are three ways to drive the simulation.</p>
<h3 id="41-playncfile--execute-from-a-file">4.1 PlayNcFile — Execute from a File</h3>
<p><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_PlayNcFile_">PlayNcFile</a><small>(API)</small> reads and executes an NC file.</p>
<pre><code class="lang-csharp">PlayNcFile(&quot;NC/file1.nc&quot;);
</code></pre>
<h3 id="42-plaync--execute-from-a-string">4.2 PlayNc — Execute from a String</h3>
<p><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_PlayNc_">PlayNc</a><small>(API)</small> executes NC code directly from a string, useful for programmatic or dynamically generated commands.</p>
<pre><code class="lang-csharp">double x = 10.0;
PlayNc($&quot;G01 X{x} Y20 F100&quot;, &quot;Generated Command&quot;);
</code></pre>
<h3 id="43-playcsvfile--drive-from-csv-data">4.3 PlayCsvFile — Drive from CSV Data</h3>
<p><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_PlayCsvFile_">PlayCsvFile</a><small>(API)</small> drives the simulation from a CSV file containing axis positions, spindle speed, and feed rate.</p>
<pre><code class="lang-csharp">PlayCsvFile(&quot;Data/file1.csv&quot;);
</code></pre>
<p>Required CSV columns (default headers): <code>MC.X</code>, <code>MC.Y</code>, <code>MC.Z</code>, <code>ToolId</code>, <code>SpindleSpeed_rpm</code>, <code>Feedrate_mmdmin</code>. Optional: <code>MC.A</code>, <code>MC.B</code>, <code>MC.C</code>, <code>ActualTime</code>, <code>StepDuration</code>.</p>
<div class="TIP">
<h5>Tip</h5>
<p>CSV files exported by <a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_WriteStepFiles_">WriteStepFiles</a><small>(API)</small> can be directly read back with <a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_PlayCsvFile_">PlayCsvFile</a><small>(API)</small>.</p>
</div>
<h3 id="44-player-control">4.4 Player Control</h3>
<table>
<thead>
<tr>
<th>Command</th>
<th>Purpose</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_Pace">Pace()</a><small>(API)</small></td>
<td>Insert a pausable checkpoint</td>
</tr>
<tr>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_Pause">Pause()</a><small>(API)</small></td>
<td>Pause execution</td>
</tr>
<tr>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_Reset">Reset()</a><small>(API)</small></td>
<td>Reset player state</td>
</tr>
</tbody>
</table>
<pre><code class="lang-csharp">PlayNcFile(&quot;NC/file1.nc&quot;);
if (someCondition)
Pause();
</code></pre>
<hr>
<h2 id="5-view-results">5. View Results</h2>
<h3 id="51-runtime-geometry">5.1 Runtime Geometry</h3>
<p>After simulation the workpiece geometry is a <strong>Runtime Geometry</strong> (cubic mesh). You can save and reload it to avoid re-computing the initial shape:</p>
<pre><code class="lang-csharp">WriteRuntimeGeom(&quot;Cache/file1.wct&quot;);
WriteRuntimeGeomToStl(&quot;Output/file1.stl&quot;);
</code></pre>
<p>To reload a saved geometry for a subsequent run:</p>
<pre><code class="lang-csharp">ReadRuntimeGeom(&quot;Cache/init.wct&quot;);
PlayNcFile(&quot;NC/file1.nc&quot;);
</code></pre>
<h3 id="52-step-data-inspection">5.2 Step Data Inspection</h3>
<p>Each simulation step carries rich data (force, torque, power, thermal, wear). Access individual steps:</p>
<pre><code class="lang-csharp">var step = GetMillingStep(100);
Message($&quot;ToolId={step.ToolId}, Force={step.MaxAbsForce_N} N&quot;);
</code></pre>
<p>Total step count:</p>
<pre><code class="lang-csharp">var total = StepCount;
Message($&quot;Total steps: {total}&quot;);
</code></pre>
<h3 id="53-export-data">5.3 Export Data</h3>
<p>Export step-level CSV:</p>
<pre><code class="lang-csharp">WriteStepFiles(&quot;Output/[NcName].step.csv&quot;);
</code></pre>
<p>Export waveform (shot) CSV:</p>
<pre><code class="lang-csharp">WriteShotFiles(&quot;Output/[NcName].shot.csv&quot;, 1);
</code></pre>
<h3 id="54-messages">5.4 Messages</h3>
<p>Use messages to log and track simulation progress:</p>
<pre><code class="lang-csharp">Message(&quot;Simulation complete&quot;);
AppendMessagesToFile(&quot;Output/messages.txt&quot;);
</code></pre>
<hr>
<h2 id="troubleshooting">Troubleshooting</h2>
<table>
<thead>
<tr>
<th>Symptom</th>
<th>Likely Cause</th>
<th>Fix</th>
</tr>
</thead>
<tbody>
<tr>
<td>Very slow simulation</td>
<td>Resolution too fine</td>
<td>Increase <code>MachiningResolution_mm</code></td>
</tr>
<tr>
<td>Irregular bumps on geometry</td>
<td>Scaled model dimensions instead of resolution</td>
<td>Use resolution settings only; see warning above</td>
</tr>
<tr>
<td>Display lag</td>
<td><code>DispCache_Mb</code> too large</td>
<td>Reduce display cache (&lt; 1000 Mb recommended)</td>
</tr>
<tr>
<td>Empty step data</td>
<td>Simulation not run or tool not engaging workpiece</td>
<td>Verify tool path intersects the workpiece</td>
</tr>
</tbody>
</table>
<h2 id="see-also">See Also</h2>
<ul>
<li><a href="../manual/setup/controller-heidenhain.html">Heidenhain Support</a> — controller configuration</li>
<li><a href="../manual/setup/controller-iso.html">General NC Code Support</a> — ISO NC support</li>
<li><a href="../manual/runtime/step-intro.html">Simulation Step</a> — what a step is</li>
<li><a href="../manual/runtime/step-output.html">Simulation Step Output</a> — step field reference</li>
<li><a class="xref" href="../manual/runtime/script-command.html">Glossary: Script Commands</a> — script command basics</li>
<li><a class="xref" href="../manual/runtime/runtime-api.html">Glossary: RuntimeApi Quick-Reference</a> — RuntimeApi quick-reference</li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 KiB

@@ -0,0 +1,145 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Dynamometer Experiment SOP | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Dynamometer Experiment SOP | HiAPI-C# 2025 ">
<link rel="icon" href="../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="">
<h1 id="dynamometer-experiment-sop">Dynamometer Experiment SOP</h1>
<p>Capture three-axis force data using a dynamometer and calculate the milling force coefficients.</p>
<h2 id="dynamometer-setup-photography">Dynamometer Setup Photography</h2>
<p>After setting up the experimental equipment, push in the X, Y, and Z directions by hand while observing whether the dynamometer output is correct.</p>
<p>This process must be photographed or recorded on video. The frame should simultaneously show the dynamometer output and the hand pushing.</p>
<p>Ensure the dynamometer wiring is correct and the sign conventions are correct, so the experimental setup can be traced back later.</p>
<h2 id="tool">Tool</h2>
<p>Use a square-end (non-corner-radius) end mill. Recommended tool parameters:</p>
<ul>
<li>D10</li>
<li>Flute4</li>
<li>Helix35</li>
</ul>
<p>There are no specific restrictions on the number of flutes, helix angle, or rake angle, but these must be accurately recorded along with the tool brand and model.</p>
<p>A 10 mm diameter is used to avoid tool breakage when cutting difficult materials. The 10 mm standard was established based on Inconel 718 as the safety baseline for this experiment.</p>
<h2 id="workpiece--toolpath">Workpiece / Toolpath</h2>
<p>Workpiece dimensions: dynamometer length × width × convenient clamping height (50 mm)</p>
<p><img src="dynamometer-experiment-sop-img/fixWorkpiece.jpg" alt="fix-workpiece.jpg"></p>
<p><img src="dynamometer-experiment-sop-img/StraightLineTraining-path.png" alt="training-path"></p>
<p>Cutting depth is 0.5 mm.</p>
<p>Toolpath categories are identified by keywords: low, high, through.</p>
<p>&ldquo;low&rdquo; denotes low spindle speed, &ldquo;high&rdquo; denotes high spindle speed, and &ldquo;through&rdquo; denotes a through-pass.
There are 8 cuts in total: low1, low2, low3, high1, high2, high3, through1, through2.</p>
<p>If material is limited, low2 and low3 alone are sufficient to complete the training.</p>
<p>low1 intentionally cuts along the edge so that through1 can smoothly enter the cutting zone.</p>
<p>The high series uses the same feed per tooth as the low series but at different spindle speeds, primarily to observe whether spindle speed affects cutting forces.
If constrained by material, machine, or other factors, high2 and high3 can be omitted first.</p>
<p>through1 and through2 maintain a constant CWE and serve as validation passes.</p>
<p>If the material is too hard, the cutting depth can be reduced for the experiment.</p>
<h2 id="experiment-results">Experiment Results</h2>
<p>The dynamometer data must be retained.</p>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
@@ -0,0 +1,120 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Projects | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Example Projects | HiAPI-C# 2025 ">
<link rel="icon" href="../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../public/docfx.min.css">
<link rel="stylesheet" href="../../public/main.css">
<meta name="docfx:navrel" content="../../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../index.html">
<img id="logo" class="svg" src="../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="Examples">
<h1 id="example-projects">Example Projects</h1>
<p>Complete project-level examples demonstrating full workflows with real data.</p>
<ul>
<li><a href="milling-training-dynamometer.html">Dynamometer Milling Training</a> — Train milling coefficients using Kistler dynamometer measurements on S50C material</li>
<li><a href="mapping-demo.html">Cascading Controller &amp; Sensor Data</a> — Cascade controller and sensor data into the simulation toolpath and update milling coefficients</li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
@@ -0,0 +1,123 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Project: Mapping Controller and Sensor Data to Simulated NC Toolpaths and Updating Milling Coefficients | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Example Project: Mapping Controller and Sensor Data to Simulated NC Toolpaths and Updating Milling Coefficients | HiAPI-C# 2025 ">
<link rel="icon" href="../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../public/docfx.min.css">
<link rel="stylesheet" href="../../public/main.css">
<meta name="docfx:navrel" content="../../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../index.html">
<img id="logo" class="svg" src="../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="Example-MappingDemo">
<h1 id="example-project-mapping-controller-and-sensor-data-to-simulated-nc-toolpaths-and-updating-milling-coefficients">Example Project: Mapping Controller and Sensor Data to Simulated NC Toolpaths and Updating Milling Coefficients</h1>
<p>The example project can be downloaded here:</p>
<p><a href="https://superhightech-gitea.webredirect.org/HiNC-Deploy/DemoMapping">https://superhightech-gitea.webredirect.org/HiNC-Deploy/DemoMapping</a></p>
<p>This project uses <a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_MapSingleByCsvFile_">MapSingleByCsvFile</a><small>(API)</small> and <a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_MapSeriesByCsvFile_">MapSeriesByCsvFile</a><small>(API)</small> to map controller data and sensor data to the virtual environment, and then update the milling coefficients.</p>
<h2 id="related-pages">Related Pages</h2>
<ul>
<li><a class="xref" href="../sensor-mapping.html">Workflow: Sensor Data Mapping</a> — sensor data mapping workflow</li>
<li><a class="xref" href="../force-training.html">Workflow: Milling Force Parameter Training</a> — milling force parameter training workflow</li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

@@ -0,0 +1,128 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Project: Training Milling Coefficients with a Dynamometer | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Example Project: Training Milling Coefficients with a Dynamometer | HiAPI-C# 2025 ">
<link rel="icon" href="../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../public/docfx.min.css">
<link rel="stylesheet" href="../../public/main.css">
<meta name="docfx:navrel" content="../../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../index.html">
<img id="logo" class="svg" src="../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="Example-MillingTraining-Dynamometer">
<h1 id="example-project-training-milling-coefficients-with-a-dynamometer">Example Project: Training Milling Coefficients with a Dynamometer</h1>
<p>The example project for training milling coefficients using a dynamometer can be downloaded here:</p>
<p><a href="https://superhightech-gitea.webredirect.org/HiNC-Deploy/Demo-Para-Training-S50C-202501">https://superhightech-gitea.webredirect.org/HiNC-Deploy/Demo-Para-Training-S50C-202501</a></p>
<p>This project uses Kistler dynamometer measurement data to train milling coefficients for S50C material via the <a href="../sensor-mapping.html#strategy-d-one-to-many-local-mapping-anchor-based">one-to-many local mapping (anchor-based)</a> method.</p>
<p><img src="milling-training-dynamometer-img/demo-training-S50C.png" alt="demo-training-S50C.png"></p>
<div class="TIP">
<h5>Tip</h5>
<p>The toolpath and cutting conditions can be freely modified to suit your specific setup.</p>
</div>
<h2 id="related-pages">Related Pages</h2>
<ul>
<li><a class="xref" href="../force-training.html">Workflow: Milling Force Parameter Training</a> — milling force parameter training workflow</li>
<li><a class="xref" href="../sensor-mapping.html">Workflow: Sensor Data Mapping</a> — sensor data mapping workflow</li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
@@ -0,0 +1,28 @@
<div id="sidetoggle">
<div>
<div class="sidefilter">
<form class="toc-filter">
<span class="glyphicon glyphicon-filter filter-icon"></span>
<span class="glyphicon glyphicon-remove clear-icon" id="toc_filter_clear"></span>
<input type="text" id="toc_filter_input" placeholder="Filter by title" onkeypress="if(event.keyCode==13) {return false;}">
</form>
</div>
<div class="sidetoc">
<div class="toc" id="toc">
<ul class="nav level1">
<li>
<a href="index.html" name="" title="Overview">Overview</a>
</li>
<li>
<a href="milling-training-dynamometer.html" name="" title="Dynamometer Milling Training">Dynamometer Milling Training</a>
</li>
<li>
<a href="mapping-demo.html" name="" title="Cascading Controller &amp; Sensor Data">Cascading Controller &amp; Sensor Data</a>
</li>
</ul>
</div>
</div>
</div>
</div>
@@ -0,0 +1,2 @@
{"items":[{"name":"Overview","href":"index.html","topicHref":"index.html"},{"name":"Dynamometer Milling Training","href":"milling-training-dynamometer.html","topicHref":"milling-training-dynamometer.html"},{"name":"Cascading Controller & Sensor Data","href":"mapping-demo.html","topicHref":"mapping-demo.html"}]}
@@ -0,0 +1,388 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Workflow: Milling Force Parameter Training | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Workflow: Milling Force Parameter Training | HiAPI-C# 2025 ">
<link rel="icon" href="../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="Workflow-ForceTraining">
<h1 id="workflow-milling-force-parameter-training">Workflow: Milling Force Parameter Training</h1>
<p>This workflow covers the end-to-end process of training milling force coefficients from sensor data, including data mapping, coefficient training, quality evaluation, and application of the trained parameters.</p>
<p>Milling coefficients are essential parameters for calculating milling forces. Training derives these coefficients from experimental sensor data (dynamometer or smart tool holder) mapped to simulated toolpaths.</p>
<pre><code class="lang-mermaid">flowchart TD
Prereq[&quot;Prerequisites&lt;br&gt;(sensor data, project setup)&quot;]
Resolution[&quot;Configure resolution &amp; enable physics&quot;]
Mapping[&quot;Configure data mapping&quot;]
Simulate[&quot;Run simulation with NC file&quot;]
Export[&quot;Export simulation data&lt;br&gt;(WriteShotFiles, WriteStepFiles)&quot;]
Map[&quot;Map sensor data to simulation&quot;]
Train[&quot;Train milling parameters&quot;]
Evaluate[&quot;Evaluate training quality&quot;]
Apply[&quot;Load trained parameters&quot;]
Prereq --&gt; Resolution --&gt; Mapping --&gt; Simulate --&gt; Export
Simulate --&gt; Map --&gt; Train --&gt; Evaluate --&gt; Apply
</code></pre>
<h2 id="1-prerequisites">1. Prerequisites</h2>
<p>Before training you need:</p>
<table>
<thead>
<tr>
<th>Item</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>HiNC project</strong></td>
<td>Machine tool, workpiece, fixture, tool house configured</td>
</tr>
<tr>
<td><strong>NC file</strong></td>
<td>The NC program used during the physical cutting experiment</td>
</tr>
<tr>
<td><strong>Sensor data CSV</strong></td>
<td>Time-stamped force/torque data from a dynamometer or smart tool holder</td>
</tr>
<tr>
<td><strong>Controller data CSV</strong> (optional)</td>
<td>Machine controller log with <code>FileNo</code>, <code>LineNo</code>, <code>ActualTime</code> for two-layer mapping</td>
</tr>
</tbody>
</table>
<h3 id="sensor-data-file-format">Sensor Data File Format</h3>
<p>The CSV must contain a header row with <code>ActualTime</code> and at least one force/torque channel:</p>
<table>
<thead>
<tr>
<th>Source</th>
<th>Headers</th>
</tr>
</thead>
<tbody>
<tr>
<td>Dynamometer</td>
<td><code>Fx</code> (or <code>Workpiece.Fx</code>), <code>Fy</code>, <code>Fz</code></td>
</tr>
<tr>
<td>Smart tool holder</td>
<td><code>Mx</code> (or <code>Holder.Mx</code>), <code>My</code>, <code>Mz</code></td>
</tr>
<tr>
<td>Accelerometer (optional)</td>
<td><code>Ax</code>, <code>Ay</code>, <code>Az</code></td>
</tr>
</tbody>
</table>
<pre><code class="lang-csv">ActualTime,CH1,CH2,Mx,My,Mz
18:23:54.703,-0.00398,-0.00034,-0.02923,0.10733,0.00409
18:23:54.704,-0.00194,0.00285,0.04155,-0.04457,0.00448
...
</code></pre>
<div class="TIP">
<h5>Tip</h5>
<p>Keep the completed training project archived. When the HiNC training algorithm is updated, you can re-run training from the same project.</p>
</div>
<hr>
<h2 id="2-configure-resolution-and-enable-physics">2. Configure Resolution and Enable Physics</h2>
<h3 id="resolution">Resolution</h3>
<p>Use a finer resolution than normal operation for training accuracy:</p>
<pre><code class="lang-csharp">MachiningResolution_mm = 0.0625; // half or less of production resolution
MachiningMotionResolution = FeedPerTooth;
</code></pre>
<div class="TIP">
<h5>Tip</h5>
<p>Training resolution should be ≤ 0.5× the production resolution for better accuracy.</p>
</div>
<h3 id="enable-physics">Enable Physics</h3>
<p><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_EnablePhysics">EnablePhysics</a> must be enabled for force calculation:</p>
<pre><code class="lang-csharp">EnablePhysics = true;
</code></pre>
<h3 id="milling-force-cycle-division">Milling Force Cycle Division</h3>
<p>Set the number of angular divisions per revolution before training. Higher values yield more accurate phase alignment:</p>
<pre><code class="lang-csharp">MillingForceCycleDivisionNum = 360;
</code></pre>
<div class="NOTE">
<h5>Note</h5>
<p>This must be set <strong>before</strong> executing <code>TrainMillingPara</code>. A larger value produces a more accurate <code>AngleOffset</code> result and better milling coefficients.</p>
</div>
<hr>
<h2 id="3-configure-data-mapping">3. Configure Data Mapping</h2>
<p>Depending on your data, choose one of the mapping strategies below.</p>
<h3 id="31-local-mapping-anchor-based">3.1 Local Mapping (Anchor-Based)</h3>
<p>For mapping sensor data to specific NC path segments:</p>
<p><strong>Step A — Specify input data:</strong></p>
<pre><code class="lang-csharp">ClearTimeMappingData();
AddTimeDataByFile(&quot;lineA&quot;, &quot;Mapping/sensor1.csv&quot;, &quot;18:25:51.7100&quot;, &quot;18:26:12.9910&quot;);
AddTimeDataByFile(&quot;lineB&quot;, &quot;Mapping/sensor1.csv&quot;, &quot;18:26:30.5750&quot;, &quot;18:27:12.2880&quot;);
</code></pre>
<p><strong>Step B — Specify NC paths</strong> (embedded in NC code comments):</p>
<pre><code>X13. F20 ;@LineSelection(&quot;lineA&quot;, FirstTouch, ShiftTime_s(2), LineEnd, ShiftDistance_mm(-1));
X25. F10 ;@LineSelection(&quot;lineB&quot;, FirstTouch, null, LastTouch, null);
</code></pre>
<p>Anchor options: <code>LineBegin</code>, <code>LineEnd</code>, <code>FirstTouch</code>, <code>LastTouch</code>.
Offset options: <code>null</code>, <code>ShiftTime_s(&lt;seconds&gt;)</code>, <code>ShiftDistance_mm(&lt;mm&gt;)</code>.</p>
<h3 id="32-two-layer-chained-mapping-controller--sensor">3.2 Two-Layer Chained Mapping (Controller + Sensor)</h3>
<p>When you have both controller data and sensor data:</p>
<pre><code class="lang-csharp">PlayNcFile(&quot;NC/machining.nc&quot;);
MapSingleByCsvFile(&quot;Data/controller.csv&quot;); // maps FileNo/LineNo → ActualTime
MapSeriesByCsvFile(&quot;Data/sensor.csv&quot;); // maps ActualTime → sensor series
</code></pre>
<div class="NOTE">
<h5>Note</h5>
<p><strong>Why two-layer mapping?</strong> Running the NC through the system interpreter produces more accurate simulation paths than direct CSV playback. The controller data bridges simulation steps to real time via <code>FileNo</code>/<code>LineNo</code>, and the sensor data bridges real time to force/torque readings.</p>
</div>
<hr>
<h2 id="4-run-simulation">4. Run Simulation</h2>
<pre><code class="lang-csharp">PlayNcFile(&quot;NC/file1.nc&quot;);
</code></pre>
<div class="WARNING">
<h5>Warning</h5>
<p>During training, <strong>do not</strong>:</p>
<ul>
<li>Adjust workpiece, tool, or controller resolution settings</li>
<li>Use the NC player reset button (close the project instead)</li>
<li>Save the project (system training configuration may overwrite tool resolution settings)</li>
</ul>
</div>
<hr>
<h2 id="5-export-simulation-data">5. Export Simulation Data</h2>
<p>Export step data and waveform data for analysis:</p>
<pre><code class="lang-csharp">WriteStepFiles(&quot;Output/[NcName].step.csv&quot;);
WriteShotFiles(&quot;Output/[NcName].shot.csv&quot;, 1);
</code></pre>
<p>The shot file contains time-resolved force columns: <code>Tool.Fx/Fy/Fz</code>, <code>Workpiece.Fx/Fy/Fz</code>, <code>Spindle.Mx/My/Mz</code>.</p>
<p>For coordinate system explanations, see <a href="../manual/analysis/milling-physics-coordinates.html">Milling Physics Coordinates</a>.</p>
<hr>
<h2 id="6-train-milling-parameters">6. Train Milling Parameters</h2>
<h3 id="trainmillingpara-new-training">TrainMillingPara (New Training)</h3>
<p><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_TrainMillingPara_">TrainMillingPara</a> trains new coefficients independently of any existing workpiece parameters.</p>
<pre><code class="lang-csharp">TrainMillingPara(Fx|Fy|Fz, &quot;StainlessSteel.mp&quot;);
</code></pre>
<h3 id="retrainmillingpara-calibration">ReTrainMillingPara (Calibration)</h3>
<p><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_ReTrainMillingPara_">ReTrainMillingPara</a> calibrates existing coefficients (10% original weight, 90% new sample weight).</p>
<pre><code class="lang-csharp">ReTrainMillingPara(Fz|Mx|My|Mz, &quot;StainlessSteel.mp&quot;);
</code></pre>
<h3 id="sample-flag-requirements">Sample Flag Requirements</h3>
<table>
<thead>
<tr>
<th>Command</th>
<th>Minimum Data Types</th>
<th>Feed Per Tooth Requirement</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>TrainMillingPara</code></td>
<td><code>Fx\|Fy\|Fz</code> (dynamometer) or <code>Fz\|Mx\|My\|Mz</code> (smart tool holder)</td>
<td>At least one sample with different feed per tooth</td>
</tr>
<tr>
<td><code>ReTrainMillingPara</code></td>
<td>No restriction</td>
<td>No restriction</td>
</tr>
</tbody>
</table>
<div class="WARNING">
<h5>Warning</h5>
<p>Using only <code>Mx|My|Mz</code> without <code>Fz</code> loses one degree of freedom (torque = r × F loses the r-direction), making coefficient training unreliable. Always include <code>Fz</code> when using torque data.</p>
</div>
<h3 id="training-conditions">Training Conditions</h3>
<ul>
<li>Samples should have <strong>stable, repeatable waveforms</strong> for at least two spindle revolutions</li>
<li>Under unstable conditions, plowing coefficients tend to be over-estimated</li>
<li>Any NC path shape (slot milling, side milling, any tool shape) is acceptable when samples are stable</li>
</ul>
<hr>
<h2 id="7-evaluate-training-quality">7. Evaluate Training Quality</h2>
<p>After training, the system reports three quality metrics:</p>
<h3 id="correlation-coefficient-r">Correlation Coefficient (R)</h3>
<p>A single value for the overall result. Ranges from 0 to 1; for new tools, expect 0.950.999.</p>
<h3 id="training-error-ratio-trainingerrratio">Training Error Ratio (TrainingErrRatio)</h3>
<p>A per-step variable registered automatically after training. Lower values indicate better step-level quality:</p>
<div class="math">
\[
\text{TrainingErrRatio} = \sqrt{\frac{\sum_{i} e_i^2}{\sqrt{\sum_{i} y_i^2 \cdot \sum_{i} \hat{y}_i^2}}}
\]</div>
<h3 id="angle-offset-angleoffset">Angle Offset (AngleOffset)</h3>
<p>A per-step variable representing the cutter rotation phase difference between measured and simulated data:</p>
<div class="math">
\[
\theta_{offset} = \frac{2\pi \cdot i_{min}}{N_{div}}
\]</div>
<div class="TIP">
<h5>Tip</h5>
<p>If <code>AngleOffset</code> varies significantly across segments in the same training batch, the spindle may have experienced speed changes, data gaps, or the system could not accurately analyze the samples.</p>
</div>
<hr>
<h2 id="8-load-trained-parameters">8. Load Trained Parameters</h2>
<p>After training, load the new coefficients into the workpiece:</p>
<pre><code class="lang-csharp">LoadCuttingParaByFile(&quot;StainlessSteel.mp&quot;);
</code></pre>
<div class="WARNING">
<h5>Warning</h5>
<p>If the training output file path is the same as the tool's existing cutting parameter file, <strong>reload the project</strong> after training to ensure the new parameters take effect.</p>
</div>
<hr>
<h2 id="xml-configuration-gui-workflow">XML Configuration (GUI Workflow)</h2>
<p>When using the GUI-based training workflow, configure the <code>.hincproj</code> file:</p>
<pre><code class="lang-xml">&lt;MillingParaGridTrainingDestinationFile&gt;MillingPara/trainedPara.mp&lt;/MillingParaGridTrainingDestinationFile&gt;
&lt;MillingParaTraining&gt;
&lt;IsMzEnabled&gt;false&lt;/IsMzEnabled&gt;
&lt;ForceOutlierRatio&gt;2&lt;/ForceOutlierRatio&gt;
&lt;LeadParaTemplate&gt;
&lt;RakeFaceCuttingParaMap&gt;
&lt;FluteFormNum&gt;1&lt;/FluteFormNum&gt;
&lt;NAngleDivisionNum&gt;0&lt;/NAngleDivisionNum&gt;
&lt;EcAngleDivisionNum&gt;0&lt;/EcAngleDivisionNum&gt;
&lt;/RakeFaceCuttingParaMap&gt;
&lt;/LeadParaTemplate&gt;
&lt;ResultParaTemplate&gt;
&lt;RakeFaceCuttingParaMap&gt;
&lt;FluteFormNum&gt;1&lt;/FluteFormNum&gt;
&lt;NAngleDivisionNum&gt;0&lt;/NAngleDivisionNum&gt;
&lt;EcAngleDivisionNum&gt;0&lt;/EcAngleDivisionNum&gt;
&lt;/RakeFaceCuttingParaMap&gt;
&lt;/ResultParaTemplate&gt;
&lt;/MillingParaTraining&gt;
</code></pre>
<p>Set <code>IsMzEnabled</code> to <code>true</code> if mapped data contains axial spindle torque from a smart tool holder.</p>
<hr>
<h2 id="complete-script-example">Complete Script Example</h2>
<pre><code class="lang-csharp">MachiningResolution_mm = 0.0625;
EnablePhysics = true;
MillingForceCycleDivisionNum = 360;
ClearTimeMappingData();
AddTimeDataByFile(&quot;lineA&quot;, &quot;Mapping/sensor1.csv&quot;, &quot;18:25:51.7100&quot;, &quot;18:26:12.9910&quot;);
AddTimeDataByFile(&quot;lineB&quot;, &quot;Mapping/sensor1.csv&quot;, &quot;18:26:30.5750&quot;, &quot;18:27:12.2880&quot;);
PlayNcFile(&quot;NC/file1.nc&quot;);
TrainMillingPara(Fx|Fy|Fz, &quot;MillingPara/trained.mp&quot;);
LoadCuttingParaByFile(&quot;MillingPara/trained.mp&quot;);
WriteStepFiles(&quot;Output/[NcName].step.csv&quot;);
WriteShotFiles(&quot;Output/[NcName].shot.csv&quot;, 1);
</code></pre>
<h2 id="see-also">See Also</h2>
<ul>
<li><a href="../manual/analysis/milling-physics-coordinates.html">Milling Physics Coordinates</a> — coordinate system reference</li>
<li><a href="sensor-mapping.html">Sensor Mapping Workflow</a> — detailed mapping workflow</li>
<li><a class="xref" href="basic-simulation.html">Workflow: Basic Machining Simulation</a> — basic simulation setup</li>
<li><a class="xref" href="nc-optimization.html">Workflow: NC Optimization</a> — optimization after training</li>
<li><a class="xref" href="../manual/runtime/machining-step.html">Glossary: Machining Step</a> — step data reference</li>
<li><a class="xref" href="../manual/runtime/runtime-api.html">Glossary: RuntimeApi Quick-Reference</a> — RuntimeApi quick-reference</li>
<li><a href="examples/milling-training-dynamometer.html">Training with a Dynamometer (Example)</a></li>
<li><a href="examples/mapping-demo.html">Cascading Mapping (Example)</a></li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
@@ -0,0 +1,286 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Workflow: Geometry Validation | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Workflow: Geometry Validation | HiAPI-C# 2025 ">
<link rel="icon" href="../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="Workflow-GeometryValidation">
<h1 id="workflow-geometry-validation">Workflow: Geometry Validation</h1>
<p>This workflow covers the suite of tools for validating machining geometry after simulation, including collision detection, geometry difference comparison, defect scanning, and flying piece removal.</p>
<pre><code class="lang-mermaid">flowchart TD
Simulate[&quot;Run simulation&quot;]
Collision[&quot;Collision detection&quot;]
Diff[&quot;Geometry difference comparison&quot;]
Defect[&quot;Geometry defect scanning&quot;]
FlyPiece[&quot;Flying piece removal&quot;]
Simulate --&gt; Collision
Simulate --&gt; Diff
Simulate --&gt; Defect
Simulate --&gt; FlyPiece
</code></pre>
<hr>
<h2 id="1-collision-detection">1. Collision Detection</h2>
<p>Collision detection monitors whether the tool, holder, or spindle collides with the workpiece, fixture, or machine during simulation. Enable it <strong>before</strong> running the simulation.</p>
<h3 id="script-commands">Script Commands</h3>
<pre><code class="lang-csharp">EnableCollisionDetection = true;
EnablePauseOnCollision = false; // set true to pause on collision
</code></pre>
<table>
<thead>
<tr>
<th>Property</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>EnableCollisionDetection</code></td>
<td>Enables collision checking during simulation</td>
</tr>
<tr>
<td><code>EnablePauseOnCollision</code></td>
<td>Pauses execution when a collision is detected</td>
</tr>
</tbody>
</table>
<h3 id="combined-with-pause-on-failure">Combined with Pause on Failure</h3>
<p><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_EnablePauseOnFailure">EnablePauseOnFailure</a> provides a broader pause-on-error mechanism:</p>
<pre><code class="lang-csharp">EnablePauseOnFailure = true;
EnableCollisionDetection = true;
PlayNcFile(&quot;NC/file1.nc&quot;); // pauses if a collision occurs
</code></pre>
<h3 id="gui-operation">GUI Operation</h3>
<p>Enable collision detection in the main options panel before simulation.</p>
<div class="TIP">
<h5>Tip</h5>
<p>Collision detection adds computation overhead. For exploratory simulations where speed matters, you can disable it and re-enable for final validation.</p>
</div>
<hr>
<h2 id="2-geometry-difference-comparison">2. Geometry Difference Comparison</h2>
<p>The <code>Diff</code> command compares the simulated workpiece shape against a target (design) shape to identify over-cut and under-cut regions.</p>
<h3 id="script-command">Script Command</h3>
<pre><code class="lang-csharp">Diff(&lt;DetectionRadius_mm&gt;);
</code></pre>
<p><strong>Detection Radius</strong> is the surface extension distance for the target shape. Deviations beyond this distance are not computed. Larger values take longer.</p>
<pre><code class="lang-csharp">Diff(1); // detection radius = 1 mm
</code></pre>
<h3 id="interpreting-results">Interpreting Results</h3>
<p>After comparison, the workpiece surface is color-coded:</p>
<ul>
<li><strong>Green</strong>: Within tolerance</li>
<li><strong>Red (positive)</strong>: Over-cut exceeding the threshold</li>
<li><strong>Blue (positive)</strong>: Under-cut exceeding the threshold</li>
</ul>
<div class="NOTE">
<h5>Note</h5>
<p>The path index on the workpiece surface is <strong>invalidated</strong> after running <code>Diff</code>. If you need to inspect individual step paths, do so before calling <code>Diff</code>.</p>
</div>
<h3 id="case-study-reciprocating-slope-interference">Case Study: Reciprocating Slope Interference</h3>
<p>CAM-generated NC code may contain subtle errors that are invisible without geometric comparison. Common issues found through <code>Diff</code>:</p>
<table>
<thead>
<tr>
<th>Issue</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Right-angle wall under-cut</td>
<td>Under-cut near walls where target geometry has sharp corners</td>
</tr>
<tr>
<td>Inconsistent Z plunging</td>
<td>Over-cut from inconsistent Z values in reciprocating plunge regions</td>
</tr>
<tr>
<td>Insufficient radius clearance</td>
<td>Under-cut at reciprocating edges where the tool hasn't moved out by its radius</td>
</tr>
<tr>
<td>Zebra-pattern under-cut</td>
<td>Under-cut stripes from excessive reciprocating path spacing</td>
</tr>
</tbody>
</table>
<div class="TIP">
<h5>Tip</h5>
<p>Without software comparison, these issues can only be discovered after physical machining, significantly impacting precision manufacturing.</p>
</div>
<hr>
<h2 id="3-geometry-defect-scanning">3. Geometry Defect Scanning</h2>
<p>Geometry defect scanning helps debug abnormal workpiece or tool geometry. This is typically used only when geometry construction problems are suspected.</p>
<h3 id="scanruntimegeominfdefect">ScanRuntimeGeomInfDefect</h3>
<p><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_ScanRuntimeGeomInfDefect_">ScanRuntimeGeomInfDefect</a> scans for infinite edge cut defects in the runtime geometry. After scanning, defect areas are rendered with colored markers.</p>
<pre><code class="lang-csharp">ScanRuntimeGeomInfDefect();
</code></pre>
<p>Return values:</p>
<ul>
<li><code>true</code> — defects detected</li>
<li><code>false</code> — no defects</li>
<li><code>null</code> — unable to execute (e.g., workpiece does not exist)</li>
</ul>
<h3 id="workflow-scan-before-simulation">Workflow: Scan Before Simulation</h3>
<pre><code class="lang-csharp">ScanRuntimeGeomInfDefect();
Pause(); // visually inspect defects
ClearDefectDisplayee(); // clear markers
PlayNcFile(&quot;NC/file1.nc&quot;);
</code></pre>
<h3 id="cleardefectdisplayee">ClearDefectDisplayee</h3>
<p><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_ClearDefectDisplayee_">ClearDefectDisplayee</a> removes defect markers from the workpiece:</p>
<pre><code class="lang-csharp">ClearDefectDisplayee();
</code></pre>
<div class="NOTE">
<h5>Note</h5>
<p>Defect markers are automatically cleared when the workpiece is reloaded or the runtime geometry is reset. During workpiece initialization, if construction defects are detected, markers are automatically displayed.</p>
</div>
<hr>
<h2 id="4-flying-piece-removal">4. Flying Piece Removal</h2>
<p>During five-axis cutting, small disconnected residual material fragments (&ldquo;flying pieces&rdquo;) may appear. Use <code>RemoveFlyPiece</code> to clean them up.</p>
<h3 id="script-command-1">Script Command</h3>
<pre><code class="lang-csharp">RemoveFlyPiece();
</code></pre>
<div class="TIP">
<h5>Tip</h5>
<p>Run <code>RemoveFlyPiece</code> after simulation and before geometry export (<code>WriteRuntimeGeomToStl</code>) to produce a clean output.</p>
</div>
<hr>
<h2 id="combined-validation-script-example">Combined Validation Script Example</h2>
<pre><code class="lang-csharp">// Configure and run simulation with collision detection
EnableCollisionDetection = true;
EnablePauseOnCollision = false;
EnablePhysics = true;
MachiningResolution_mm = 0.125;
PlayNcFile(&quot;NC/file1.nc&quot;);
// Remove any flying pieces
RemoveFlyPiece();
// Compare against target geometry (1 mm detection radius)
Diff(1);
// Scan for geometry defects
var hasDefects = ScanRuntimeGeomInfDefect();
if (hasDefects == true)
{
WarningMessage(&quot;Geometry defects detected&quot;);
}
// Export final geometry
WriteRuntimeGeomToStl(&quot;Output/final.stl&quot;);
WriteStepFiles(&quot;Output/[NcName].step.csv&quot;);
</code></pre>
<h2 id="see-also">See Also</h2>
<ul>
<li><a class="xref" href="basic-simulation.html">Workflow: Basic Machining Simulation</a> — basic simulation setup</li>
<li><a class="xref" href="../manual/runtime/runtime-api.html">Glossary: RuntimeApi Quick-Reference</a> — RuntimeApi quick-reference</li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
@@ -0,0 +1,408 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Workflow: NC Optimization | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Workflow: NC Optimization | HiAPI-C# 2025 ">
<link rel="icon" href="../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="Workflow-NcOptimization">
<h1 id="workflow-nc-optimization">Workflow: NC Optimization</h1>
<p>This workflow describes how to generate optimized NC files from a physics-based simulation. The optimizer adjusts feed rates to keep physical quantities (spindle power, torque, thermal stress, cutting force) within specified safety limits while maximizing machining efficiency.</p>
<pre><code class="lang-mermaid">flowchart TD
Prereq[&quot;Prerequisites&lt;br&gt;(simulation with physics,&lt;br&gt;cutting parameters)&quot;]
Config[&quot;Configure optimization options&quot;]
Simulate[&quot;Run simulation&quot;]
Output[&quot;Generate optimized NC files&quot;]
Verify[&quot;Verify optimization results&quot;]
Prereq --&gt; Config --&gt; Simulate --&gt; Output --&gt; Verify
</code></pre>
<h2 id="1-prerequisites">1. Prerequisites</h2>
<p>NC optimization requires a simulation environment with <strong>physics enabled</strong> and valid <strong>cutting parameters</strong>:</p>
<pre><code class="lang-csharp">EnablePhysics = true;
LoadCuttingParaByFile(&quot;Material.mp&quot;);
</code></pre>
<table>
<thead>
<tr>
<th>Prerequisite</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Physics enabled</td>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_EnablePhysics">EnablePhysics</a> must be <code>true</code></td>
</tr>
<tr>
<td>Cutting parameters</td>
<td>Workpiece must have loaded milling coefficients (see <a class="xref" href="force-training.html">Workflow: Milling Force Parameter Training</a>)</td>
</tr>
<tr>
<td>Valid tool definitions</td>
<td>Tool geometry, flute count, and material properties configured</td>
</tr>
</tbody>
</table>
<div class="NOTE">
<h5>Note</h5>
<p>Optimization is based on an ideal geometric model. If the workpiece is a casting or has installation errors, configure a conservatively larger workpiece geometry to prevent misidentification of cutting vs. non-cutting regions.</p>
</div>
<hr>
<h2 id="2-configure-optimization-options">2. Configure Optimization Options</h2>
<h3 id="feed-rate-control">Feed Rate Control</h3>
<table>
<thead>
<tr>
<th>Property</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_OptEnableFeedrate">OptEnableFeedrate</a></td>
<td>Enable sequential feed rate optimization</td>
<td><code>true</code></td>
</tr>
<tr>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_OptEnableInterpolation">OptEnableInterpolation</a></td>
<td>Re-interpolation for smoother acceleration/deceleration</td>
<td></td>
</tr>
<tr>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_OptRapidFeed_mmdmin">OptRapidFeed_mmdmin</a></td>
<td>Feed rate for non-cutting regions (mm/min)</td>
<td></td>
</tr>
<tr>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_OptMinFeedrate_mmdmin">OptMinFeedrate_mmdmin</a></td>
<td>Minimum cutting-region feed rate (mm/min)</td>
<td></td>
</tr>
<tr>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_OptMaxFeedrate_mmdmin">OptMaxFeedrate_mmdmin</a></td>
<td>Maximum cutting-region feed rate (mm/min)</td>
<td></td>
</tr>
<tr>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_OptMaxAcceleration_mmds2">OptMaxAcceleration_mmds2</a></td>
<td>Acceleration/deceleration limit (mm/s²)</td>
<td></td>
</tr>
<tr>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_OptFeedrateAssignmentRatio">OptFeedrateAssignmentRatio</a></td>
<td>Re-interpolation trigger threshold</td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="extended-distance">Extended Distance</h3>
<table>
<thead>
<tr>
<th>Property</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_OptExtendedPreDistance_mm">OptExtendedPreDistance_mm</a></td>
<td>Pre-distance for equivalent calculation of cutting regions (mm)</td>
</tr>
<tr>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_OptExtendedPostDistance_mm">OptExtendedPostDistance_mm</a></td>
<td>Post-distance for equivalent calculation of cutting regions (mm)</td>
</tr>
</tbody>
</table>
<h3 id="safety-factors-physics-based-constraints">Safety Factors (Physics-Based Constraints)</h3>
<table>
<thead>
<tr>
<th>Property</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_OptSpindlePowerSafetyFactor">OptSpindlePowerSafetyFactor</a></td>
<td>Spindle power safety factor (0 = ignore)</td>
</tr>
<tr>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_OptSpindleTorqueSafetyFactor">OptSpindleTorqueSafetyFactor</a></td>
<td>Spindle torque safety factor (0 = ignore)</td>
</tr>
<tr>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_OptThermalYieldSafetyFactor">OptThermalYieldSafetyFactor</a></td>
<td>Thermal yield safety factor (0 = ignore)</td>
</tr>
<tr>
<td><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_OptPreferedForce_N">OptPreferedForce_N</a></td>
<td>Target cutting force (N)</td>
</tr>
</tbody>
</table>
<div class="NOTE">
<h5>Note</h5>
<p><strong>Target value</strong> = 100% / Safety factor. For example, a safety factor of 1.5 means the physical quantity targets ~67% of the limit.</p>
</div>
<h3 id="constraint-priority">Constraint Priority</h3>
<p>In cutting regions, constraints are applied in this order:</p>
<ol>
<li><strong>Direct feed rate constraints</strong> (min/max feed rate, min/max feed per tooth from tool settings)</li>
<li><strong>Acceleration/deceleration constraints</strong> (<code>OptMaxAcceleration_mmds2</code>)</li>
<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>
<h3 id="script-command-example">Script Command Example</h3>
<pre><code class="lang-csharp">OptEnableFeedrate = true;
OptEnableInterpolation = true;
OptRapidFeed_mmdmin = 4000;
OptMinFeedrate_mmdmin = 100;
OptMaxFeedrate_mmdmin = 4000;
OptMaxAcceleration_mmds2 = 10;
OptExtendedPreDistance_mm = 3;
OptExtendedPostDistance_mm = 2;
OptSpindlePowerSafetyFactor = 1.5;
OptSpindleTorqueSafetyFactor = 1.5;
OptThermalYieldSafetyFactor = 0;
OptPreferedForce_N = double.PositiveInfinity;
</code></pre>
<h3 id="xml-configuration-nc-code-inline">XML Configuration (NC Code Inline)</h3>
<p>Optimization settings can be embedded in NC code comments:</p>
<pre><code class="lang-nc">N0110 X-3.064 Y6.378 (;@OptMaxAcceleration_mmds2=10;)
N0150 G01 X-3.068 Y40.776 (;@OptMaxAcceleration_mmds2=100; OptMaxFeedrate_mmdmin=12000;)
</code></pre>
<hr>
<h2 id="3-run-simulation">3. Run Simulation</h2>
<p>Configuration can be interleaved between NC files. Settings apply to the files that follow:</p>
<pre><code class="lang-csharp">OptRapidFeed_mmdmin = 4000;
PlayNcFile(&quot;NC/file1.nc&quot;);
OptRapidFeed_mmdmin = 8000;
PlayNcFile(&quot;NC/file2.nc&quot;);
</code></pre>
<h3 id="excluding-lines-from-optimization">Excluding Lines from Optimization</h3>
<p>To preserve specific NC lines unchanged:</p>
<pre><code class="lang-nc">N0140 G03 X-2.66 Y38.193 I-103.796 J7.172 (;@Preserve();)
</code></pre>
<p>To exclude a range:</p>
<pre><code class="lang-nc">N0140 G03 X-2.66 Y38.193 (;@BeginPreserve();)
N0150 G01 X-3.068 Y40.776
N0160 X-3.555 Y43.338 (;@EndPreserve();)
</code></pre>
<div class="WARNING">
<h5>Warning</h5>
<p>Do not combine <a class="xref" href="../api/Hi.MachiningSteps.MachiningStep.html#Hi_MachiningSteps_MachiningStep_UpdateNcOptOption_">UpdateNcOptOption</a> inside the <a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_SessionStepBuilt">SessionStepBuilt</a> event with NC-embedded optimization commands. This may cause undefined behavior due to parallel computation.</p>
</div>
<hr>
<h2 id="4-generate-optimized-nc-files">4. Generate Optimized NC Files</h2>
<p><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_OptimizeToFiles_">OptimizeToFiles</a> writes the optimized NC programs:</p>
<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>
<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;
</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>
<h3 id="embedded-log-comments">Embedded Log Comments</h3>
<p>Control embedded log verbosity with <a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_EmbeddedLogMode_">EmbeddedLogMode</a>:</p>
<table>
<thead>
<tr>
<th>Mode</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>None</code></td>
<td>No log comments</td>
</tr>
<tr>
<td><code>SimpleLog</code></td>
<td><code>StepIndex</code> on re-interpolated lines; <code>LineNo</code> on last interpolated line per original line</td>
</tr>
<tr>
<td><code>FullLog</code></td>
<td><code>StepIndex</code> and <code>LineNo</code> on all lines</td>
</tr>
</tbody>
</table>
<p>Example output: <code>G01 X10.0 Y20.0 F500 (src(LineNo: 140, StepIndex: 256))</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>
<h3 id="post-optimization-simulation-differences">Post-Optimization Simulation Differences</h3>
<p>Optimized feed rates produce different interpolation points, causing:</p>
<ul>
<li>Different simulation mesh errors</li>
<li>Surface morphology changes at the surface roughness level (more pronounced at corners)</li>
</ul>
<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>
</div>
<hr>
<h2 id="tool-breakage-solutions">Tool Breakage Solutions</h2>
<p>If the simulation shows yielding stress ratio, max spindle torque ratio, or max spindle power ratio above 100%, consider:</p>
<ol>
<li>Modify the toolpath to reduce cutting width/depth</li>
<li>Use HiNC optimization to adjust feed rates, bringing these ratios below 100%</li>
</ol>
<p>For thermal edge chipping, reduce the spindle speed to allow heat dissipation.</p>
<hr>
<h2 id="complete-script-example">Complete Script Example</h2>
<pre><code class="lang-csharp">EnablePhysics = true;
LoadCuttingParaByFile(&quot;Material.mp&quot;);
OptEnableFeedrate = true;
OptEnableInterpolation = true;
OptRapidFeed_mmdmin = 4000;
OptMinFeedrate_mmdmin = 100;
OptMaxFeedrate_mmdmin = 4000;
OptMaxAcceleration_mmds2 = 10;
OptExtendedPreDistance_mm = 3;
OptExtendedPostDistance_mm = 2;
OptSpindlePowerSafetyFactor = 1.5;
OptSpindleTorqueSafetyFactor = 1.5;
OptThermalYieldSafetyFactor = 0;
OptPreferedForce_N = double.PositiveInfinity;
PlayNcFile(&quot;NC/file1.nc&quot;);
OptimizeToFiles(&quot;Cache/Opt-[NcName]&quot;);
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="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/runtime-api.html">Glossary: RuntimeApi Quick-Reference</a> — RuntimeApi quick-reference</li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
@@ -0,0 +1,342 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Workflow: Sensor Data Mapping | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Workflow: Sensor Data Mapping | HiAPI-C# 2025 ">
<link rel="icon" href="../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="Workflow-SensorMapping">
<h1 id="workflow-sensor-data-mapping">Workflow: Sensor Data Mapping</h1>
<p>This workflow covers mapping external sensor data (dynamometer, smart tool holder, accelerometer) to simulation toolpaths so that simulation steps can index real-world measurement data.</p>
<pre><code class="lang-mermaid">flowchart TD
Prepare[&quot;Prepare sensor CSV data&quot;]
Configure[&quot;Configure time mapping&quot;]
Simulate[&quot;Run simulation&quot;]
Map[&quot;Map data to simulation steps&quot;]
View[&quot;View mapped results&quot;]
Prepare --&gt; Configure --&gt; Simulate --&gt; Map --&gt; View
</code></pre>
<h2 id="overview">Overview</h2>
<p>Data mapping associates external sensor measurements with simulated machining steps. After mapping, each step can reference real-world force, torque, and acceleration data for:</p>
<ul>
<li>Inspecting machining states</li>
<li>Training milling coefficients (see <a class="xref" href="force-training.html">Workflow: Milling Force Parameter Training</a>)</li>
<li>Calibrating milling coefficients</li>
<li>Comparing simulated vs. measured forces</li>
</ul>
<p>Depending on data volume and application, mapping is either <strong>one-to-one</strong> (each step maps to one data point) or <strong>one-to-many</strong> (each step maps to multiple data points from high-sampling-rate sensors).</p>
<hr>
<h2 id="1-prepare-sensor-csv-data">1. Prepare Sensor CSV Data</h2>
<h3 id="sensor-data-format">Sensor Data Format</h3>
<p>The CSV file must have a header row with <code>ActualTime</code> and sensor channels:</p>
<table>
<thead>
<tr>
<th>Source</th>
<th>Headers</th>
<th>Aliases</th>
</tr>
</thead>
<tbody>
<tr>
<td>Dynamometer</td>
<td><code>Fx</code>, <code>Fy</code>, <code>Fz</code></td>
<td><code>Workpiece.Fx</code>, <code>Workpiece.Fy</code>, <code>Workpiece.Fz</code></td>
</tr>
<tr>
<td>Smart tool holder</td>
<td><code>Mx</code>, <code>My</code>, <code>Mz</code></td>
<td><code>Holder.Mx</code>, <code>Holder.My</code>, <code>Holder.Mz</code></td>
</tr>
<tr>
<td>Accelerometer</td>
<td><code>Ax</code>, <code>Ay</code>, <code>Az</code></td>
<td></td>
</tr>
</tbody>
</table>
<pre><code class="lang-csv">ActualTime,Mx,My,Mz
18:23:54.703,-0.02923,0.10733,0.00409
18:23:54.704,0.04155,-0.04457,0.00448
...
</code></pre>
<p>The time format is <code>&lt;hours&gt;:&lt;minutes&gt;:&lt;seconds&gt;.&lt;fractional seconds&gt;</code>. Additional fields (e.g., <code>CH1</code>, <code>CH2</code>) may be included and will be available after mapping.</p>
<h3 id="controller-data-format-for-two-layer-mapping">Controller Data Format (for Two-Layer Mapping)</h3>
<p>The controller CSV must contain at least <code>FileNo</code>, <code>LineNo</code>, and <code>ActualTime</code>:</p>
<pre><code class="lang-csv">FileNo,LineNo,ActualTime,MC.X,MC.Y,MC.Z,...
1,6,00:00:00.030,0,0,0.37,...
</code></pre>
<hr>
<h2 id="2-configure-time-mapping">2. Configure Time Mapping</h2>
<h3 id="strategy-a-one-to-one-mapping-mapsinglebycsvfile">Strategy A: One-to-One Mapping (MapSingleByCsvFile)</h3>
<p><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_MapSingleByCsvFile_">MapSingleByCsvFile</a> reads a CSV file and uses time interpolation to map each data point to one simulation step.</p>
<pre><code class="lang-csharp">PlayNcFile(&quot;NC/file1.nc&quot;);
MapSingleByCsvFile(&quot;Data/sensor.csv&quot;);
</code></pre>
<h3 id="strategy-b-one-to-one-via-playcsvfile">Strategy B: One-to-One via PlayCsvFile</h3>
<p><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_PlayCsvFile_">PlayCsvFile</a> can drive the simulation directly from CSV data, where each row becomes one step. Custom fields in the CSV are automatically available on each step.</p>
<pre><code class="lang-csharp">PlayCsvFile(&quot;Data/controller.csv&quot;);
</code></pre>
<h3 id="strategy-c-one-to-many-global-mapping-mapseriesbycsvfile">Strategy C: One-to-Many Global Mapping (MapSeriesByCsvFile)</h3>
<p>For high-sampling-rate data, first establish <code>ActualTime</code> via one-to-one mapping, then map the series:</p>
<pre><code class="lang-csharp">PlayNcFile(&quot;NC/file1.nc&quot;);
MapSingleByCsvFile(&quot;Data/controller.csv&quot;); // establishes ActualTime
MapSeriesByCsvFile(&quot;Data/sensor.csv&quot;); // maps high-rate series
</code></pre>
<h3 id="strategy-d-one-to-many-local-mapping-anchor-based">Strategy D: One-to-Many Local Mapping (Anchor-Based)</h3>
<p>For mapping sensor data to specific NC path segments using anchors.</p>
<p><strong>Step 1 — Specify input data and time ranges:</strong></p>
<pre><code class="lang-csharp">ClearTimeMappingData();
AddTimeDataByFile(&quot;lineA&quot;, &quot;Mapping/sensor1.csv&quot;, &quot;18:25:51.7100&quot;, &quot;18:26:12.9910&quot;);
AddTimeDataByFile(&quot;lineB&quot;, &quot;Mapping/sensor1.csv&quot;, &quot;18:26:30.5750&quot;, &quot;18:27:12.2880&quot;);
</code></pre>
<p><strong>Step 2 — Specify NC path anchors</strong> (embedded in NC code):</p>
<pre><code>X13. F20 ;@LineSelection(&quot;lineA&quot;, FirstTouch, ShiftTime_s(2), LineEnd, ShiftDistance_mm(-1));
X25. F10 ;@LineSelection(&quot;lineB&quot;, FirstTouch, null, LastTouch, null);
</code></pre>
<p>For range mapping across multiple NC lines, use <code>BeginSelection</code> / <code>EndSelection</code>:</p>
<pre><code>;@BeginSelection(&quot;region1&quot;, LineBegin, null);
...
;@EndSelection(&quot;region1&quot;, LineEnd, null);
</code></pre>
<p><strong>Anchor Flags:</strong></p>
<table>
<thead>
<tr>
<th>Flag</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>LineBegin</code></td>
<td>Motion start point of the line</td>
</tr>
<tr>
<td><code>LineEnd</code></td>
<td>Motion end point of the line</td>
</tr>
<tr>
<td><code>FirstTouch</code></td>
<td>First contact with the workpiece</td>
</tr>
<tr>
<td><code>LastTouch</code></td>
<td>Last contact with the workpiece</td>
</tr>
</tbody>
</table>
<p><strong>Offset Options:</strong></p>
<table>
<thead>
<tr>
<th>Offset</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>null</code></td>
<td>No offset</td>
</tr>
<tr>
<td><code>ShiftTime_s(&lt;seconds&gt;)</code></td>
<td>Time-based offset (positive = forward)</td>
</tr>
<tr>
<td><code>ShiftDistance_mm(&lt;mm&gt;)</code></td>
<td>Distance-based offset (positive = forward)</td>
</tr>
</tbody>
</table>
<div class="NOTE">
<h5>Note</h5>
<p>For FANUC controllers that do not support <code>;</code> as a comment character, enclose the script command in a comment block:</p>
<pre><code>X13. F20 (;@LineSelection(&quot;lineA&quot;, FirstTouch, null, LineEnd, null);)
</code></pre>
</div>
<h3 id="map-on-selection-end">Map on Selection End</h3>
<p><a class="xref" href="../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_EnableMapOnSelectionEnd">EnableMapOnSelectionEnd</a> controls automatic mapping when a selection ends (default: <code>true</code>):</p>
<pre><code class="lang-csharp">EnableMapOnSelectionEnd = true; // EndSelection triggers Map automatically
</code></pre>
<h3 id="clearing-mapping-data">Clearing Mapping Data</h3>
<p>Mapping data persists across player resets. To clear:</p>
<pre><code class="lang-csharp">ClearTimeMappingData();
</code></pre>
<hr>
<h2 id="3-run-simulation">3. Run Simulation</h2>
<pre><code class="lang-csharp">PlayNcFile(&quot;NC/file1.nc&quot;);
</code></pre>
<div class="NOTE">
<h5>Note</h5>
<p><strong>Why interpret NC code instead of playing CSV directly?</strong>
The system NC interpreter produces more accurate simulation paths than direct controller CSV playback, which has limited sampling resolution that distorts tool paths.</p>
</div>
<hr>
<h2 id="4-map-data">4. Map Data</h2>
<p>After simulation, apply the mapping strategy chosen in step 2. For the two-layer chained approach:</p>
<pre><code class="lang-csharp">// Chain 1: Controller data → simulation steps (via FileNo/LineNo → ActualTime)
MapSingleByCsvFile(&quot;Data/controller.csv&quot;);
// Chain 2: Sensor data → simulation steps (via ActualTime → sensor readings)
MapSeriesByCsvFile(&quot;Data/sensor.csv&quot;);
</code></pre>
<p>The chaining works because:</p>
<ul>
<li>Simulation steps and controller data share <code>FileNo</code>/<code>LineNo</code> anchors</li>
<li>Controller data and sensor data share <code>ActualTime</code> anchors</li>
<li>After chaining, simulation steps can index sensor data</li>
</ul>
<div class="TIP">
<h5>Tip</h5>
<p>Due to machine acceleration/deceleration, simulation time and actual time diverge over longer durations. Anchor-based linear projection corrects for this drift.</p>
</div>
<hr>
<h2 id="5-view-mapped-results">5. View Mapped Results</h2>
<p>After mapping, sensor data is available on each step. Use the UI to:</p>
<ul>
<li>View color gradient maps on the workpiece geometry</li>
<li>Inspect time-series charts</li>
<li>Click-to-track specific data channels</li>
</ul>
<p>Export mapped results:</p>
<pre><code class="lang-csharp">WriteStepFiles(&quot;Output/[NcName].step.csv&quot;);
WriteShotFiles(&quot;Output/[NcName].shot.csv&quot;, 1);
</code></pre>
<hr>
<h2 id="complete-two-layer-mapping-example">Complete Two-Layer Mapping Example</h2>
<pre><code class="lang-csharp">// Configure resolution
MachiningResolution_mm = 0.125;
EnablePhysics = true;
// Clear any previous mapping data
ClearTimeMappingData();
// Run simulation using NC interpreter for accurate paths
PlayNcFile(&quot;NC/machining.nc&quot;);
// Map controller data (contains FileNo, LineNo, ActualTime)
MapSingleByCsvFile(&quot;Data/controller.csv&quot;);
// Map high-rate sensor data (contains ActualTime and force/torque)
MapSeriesByCsvFile(&quot;Data/sensor.csv&quot;);
// Export results
WriteStepFiles(&quot;Output/[NcName].step.csv&quot;);
</code></pre>
<h2 id="see-also">See Also</h2>
<ul>
<li><a class="xref" href="force-training.html">Workflow: Milling Force Parameter Training</a> — using mapped data for coefficient training</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/machining-step.html">Glossary: Machining Step</a> — step data model</li>
<li><a class="xref" href="../manual/runtime/runtime-api.html">Glossary: RuntimeApi Quick-Reference</a> — RuntimeApi quick-reference</li>
<li><a class="xref" href="examples/mapping-demo.html">Example Project: Mapping Controller and Sensor Data to Simulated NC Toolpaths and Updating Milling Coefficients</a> — mapping demo example project</li>
<li><a class="xref" href="examples/milling-training-dynamometer.html">Example Project: Training Milling Coefficients with a Dynamometer</a> — dynamometer training example project</li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
@@ -0,0 +1,40 @@
<div id="sidetoggle">
<div>
<div class="sidefilter">
<form class="toc-filter">
<span class="glyphicon glyphicon-filter filter-icon"></span>
<span class="glyphicon glyphicon-remove clear-icon" id="toc_filter_clear"></span>
<input type="text" id="toc_filter_input" placeholder="Filter by title" onkeypress="if(event.keyCode==13) {return false;}">
</form>
</div>
<div class="sidetoc">
<div class="toc" id="toc">
<ul class="nav level1">
<li>
<a href="basic-simulation.html" name="" title="Basic Simulation">Basic Simulation</a>
</li>
<li>
<a href="force-training.html" name="" title="Milling Force Parameter Training">Milling Force Parameter Training</a>
</li>
<li>
<a href="nc-optimization.html" name="" title="NC Optimization">NC Optimization</a>
</li>
<li>
<a href="sensor-mapping.html" name="" title="Sensor Data Mapping">Sensor Data Mapping</a>
</li>
<li>
<a href="geometry-validation.html" name="" title="Geometry Validation">Geometry Validation</a>
</li>
<li>
<a href="dynamometer-experiment-sop.html" name="" title="Dynamometer Experiment SOP">Dynamometer Experiment SOP</a>
</li>
<li>
<a href="examples/index.html" name="examples/toc.html" title="Examples">Examples</a>
</li>
</ul>
</div>
</div>
</div>
</div>
@@ -0,0 +1,2 @@
{"items":[{"name":"Basic Simulation","href":"basic-simulation.html","topicHref":"basic-simulation.html"},{"name":"Milling Force Parameter Training","href":"force-training.html","topicHref":"force-training.html"},{"name":"NC Optimization","href":"nc-optimization.html","topicHref":"nc-optimization.html"},{"name":"Sensor Data Mapping","href":"sensor-mapping.html","topicHref":"sensor-mapping.html"},{"name":"Geometry Validation","href":"geometry-validation.html","topicHref":"geometry-validation.html"},{"name":"Dynamometer Experiment SOP","href":"dynamometer-experiment-sop.html","topicHref":"dynamometer-experiment-sop.html"},{"name":"Examples","href":"examples/index.html","tocHref":"examples/toc.html","topicHref":"examples/index.html","homepage":"examples/index.html"}]}