Optimization of CNC code taking into account, in particular, sustainability aspects
A pre-trained LLM iteratively refines CNC code to balance geometric accuracy, energy efficiency, and sustainability, addressing the complexity of traditional CNC programming by optimizing CNC code for improved manufacturing efficiency and reduced environmental impact.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- SIEMENS AG
- Filing Date
- 2025-11-17
- Publication Date
- 2026-06-25
AI Technical Summary
Traditional CNC programming methods struggle to optimize CNC code for energy efficiency, geometric accuracy, and tool life simultaneously, especially as programs become increasingly complex, and incorporating sustainability considerations adds further complexity.
A method using a pre-trained Large Language Model (LLM) to iteratively refine CNC code, balancing geometric accuracy, energy efficiency, and sustainability by generating optimized CNC code through reinforcement learning, with rewards for geometry preservation, energy efficiency, and syntactic correctness.
The method efficiently optimizes CNC code to improve manufacturing processes by reducing energy consumption, minimizing tool wear, and enhancing geometric accuracy while supporting sustainable manufacturing practices.
Smart Images

Figure EP2025083235_25062026_PF_FP_ABST
Abstract
Description
[0001] 202414791 Foreign version
[0002] 1
[0003] OPTIMIZATION OF CNC CODE WITH PARTICULAR CONSIDERATION OF
[0004] FROM SUSTAINABILITY ASPECTS
[0005] This disclosure relates to the optimization of CNC code, in particular to a method, a system and a computer program product for optimizing CNC code using artificial intelligence and taking sustainability into account.
[0006] Computer numerical control (CNC) is a widely used manufacturing process that employs computer-controlled machine tools to produce complex parts with high precision. CNC machines use programmed instructions, known as CNC code, to control the movement of cutting tools and regulate various machining parameters. As manufacturing technologies have advanced, the complexity of CNC code has increased, necessitating more sophisticated approaches to optimizing machining processes.
[0007] Traditional CNC programming methods often rely on manual coding or computer-aided manufacturing (CAM) software to generate toolpaths and machine instructions. While these methods are generally effective at creating the code, they don't always result in the most energy-efficient manufacturing processes. Factors such as energy consumption, tool wear, and material waste can significantly impact the overall efficiency and environmental footprint of CNC machining operations.
[0008] “Assessing the capabilities of ChatGPT to improve additive manufacturing troubleshooting” by S. Badini, Silvia et al. describes the optimization of the G-code generation process by selecting the correct printing parameters such as printing temperature, printing speed, layer thickness, material flow, etc. This controls the movements of the printer's extruder and the layer-by-layer build process, thus ensuring the quality of the final product and reducing printing time. Another optimization criterion is the amount of printing material used (e.g., filament).
[0009] “LLM-AID: Leveraging Large Language Models for Rapid Domain-Specific Accelerator Development” by Firouzi Farshad et al. describes an LLM framework that optimizes performance values (power / energy consumption) in chip design. 202414791 Foreign version
[0010] 2
[0011] (Speed / Throughput) and Area (Area, Chip Size). All values to be optimized refer to values of the chip being optimized (hardware accelerator) itself.
[0012] Optimizing CNC code presents several challenges. First, the sheer complexity of modern CNC programs makes it difficult for human programmers to identify all potential areas for improvement. Second, simultaneously optimizing multiple objectives, such as geometric accuracy, energy efficiency, and tool life, requires careful consideration of trade-offs. Furthermore, the optimization process often demands extensive expertise and experience, which can be time-consuming and expensive to acquire, and the necessary specialists are sometimes unavailable.
[0013] Furthermore, sustainability aspects in manufacturing have gained increasing importance in recent years. Reducing energy consumption and minimizing waste are key objectives for many industries, but incorporating these factors into CNC code optimization adds another layer of complexity to an already challenging problem.
[0014] The proposed method aims to solve the problem of optimizing CNC code while simultaneously addressing other optimization goals. Traditional CNC programming and optimization methods may not be able to effectively reconcile these competing objectives, especially as the complexity of CNC programs continues to increase.
[0015] It identifies potential areas for improvement in complex CNC programs that may go beyond traditional optimization techniques.
[0016] The aim is to optimize for several goals simultaneously, including geometric accuracy, energy efficiency and service life, which requires a sophisticated balance between compromises.
[0017] The increasing importance of integrating sustainability aspects into manufacturing processes adds another layer of complexity to the optimization problem. By developing an artificial intelligence-based CNC code optimization system, the application aims to overcome these challenges and offer a more comprehensive, efficient, and sustainable approach to CNC machining processes.
[0018] The described problem is solved by a method according to the features of claim 1. 202414791 Foreign version
[0019] 3
[0020] The problem is further solved by a system having the features of claim 10 and by a computer program product according to the features of claim 14.
[0021] The first aspect provides a method for generating optimized CNC code. This method includes: receiving input CNC code or a CAD model; generating optimized CNC code based on the input using a pre-trained Large Language Model (LLM); creating a CAD model and a corresponding energy consumption curve from the optimized CNC code; comparing the generated CAD model with an original CAD model for geometric similarity; comparing the generated energy curve with an original energy curve for efficiency improvements; calculating an overall reward based on a normalized combination of a geometry preservation reward (RG) and an energy efficiency reward (RE); and iteratively refining the optimized CNC code using the LLM as an agent, based on the calculated overall reward, until convergence is achieved.
[0022] This method enables efficient optimization of the CNC code, taking into account both geometric accuracy and energy efficiency, resulting in improved manufacturing processes and reduced environmental impact.
[0023] The pre-trained Large Language Model (LLM) can be trained on a dataset of CNC programs to learn contextual semantics and patterns in CNC code.
[0024] Training the LLM on a diverse dataset of C NC programs improves its ability to generate optimized code for various manufacturing scenarios, increasing the versatility and effectiveness of the optimization process.
[0025] The process may also include defining a tolerance for geometric differences between the created CAD model and the original CAD model.
[0026] Defining a tolerance for geometric differences allows for minor adjustments in the optimized CNC code, which can significantly improve efficiency without compromising the overall quality of the manufactured part. 202414791 Foreign version
[0027] 4
[0028] The process can also include the visualization of differences between the created CAD model and the original CAD model that are within the defined tolerance.
[0029] Visualizing the differences within the defined tolerance provides manufacturers with valuable insights into potential trade-offs between geometric accuracy and efficiency, enabling informed decisions in the optimization process.
[0030] The procedure can further include the calculation of efficiency improvements and associated sustainability factors based on differences between the generated energy curve and the original energy curve.
[0031] Quantifying efficiency improvements and sustainability factors enables manufacturers to assess the environmental and economic benefits of optimized CNC code and supports data-driven decisions in sustainable manufacturing practices.
[0032] The overall reward may also include a syntactic correctness reward to assess the syntactic correctness of the optimized CNC code.
[0033] The inclusion of a syntactic correctness reward ensures that the optimized CNC code remains executable and conforms to CNC programming standards, thereby reducing the risk of errors during manufacturing.
[0034] The syntactic correctness reward can be evaluated before calculating the geometry preservation reward (RG) and the energy efficiency reward (RE).
[0035] Prior evaluation of syntactic correctness ensures that only valid CNC code is considered for further optimization, which streamlines the optimization process and reduces computational effort.
[0036] In some cases, CNC software tools check the program by simulating the trajectories and checking for collisions with the machine itself or even with the workpiece.
[0037] The LLMs should run on GPUs, optionally also in highly scaled cloud servers.
[0038] Since the system iterates through the problem, we have little optimization potential apart from better hardware.
[0039] Using a CNC standard ensures code compatibility. If you have machine-specific information, you can also inform the LLM by providing this information within the context. 202414791 Foreign version
[0040] 5
[0041] The process can further include optimizing the CNC code to minimize tool wear by incorporating a tool wear minimization factor into the overall reward calculation.
[0042] Predicting and optimizing tool life can be integrated into the code generation process by, for example, selecting the optimal parameters (cutting speed, feed rate) (these are specified by the manufacturers) and keeping them constant during optimization. The feed rate per revolution is specified in the CNC code. Wear prediction could also be included.
[0043] Integrating tool wear minimization into the optimization process extends the service life of manufacturing tools, reduces maintenance costs, and improves overall production efficiency. When industry standards and regulations apply that pertain to the geometry of the workpiece itself, this can be incentivized through appropriate rewards or measured quantitatively.
[0044] In a second aspect, a system for optimizing CNC code using artificial intelligence is provided. The system includes: a processor; and a memory that stores instructions which, when executed by the processor, cause the system to carry out the procedure of the first aspect.
[0045] This system offers a hardware implementation for the CNC code optimization process and enables seamless integration into existing manufacturing processes and infrastructures. The processor can also be configured to define a tolerance for geometric differences between the generated CAD model and the original CAD model, and to visualize differences that fall within the defined tolerance.
[0046] This configuration improves the system's ability to provide detailed insights into the optimization process and supports more informed decision-making by manufacturing professionals.
[0047] The processor can still be configured to calculate efficiency improvements and related sustainability factors based on differences between the generated energy curve and the original energy curve.
[0048] This additional functionality allows the system to quantify the ecological and economic benefits of the optimized CNC code, thus supporting sustainable manufacturing initiatives. 202414791 Foreign version
[0049] 6
[0050] In a third aspect, a computer program product for optimizing CNC code using artificial intelligence is provided. The computer program product comprises a computer-readable storage medium containing program instructions, the program instructions being executable by a processor to instruct the processor to perform the procedure of the first aspect.
[0051] This computer program product enables the use of CNC code optimization on various computer platforms, increasing the accessibility and acceptance of the technology in diverse manufacturing environments. The program instructions can still be executed by the processor to instruct it to define a tolerance for geometric differences between the generated CAD model and the original CAD model, and to visualize differences between the generated and original CAD models that fall within the defined tolerance.
[0052] This additional functionality in the computer program product provides users with visual feedback on the optimization process, thus enabling a better understanding and control of the trade-offs between geometric accuracy and efficiency.
[0053] 202414791 Foreign version
[0054] 7
[0055] BRIEF DESCRIPTION OF THE IMAGES
[0056] Embodiments of the invention are described by way of example with reference to the following drawings, in which:
[0057] FIG. 1 shows a diagram of the pre-training of an LLM according to aspects of the present disclosure.
[0058] FIG. 2 presents a schematic diagram illustrating the basic principle of reinforcement learning.
[0059] FIG. 3 shows a flowchart of a learning mechanism according to the subject matter of the application,
[0060] FIG. 4 shows a simplified schematic diagram of the inference,
[0061] FIG. 5 shows a system diagram with interconnected components for CNC operations according to example implementation forms.
[0062] Where possible, the same reference symbols are used in all illustrations to indicate similar features.
[0063] DETAILED DESCRIPTION
[0064] The CNC code optimization system comprises a processor and a memory that stores instructions. The processor executes the instructions to perform a process for generating optimized CNC code.
[0065] FIG. 1 shows the basic system for optimizing CNC code. The system includes a general Large Language Model LLM, 13, which is trained on input data, namely unlabeled input data, CNC code, 111, ... 117 and corresponding CAD models 121, ... 127.
[0066] The Large Language Model 13 receives the input data and processes the inputs to generate a pre-trained LLM' 14, which is then able to produce optimized CNC code.
[0067] The input data is represented by elements 111, 112, 113, and 114. These can correspond to different types of input files or data formats. The basic Large Language Model is represented by element 13, which processes the input to generate optimized CNC code. Additional processing steps and comparisons are performed, as shown by elements 116, 117, and other related components in the diagram. 202414791 Foreign Version
[0068] 8
[0069] The system includes a Large Language Model (LLM). The LLM is pre-trained on a dataset of CNC programs to learn contextual semantics and patterns in CNC code. This pre-training enables the LLM to effectively understand and generate CNC code.
[0070] As shown in FIG. 1, the Large Language Model 13 receives the input data 1 and processes it to generate the optimized output. The input data can include CNC programs and / or CAD models. The Large Language Model LLM analyzes the input data 1 and applies its learned knowledge of CNC code patterns to generate optimized CNC code as optimized output.
[0071] FIG. 2 illustrates the learning mechanism of reinforcement learning in more detail. The Large Language Model (LLM) acts as agent 21 in a reinforcement learning framework. As agent, the Large Language Model (LLM) interacts with the CNC code environment 22 and performs actions to modify and optimize the code based on received rewards.
[0072] The training mechanism of the Large Language Model (LLM) involves iterative refinement of the generated CNC code. The Large Language Model LLM generates candidates for optimized code 111, ... , which are then evaluated based on geometric similarity to the original design and improvements in energy efficiency. Based on these evaluations, the Large Language Model LLM receives rewards 25, along with a status 24, such as the status of the environment 22 (i.e., the currently generated code), which guides further optimizations in subsequent iterations.
[0073] Through this training process, the Large Language Model (LLM) learns to generate CNC code that maintains geometric accuracy while improving efficiency and sustainability. Pre-training with various CNC program examples, as shown in Figure 1, allows the LLM to develop a broad understanding of CNC code structures and conventions, which the reinforcement learning process then refines for specific optimization tasks.
[0074] The optimization process includes several steps to refine the generated CNC code for improved efficiency and geometric accuracy.
[0075] As shown in FIG. 3, after the optimized CNC code 30 is generated by the Large Language Model, a CAD model 38 is created based on this optimized code, 31. In addition, an energy consumption curve is generated to predict the expected 202414791 foreign version
[0076] 9
[0077] To represent energy consumption during the manufacturing process using the optimized code.
[0078] An energy consumption curve can refer to a graphical representation or data set that illustrates the energy consumption or efficiency profile associated with the execution of a specific CNC code or machining operation. This energy curve can, in turn,
[0079] - Show the energy consumption over time during the processing process
[0080] - To display the power consumption in different phases of CNC operation
[0081] - Display peaks and troughs in energy demand during different processing steps
[0082] - Provide a visual or numerical representation of the overall energy efficiency for a specific CNC program
[0083] - To enable a comparison between different CNC code versions regarding their energy performance
[0084] - Help in identifying areas with potential energy optimization in the machining process
[0085] - To serve as a metric for evaluating the improvements in sustainability and efficiency achieved through code optimization.
[0086] The energy consumption curve can be generated through simulation, real-time monitoring, or predictive modeling based on CNC code parameters and machine characteristics. It can be used in conjunction with other metrics to evaluate the overall performance and efficiency of the optimized CNC code.
[0087] Conflicts between geometric accuracy and energy efficiency during optimization can be resolved in various ways.
[0088] Both rewards have simply been added together so far. However, by creating a weighted sum, one can emphasize either geometry or efficiency.
[0089] In the worst case, an equilibrium optimization occurs, the solution to which is a saddle point. In similar systems like Generative Adversarial Networks (GANs), such an optimization can be solved by alternately optimizing one reward and then the other, and so on. After a certain time, the system converges, meaning no further changes are visible in the CNC code. 202414791 Foreign version
[0090] 10
[0091] In a further step 32, the pre-trained LLM is used to generate a new CNC code 301 from the CNC code 30, presumably optimized compared to the original code. Based on this new code 301, a CAD model 381 and an energy consumption curve 371 are generated, 33.
[0092] The system then performs comparisons between the newly created CAD model 381 and the original CAD model 38. This comparison 34 evaluates the geometric similarity between the two models to ensure that the optimized code retains the intended shape and dimensions of the part to be manufactured.
[0093] The system also compares the energy consumption curve 371 derived from the optimized CNC code with the original energy curve 37, which corresponds to the original CNC code 30. This comparison allows for the evaluation of potential efficiency improvements regarding energy consumption during the manufacturing process.
[0094] Based on these comparisons, the system calculates rewards (R). A geometry preservation reward (RG) is determined based on the similarity between the created CAD model and the original CAD model. An energy efficiency reward (RE) is calculated by evaluating the improvements in the energy consumption curve compared to the original curve.
[0095] The term "geometry preservation reward" can refer to a quantitative measure or value that assesses the degree to which optimized CNC code maintains the intended geometric features and dimensions of the original design or CAD model. This reward can evaluate the similarity between the CAD model generated from the optimized CNC code and the original CAD model, and quantify the accuracy of critical dimensions, shapes, and surface features in the optimized design, taking into account tolerances and acceptable deviations from the original geometry.
[0096] The iterative refinement process is guided to ensure that optimizations do not affect the intended product geometry.
[0097] The geometry preservation reward can be calculated using various algorithms, comparison techniques, or machine learning models that analyze and compare 3D geometries.
[0098] As shown in FIG. 2, these rewards serve as inputs for controlling the optimization process, i.e., the training process of the LLM. The rewards are fed back to the Large Language Model (LLM), which acts as an agent in the optimization framework 202414791 (foreign version).
[0099] 11 functions. The Large Language Model LLM uses these rewards to refine its output in subsequent iterations, with the goal of generating CNC code that better preserves the intended geometry while improving energy efficiency.
[0100] The optimization process continues iteratively, with the Large Language Model generating new versions of the optimized CNC code based on the rewards received. Each iteration can produce incremental improvements in both geometric accuracy and energy efficiency. The process can continue until a predefined convergence criterion is met or a specified number of iterations are completed. This could involve a change below a defined value or when the generated code switches back and forth between different versions.
[0101] The reward calculation process involves several factors to ensure that the optimized CNC code meets various performance criteria. The main components of the reward calculation are the geometry preservation reward (RG) and the energy efficiency reward (RE).
[0102] The geometry preservation reward (RG) is calculated by comparing the CAD model generated from the optimized CNC code with the original CAD model. This comparison assesses the similarity between the two models and ensures that the optimized code maintains the intended shape and dimensions of the part to be manufactured. The reward value increases with increasing geometric similarity between the models.
[0103] The energy efficiency reward (RE) is determined by comparing the energy consumption curve derived from the optimized CNC code with the original energy curve. This comparison evaluates potential efficiency improvements regarding energy consumption during the manufacturing process. A higher reward value is awarded for greater reductions in energy consumption.
[0104] To calculate the total reward, the geometry maintenance reward R is used. Gand the energy efficiency reward RE is first normalized to ensure they are on comparable scales. The normalization process may involve scaling each reward to a predefined range, such as 0 to 1. After normalization, the rewards are combined using a weighted sum approach. The weights assigned to each reward can be based on 202414791 foreign version
[0105] 12 the relative importance of geometric accuracy and energy efficiency for the specific manufacturing task.
[0106] In some examples, additional reward factors can be included in the overall reward calculation. A syntactic correctness reward can be included to evaluate the syntactic validity of the generated CNC code. This reward ensures that the optimized code adheres to the correct syntax and structure required for CNC programming. The syntactic correctness reward can be calculated before the geometry preservation reward (RG) and the energy efficiency reward (R). E The results will be evaluated to ensure that only syntactically valid code is considered for further optimization.
[0107] Another potential reward factor is the minimization of tool wear. By including a tool wear minimization factor in the overall reward calculation, the optimization process can consider the impact of the generated CNC code on tool life. This factor can be based on parameters such as cutting forces, toolpath smoothing, or material removal rates. The Large Language Model (LLM) can be configured to optimize for these additional criteria beyond geometry and energy consumption. By including multiple reward factors, the optimization process can balance various performance aspects, including geometric accuracy, energy efficiency, code correctness, and tool wear.
[0108] FIG. 4 illustrates the reward calculation process within the overall optimization framework during the inference phase. The optimized CNC code 41 generated by the Large Language Model LLM 14 is used to create a CAD model and an energy consumption curve. These are then compared with the original CAD model and energy curve to calculate the respective rewards 42. The combined reward is fed back to the Large Language Model LLM to guide further optimizations in subsequent iterations.
[0109] The system implements an iterative refinement process to optimize CNC code using the Large Language Model (LLM) as an agent. This process involves repeatedly generating and evaluating optimized CNC code based on calculated rewards until a convergence criterion is met.
[0110] As shown in FIG. 2, the Large Language Model (LLM) acts as an agent within a reinforcement learning framework. The agent interacts with an environment representing the CNC code optimization task. The agent performs actions by [202414791 Foreign Version]
[0111] 13
[0112] CNC code is generated or modified, and feedback is received in the form of rewards calculated based on the performance of the generated code.
[0113] FIG. 4 illustrates the information flow during the iterative refinement process. The Large Language Model generates optimized CNC code based on the input. This optimized code is then used to create a CAD model and an energy consumption curve. The system compares these outputs with the original CAD model and energy curve to calculate rewards for geometry preservation and energy efficiency.
[0114] The calculated rewards are combined into a total reward, which serves as feedback to guide the Large Language Model in subsequent iterations. The Large Language Model uses this feedback to adjust its output, with the goal of generating CNC code that better preserves the intended geometry while improving energy efficiency.
[0115] The iterative refinement process continues until convergence is achieved. Convergence can be determined based on various criteria, for example: the total reward reaches a predefined threshold, the improvement in reward values between successive iterations falls below a set tolerance, or a maximum number of iterations has been completed.
[0116] During each iteration, the Large Language Model (LLM) refines its output based on the rewards received. The model can adjust various aspects of the generated CNC code to optimize for both geometric accuracy and energy efficiency, such as...
[0117] Toolpaths, cutting parameters, or the sequence of operations.
[0118] The iterative nature of this process allows the system to apply a wide range of potential optimizations, continuously improving the quality of the generated CNC code. By using the Large Language Model as an agent and utilizing computed rewards, the system can effectively navigate the complex optimization space and converge to high-quality solutions that balance multiple performance criteria. 202414791 Foreign Version
[0119] 14
[0120] The optimized output generated by the Large Language Model (LLM) is CNC code that balances geometric accuracy with energy efficiency and other optimization criteria. This optimized CNC code is designed to maintain the intended shape and dimensions of the part being manufactured while improving energy consumption during the manufacturing process.
[0121] The Large Language Model (LLM) processes the input data, which can include original CNC code or CAD models, to generate optimized output. This optimized output incorporates modifications to various aspects of the CNC code, such as toolpaths, cutting parameters, and operation sequences, to achieve improved performance.
[0122] When generating optimized output, the Large Language Model considers several factors. The optimized CNC code aims to preserve the geometric accuracy of the original design by ensuring that the toolpaths and cutting operations produce a part that precisely meets the intended specifications. At the same time, the optimized output incorporates changes that can lead to reduced energy consumption during the manufacturing process, such as optimized cutting speeds or more efficient tool movements. The optimized output can also include modifications that address additional optimization criteria. For example, the CNC code can be structured to minimize tool wear by adjusting cutting forces or optimizing the sequence of operations.The optimized output is designed to be syntactically correct and ensures that the generated CNC code adheres to the correct syntax and structure required for CNC programming.
[0123] By balancing these various optimization criteria, the optimized output represents an improved version of the original CNC code, aiming to improve manufacturing efficiency while maintaining product quality. The optimized CNC code generated by the system can be seamlessly integrated into existing manufacturing processes.
[0124] As shown in FIG. 5, the optimized CNC code U1 is sent to the control unit 52 of the CNC machine 51. The control unit 52 interprets the optimized code and controls the CNC machine 51 to execute the manufacturing process with improved efficiency and accuracy. The CNC machine is, for example, part of a manufacturing plant 50. 202414791 Foreign version
[0125] 15
[0126] The figure illustrates how the system can visualize differences between the generated CAD model and the original CAD model that are within the defined tolerance. The visualization module generates visual representations of these differences, which can be displayed on screen 53. This visualization capability allows engineers and operators to quickly assess the impact of optimizations on the part geometry and make informed decisions about whether to accept the optimized code.
[0127] In various industrial environments, the CNC code optimization system can offer significant advantages. For example, in aerospace manufacturing, where precision and material efficiency are critical, optimized CNC code can help reduce waste while maintaining tight tolerances. In automotive production, the system can optimize toolpaths for complex parts and potentially reduce cycle times and energy consumption.
[0128] The system allows the definition of a tolerance for geometric differences between the generated CAD model and the original CAD model. This tolerance setting enables manufacturers to specify acceptable deviations in part geometry while still achieving overall optimization goals. For example, a manufacturer might define a tolerance of 0.1 mm for non-critical surfaces, while maintaining tighter tolerances for critical features.
[0129] By providing tolerance definitions and difference visualization, the system enables manufacturers to align optimization goals with geometric requirements. This flexibility can be particularly valuable in industries such as medical technology, where certain features require exact replication, while others can tolerate slight variations to improve overall production efficiency.
[0130] Integrating optimized CNC code into existing processes can lead to reduced material waste, lower energy consumption, and improved tool life in various manufacturing applications. The system's ability to consider multiple optimization criteria simultaneously enables a holistic approach to improving manufacturing efficiency while maintaining product quality.
[0131] The CNC code optimization system implements a workflow that integrates artificial intelligence to achieve both efficiency and sustainability in manufacturing processes. This workflow begins with the input of CNC code or CAD models and proceeds through several stages of analysis and optimization. 202414791 Foreign version
[0132] 16
[0133] A key aspect of the optimization process involves calculating efficiency improvements and related sustainability factors based on differences between the generated energy curve and the original energy curve. The system generates an energy consumption curve for both the original CNC code and the optimized version. By comparing these curves, the system can quantify potential energy savings and associated reductions in environmental impact.
[0134] Efficiency improvements are calculated by analyzing the differences in energy consumption between the original and optimized processes. This can include factors such as reduced machining time, optimized toolpaths, and improved cutting parameters. The system can express these improvements as percentage reductions in energy consumption or time savings. Sustainability factors are derived from the efficiency improvements and can include metrics such as reduced carbon emissions, decreased material waste, and extended tool life. For example, a reduction in energy consumption can be directly translated into a corresponding reduction in carbon emissions, based on the energy source used in the manufacturing plant.
[0135] The system can also consider additional sustainability factors, such as the impact on coolant consumption, the reduction of scrap material, and the potential for increased product quality (which can lead to fewer rejected parts and less waste). These factors are quantified and presented along with the efficiency improvements to provide a comprehensive overview of the optimization's impact on both manufacturing performance and environmental sustainability.
[0136] By integrating these calculations into the optimization workflow, the system ensures that the generated CNC code not only maintains geometric accuracy but also contributes to more sustainable manufacturing practices. This approach enables manufacturers to make informed decisions about implementing optimized CNC code, balancing production efficiency with environmental considerations.
[0137] In one embodiment, further optimization goals can be considered, for example:
[0138] - Extension of the system to take into account additional objectives beyond geometry and energy efficiency 202414791 Foreign version
[0139] 17
[0140] - Inclusion of factors such as tool wear, surface quality and production time
[0141] - Allows users to set custom weights for different optimization goals.
[0142] The system can still be taken into account in predictive maintenance:
[0143] - Inclusion of machine condition data in the optimization process
[0144] - Prediction of potential failures or maintenance needs based on optimized CNC code
[0145] - Adaptation of optimization strategies to extend machine lifespan and reduce downtime.
[0146] Another advantageous application can be seen in material-specific optimization:
[0147] - Development of specialized optimization models for various materials (e.g., metals, plastics, composites)
[0148] - Consideration of material properties and behavior in the optimization process
[0149] - Optimization for material-specific factors such as chip formation and heat dissipation.
[0150] Even though the described example is limited to the optimization of a CNC code for a machine tool, it is still conceivable to carry out the optimization across multiple machines, for example with regard to a machining chain of a workpiece across several machining stations:
[0151] - Extension of the system to simultaneously optimize CNC code across multiple machines
[0152] - Consideration of load balancing and production planning in the optimization process
[0153] - thereby optimizing for the overall efficiency of the factory rather than the performance of individual machines.
[0154] Further examples of implementation are conceivable with regard to a hybrid optimization approach:
[0155] - Combination of AI-based optimization with traditional rule-based optimization techniques,
[0156] - Incorporating the expertise of domain specialists into the optimization process,
[0157] - Enabling manual overrides and fine-tuning of AI-generated optimizations. 202414791 Foreign version
[0158] 18
[0159] The described solution advantageously does not require external sensors and can therefore be used on any CNC machine.
[0160] Furthermore, no historical data (i.e., from previous processing cycles) is required, and therefore no intervention from experts is necessary. This means that the proposed solution is suitable not only for series production but also for custom manufacturing.
Claims
202414791 Foreign version 19 Patent claims 1. Computer-implemented method for generating optimized CNC code (41), comprising: - Receiving an input CNC code or CAD model (30); - Generating an optimized CNC code based on the input using a pre-trained Large Language Model (LLM', 14); - Creating a CAD model (41) and a corresponding energy consumption curve during the manufacturing process from the optimized CNC code (43); - Comparing the created CAD model with an original CAD model for geometric similarity; - Comparing the generated energy curve with an original energy consumption curve to identify efficiency improvements; - Calculating a total reward based on a normalized combination of a geometry conservation reward (RG) and an energy efficiency reward (RE); and - Iterative refinement of the optimized CNC code using the LLM as an agent based on the calculated total reward until convergence is achieved, where convergence is determined based on at least one of the following criteria: the total reward reaches a predefined threshold, or the improvement in reward values between successive iterations falls below a set tolerance, or a maximum number of iterations has been completed and the CNC code is generated.
2. The computer-implemented method according to claim 1, characterized in that the pre-trained Large Language Model (LLM') is trained on a dataset of CNC programs to learn contextual semantics and patterns in CNC code.
3. The computer-implemented method according to claim 1, characterized in that the calculation of the total reward further comprises normalizing and combining the geometry preservation reward (RG) and the energy efficiency reward (RE).
4. The computer-implemented method according to claim 1, further comprising 202414791 Foreign version 20 Defining a tolerance for geometric differences between the created CAD model (381) and the original CAD model (38).
5. The computer-implemented method according to claim 4, further comprising the visualization of differences between the created CAD model (381) and the original CAD model (38) that are within the defined tolerance.
6. The computer-implemented method according to claim 1, further comprising the calculation of efficiency improvements and associated sustainability factors based on differences between the generated energy consumption curve (371) and the original energy consumption curve.
7. The computer-implemented method according to one of claims 1 to 6, characterized in that the total reward further includes a syntactic correctness reward for evaluating the syntactic correctness of the optimized CNC code.
8. The computer-implemented method according to claim 7, characterized in that the syntactic correctness reward is evaluated before the calculation of the geometry preservation reward (RG) and the energy efficiency reward (RE).
9. The computer-implemented method according to any one of claims 1 to 8, further comprising the optimization of the CNC code to minimize tool wear by including a tool wear minimization factor in the overall reward calculation.
10. A system for optimizing CNC code using artificial intelligence, comprising: a processor; and a memory that stores instructions which, when executed by the processor, cause the system to perform the method according to claim 1.
11. The system according to claim 10, characterized in that the processor is further configured to define a tolerance for geometric differences between the created CAD model and the original CAD model. 202414791 Foreign version 21 and to visualize differences between the created CAD model and the original CAD model that are within the defined tolerance.
12. The system according to claim 10 or 11, characterized in that the processor is further configured to calculate efficiency improvements and associated sustainability factors based on differences between the generated energy curve and the original energy curve.
13. The system according to one of claims 10 to 12, characterized in that the total reward further includes a syntactic correctness reward for evaluating the syntactic correctness of the optimized CNC code, and wherein the syntactic correctness reward is evaluated before the calculation of the geometry preservation reward (RG) and the energy efficiency reward (RE).
14. A computer program product for optimizing CNC code using artificial intelligence, wherein the computer program product comprises a computer-readable storage medium containing program instructions, wherein the program instructions are executable by a processor to cause the processor to perform the method according to claim 1.
15. The computer program product according to claim 14, characterized in that the program instructions are further executable by the processor to cause the processor to define a tolerance for geometric differences between the created CAD model and the original CAD model and to visualize differences between the created CAD model and the original CAD model that are within the defined tolerance.