From 1227ad244f627fbd4a562cdf2d27712659038ddd Mon Sep 17 00:00:00 2001 From: iamboss Date: Wed, 25 Nov 2026 22:06:30 +0800 Subject: [PATCH] feat(Demo-Para-Training-S50C-202501): S50C.hincproj trains through dedicated mission commands, and the NC/lines.nc anchors are live The mission of S50C.hincproj is now settings rows (physics on, machining resolution 0.015625 mm, feed-per-tooth motion resolution, collision detection and pause on failure off), a script with the training settings (360 divisions per spindle turn, the 3d result template), the time mapping of the six dynamometer windows low1-high3, NC/lines.nc, a ReadOnFirstOrWrite record Cache/S50C-lines-done.wct, the training into Output/S50C-3-fine-0.1.mp at the call's default outlier ratio 0.1, a script that puts the template dimension back to 2, and a disabled Post-Execution. NC/lines.nc writes its eight LineSelection anchors as (@@...), the script marker the current runner reads: low1-high3 map their windows, through1 and through2 are anchors without a window. The project is saved in the current format, and EmptyMachine.mt and SpindleCapability/test3.SpindleCapability with it. Verified: the previous mission (its dynamometerFile and outlierRatio variables written as the literal values they held) and this one play 11,708 steps with the same per-step signature, on the previous NC and on this one. On the previous NC neither trains, its ;@ anchors not being read, and Output/S50C-3-fine-0.1.mp stays as committed; on this NC both train the same Output/S50C-3-fine-0.1.mp (4,533 sample equations, R = 97.08%; that run at 0.125 mm). Co-Authored-By: Claude Opus 5.5 --- EmptyMachine.mt | 219 ++- NC/lines.nc | 16 +- S50C.hincproj | 1787 +++++++++++++++++++-- SpindleCapability/test3.SpindleCapability | 3 + 4 files changed, 1847 insertions(+), 178 deletions(-) diff --git a/EmptyMachine.mt b/EmptyMachine.mt index c3aa54b..bd60a86 100644 --- a/EmptyMachine.mt +++ b/EmptyMachine.mt @@ -2,34 +2,195 @@ EmptyMachine - - - [O][B][w];[O][Y][X][Z][A][S][t] - true - - - - - - - - - - - - - - - - - - - - - - - - - + + GeneralMechanism + + + O + + + B + + + w + + + Y + + + X + + + Z + + + A + + + S + + + t + + + + + + + + O + + + + + B + + + + + + + + + + B + + + + + w + + + + + + + + + + O + + + + + Y + + + + + + + + + + Y + + + + + X + + + + + + + + + + X + + + + + Z + + + + + + + + + + Z + + + + + A + + + + + + + + + + A + + + + + S + + + + + + + + + + S + + + + + t + + + + + + + + + + + O + + + + + + w + + + + + t + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/NC/lines.nc b/NC/lines.nc index 496b726..0f2803f 100644 --- a/NC/lines.nc +++ b/NC/lines.nc @@ -9,19 +9,19 @@ G43 Z10. H01 G01 G90 X2. Y-20. M08 Z2. G01 Z-0.5 F200. -G01 Y16. (;@LineSelection("low1",FirstTouch,null,LastTouch,null);) +G01 Y16. (@@LineSelection("low1",FirstTouch,null,LastTouch,null);) Z2. G00 Z10. G01 X14. Y-20. Z2. G01 Z-0.5 F400. -G01 Y16. (;@LineSelection("low2",FirstTouch,null,LastTouch,null);) +G01 Y16. (@@LineSelection("low2",FirstTouch,null,LastTouch,null);) Z2. G00 Z10. G01 X26. Y-20. Z2. G01 Z-0.5 F600. -G01 Y16. (;@LineSelection("low3",FirstTouch,null,LastTouch,null);) +G01 Y16. (@@LineSelection("low3",FirstTouch,null,LastTouch,null);) Z2. G00 Z10. @@ -29,27 +29,27 @@ S7200 G01 X38. Y-20. Z2. G01 Z-0.5 F1200. -G01 Y16. (;@LineSelection("high1",FirstTouch,null,LastTouch,null);) +G01 Y16. (@@LineSelection("high1",FirstTouch,null,LastTouch,null);) Z2. G00 Z10. G01 X50. Y-20. Z2. G01 Z-0.5 F2400. -G01 Y16. (;@LineSelection("high2",FirstTouch,null,LastTouch,null);) +G01 Y16. (@@LineSelection("high2",FirstTouch,null,LastTouch,null);) Z2. G00 Z10. G01 X62. Y-20. Z2. G01 Z-0.5 F3600. -G01 Y16. (;@LineSelection("high3",FirstTouch,null,LastTouch,null);) +G01 Y16. (@@LineSelection("high3",FirstTouch,null,LastTouch,null);) Z2. G00 Z10. G00 G90 X-6. Y10. G17 G01 Z-0.5 F600. S500 M03 -X13. F200 (;@LineSelection("through1",FirstTouch,null,LastTouch,null);) -X25. F100 (;@LineSelection("through2",FirstTouch,null,LastTouch,null);) +X13. F200 (@@LineSelection("through1",FirstTouch,null,LastTouch,null);) +X25. F100 (@@LineSelection("through2",FirstTouch,null,LastTouch,null);) Z2. Z10. F6000. diff --git a/S50C.hincproj b/S50C.hincproj index 364c1d0..83cfd51 100644 --- a/S50C.hincproj +++ b/S50C.hincproj @@ -1,5 +1,5 @@  - + @@ -32,7 +32,7 @@ @@ -47,14 +47,12 @@ - 0.015625 - 15 - - + + 4 - 0 + 0 35 @@ -65,8 +63,8 @@ - - + + WC-Co6-800nm @@ -157,7 +155,7 @@ 0.003 - 16.806603351650548 + 18.381757444447093 30 5 @@ -173,34 +171,101 @@ 21 - SpindleBuckleAnc + 0 + SpindleMountAnc -56.6 - 44.5 + Mx, My, Mz - - - - - - (-45, -70, 0) - (45, 70, 10) - - - - - - - - - - + + Fixture + + + GeomAnchor + + + TableMount + + + WorkpieceMount + + + + + + + + GeomAnchor + + + + + TableMount + + + + + + + + + + GeomAnchor + + + + + WorkpieceMount + + + + + + + + + + + GeomAnchor + + + + + + + + + + (-45, -70, 0) + (45, 70, 10) + + + + + + + + + TableMount + + + + + WorkpieceMount + + + + + GeomAnchor + + 0.125 + 0.1 @@ -212,12 +277,74 @@ - - - - - - + + Workpiece + + + FixtureMount + + + ProgramZeroAnchor + + + GeomAnchor + + + + + + + + GeomAnchor + + + + + FixtureMount + + + + + + + + + + GeomAnchor + + + + + ProgramZeroAnchor + + + + + + + + + + + FixtureMount + + + + + + FixtureMount + + + + + ProgramZeroAnchor + + + + + GeomAnchor + + CuttingParameter/S50C.mp @@ -230,10 +357,14 @@ - 25 + 25 + + 25 1000 + 0.5 + 50 @@ -264,7 +395,7 @@ @@ -279,14 +410,12 @@ - 0.015625 - 15 - - + + 4 - 0 + 0 35 @@ -297,8 +426,8 @@ - - + + WC-Co6-800nm @@ -389,7 +518,7 @@ 0.003 - 16.806603351650548 + 18.381757444447093 30 5 @@ -405,20 +534,20 @@ 21 - SpindleBuckleAnc + 0 + SpindleMountAnc -56.6 - 44.5 + Mx, My, Mz - + Fanuc (0, 0, 0) (0, 0, 0) (0, 0, 0) - true @@ -429,9 +558,9 @@ - false true false + false (-INF, -INF, -INF) @@ -452,77 +581,1444 @@ 0 - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + - - - LineBeginCsScript - LineEndCsScript - MC. - CL. - ToolId - SpindleSpeed_rpm - Spd.Dir. - Feedrate_mmdmin - StepDuration - ActualTime - - + + + + + + + Fanuc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + Alarm + Alarm + PS0007 ILLEGAL USE OF DECIMAL POINT + + + 1 + + + NC + + + 1000 + + + 10000 + + + + + + + + + + + + + + + + + {"CoordinateOffset":{"CoordinateId":"G54"},"CannedCycle":{"Term":"G80"}} + + + + + Parsing + + + + + N + + + @@ + @@^ + + + + + + + Assignments + + + # + + None + + + + + G43.4 + + + + + H + + # + + M + + + + + + G05.1 + + + G05.1 + + + + + Q + R + + # + + G + M + + + + + + G05 + G5 + + + + + P + + # + + G + M + + + + + + G4 + G04 + + + + X + U + S + + + + P + + # + + G + M + + + + + + G28 + + + + X + Y + Z + A + B + C + + + # + + G + M + F + S + + + + + + G41 + G42 + + + + + D + + # + + M + + + + + + G43 + G44 + + + + + H + + # + + M + + + + + + G52 + + + + X + Y + Z + + + # + + G + M + F + S + + + + + + G68 + + + + X + Y + Z + I + J + K + R + + + # + + G + M + F + S + + + + + + G68.2 + + + + X + Y + Z + I + J + K + + + # + + G + M + F + S + + + + + + G73 + G74 + G76 + G81 + G82 + G83 + G84 + G85 + G86 + G87 + G89 + + + + X + Y + Z + R + Q + F + + + K + + + P + + # + + G + M + + + + + + M98 + + + + + P + L + + # + + G + M + F + S + T + + + + + + M99 + + + + + P + + # + + G + M + F + S + T + + + + + + M198 + + + + + P + L + + # + + G + M + F + S + T + + + + + + G65 + + + + A + B + C + D + E + F + H + I + J + K + M + Q + R + S + T + U + V + W + X + Y + Z + + + P + L + + # + + G + + + + + + G66 + + + + A + B + C + D + E + F + H + I + J + K + M + Q + R + S + T + U + V + W + X + Y + Z + + + P + L + + # + + G + + + + + + G54.1 + + + G54.1 + + + + + P + + # + + G + M + + + + + # + + + X + Y + Z + U + V + W + A + B + C + I + J + K + + false + false + None + + + # + + + F + S + R + Q + E + + false + false + None + + + # + + + T + D + H + P + L + + false + false + None + + + + Flags + + + G + M + + true + + + Debug-Parsing + false + + + + Evaluation + + + + + + + + + Fanuc + + + 15 + + + 15 + + + + + + N + + + + + Setup + + + + + + + + + + + + N + + + + + + Logic + + + + + G20 + G70 + + + G21 + G71 + + + + + + + + + G4 + G04 + + + X + U + + + P + + + S + + + + + + + + + + M00 + M01 + + + + + + + + + + + + + + + + + + + + + + + G84 + G74 + + + + + G53 + + + + Parsing + Parsing/G28 + + + Parsing + + + + + + + + + + + + TiltTransform + PathSmoothing + IsoLocalCoordinateOffset + CannedCycle + MotionState + CallStack + WhileFrames + SiemensLoopFrames + + + + + Debug-Logic + false + + + + PostLogic + + + + MachineCoordinateState + + + MachineCoordinateState + + + + Expansion + + + Debug-PostLogic + false + + + + Inspection + + + + Debug-Inspection + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LineBeginCsScript + LineEndCsScript + MC. + CL. + ToolId + SpindleSpeed_rpm + Spd.Dir. + Feedrate_mmdmin + StepDuration + ActualTime + Coolant + + + + + + + + + + + + + + + + + CsvRowToSections + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 20000 + 36000 + true + + PAINT + TOOLNO + LOADTL + TOOL PATH + TOOLPATH + END-OF-PATH + + + + + + + + + + + + + + + + + + + + + + + + ClsfRecordToSections + + + + Msys + CutterLocationState + ClsfToolData + ActiveTool + Feedrate + SpindleSpeed + Coolant + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + true + false + + + + + true + + + 0.015625 + + + + + true + + + + + + + + + + true + + + false + + + + + true + + + false + + + true - train - ////一般設定//// -MillingForceCycleDivisionNum=360; -MachiningResolution=0.125/8; -MachiningMotionResolution = FeedPerTooth; -EnableCollisionDetection = false; //是否啟用碰撞檢測開啟 -EnablePauseOnCollision = false; //是否啟用碰撞發生時暫停 - -DefaultParaTemplateDimension=3; -ClearTimeMappingData(); - -string dynamometerFile=$"./Managed/dynamometer-S50C/Exp09/Exp09.csv"; - -AddTimeDataByFile("low1",dynamometerFile,16.4726,21.6107); -AddTimeDataByFile("low2",dynamometerFile,39.5988,42.2784); -AddTimeDataByFile("low3",dynamometerFile,51.9493,53.7441); -AddTimeDataByFile("high1",dynamometerFile,60.0392,60.9723); -AddTimeDataByFile("high2",dynamometerFile,64.3404,64.8226); -AddTimeDataByFile("high3",dynamometerFile,66.8694,67.2146); - -//WriteRuntimeGeom("Cache/raw.wct"); //寫入暫存檔 -//ReadRuntimeGeom("Cache/raw.wct"); //讀取暫存檔 -PlayNcFile("NC/lines.nc"); - -var outlierRatio=0.1; -TrainMillingPara(Fx|Fy|Fz, $"Output/S50C-{DefaultParaTemplateDimension}-fine-{outlierRatio}.mp",outlierRatio); - - + Training settings + // The training samples each spindle turn in 360 divisions. The count belongs to this project +// and is not saved: the project opens at 36. +MillingCycleDivisionNum = 360; +// The 3d result template (RakeFaceCuttingPara3d). The template dimension is process-wide: a project +// loaded later in the same HiNC keeps it, so the last script of this mission puts back the default 2. +DefaultParaTemplateDimension = 3; + + true + + + Time mapping low1-high3 + // Each key maps its window (seconds) of the dynamometer recording onto the steps between the +// (@@LineSelection) anchors of the same key in NC/lines.nc; through1 and through2 have anchors but no window. +ClearTimeMappingData(); +AddTimeDataByFile("low1", "./Managed/dynamometer-S50C/Exp09/Exp09.csv", 16.4726, 21.6107); +AddTimeDataByFile("low2", "./Managed/dynamometer-S50C/Exp09/Exp09.csv", 39.5988, 42.2784); +AddTimeDataByFile("low3", "./Managed/dynamometer-S50C/Exp09/Exp09.csv", 51.9493, 53.7441); +AddTimeDataByFile("high1", "./Managed/dynamometer-S50C/Exp09/Exp09.csv", 60.0392, 60.9723); +AddTimeDataByFile("high2", "./Managed/dynamometer-S50C/Exp09/Exp09.csv", 64.3404, 64.8226); +AddTimeDataByFile("high3", "./Managed/dynamometer-S50C/Exp09/Exp09.csv", 66.8694, 67.2146); + + + + + true + + + NC/lines.nc + Auto + + + + + true + + + ReadOnFirstOrWrite + Cache/S50C-lines-done.wct + + + + + true + + + Train (Fx|Fy|Fz) + // The outlier ratio is the call's default 0.1: the fraction of the worst steps left out of the fit. +// This project passed 0.1 as the third argument when, before 2025-12-08, that argument was an +// error-ratio threshold; the file name keeps the 0.1. +TrainMillingPara(Fx|Fy|Fz, "Output/S50C-3-fine-0.1.mp"); + + + + + true + + + Restore the template dimension (guard) + // Back to the default, so a project loaded after this one does not inherit the 3d template. +DefaultParaTemplateDimension = 2; + + + + + false + + + false + Output/[NcName].shot.csv + 1 + false + Output/[NcName].step.csv + false + Output/Opt-[NcName] + false + Output/[NcName].nc + false + 1 + + + @@ -530,62 +2026,72 @@ TrainMillingPara(Fx|Fy|Fz, $"Output/S50C-{DefaultParaTemplateDimension}-fine-{ou - + ./Managed/dynamometer-S50C/Exp09/Exp09.csv - 00:00:16.4726000 - 00:00:21.6107000 - + 00:00:16.4726000 + 00:00:21.6107000 + - + ./Managed/dynamometer-S50C/Exp09/Exp09.csv - 00:00:39.5988000 - 00:00:42.2784000 - + 00:00:39.5988000 + 00:00:42.2784000 + - + ./Managed/dynamometer-S50C/Exp09/Exp09.csv - 00:00:51.9493000 - 00:00:53.7441000 - + 00:00:51.9493000 + 00:00:53.7441000 + - + ./Managed/dynamometer-S50C/Exp09/Exp09.csv - 00:01:00.0392000 - 00:01:00.9723000 - + 00:01:00.0392000 + 00:01:00.9723000 + - + ./Managed/dynamometer-S50C/Exp09/Exp09.csv - 00:01:04.3404000 - 00:01:04.8226000 - + 00:01:04.3404000 + 00:01:04.8226000 + - + ./Managed/dynamometer-S50C/Exp09/Exp09.csv - 00:01:06.8694000 - 00:01:07.2146000 - + 00:01:06.8694000 + 00:01:07.2146000 + - false - false - true - - + + + true + false + false + true + false + true + true false + true + false + false 35 - - + 0 + true + CutterRadius + + TrainingErrRatio @@ -825,5 +2331,4 @@ TrainMillingPara(Fx|Fy|Fz, $"Output/S50C-{DefaultParaTemplateDimension}-fine-{ou - \ No newline at end of file diff --git a/SpindleCapability/test3.SpindleCapability b/SpindleCapability/test3.SpindleCapability index 1c3fdfe..9afed4f 100644 --- a/SpindleCapability/test3.SpindleCapability +++ b/SpindleCapability/test3.SpindleCapability @@ -3,7 +3,10 @@ not built 0.4 + true + 65 4000.0000000000005 + 4.82 90