A method and system for layer-by-layer scan compensation of a mold conformal cooling insert
By organizing the history of printed layers into a searchable memory during the laser powder bed fusion printing process and generating a scanning path compensation that conforms to physical constraints, the problem of warpage accumulation in laser powder bed fusion printing is solved, and the forming accuracy and printing pass rate of mold conformal cooling inserts are improved.
Patent Information
- Application Number
- CN202611508999.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-28
- Publication Date
- 2026-11-20
AI Technical Summary
In the existing technology, during the conformal cooling insert process of laser powder bed fusion printing mold, residual stress and warpage accumulate monotonically along the layer number. The feedback layer by layer is limited by the sliding window and cannot reuse the compensation experience of the early isomorphic overhanging layer, resulting in the deformation increasing layer by layer.
The history of printed layers generated during the layer-by-layer printing process is organized into a memory that can be retrieved by content addressing. By using a layer embedding autoencoder and a scan compensation generator, scan path compensation that conforms to LPBF physical constraints is generated. Layer-by-layer adjustments are made using the measured thermal field and morphology data of the printed layers. The compensation experience of the early isomorphic overhanging layers is reused to suppress warping drift.
It effectively suppressed the warping accumulation of the rear isomorphic overhang layer, improved the forming accuracy and printing pass rate of the mold conformal cooling insert, and reduced the probability of downtime for rescanning and rework.
Smart Images

Figure CN123129457A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of additive manufacturing technology, and in particular to a method and system for generating layer-by-layer scanning compensation for mold conformal cooling inserts. Background Technology
[0002] The conformal cooling insert of the injection mold has conformal cooling channels that run along the surface of the cavity. These channels have complex structures and are difficult to form by machining. They are usually formed as a whole by laser powder bed melting process.
[0003] Laser powder bed melting slices the part according to a preset layer thickness, spreads powder layer by layer, and clads it with laser scanning. The conformal cooling channel runs through the interior of the insert, and the internal support structure cannot be removed after printing. Therefore, no support structure can be placed in the channel. The channel cross-section is usually designed as a self-supporting shape, such as teardrop or arch, so that the overhang angle of the channel top wall does not exceed the material's self-supporting critical angle.
[0004] Even so, the area below the overhanging area on the top wall of the channel is powder rather than a molten solid, resulting in poor thermal conductivity. During printing, it is still easy for the insert to collapse and sag, surface roughness, and residual stress concentration to occur. In addition, the laser heat input during the layer-by-layer cladding process causes residual stress to accumulate between layers. As the printing process progresses, the insert warps, the channel deforms, and the surface accuracy degrades.
[0005] To control the aforementioned deformation, it is necessary to determine parameters such as the power, speed, and scanning strategy of the laser scanning for each layer based on its geometric characteristics and thermal state. Existing technologies employ three representative processing methods:
[0006] Firstly, printing with fixed or preset process parameters: Most laser powder bed melting equipment uses the same set of laser power, scanning speed and scanning strategy for all layers; some equipment presets the parameters of the overhanging surface and the upper surface according to the feature type before printing, such as reducing the power and speed for the lower overhanging surface. However, these parameters are set once in the printing preparation stage and remain unchanged during the printing process. However, since the process adjustments required for the solid layer and the overhanging layer change as the printing process progresses, if the parameters remain unchanged throughout the process, the overhanging layer in the later stage will still collapse, and the solid layer may be overburned, with deformation accumulating layer by layer.
[0007] Secondly, simulation-based pre-compensation: Finite element thermo-mechanical simulation is used to predict the overall warping of the part before printing, and reverse deformation compensation is applied to the part model in advance. The compensated model is used directly during printing, and no further adjustments are made according to the actual state during the printing process. However, since the simulation is completed all at once before printing, it is impossible to perceive the deviation of the actual thermal field and morphology from the simulation assumption during the printing process. In actual printing, the interaction between powder and laser is random, and the error of open-loop compensation accumulates layer by layer with the printing process.
[0008] Third, layer-by-layer closed-loop feedback: using in-situ measurement methods such as off-axis infrared thermal imagers and layer-by-layer profilometers, the thermal field and surface morphology of the bed are obtained after each layer is printed, and the scanning parameters of subsequent layers are adjusted accordingly. This type of method usually only makes feedback adjustments based on the measurement results of the most recently printed layer or several layers.
[0009] The layer-by-layer closed-loop feedback is based only on the sliding window range formed by the most recent layer or several layers. Information of earlier printed layers is discarded as the printing process progresses. When the overhanging feature that appears in the later stage is geometrically similar to the same type of feature that has been printed earlier, the process settings and actual deformation results of the corresponding layer of the earlier feature are no longer accessible. It is impossible to make targeted adjustments to the current layer based on the actual results of the same type of feature in the earlier stage. The amount of deformation increases cumulatively as the layer number progresses.
[0010] Meanwhile, layer-by-layer decision-making requires low computational latency, while the scale of measurement data for the printed layers continues to increase as the printing process progresses. How to balance the preservation and utilization of historical information under the condition of limited online computing overhead still needs improvement. Summary of the Invention
[0011] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and system for generating conformal cooling inserts for molds by scanning and compensation layer by layer. This invention aims to solve the problems that, during the process of laser powder bed fusion printing of conformal cooling inserts for molds, residual stress and warpage accumulate monotonically along the layer number, and the layer-by-layer feedback is limited by the sliding window, making it impossible to reuse the compensation experience of early isomorphic overhang layers.
[0012] The method is as follows: the history of printed layers generated by the layer-by-layer printing process is organized into a memory that can be retrieved by content addressing. Before the generation of each layer scan path compensation, the retrieval embedding of the most recently completed layer is used as the query. After filtering by layer type and overhang angle, the non-local isomorphic history layer is recalled and assembled with the reference anchor point and the near layer sliding window into a context injection compensation generator.
[0013] The retrieval embedding space is shaped through joint training with interlayer redundancy suppression and trajectory smoothing to suppress the embedding collapse of adjacent entity layers and ensure recall discriminability. The prediction head outputs warping, defects and intervention probabilities, and the retrieval confidence supports the output of the three-level decision rules that conform to the physical constraints of LPBF and the traceable evidence chain.
[0014] By reusing the compensation experience and measured collapse results of the early overhanging layers, the layer-by-layer accumulation of warping and drift was suppressed, and the subsequent isomorphic overhanging layers were transformed from rework due to exceeding tolerances to passing through in one go.
[0015] To achieve the above objectives, this application proposes a layer-by-layer scanning compensation generation method for conformal cooling inserts in molds, applied to the laser powder bed fusion layer-by-layer printing process, comprising:
[0016] Step S1: Before printing the current layer, obtain the slice geometry of the current layer and the measured thermal field of the most recently printed layer;
[0017] Step S2: Using the retrieval embedding of the most recently completed printed layer as the query, select non-local historical printed layers from the printed layer history database in descending order of similarity as the retrieval hit layers, and retrieve the printed layer context of each of the retrieval hit layers; wherein, the retrieval embedding is obtained by encoding the dense representation of the printed layer by a layer embedding autoencoder, and the embedding space of the layer embedding autoencoder is trained to suppress the similarity between the retrieval embeddings of adjacent entity layers that exceeds a preset boundary;
[0018] Step S3: Assemble the printed layer context, reference anchor cache, and near-layer sliding window cache of each of the retrieved hit layers into a layer compensation context;
[0019] Step S4: The scan compensation generator generates scan path compensation for the current layer using the current layer slice geometry, the measured thermal field of the most recently printed layer, and the layer compensation context as input.
[0020] Step S5: Print the current layer according to the scanning path, and obtain the measured thermal field and measured morphology of the current layer after printing through in-situ measurement;
[0021] Step S6: Construct a dense representation of the printed layer of the current layer and encode it to obtain the retrieval embedding of the current layer. Write the retrieval embedding of the current layer and the printed layer context of the current layer into the near layer sliding window cache. When the number of entries in the near layer sliding window cache exceeds the preset capacity, move the oldest entry into the printed layer history library for subsequent layer retrieval.
[0022] As a further solution, in step S6, a dense representation of the printed layer of the current layer is constructed, including:
[0023] The layer semantic encoder encodes the geometry of the current layer slice, the measured thermal field, and the measured morphology, outputting layer semantic embedding, overhang severity score, thermal accumulation score, and defect risk score. The layer semantic embedding, overhang severity score, thermal accumulation score, defect risk score, embedded data with applied scan path compensation, measured warpage, overhang angle, and layer type embedding are concatenated and linearly projected to obtain a dense representation of the printed layer. The measured warpage is the warpage amount calculated from the measured morphology.
[0024] As a further solution, the printed layer history library consists of a retrieval embedding library and a context library, which correspond to each other by layer number;
[0025] The near-layer sliding window buffer retains the most recently printed printed layer contexts, the number of which does not exceed a preset capacity, and the reference anchor point buffer is a healthy, uniform, and unchanging printed layer context from a reference printed layer.
[0026] The printed layer context is a multi-field concatenated vector, including the printed layer dense representation, the embedded data with applied scan path compensation, the measured warp calculated from the measured topography, the overhang severity score, the thermal accumulation score, the defect risk score, and the overhang angle and layer type embedding.
[0027] The printed layer dense representation is used for context-attention semantic fusion, while the remaining original fields are used for retrieval filtering and evidence chain reading; the droop severity score, the heat accumulation score, and the defect risk score are output by the layer semantic encoder.
[0028] As a further solution, the layer embedding autoencoder includes an encoder and a decoder, the encoder compressing the printed layer dense representation into a retrieval embedding, and the decoder being used during the training phase to reconstruct the printed layer dense representation from the retrieval embedding;
[0029] The retrieval embedding, after L2 normalization, is used for similarity calculation;
[0030] The embedding space of the layer embedding autoencoder, after training, also smooths the trajectory of the normalized retrieval embedding sequence, and the suppression of similarity between adjacent entity layer retrieval embeddings that exceeds the preset boundary is limited to a local temporal window.
[0031] As a further solution, the non-local historical printed layers are historical printed layers from a candidate set, which is determined as follows:
[0032] Exclude a preset number of recently moved printed layers from the printed layer history library, and retain only the historical printed layers that have the same layer type as the current layer and whose absolute value of the difference in overhang angle does not exceed a preset tolerance;
[0033] The preset number of excluded printed layers are R layers that were most recently moved into the printed layer history library, and R is equal to the preset capacity of the near-layer sliding window cache;
[0034] The layer type is determined by the geometry of the current layer slice, including uniform solid, channel top overhang, and channel wall and cavity transition; the overhang angle is the maximum overhang angle extracted from the geometry of the current layer slice.
[0035] As a further solution, the similarity is cosine similarity; the number of layers hit by the retrieval is the smaller of the upper bound of the retrieval budget K and the size of the candidate set, and the upper bound of the retrieval budget K increases with the increase of the size of the printed layer history database, and is not less than the preset minimum number of retrievals.
[0036] As a further solution, the assembly layer compensation context includes: splicing in the order of the baseline anchor cache, the printed layer context of each of the retrieved hit layers, and the near-layer sliding window cache;
[0037] When the printed layer history library is empty or the number of retrieved layers is zero, the layer compensation context consists of the baseline anchor cache and the near-layer sliding window cache.
[0038] As a further solution, the scan compensation generator includes: a layer encoder for encoding the current layer slice geometry and the measured thermal field of the most recently printed layer into a query representation;
[0039] The context attention unit is used to perform attention calculations using the query representation as the query and each context entry in the layer compensation context as the key and value, to obtain an attention-enhanced representation.
[0040] The fusion unit is used to fuse the query representation with the attention enhancement representation to obtain the retrieval enhancement hidden state;
[0041] The decoding unit is used to decode the retrieval enhancement hidden state and generate the scan path compensation for the current layer.
[0042] As a further solution, the scan path compensation includes scan parameter and scan strategy compensation components and scan path pre-compensation offset components;
[0043] The scanning parameters and scanning strategy compensation components include at least one of laser power, scanning speed, scanning spacing, scanning strategy, contour scanning and preheating pre-scanning, and island rotation angle;
[0044] The pre-compensation offset component of the scanning path is the geometric inverse deformation amount of the scanning path. When the value is positive, the path expands outward, and when the value is negative, the path shrinks inward, which is used to offset the predicted warping deformation.
[0045] As a further solution, it also includes:
[0046] The warpage prediction value and defect risk of the current layer are obtained based on the enhanced hidden state prediction. The warpage prediction value is non-negative and the defect risk value ranges from 0 to 1.
[0047] The retrieval confidence is determined based on the similarity and the consistency between the current layer's predicted quality and the measured quality of the retrieval hit layer.
[0048] Based on the retrieval enhancement hidden state, the warping prediction value, the defect risk, and the retrieval confidence, at least one intervention probability in the prediction time domain is generated. The intervention probability is the probability that the current layer compensation is insufficient and online intervention or post-processing rework is required. The prediction time domain includes at least one of the short-term prediction time domain after the current layer, the medium-term prediction time domain after the current layer, and the printing end state. Each prediction time domain is distinguished by prediction time domain embedding.
[0049] Based on the intervention probability, the defect risk, and the retrieval confidence, an executable compensation decision is generated. The action of the compensation decision is selected from at least one of the following: accept, adjust compensation parameters, switch scanning strategy, reduce power (downskin), rescan correction, pause thermal relaxation, and add margin by marking.
[0050] As a further solution, the retrieval confidence is calculated as follows:
[0051] The warpage prediction value is normalized according to the preset warpage normalization reference value and then combined with the defect risk to form the prediction quality vector of the current layer;
[0052] For each retrieved layer, the measured warp in its printed layer context is normalized according to the preset warp normalization reference value and combined with the defect risk score to form a measured quality vector, wherein the defect risk score is the observation score output by the layer semantic encoder.
[0053] The retrieval confidence score is obtained by taking the normalized value of the similarity of the retrieval hit layer as the weight and the mean of the absolute difference between the warp component and the defect risk component minus 1 as the quality consistency score, and by taking the weighted average of all retrieval hit layers.
[0054] When the number of hit layers in the retrieval is zero, the retrieval confidence is set to 0.
[0055] As a further solution, the action of the compensation decision is determined according to the following rules:
[0056] Risk classification: When the intervention probability corresponding to the short-term prediction time domain is not less than the preset high-risk threshold, or when the defect risk is not less than the preset defect risk threshold, the action includes rescan correction and power reduction downskin; when the intervention probability corresponding to the printing end state is not less than the preset out-of-tolerance threshold, the action includes adjusting compensation parameters and marking machining margin; in other cases, the action includes acceptance.
[0057] Trend verification: When the retrieval confidence is not less than a preset precedent threshold, compensation measures are determined according to historical precedents; when the retrieval confidence is less than a preset rare situation threshold, the action includes switching the scanning strategy or pausing hot relaxation, and encrypting monitoring.
[0058] Constraints must be met: cladding layers cannot be reverted or redone; support structures are prohibited within conformal cooling channels; the execution of the actions must be aligned with the pauseable thermal relaxation window; power reduction downskin is prioritized for high-risk overhanging layers; and multiple high-risk layers are processed together.
[0059] The intervention probability corresponding to the intermediate prediction time domain is used as a monitoring signal and is not used for the threshold determination of the action; the compensation decision also outputs an evidence chain consisting of the layer number of each search hit layer and the similarity, and executes the current layer printing according to the compensation decision.
[0060] As a further solution, step S5 includes a consistency check: calculating the residual between the predicted warpage value and the measured warpage calculated from the measured morphology; when the residual exceeds a preset threshold, marking the prediction deviation of the current layer and triggering a review.
[0061] On the other hand, the present invention also provides a method for retrieving embedding spaces and training scan compensation generators, used in the layer-by-layer scan compensation generation method as described in any of the preceding claims, comprising:
[0062] During the training period, the dense representation of the printed layer and its derived printed layer history library are filled with expert-compensated true values and measured warping true values.
[0063] The encoder and decoder of the layer-embedded autoencoder, the scan compensation generator, the scoring head and prediction head of the layer semantic encoder are jointly trained. The total loss function includes:
[0064] The loss includes: reconstruction loss, which enables the decoder to reconstruct the dense representation of the printed layer from the retrieval embeddings; inter-layer redundancy suppression loss, which penalizes the portion where the cosine similarity of the retrieval embeddings of adjacent layers exceeds a preset boundary m within a local temporal window, thereby suppressing the embedding collapse of adjacent entity layers; trajectory smoothing loss, which constrains the second-order difference of the normalized retrieval embedding sequence; and compensation imitation loss, warping prediction loss, defect risk loss, intervention probability loss, and semantic scoring head loss, at least one of these.
[0065] In this process, the Top-K selection in the self-retrieval is discrete and non-differentiable. The training gradient is backpropagated to the attention parameters through the softmax weights of the context attention. The layer-embedded autoencoder is indirectly shaped by the reconstruction loss, inter-layer redundancy suppression loss and trajectory smoothing loss, thus achieving end-to-end coupling between retrieval and generation.
[0066] As a further solution, the inter-layer redundancy suppression loss is:
[0067] ;
[0068] in, To suppress losses due to interlayer redundancy, Let t be the normalized retrieval embedding for layer t, T be the total number of training and printing sequences, m be the preset boundary, and w be the local temporal window. The number of lag layers;
[0069] The interlayer redundancy suppression loss only penalizes the similarity between retrieval embeddings that exceeds the preset boundary within a local temporal window, and does not exclude isomorphic layers that are repeated at long distances.
[0070] As a further solution, the trajectory smoothing loss is:
[0071] ;
[0072] in, For trajectory smoothing loss, The normalized retrieval embedding is the t-th layer, and T is the total number of layers in the training and printing sequence; the trajectory smoothing loss is applied to the normalized retrieval embedding and uses the L2 norm instead of the square norm to constrain the second-order stability of the embedding direction trajectory.
[0073] In another aspect, the present invention also provides a layer-by-layer scanning compensation generation system for mold conformal cooling inserts, comprising:
[0074] The layer semantic encoder is used to encode the geometry, measured thermal field and measured morphology of the current layer slice, and outputs the layer semantic embedding, overhang severity score, thermal accumulation score and defect risk score.
[0075] The printed layer dense representation construction module is used to embed the layer semantics, the overhang severity score, the thermal accumulation score, the defect risk score, the embedded data with applied scan path compensation, the measured warp, the overhang angle, and the layer type, and then perform linear projection to obtain the printed layer dense representation.
[0076] A layer embedding autoencoder is used to compress the dense representation of the printed layer into a retrieval embedding. Its embedding space is trained to suppress the similarity between retrieval embeddings of adjacent entity layers within a local temporal window that exceeds a preset boundary, and to smooth the trajectory of the normalized retrieval embedding sequence.
[0077] The memory includes a printed layer history library, a near-layer sliding window cache, and a reference anchor point cache. The printed layer history library consists of a retrieval embedding library and a context library, which correspond to each other by layer number.
[0078] The self-retrieval module is used to select non-local historical printed layers from the printed layer history database according to the similarity from high to low as the retrieval hit layers, and output the printed layer context of each retrieval hit layer.
[0079] A layer compensation context assembly module is used to assemble the baseline anchor cache, the printed layer context of each of the search hit layers, and the near-layer sliding window cache into a layer compensation context.
[0080] A scan compensation generator is used to generate scan path compensation for the current layer, taking the current layer slice geometry, the measured thermal field of the most recently printed layer, and the layer compensation context as input.
[0081] The printing and measurement module is used to compensate for printing the current layer according to the scanning path, and to obtain the measured thermal field and measured morphology after printing;
[0082] An update module is used to update the current layer's retrieval embedding and the printed layer context to the memory.
[0083] As a further solution, the self-retrieval module is specifically used for:
[0084] Exclude the preset number of printed layers recently moved into the retrieval embedding library, retain only the historical printed layers with the same layer type as the current layer and whose absolute value of the overhang angle difference does not exceed the preset tolerance as the candidate set, and select the retrieval hit layer from the candidate set in descending order of similarity;
[0085] The preset number of excluded entries is the R entries most recently moved into the retrieval embedding library, and R is equal to the preset capacity of the near-layer sliding window cache; the similarity is cosine similarity, and the upper bound K of the retrieval budget increases with the size of the retrieval embedding library and is not less than the preset minimum number of retrievals;
[0086] The number of retrieval hit layers is the smaller of the upper bound of the retrieval budget and the size of the candidate set.
[0087] As a further solution, the scan compensation generator includes:
[0088] A query representation encoding unit is used to encode the current layer slice geometry and the measured thermal field of the most recently printed layer into a query representation;
[0089] The context attention unit is used to perform attention calculations using the query representation as the query and each context entry in the layer compensation context as the key and value, to obtain an attention-enhanced representation.
[0090] The fusion unit is used to fuse the query representation with the attention enhancement representation to obtain the retrieval enhancement hidden state;
[0091] The decoding unit is used to decode the retrieval enhancement hidden state and generate the scan path compensation for the current layer.
[0092] As a further solution, it also includes:
[0093] The prediction head module is used to predict the warpage prediction value and defect risk of the current layer based on the retrieval enhancement hidden state. The warpage prediction value is non-negative, and the defect risk ranges from 0 to 1. Based on the retrieval enhancement hidden state, the warpage prediction value, the defect risk, and the retrieval confidence, it generates at least one intervention probability in the prediction time domain. The intervention probability is the probability that the current layer compensation is insufficient and online intervention or post-processing rework is required. The prediction time domain includes at least one of the short-term prediction time domain after the current layer, the medium-term prediction time domain after the current layer, and the printing end state. Each prediction time domain is distinguished by prediction time domain embedding.
[0094] The retrieval confidence calculation module is used to determine the retrieval confidence based on the similarity and the consistency between the current layer prediction quality and the measured quality of the retrieval hit layer.
[0095] The decision module is used to generate an executable compensation decision based on the intervention probability, the defect risk and the retrieval confidence. The action of the compensation decision is selected from at least one of acceptance, adjustment of compensation parameters, switching of scanning strategy, power reduction downskin, rescan correction, suspension of thermal relaxation, and labeling of machine margin, and outputs an evidence chain consisting of the layer number of each retrieval hit and similarity.
[0096] The printing and measurement module executes the printing of the current layer according to the compensation decision.
[0097] As a further solution, the printing and measurement module includes an off-axis infrared thermal imager and a profilometer or stripe projection device, which are used to acquire the measured thermal field and measured morphology of the current layer after printing.
[0098] Furthermore, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it performs the layer-by-layer scan compensation generation method as described in any of the preceding claims, or performs the training method as described in any of the preceding claims.
[0099] Furthermore, the present invention also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the method described in any of the preceding claims, or the training method described in any of the preceding claims.
[0100] In another aspect, the present invention also provides an additive manufacturing apparatus, including a laser powder bed melting forming unit, characterized in that it further includes a layer-by-layer scanning compensation generation system as described in any of the preceding claims;
[0101] The layer-by-layer scanning compensation generation system generates scanning path compensation for each layer during the layer-by-layer printing process of the forming unit, and controls the forming unit to execute the printing of the current layer according to the scanning path compensation.
[0102] As a further solution, the additive manufacturing equipment is used to print mold conformal cooling inserts, wherein the conformal cooling channel of the mold conformal cooling insert has a self-supporting shape, the overhang angle of its top wall does not exceed the material self-supporting critical angle, and no support structure is allowed to be placed in the conformal cooling channel.
[0103] The layer-by-layer scanning compensation generation system generates downskin compensation and scanning path pre-compensation offset components for the channel top overhang layer to suppress top wall collapse and warping accumulation.
[0104] Compared with related technologies, the method and system for generating layer-by-layer scanning compensation of conformal cooling inserts for molds provided by the present invention have the following advantages:
[0105] 1. This invention organizes the printed layer data generated by printing layer by layer into a memory that can be retrieved by content, so that the isomorphic overhanging layers that appear in the later stage can reuse the scanning path compensation and measured collapse results of the earlier similar layers. This overcomes the limitation that layer-by-layer feedback can only refer to the most recent few layers and that the information of the earlier layers is inaccessible after leaving the observation range, thereby reducing the deformation of the later overhanging layers and its cumulative growth with the layer number.
[0106] 2. The embedding space of the layer-embedded autoencoder of the present invention is jointly shaped by interlayer redundancy suppression loss and trajectory smoothing loss, so that the retrieval embedding is clustered according to geometry and thermal transition type rather than by layer number. Adjacent entity layers no longer occupy the retrieval results, thereby ensuring that the recalled non-local historical overhang layers that have reference value for compensating the current layer are recalled, and improving the utilization efficiency of the retrieval budget.
[0107] 3. The retrieval results of this invention are injected into the attention calculation of the compensation generator through the native context entry interface, and jointly trained end-to-end with the generation without changing the structure and rules of the basic compensation generation model. The retrieval confidence, warpage prediction value and defect risk jointly support the three-level decision rules, and output executable actions that conform to the physical constraints of the equipment and the evidence chain composed of the retrieval hit layer number and similarity, so that the compensation decision can be verified. Each layer of retrieval contains only one encoding and one similarity ranking. The computational cost is negligible compared with the compensation generation and printing, which meets the online decision-making needs of thousands of layers of printing.
[0108] 4. Because the isomorphic overhanging layer in the latter part of the present invention obtains targeted compensation that matches its own context, its collapse deformation can be controlled within the reserved machining allowance, avoiding downtime for rescanning, power reduction for compensation, and post-processing rework caused by deformation exceeding the tolerance. Comparative verification shows that the collapse amount and rework intervention probability of similar overhanging layers are significantly reduced, and the excess rework can be improved to pass the test in one go. The forming accuracy of the top wall of the conformal cooling insert channel and the first-pass printing qualification rate are improved accordingly. Attached Figure Description
[0109] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0110] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0111] Figure 1 A schematic diagram illustrating the steps of a layer-by-layer scanning compensation generation method for conformal cooling inserts in a mold, provided by the present invention;
[0112] Figure 2 A schematic diagram of a layer-by-layer scanning compensation generation system for conformal cooling inserts in molds provided by the present invention;
[0113] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0114] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0115] Please see Figure 1 This application provides a method for layer-by-layer scanning compensation generation of mold conformal cooling inserts, applied to the laser powder bed fusion layer-by-layer printing process, including:
[0116] Step S1: Before printing the current layer, obtain the slice geometry of the current layer and the measured thermal field of the most recently printed layer;
[0117] Step S2: Using the retrieval embedding of the most recently completed printed layer as the query, select non-local historical printed layers from the printed layer history database in descending order of similarity as the retrieval hit layers, and retrieve the printed layer context of each of the retrieval hit layers; wherein, the retrieval embedding is obtained by encoding the dense representation of the printed layer by a layer embedding autoencoder, and the embedding space of the layer embedding autoencoder is trained to suppress the similarity between the retrieval embeddings of adjacent entity layers that exceeds a preset boundary;
[0118] Step S3: Assemble the printed layer context, reference anchor cache, and near-layer sliding window cache of each of the retrieved hit layers into a layer compensation context;
[0119] Step S4: The scan compensation generator generates scan path compensation for the current layer using the current layer slice geometry, the measured thermal field of the most recently printed layer, and the layer compensation context as input.
[0120] Step S5: Print the current layer according to the scanning path, and obtain the measured thermal field and measured morphology of the current layer after printing through in-situ measurement;
[0121] Step S6: Construct a dense representation of the printed layer of the current layer and encode it to obtain the retrieval embedding of the current layer. Write the retrieval embedding of the current layer and the printed layer context of the current layer into the near layer sliding window cache. When the number of entries in the near layer sliding window cache exceeds the preset capacity, move the oldest entry into the printed layer history library for subsequent layer retrieval.
[0122] The following explanation uses the printing of conformal cooling inserts for injection molds using a laser powder bed melting equipment as an example.
[0123] For example, the insert material is 18Ni300 maraging steel, and 316L stainless steel can also be used in corrosion-resistant scenarios; the insert has an external shape of approximately 80×60×50 mm, a single layer thickness of 40 micrometers, and a total of approximately 1250 layers; the insert has two conformal cooling channels inside, the overhang area of the top wall of the first channel is located at approximately the 300th layer, and the overhang area of the top wall of the second channel is located at approximately the 600th layer. The top walls of the two channels are geometrically isomorphic, both being arched overhang surfaces of approximately 50 degrees.
[0124] It is understood that the materials, dimensions, layer thickness, number of layers, and channel positions mentioned above are all for illustrative purposes. In actual implementation, they can be adjusted accordingly based on the part structure, equipment specifications, and process conditions.
[0125] This solution addresses the scanning path compensation for each layer during the layer-by-layer printing process. The processing occurs before each layer is printed and after the printing measurement, thus forming a layer-by-layer closed loop.
[0126] The core dilemma it faces is that the residual stress and warpage during layer-by-layer cladding accumulate monotonically with each layer number, while the compensation for each layer should be determined by referring to the actual printing results of the previous layers. Some existing layer-by-layer feedback methods can only observe the most recent few layers, and the compensation experience and measured results of the early printed layers become inaccessible after they leave the observation range. When the later section exhibits overhang characteristics that are geometrically isomorphic to the early layers, the early experience cannot be reused, and the deformation continues to increase with each layer number.
[0127] The overall idea of this solution is to organize the printed layer data generated by the printer itself during the printing process, namely the measured thermal field, measured morphology and the actual scan path compensation used for each layer after printing, into a memory that can be retrieved by content; before generating the scan path compensation for each current layer, the non-local historical printed layers with similar compensation contexts to the current layer are retrieved, and these historical layers are assembled together with the reference anchor cache and the near-layer sliding window cache into a layer compensation context, which is then injected into the scan compensation generator.
[0128] This process can be understood as follows: before printing each layer, the system first checks its own past printing records to find precedents similar to the current layer, and then determines the compensation for the current layer based on the outcomes of these precedents. Thus, in addition to referencing the most recent layers, the scanning compensation generator can also see what compensation was used in earlier similar layers and how much they ultimately collapsed, thereby reusing the experience of earlier isomorphic overhanging layers and suppressing the monotonous accumulation of warpage with layer number.
[0129] Please see Figure 2 The layer-by-layer scan compensation generation system provided in this solution includes a layer semantic encoder, a printed layer dense representation construction module, a layer embedding autoencoder, a memory, a self-retrieval module, a layer compensation context assembly module, a scan compensation generator, a prediction head module, a decision module, a printing and measurement module, and an update module.
[0130] The memory includes a printed layer history library, a near-layer sliding window cache, and a baseline anchor point cache. The printed layer history library consists of a retrieval embedding library and a context library, which correspond one-to-one with the layer number.
[0131] The reason for using multiple memory structures instead of a single history list is that information at different time scales serves different purposes: the baseline anchor provides a stable long-term reference, the history repository provides non-local experience that can be addressed by content, and the sliding window cache provides local context for the most recent layers. The components and their functions are shown in Table 1.
[0132] Table 1 System Components and Their Functions
[0133]
[0134] Compared to existing layer-by-layer feedback methods, this technical solution has five key features:
[0135] First, the history of printed layers is organized into a content-addressable and retrieval-based memory. Non-local isomorphic layers are recalled by content outside the near-layer sliding window. For example, when printing the top wall of the second conformal cooling channel, the top wall of the first channel is recalled, and its compensation experience and collapse results are reused.
[0136] Second, inter-layer redundancy suppression constraints are added to the training objective. This only suppresses excessive similarity within a local time window and does not exclude isomorphic layers that are repeated at a long distance. This makes the retrieval embedding clustered according to geometric and thermal transition types, rather than clustered according to layer number. Otherwise, a large number of similar uniform entity layers between channels would fill the retrieval results.
[0137] Third, before searching, the candidate set is filtered by layer type and overhang angle to ensure that the search context is comparable. The collapse mechanism of uniform solid layer and channel top overhang layer is different and cannot be referenced by each other.
[0138] Fourth, the retrieval results are directly injected into the attention calculation of the scan compensation generator via the native context entry interface, and jointly trained end-to-end with the generator, rather than as an independent correction outside of the generation process.
[0139] Fifth, intervention decisions strictly adhere to the physical feasible domain of laser powder bed melting, the melted cladding layer cannot be undone and redone, support structures are prohibited in conformal cooling channels, and the output is an executable and traceable compensation decision.
[0140] The above modules can be implemented by computer programs running on a processor or by hardware units.
[0141] In one embodiment, the aforementioned layer-by-layer scanning compensation generation system and the laser powder bed fusion forming unit together constitute an additive manufacturing device. The laser powder bed fusion forming unit includes a laser scanning device and a powder spreading device. The layer-by-layer scanning compensation generation system generates scanning path compensation for each layer during the layer-by-layer printing process of the forming unit, and controls the forming unit to execute the printing of the current layer according to the scanning path compensation. The off-axis infrared thermal imager and the layer-by-layer profilometer or stripe projection device of the printing and measurement module respectively collect the measured thermal field and measured morphology after the current layer is printed.
[0142] The above-described layer-by-layer scan compensation generation method and training method can be stored in a computer-readable storage medium in the form of a computer program, and the above steps can be implemented by a processor executing the program; or the above steps can be implemented by an electronic device including a processor and a memory executing the program.
[0143] The input data is explained below. Before printing each current layer, the system acquires the current layer slice geometry and the measured thermal field of the most recently printed layer. The slice geometry of layer t is denoted as... The data is obtained by slicing the part model, including the cross-sectional profile and overhang angle diagram; the thermal field of the bed surface after printing the t-th layer is denoted as... The data was acquired by an off-axis infrared thermal imager; the actual morphology of the t-th layer after printing is denoted as... , representing the surface height or deviation field, is acquired by a layer-by-layer profilometer or fringe projection device. The layer index t takes values sequentially from 1 to the total number of layers T, with each layer in the layer-by-layer printing process corresponding to one retrieval and generation.
[0144] It should be noted that the total number of layers T is a scalar, and is related to the value representing the thermal field. Different meanings; layer thickness These are physical quantities, not model dimensions. For example, a value of 40 micrometers would result in approximately 1250 layers. Materials can be mold steel, such as 18Ni300 maraging steel, or 316L stainless steel for corrosion-resistant applications. The measured data mentioned above are used both for compensation decisions in the current layer and for consistency verification after printing. Input parameters and derived quantities are shown in Table 2.
[0145] Table 2 Input Parameters and Derivatives Table
[0146]
[0147] Among them, the measured warp is the warp amplitude greater than or equal to zero, such as the maximum sag or root mean square deviation, which is an unsigned displacement and is aligned with the non-negative output of the warp prediction head in the following text.
[0148] Layer semantic encoder , and Encode and output layer semantic embedding. Severity of suspension score Cumulative thermal score Defect risk scoring The three scores are observation scores in the range of 0 to 1, and their calculation is as follows:
[0149] , , ;in, For the sigmoid function, the layer semantic embedding dimension For example, take 128.
[0150] Optionally, the layer semantic encoder uses a geometry-thermal-morphology encoding backbone pre-trained on historical printing site data. This backbone is kept frozen during subsequent training. After the backbone, three scoring heads are connected, each of which is a two-layer multilayer perceptron with GELU activation and layer normalization. This is the only trainable part in the layer semantic encoder, thereby transforming unstructured layer geometry and site measurement data into structured semantic features.
[0151] The overhang severity score reflects the severity of overhang in the current layer, the heat accumulation score reflects the heat accumulation level in the current layer, and the defect risk score is the risk of collapse or porosity inferred from the measured morphology.
[0152] It's important to emphasize that the thermal cumulative score and defect risk score are observations obtained based on measured data after printing. They are named differently from the warpage prediction and defect risk scores output by the prediction head module before printing, to distinguish them from the retrieval enhancement hidden state output by the scan compensation generator. Scan path compensation Distinguish between them.
[0153] The dense representation construction module for the printed layer concatenates the above quantities and then performs linear projection to obtain the dense representation of the printed layer, which is calculated as follows:
[0154] ;
[0155] in, Indicates splicing, This is a learnable embedding of each parameter in the actual scan path compensation used in this layer. For learnable embeddings of layer type, dense representation of dimension For example, 256 is chosen. The dense representation of the printed layer simultaneously preserves geometric, thermal, morphological, compensation, and outcome information, serving as the evaluation input for the scan compensation generator and the input for the layer embedding autoencoder; it incorporates measured warpage so that subsequently retrieved historical layers can carry their true deformation outcomes, which is a prerequisite for reusing experience.
[0156] The layer embedding autoencoder compresses the dense representation of the printed layers into a retrieval embedding. The retrieval embedding is then L2 normalized before being used for similarity calculation to obtain the normalized retrieval embedding. The encoder's calculation is as follows:
[0157] , ;
[0158] in, For the retrieval embedding of the encoder output, , These are the bias vectors for the first and second layers, respectively. The dimension is take , The dimension is take Retrieve Embedded Dimensions For example, a dimension of 128 is chosen, which is lower than the dense representation dimension of 256; the decoder and encoder have a symmetrical structure and are used for reconstruction during the training phase, i.e. , For the dense representation reconstructed by the decoder, The decoder is used during the inference phase; the decoder does not participate in the retrieval, thus ensuring the discriminative nature of the retrieval key without increasing the inference burden on the generator.
[0159] It should be noted that normalized retrieval embedding As a vector, and the scan velocity scalar in scan compensation. The meanings are different. The embedding space of the layer embedding autoencoder is trained to suppress the similarity between the retrieval embeddings of adjacent entity layers that exceeds the preset boundary, and to smooth the trajectory of the normalized retrieval embedding sequence.
[0160] The necessity of training constraints in this embodiment lies in the fact that there are a large number of continuous uniform solid layers between the channels of the conformal cooling insert. The geometry and thermal context of adjacent solid layers are highly similar. If the autoencoder is trained only for reconstruction, the retrieval embeddings of adjacent solid layers will be almost indistinguishable. During retrieval, the result with the highest similarity will always be the nearest redundant layer, wasting the retrieval budget. The non-local history overhang layers that actually contain information cannot be recalled. The above constraints only penalize excessive similarity within a local time window and do not exclude isomorphic layers that are repeated at a distance. Therefore, even if two geometrically isomorphic channel top overhangs are hundreds of layers apart, they can still approach each other in the embedding space. This is further explained in Embodiment 2 below.
[0161] The printed layer history library in the memory stores printed layers that have been moved out of the near-layer sliding window cache. It consists of a retrieval embedding library and a context library, which are linked one-to-one by layer number. The near-layer sliding window cache retains the context of the most recently printed printed layers, with a number not exceeding a preset capacity. The preset capacity is denoted as [missing information]. For example, a value of 5 is used; the reference anchor cache consists of a healthy uniform layer from the reference print and a fixed printed layer context; where a healthy uniform layer refers to a uniform solid layer in the reference print with a stable thermal state and no significant collapse. During system initialization, the printed layer history library and the near-layer sliding window cache are empty, while the reference anchor cache is pre-loaded with the printed layer context of the healthy uniform layer. The sliding window capacity is set relatively small because layer-by-layer decision-making requires lower computational latency; earlier information is accessed by content-addressed access from the history library, preventing the context from growing indefinitely with the printing process. Printed layer context. This is a multi-field concatenated vector, its structure is as follows:
[0162] ;
[0163] Among them, dense represents The dense representation has been projected from the aforementioned fields and overlaps with the remaining original fields. This overlap is intentionally preserved. The dense representation is used for contextual attention semantic fusion, while the remaining original fields are used for retrieval filtering and evidence chain reading, without needing to be decoded and restored from the dense representation.
[0164] The quality vector of the printed layer can also be derived from the measured fields in the context entry. Among them, normalized warping , The normalized warpage reference value is taken as the rejection threshold or the upper limit of the machining allowance, for example, 0.15 mm. The normalization process makes the normalized warpage and the defect risk score fall in the same 0 to 1 range and have the same dimensions. In the subsequent quality consistency calculation, the absolute difference between the two components can be directly added and each accounts for half of the weight.
[0165] The quality vector does not occupy a separate storage slot; it is directly constructed from the context entry field during retrieval. The inbound and outbound mechanism is as follows: After the current layer is printed and measured, the retrieval embedding of the current layer is calculated. The retrieval embedding of the current layer and the context of the printed layers of that layer are written into the near-layer sliding window cache. When the number of entries in the near-layer sliding window cache exceeds the preset capacity, the oldest entry is moved into the printed layer history database for subsequent layer retrieval. The baseline anchor point cache remains unchanged. Thus, the sliding window cache always retains the most recent few layers, and the history database continuously accumulates off-window layers, forming a layer history that is automatically generated during the printing process and can be addressed by content.
[0166] Self-retrieval is performed once before generating scan path compensation for each current layer. The query is constructed using the retrieval embedding of the most recently completed printed layer as the query, and the query is executed when t is greater than 1. The most recently completed printed layers and the current layer are consecutive printed layers belonging to the same feature segment, and their retrieval embeddings are in the same layer type embedding subspace. When the current layer is the first layer, the printed layer history library is empty, the number of layers hit by retrieval is zero, the layer compensation context consists of the baseline anchor cache and the near-layer sliding window cache, and the system degenerates into a basic compensation method that does not rely on historical retrieval.
[0167] As printing progresses and the historical database is gradually enriched, the search function becomes available. Since the same feature segment in a layer-by-layer slice usually spans multiple consecutive layers, the layer type does not change between adjacent layers. The cosine similarity can be directly compared between the embedding subspace of the query and the candidate layer, which are in the same layer type. If a layer type change occurs at the boundary of the segment, such as entering the first layer of the channel top overhang from the channel wall, the candidate set after type filtering is empty. It also degenerates into the basic context of the reference anchor point and the near-layer sliding window, and does not forcibly search for layers of different types.
[0168] The determination of the candidate set involves two steps:
[0169] The first step is proximate cause protection; the candidate set is determined by the retrieval embedding library. The result is obtained after excluding the most recently moved R-line printed layers; where R is equal to the preset capacity of the near-layer sliding window buffer, for example... The reason for setting this exclusion step is that several records in the history database that have just left the window highly overlap with the content of the sliding window. If they are not excluded, the retrieval budget will be consumed on the nearest neighbors that are equivalent to the sliding window, which will not reflect the meaning of non-local access. Taking R to be equal to the sliding window capacity will leave a gap of 5 records between the retrieval results and the sliding window, ensuring that the retrieval hit layer is all non-local history that has been printed.
[0170] The second step is conditional filtering, which retains only historically printed layers that are of the same type as the current layer and whose absolute value of the overhang angle difference does not exceed a preset tolerance as the candidate set. and Preset tolerance For example, a 10-degree angle is used. The collapse mechanisms of uniform solid layers and channel top overhang layers are different, and the compensation experience between layers with excessively large differences in overhang angles cannot be directly referenced. This filter ensures that the retrieval context is comparable, and together with the training constraints of the embedding space, it avoids adjacent solid layers crowding out the retrieval results.
[0171] Then, the similarity between the query and the historical printed layer retrieval embeddings in the candidate set is calculated. The similarity is taken as the cosine similarity, that is:
[0172] i belongs to the candidate layer after the above two filtering steps. The retrieval hit layer is selected from high to low similarity, and the hit index set is... i belongs to the candidate layer.
[0173] The upper bound K of the retrieval budget increases with the size of the printed layer history database, and is not less than the preset minimum number of retrievals. For example, K can be set to 6. The larger of the two values—rounded up—of the number of embeddings retrieved from the printed layer history library is used. ;in, The number of embeddings retrieved from the embedding library; the actual number of hits. That is, the number of layers hit by the retrieval is the smaller of the upper bound of the retrieval budget and the size of the candidate set.
[0174] The reason for this approach is that when the memory size is small, K is set to 6 to ensure the minimum number of references. As printing progresses, K increases adaptively, retrieving about 5% of the historical layers, balancing reference coverage and online computation overhead. When the candidate set size is less than K, the number of hits is naturally capped at the candidate set size.
[0175] The set of printed layer contexts of the retrieved hit layer is denoted as ,Right now Cosine similarity is effective because the query and candidate layer embeddings are computed by the same embedding autoencoder, and the embedding space structure is jointly constrained by reconstruction loss, inter-layer redundancy suppression loss, and trajectory smoothing loss during end-to-end training, making cosine similarity an effective measure of compensating for contextual relevance. Each layer retrieval only requires one encoding and one similarity ranking, and its overhead is negligible compared to the compensation generation and printing process.
[0176] The system retrieves the printed layer context of the retrieved hit layer and concatenates it with the baseline anchor cache and the near-layer sliding window cache in the order of baseline anchor, retrieved hit layer, and near-layer sliding window to form a layer compensation context. ;in, Cache the baseline anchor point. For near-layer sliding window caching, the context layout has one anchor point. Search entries and 10 sliding window items, total strip.
[0177] When the number of retrieved hit layers is zero, the layer compensation context consists of a reference anchor cache and a near-layer sliding window cache. Taking a conformal cooling insert as an example, when printing the top wall of the second conformal cooling channel, the system will use the historical layer corresponding to the top wall of the first channel as the primary retrieved hit layer, along with the reference anchor and the 5 most recent layers, and provide them to the scan compensation generator.
[0178] After the prediction head module outputs, the system also performs retrieval trend verification, providing the confidence score of the retrieval results. The prediction quality vector for the current layer is... ;in, The warpage prediction value is the value after normalization according to the preset warpage normalization reference value. For defect risk; for each search hit layer, the measured quality vector is ;in, This is the value of the measured warpage of this layer after normalization to the same normalized reference value. Assign a defect risk score to this layer.
[0179] The retrieval confidence score is calculated as follows:
[0180] ;
[0181] in, The cosine similarity is linearly transformed from the interval of −1 to 1 to the interval of 0 to 1, and used as the similarity weight of the hit layer; the mean of the absolute difference between the two components of warp and defect risk is subtracted from 1 as the quality consistency. The closer the predicted quality is to the historical measured quality, the closer this value is to 1; after calculating the weighted average of all hit layers, the retrieval confidence falls within the interval of 0 to 1.
[0182] When the number of hit layers in a retrieval is zero, the retrieval confidence is set to 0, indicating a lack of historical precedent and high uncertainty. Here, the quality consistency score uses the mean of the absolute differences between the two components instead of the cosine of the two-dimensional vector because the typical value of normalized warping is approximately 0.5 to 0.9, while the typical value of defect risk is approximately 0.05 to 0.2. If a two-dimensional cosine is used, the vector direction will be dominated by the warped component, and the cosine value will always be close to 1. The quality consistency score will degenerate into a constant, and the retrieval confidence will degenerate into being determined solely by retrieval similarity. Rare layer situational branches in the decision-making process will be almost impossible to trigger.
[0183] By switching to the mean of the absolute differences of the two components, warpage and defects each have equal weight and do not dominate. When the predicted quality deviates from historical measurements, the retrieval confidence truly decreases, and trend verification becomes more effective in discriminating between rare or abnormal layer conditions. A retrieval confidence close to 1 indicates that the current layer has historical precedents to support it, and decisions can be made based on these precedents; a lower value indicates that the current layer is a rare or abnormal condition, and subsequent decisions should involve more intensive monitoring or a change in strategy.
[0184] Regarding the coupling method between self-retrieval and generation, Top-K selection is a discrete operation and cannot be directly differentiated. During training, the gradient is backpropagated to the attention parameters via the softmax weights of the context attention in the scan-compensated generator. The layer-embedded autoencoder is indirectly shaped through reconstruction loss, inter-layer redundancy suppression loss, and trajectory smoothing loss, thus achieving end-to-end coupling between retrieval and generation. Compared to treating retrieval results as independent correction terms, this coupling allows the organization of retrieval items to be optimized along with the generation task.
[0185] The scan compensation generator includes a layer encoder, a context attention unit, a fusion unit, and a decoding unit. The layer encoder encodes the geometry of the current layer slice and the measured thermal field of the most recently printed layer into a query representation, i.e. Dimension It has the same dimension as dense representation, for example, 256.
[0186] The context attention unit performs attention computation using the query representation as the query and each context entry in the layer-compensated context as the key and value. The context entry matrix is denoted as... Attention is calculated as follows:
[0187] , , , ;
[0188] Here, softmax normalizes the number of context entries, enabling the current layer representation to access the baseline anchor and retrieve the entire context of the hit layer and near-layer sliding window based on relevance. Here, the matrix notation of attention query, key, and value is irrelevant to the meaning of the upper bound K of the retrieval budget.
[0189] The fusion unit adds the query representation and the attention-enhanced representation, and then processes them sequentially through layer normalization and a feedforward network to obtain the retrieval-enhanced hidden state, i.e. The decoding unit decodes the retrieval enhancement hidden state to generate the scan path compensation for the current layer, i.e. Scan path compensation includes laser power, scanning speed, scanning spacing, scanning strategy, contour scanning and pre-warming scanning, island rotation angle, and scan path pre-compensation offset. .
[0190] The scan path pre-compensation offset is the geometric anti-deformation amount of the scan path, in millimeters. When the value is positive, the path expands outward, and when the value is negative, the path shrinks inward. It is used to offset the predicted warping deformation. It is the geometric compensation component in the scan path compensation. The other parameters are parameter and strategy compensation components, which together constitute the scan path compensation.
[0191] For example, the first projection matrix Dimensions take Second and third projection matrices , Dimensions take , For the context entry dimension, it consists of a dense representation of 256 dimensions with scan path compensation embedded. Embedding 32 dimensions, 5 scalar fields, and layer type. It is made by splicing together 8 dimensions, that is The layer compensation context is injected into the generator via the native context entry interface. It does not add a new attention layer or change the basic compensation generation rules. The trainable parts are the decoding unit and the optional context attention projection. The basic compensation backbone can be frozen. Self-retrieval is performed only once in each layer, and its result is reused for the entire compensation generation of that layer.
[0192] The prediction head module obtains the warpage prediction value and defect risk of the current layer based on the retrieved enhanced hidden state prediction. The warpage prediction value is non-negative, and the defect risk value ranges from 0 to 1. For example, the warpage prediction head and the defect risk head share a 128x256 first-layer mapping. The warpage prediction value is calculated as follows:
[0193] Softplus guarantees non-negative output; the defect risk is calculated as follows:
[0194] The sigmoid function maps the output to a range of 0 to 1; a higher defect risk indicates that the layer is expected to produce more collapses or porosity defects. For the bias of the shared mapping, , These are the output weight vector and bias of the warp prediction head, respectively. , These are the output weight vector and bias of the defect risk head, respectively.
[0195] Furthermore, the prediction head module generates at least one intervention probability in the prediction time domain based on the retrieval enhancement hidden state, warpage prediction value, defect risk, and retrieval confidence. The intervention probability is the probability that the current layer compensation is insufficient, requiring online intervention or post-processing rework, and it is calculated as follows:
[0196] ;
[0197] Where H represents the prediction time domain, including at least one of the following: the short-term prediction time domain after the current layer, the medium-term prediction time domain after the current layer, and the printing end state. To predict the temporal embedding, the dimension is, for example, 16, to distinguish between different temporal domains; It is a three-layer multilayer perceptron, activated by GELU and then output by sigmoid. The three temporal domains share the same network, distinguished only by the prediction temporal embedding, and are jointly trained with the same intervention loss to ensure consistency between long-term and short-term predictions. The intervention here refers to adjusting scanning parameters, switching scanning strategies, pausing thermal relaxation, rescanning for correction, or marking the area to reserve machining margin for CNC rework in post-processing. It is subject to two physical constraints: first, the cladding layer cannot be undone and can only be rescanned, remelted for correction, or post-processed; second, supports are prohibited in the conformal cooling channel, as they will block the flow channel and cannot be removed. Therefore, the intervention is mainly based on parameter and strategy adjustment and post-processing.
[0198] For example, the short-term prediction time domain corresponds to the last 10 layers, the medium-term prediction time domain corresponds to the last 50 layers, and the printing completion state corresponds to the completion of printing the entire part. The reason why the estimation of intervention probability depends on the retrieval confidence is that whether the compensation of the current layer is sufficient depends on the evolution of its subsequent non-local layers. Observing only the most recently printed layers cannot predict the impact of distant subsequent layers. However, the measured warpage trajectories of similar historical layers and their subsequent layers recalled by the retrieval are precedents for such subsequent layer impacts. Therefore, the intervention probability can access non-local evidence and identify layers prone to collapse in advance. The division of labor among the three time domains is as follows: the short-term prediction time domain corresponds to short-term high-risk triggers and is used to determine rescan corrections; the printing completion state corresponds to long-term out-of-tolerance triggers and is used to determine the marking of machining allowances; the medium-term prediction time domain serves as a medium-term monitoring signal for operator trend warnings and log tracing. It does not directly enter the threshold determination of compensation decision, but its prediction deviation is included in the consistency verification in the following text.
[0199] The decision-making module determines the actions for compensation decisions based on three categories of rules: risk classification, trend verification, and constraint satisfaction. The action set is strictly limited to online executable items for laser powder bed melting, excluding the addition of support, because support must be preset during the printing preparation stage and cannot be placed in the conformal cooling channel, and also excluding withdrawal and redo, because the melted layer is irreversible and can only be re-scanned for correction or left for post-processing. The three categories of rules are shown in Table 3.
[0200] Table 3. Three-level rule table for compensation decision-making
[0201]
[0202] In this context, the intervention probability corresponding to the mid-term prediction time domain is used as a monitoring signal and is not involved in threshold determination. Power reduction (downskin) refers to reducing laser power and scanning speed in the underhanging surface region to prevent sagging and collapse of the underhanging surface.
[0203] Compensation decision is denoted as ;in, The subset of actions selected for this round of decision-making is non-empty and can contain multiple actions simultaneously. For example, the high-risk setting includes both rescan correction and power reduction (downskin). The actions are selected from accept, adjust compensation parameters, switch scan strategy, power reduction (downskin), rescan correction, pause thermal relaxation, and mark machine margin. The evidence chain consists of the search hit layer number and similarity, making the compensation decision traceable.
[0204] After a decision is made, printing of the current layer is executed according to the compensation decision. When the decision is to adjust compensation parameters, switch scanning strategies, or reduce power (downskin), the scan path compensation is regenerated with the adjusted parameters. When the decision is to rescan for correction, a second scan of the current layer is performed. When the decision is to pause thermal relaxation, printing resumes after thermal relaxation. Since the action set and execution method are limited to the actual executable range of the device, the decision result can directly affect the printing process.
[0205] The above model is obtained through joint training. During training, the encoding backbone is kept frozen, and only the scoring head is trained. The layer embedding autoencoder, scan compensation generator, and each prediction head are trained jointly. The layer embedding autoencoder can also be pre-trained offline and then fine-tuned. During training, a teacher-mandated method is adopted. The dense representation of the printed layer and the retrieval embedding derived from it, as well as the scan path compensation field and the measured warpage field in the printed layer history library, are all filled with expert compensation ground truth and measured warpage ground truth. That is, the memory is filled with expert trajectories during training to avoid the model's own error being amplified by the memory feedback and to stabilize the shaping of the embedding space. The scan path compensation and warpage prediction values of the model prediction end are corrected by supervised terms such as compensation imitation loss and warpage loss.
[0206] The inference phase is changed to compensate for the actual applied scan path and fill the measured warp. The memory bank reflects the real printed trajectory. The distribution difference between the expert trajectory used for training and the real trajectory used for inference is mitigated by scheduled sampling / DAgger fine-tuning.
[0207] The total loss function includes reconstruction loss, inter-layer redundancy suppression loss, trajectory smoothing loss, and at least one of compensation imitation loss, warping prediction loss, defect risk loss, intervention probability loss, and semantic scoring head loss. The composition and function of each item are shown in Table 4.
[0208] Table 4. Composition of the Total Loss Function
[0209]
[0210] The specific calculations for each loss are as follows. The reconstruction loss is the mean square error between the decoder's reconstructed output and the dense representation of the printed layer, i.e. The inter-layer redundancy suppression loss consists of a local similarity penalty, defined as follows: ,but ;in, For the normalized retrieval embedding of the t-th layer, , Let T be any two normalized retrieval embeddings, T be the total number of training and printing sequences, m be a preset boundary (e.g., 0.85), and w be a local temporal window (e.g., 3), whose value does not exceed the total number of layers minus one, i.e., the preset window value is taken as the sum of the two normalized retrieval embeddings. The smaller one.
[0211] The significance of interlayer redundancy suppression loss in the context of mosaick scenarios lies in the fact that many solid layers between channels are highly similar, and the embeddings trained solely on reconstruction are almost indistinguishable, resulting in the retrieval results being redundant layers. This loss forces the embeddings to capture meaningful layer context differences, such as the difference between the channel top overhang transition layer and the uniform solid layer, enabling the embeddings to cluster by geometric and thermal transition type rather than by layer number. This allows for the retrieval of truly informative non-local historical overhang layers, such as recalling the first channel top wall from the second channel top wall. At the same time, this loss only takes effect within the local temporal window, and the similarity of two isomorphic overhang layers will not be penalized even if they are hundreds of layers apart, thus preserving isomorphic experience.
[0212] Trajectory smoothing loss constrains normalization to retrieve the second difference of the embedded sequence, i.e. It operates on the normalized retrieval embedding, which is consistent with the direction on which Top-K retrieval depends, preventing the retrieval results from becoming unstable due to layer number noise. It uses the L2 norm instead of the square norm, making occasional jump changes more moderate.
[0213] The compensation for imitation loss is:
[0214] ;in, The true value of the optimal compensation for this layer is given by expert process or simulation.
[0215] Warpage loss is:
[0216] Among them, the measured true value of warpage That is, the measured warpage calculated from the measured morphology, denoted here as... This emphasizes its role as a supervisor of truth values.
[0217] The loss due to defect risk is:
[0218] ;in, Defect labels are either 0 or 1.
[0219] The probability loss of intervention is:
[0220]
[0221] in, For the prediction time-domain set, including the last 10 layers, the last 50 layers, and the final three time domains, and the retrieval embedding library. Different meanings The label is 0 or 1, indicating whether the layer has been actually intervened in the time domain. Interventions include online parameter tuning, rescanning, pausing, or post-processing rework.
[0222] The semantic scoring head loss is:
[0223] ;
[0224] Only in labeled subsets Calculate above.
[0225] The total loss is the weighted sum of the above items, that is:
[0226]
[0227] In this context, the weights of the three embedding regularization terms are all set to 1.0, that is... The default weight for each task supervision item is 1.0, that is:
[0228] ;
[0229] It can be calibrated according to the magnitude and scale of each item. When the defect labels or intervention labels are sparse, the corresponding loss weight can be increased.
[0230] The three embedding regular expressions each perform their own functions: reconstruction enables the embedding to bind the content of the layer, inter-layer redundancy suppression prevents neighboring redundant layers from monopolizing the search results, and trajectory smoothing stabilizes the embedding direction trajectory.
[0231] During online printing, the system executes the above process once for each layer. First, a self-search is performed to obtain the search hit layer and assemble the layer compensation context; then, the scan compensation generator generates the scan path compensation for the current layer, the prediction head module outputs the warpage prediction value, defect risk, and intervention probability, and the decision module outputs the compensation decision and evidence chain. All these processes are completed before printing the current layer; then, printing is performed according to the compensation decision, and the measured thermal field and measured morphology of the current layer after printing are obtained through in-situ measurements to calculate the measured warpage.
[0232] After printing, a consistency check is performed, and the residual is checked. When the residual exceeds a preset threshold, the current layer is marked as a prediction bias layer and a review is triggered. Consistency verification does not participate in training; it is only used for monitoring during inference. Since the warped prediction value only depends on the contextual hidden state and not explicitly on the compensation of this layer, it predicts the expected warping of the compensation strategy according to the learned standard in the context of this layer. When the decision adjusts the scan path compensation, the residual exceeding the threshold may be due to prediction error or deviation from the standard strategy by human adjustment. Both trigger a review. Any deviation from the standard expectation will be included in the manual review, which is the safety semantic of this verification.
[0233] If precise separation of prediction error and adjustment effect is required, the embedded data with applied scan path compensation can be incorporated into the prediction head input, making the warpage prediction conditional on the planned compensation. After compensation and adjustment, the prediction is recalculated and compared with the measured warpage. Finally, the retrieval embedding of the current layer and the printed layer context of that layer are written to the near-layer sliding window cache. When the cache exceeds the preset capacity, the oldest entry is moved to the printed layer history database, forming a layer-by-layer closed loop of retrieval, generation, prediction, decision-making, printing, measurement, and storage.
[0234] Example 1
[0235] This embodiment illustrates the preparation of training data and the joint training process. Layer-by-layer data from historical printing or simulated printing is collected, including the slice geometry, post-printing thermal field, post-printing morphology of each layer, and the ground truth values for optimal scan path compensation, defect labels, and intervention labels given by expert processes or simulations for that layer. During training, following a teacher-mandated approach, the dense representation of the printed layers and its derived retrieval embeddings, as well as the applied scan path compensation fields and measured warpage fields in the printed layer history database, are all filled with expert compensation ground truth values and measured warpage ground truth values to avoid amplification of model errors through memory feedback. Subsequently, the encoder and decoder of the layer-embedded autoencoder, the scan compensation generator, and the scoring head and prediction head of the layer semantic encoder are jointly trained. The model and retrieval parameters used in this embodiment are summarized in Table 5.
[0236] Table 5 Key Parameters and Typical Values
[0237]
[0238] After training, the inference phase is changed to fill the memory bank with actual applied scan path compensation and measured warping. The distribution difference between training and inference is mitigated by scheduled sampling or DAGger-style fine-tuning.
[0239] Example 2
[0240] This embodiment further explains self-retrieval, focusing on why it can reuse early experience outside of the sliding window. The retrieval embedding is obtained by encoding the dense representation of the printed layer by the layer embedding autoencoder. The dense representation comes from the encoding results of the layer semantic encoder on the layer geometry, thermal field, and morphology. If the encoder is trained only with reconstruction as the goal, the dense representations of adjacent entity layers are highly similar, and their retrieval embeddings are almost indistinguishable. The layers that are retrieved will be concentrated in the nearest redundant layers, the retrieval budget will be wasted, and the truly valuable nonlocal history overhang layers cannot be recalled.
[0241] To address this, the embedding space of the layer embedding autoencoder is trained to suppress the similarity between adjacent entity layer retrieval embeddings exceeding preset boundaries within the local temporal window, and to smooth the trajectory of the normalized retrieval embedding sequence. This allows the retrieval embeddings to cluster according to geometric and thermal transition types, rather than by layer number. For example, the embeddings of channel top overhang transition layers will be close to each other, and the embeddings of uniform entity layers will be close to each other, while maintaining distinction between them. When printing to the overhang layer on the top wall of the second channel, the query can cross a large interval of layer numbers and hit the historical layer on the top wall of the first channel. Layer type filtering and overhang angle filtering further ensure that the query and candidates are in a comparable compensation context. The compensation experience between layers with excessively large overhang angle differences cannot be directly referenced. Therefore, the candidate set only retains historical layers with the same layer type as the current layer and whose absolute value of the overhang angle difference does not exceed a preset tolerance (e.g., 10 degrees).
[0242] The retrieval confidence score can be calculated as follows: The warpage prediction value is normalized according to a preset warpage normalization reference value and then combined with the defect risk score to form the predicted quality vector for the current layer. For each retrieved layer, the measured warpage in its printed layer context is normalized according to the same preset warpage normalization reference value and then combined with the defect risk score to form the measured quality vector. Using the normalized similarity value of the retrieved layer as the weight, and the mean of the absolute difference between the warpage component and the defect risk component (1 minus the mean) as the quality consistency, a weighted average is calculated for all retrieved layers to obtain the retrieval confidence score. When the number of retrieved layers is zero, the retrieval confidence score is 0.
[0243] The mean of the absolute differences between the components is used here to measure the consistency between the predicted quality and the historical measured quality, instead of the cosine of the two-dimensional vector. This is because, in the typical value range of the two components, the vector direction will be dominated by the warped component, and the cosine value will be close to constant, thus losing the discriminative power of quality consistency. Using the absolute difference allows the warped and defect risks to each account for half of the weight. When the predicted quality deviates from the historical measured quality, the retrieval confidence decreases, thereby enabling the ability to discriminate rare or abnormal layer situations.
[0244] A search confidence score close to 1 indicates that the current layer has historical precedents to support it and the prediction is reliable; a lower score indicates that the current layer is a rare situation, and subsequent decisions will be based on this, such as encrypted monitoring or switching strategies. The search confidence score, the layer number of the search-hit layer, and the similarity score together constitute a chain of evidence, making compensation decisions traceable.
[0245] Example 3
[0246] This embodiment illustrates the system's handling method when search conditions are not met, and explains the necessity of these degenerate designs. When the current layer is the first layer, the printed layer history database is empty, the number of layers hit by the search is zero, and the layer compensation context consists of a baseline anchor cache and a near-layer sliding window cache. The system generates scan path compensation in a basic manner that does not rely on historical searches. As printing progresses, the history database is gradually enriched, and the search function takes effect accordingly.
[0247] When a layer type jump occurs, such as transitioning from the channel wall section to the first layer of the channel top overhang section, and the most recently printed layer is inconsistent with the current layer's layer type, the candidate set after conditional filtering is empty. The system also degenerates into a basic context of a baseline anchor point plus a near-layer sliding window, and does not forcibly search for layers of different types. When the number of layers hit in the search is zero, it is agreed that the search confidence is zero, indicating that the current layer has no historical precedent support and is highly uncertain. The decision is made to treat it as a rare layer, and actions include switching the scanning strategy or pausing thermal relaxation and encrypting monitoring. After the layer is printed and stored, subsequent layers of the same type will have precedent support.
[0248] Furthermore, when the candidate set size is smaller than the upper bound of the retrieval budget, the number of retrieval hits will naturally cap at the candidate set size, which is a normal degradation of the number of hits and does not affect the execution of the process.
[0249] Example 4
[0250] This embodiment illustrates the three levels of compensation decision-making and their effects in conjunction with the aforementioned rules.
[0251] The first type is the acceptance file, as in the example of layer 600 in Example 5 below. The short-term predicted time domain intervention probability and defect risk have not exceeded the limit, the retrieval confidence is higher than the preset precedent threshold, the system determines the compensation treatment according to historical precedents and prints it directly, and outputs the evidence chain to achieve one-time pass.
[0252] The second type is rescanning. For example, if the short-term prediction time domain intervention probability of a certain overhanging layer is predicted to rise to about 0.52, exceeding the preset high-risk threshold of 0.5, the decision action includes rescanning correction and power reduction downskin. The overhanging layer is scanned twice in the same layer and the power and speed of the lower overhanging surface are reduced. This is consistent with the treatment direction of stopping the machine for rescanning and reducing power in the comparative case.
[0253] The third type is the rare situation file. For example, when a printout shows a drooping configuration for the first time, the retrieval confidence level is lower than the preset rare situation threshold of 0.4. Actions include switching the scanning strategy or pausing thermal relaxation, and encrypting monitoring. After the configuration is printed and stored, subsequent similar layers can obtain precedent support. When multiple consecutive layers are identified as high-risk drooping layers, they are merged and processed according to constraint satisfaction rules to reduce the number of processing steps.
[0254] Example 5
[0255] This embodiment provides a complete printing process example to illustrate the coordination of each step and its actual effect.
[0256] The printed object is a conformal cooling insert for injection molds, which has two conformal cooling channels inside. The channel cross-section is designed with a self-supporting shape, such as a teardrop or arch, so that the top wall overhang angle is controlled within the material's self-supporting critical angle. Depending on the process conditions, this overhang angle typically does not exceed 45 degrees to 60 degrees. In this embodiment, the top wall is an arched overhang surface of about 50 degrees. Support structures are prohibited from being placed inside the channels. For the overhang layer at the top of the channels, a power reduction downskin is preferred when making decisions, and the scan path is pre-compensated for the offset component to suppress the accumulation of top wall collapse and warping.
[0257] The top wall of the first channel is located approximately at layer 300, and the top wall of the second channel is located approximately at layer 600. Before printing progresses to layer 600, i.e. the top wall of the second channel, the system first performs a self-search: using the retrieval embedding of layer 599 as the query, it excludes several recently moved records from the printed layer history database, filters the candidate set according to the condition that the difference between the channel top overhang layer and the overhang angle does not exceed 10 degrees, and then sorts them by cosine similarity. It hits layer 300, whose similarity is 0.84. The two layers belong to the channel top wall overhang surface, and the arch angles differ by only about 3 degrees, which are geometrically isomorphic historical layers.
[0258] The system retrieved the context of the 300th printed layer; it recorded the compensation and results at that time: the scan direction was rotated by approximately 67 degrees, the laser power was reduced by approximately 8%, a preliminary contour scan was performed, and the actual collapse at that location after printing was approximately 0.10 mm. The confidence level calculation showed that the predicted quality of the current layer matched the historical measured quality by approximately 0.77, indicating a situation supported by historical precedent.
[0259] It should be noted that the treatment for layer 600 should not be directly applied to layer 300, because by this time the insert has accumulated approximately 0.25 mm of warping, and the condition of the base plate is significantly different from that of layer 300. Based on this, the system adds compensation based on historical experience: preheating and pre-scanning are performed, the scanning speed is reduced by approximately 12%, and the scanning path is pre-offset by approximately 0.04 mm to counteract the expected warping.
[0260] The prediction head output shows that, according to the compensation printed, the layer will collapse by approximately 0.11 mm, within a machining allowance of approximately 0.15 mm, which can be achieved through post-processing CNC precision finishing; the defect risk is approximately 9%, and the intervention probability corresponding to the printing end state is approximately 15%. The decision is judged as acceptable according to the three-level rules, and printing is carried out directly, with the output of the evidence chain; this includes the layer number and similarity of the retrieved layer, making the compensation and decision for that layer traceable.
[0261] In contrast, if self-search is not performed and feedback is based solely on the most recent layers, since these layers are all ordinary solid layers with a lack of comparable experience, the layer can only be printed with default parameters, resulting in an estimated collapse of approximately 0.28 mm, exceeding the machining allowance. Post-processing CNC cannot correct this, and the probability of intervention corresponding to the printing end state rises to approximately 52%, requiring machine shutdown, rescanning, and power reduction for remediation. The effects of the two methods are compared in Table 6.
[0262] Table 6 Comparison of the effects of the running examples
[0263]
[0264] It is evident that by retrieving and reusing the content of the self-generated layer history and reusing experience, the subsequent isomorphic overhang layer can be transformed from rework due to excessive tolerances to a one-pass process. The layer-by-layer accumulation of residual stress and warping is suppressed, which is precisely the value of self-generated layer history retrieval in layer-by-layer scanning path compensation.
[0265] In the above embodiments, the layer-by-layer scan compensation generation method can be implemented by a computer program;
[0266] This solution also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, performs any of the aforementioned layer-by-layer scan compensation generation methods, or performs the aforementioned training methods.
[0267] This solution also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the aforementioned method;
[0268] The above methods, systems, and equipment can be integrated into laser powder bed melting equipment and uniformly scheduled by the equipment-side controller.
[0269] The above are only some embodiments of this application and do not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A method for layer-by-layer scanning compensation generation of mold conformal cooling inserts, applied to the laser powder bed fusion layer-by-layer printing process, characterized in that, include: Step S1: Before printing the current layer, obtain the slice geometry of the current layer and the measured thermal field of the most recently printed layer; Step S2: Using the retrieval embedding of the most recently completed printed layer as the query, select non-local historical printed layers from the printed layer history database in descending order of similarity as the retrieval hit layers, and retrieve the printed layer context of each of the retrieval hit layers; wherein, the retrieval embedding is obtained by encoding the dense representation of the printed layer by a layer embedding autoencoder, and the embedding space of the layer embedding autoencoder is trained to suppress the similarity between the retrieval embeddings of adjacent entity layers that exceeds a preset boundary; Step S3: Assemble the printed layer context, reference anchor cache, and near-layer sliding window cache of each of the retrieved hit layers into a layer compensation context; Step S4: The scan compensation generator generates scan path compensation for the current layer using the current layer slice geometry, the measured thermal field of the most recently printed layer, and the layer compensation context as input. Step S5: Print the current layer according to the scanning path, and obtain the measured thermal field and measured morphology of the current layer after printing through in-situ measurement; Step S6: Construct a dense representation of the printed layer of the current layer and encode it to obtain the retrieval embedding of the current layer. Write the retrieval embedding of the current layer and the printed layer context of the current layer into the near layer sliding window cache. When the number of entries in the near layer sliding window cache exceeds the preset capacity, move the oldest entry into the printed layer history library for subsequent layer retrieval.
2. The layer-by-layer scanning compensation generation method according to claim 1, characterized in that, In step S6, constructing a dense representation of the printed layer for the current layer includes: The layer semantic encoder encodes the geometry of the current layer slice, the measured thermal field, and the measured morphology, outputting layer semantic embedding, overhang severity score, thermal accumulation score, and defect risk score. The layer semantic embedding, overhang severity score, thermal accumulation score, defect risk score, embedded data with applied scan path compensation, measured warpage, overhang angle, and layer type embedding are concatenated and linearly projected to obtain a dense representation of the printed layer. The measured warpage is the warpage amount calculated from the measured morphology.
3. The layer-by-layer scanning compensation generation method according to claim 1, characterized in that, The printed layer history library consists of a retrieval embedding library and a context library, which correspond to each other by layer number; The near-layer sliding window buffer retains the most recently printed printed layer contexts, the number of which does not exceed a preset capacity, and the reference anchor point buffer is a healthy, uniform, and unchanging printed layer context from a reference printed layer. The printed layer context is a multi-field concatenated vector, including the printed layer dense representation, the embedded data with applied scan path compensation, the measured warp calculated from the measured topography, the overhang severity score, the thermal accumulation score, the defect risk score, and the overhang angle and layer type embedding. The printed layer dense representation is used for context-attention semantic fusion, while the remaining original fields are used for retrieval filtering and evidence chain reading; the droop severity score, the heat accumulation score, and the defect risk score are output by the layer semantic encoder.
4. The layer-by-layer scanning compensation generation method according to claim 2, characterized in that, The layer embedding autoencoder includes an encoder and a decoder. The encoder compresses the printed layer dense representation into a retrieval embedding, and the decoder is used during the training phase to reconstruct the printed layer dense representation from the retrieval embedding. The retrieval embedding, after L2 normalization, is used for similarity calculation; The embedding space of the layer embedding autoencoder, after training, also smooths the trajectory of the normalized retrieval embedding sequence, and the suppression of similarity between adjacent entity layer retrieval embeddings that exceeds the preset boundary is limited to a local temporal window.
5. The layer-by-layer scanning compensation generation method according to claim 1, characterized in that, The non-local historical printed layers are the historical printed layers in the candidate set, which is determined in the following way: Exclude a preset number of recently moved printed layers from the printed layer history library, and retain only the historical printed layers that have the same layer type as the current layer and whose absolute value of the difference in overhang angle does not exceed a preset tolerance; The preset number of excluded printed layers are R layers that were most recently moved into the printed layer history library, and R is equal to the preset capacity of the near-layer sliding window cache; The layer type is determined by the geometry of the current layer slice, including uniform solid, channel top overhang, and channel wall and cavity transition; The overhang angle is the maximum overhang angle extracted from the geometry of the current layer slice.
6. The layer-by-layer scanning compensation generation method according to claim 5, characterized in that, The similarity is cosine similarity; the number of layers hit by the retrieval is the smaller of the upper bound of the retrieval budget K and the size of the candidate set. The upper bound of the retrieval budget K increases with the increase of the size of the printed layer history database and is not less than the preset minimum number of retrievals.
7. The layer-by-layer scanning compensation generation method according to claim 1, characterized in that, The assembly layer compensation context includes: splicing in the order of the baseline anchor cache, the printed layer context of each of the search hit layers, and the near-layer sliding window cache; When the printed layer history library is empty or the number of retrieved layers is zero, the layer compensation context consists of the baseline anchor cache and the near-layer sliding window cache.
8. The layer-by-layer scanning compensation generation method according to claim 1, characterized in that, The scan compensation generator includes: a layer encoder, used to encode the current layer slice geometry and the measured thermal field of the most recently printed layer into a query representation; The context attention unit is used to perform attention calculations using the query representation as the query and each context entry in the layer compensation context as the key and value, to obtain an attention-enhanced representation. The fusion unit is used to fuse the query representation with the attention enhancement representation to obtain the retrieval enhancement hidden state; The decoding unit is used to decode the retrieval enhancement hidden state and generate the scan path compensation for the current layer.
9. The layer-by-layer scanning compensation generation method according to claim 1, characterized in that, The scan path compensation includes scan parameter and scan strategy compensation components and scan path pre-compensation offset components. The scanning parameters and scanning strategy compensation components include at least one of laser power, scanning speed, scanning spacing, scanning strategy, contour scanning and preheating pre-scanning, and island rotation angle; The pre-compensation offset component of the scanning path is the geometric inverse deformation amount of the scanning path. When the value is positive, the path expands outward, and when the value is negative, the path shrinks inward, which is used to offset the predicted warping deformation.
10. The layer-by-layer scanning compensation generation method according to claim 8, characterized in that, Also includes: The warpage prediction value and defect risk of the current layer are obtained based on the enhanced hidden state prediction. The warpage prediction value is non-negative and the defect risk value ranges from 0 to 1. The retrieval confidence is determined based on the similarity and the consistency between the current layer's predicted quality and the measured quality of the retrieval hit layer. Based on the retrieval enhancement hidden state, the warping prediction value, the defect risk, and the retrieval confidence, at least one intervention probability in the prediction time domain is generated. The intervention probability is the probability that the current layer compensation is insufficient and online intervention or post-processing rework is required. The prediction time domain includes at least one of the short-term prediction time domain after the current layer, the medium-term prediction time domain after the current layer, and the printing end state. Each prediction time domain is distinguished by prediction time domain embedding. Based on the intervention probability, the defect risk, and the retrieval confidence, an executable compensation decision is generated. The action of the compensation decision is selected from at least one of the following: accept, adjust compensation parameters, switch scanning strategy, reduce power (downskin), rescan correction, pause thermal relaxation, and add margin by marking.
11. The layer-by-layer scanning compensation generation method according to claim 10, characterized in that, The retrieval confidence score is calculated as follows: The warpage prediction value is normalized according to the preset warpage normalization reference value and then combined with the defect risk to form the prediction quality vector of the current layer; For each retrieved layer, the measured warp in its printed layer context is normalized according to the preset warp normalization reference value and combined with the defect risk score to form a measured quality vector, wherein the defect risk score is the observation score output by the layer semantic encoder. The retrieval confidence score is obtained by taking the normalized value of the similarity of the retrieval hit layer as the weight and the mean of the absolute difference between the warp component and the defect risk component minus 1 as the quality consistency score, and by taking the weighted average of all retrieval hit layers. When the number of hit layers in the retrieval is zero, the retrieval confidence is set to 0.
12. The layer-by-layer scanning compensation generation method according to claim 10, characterized in that, The action for the compensation decision is determined according to the following rules: Risk classification: When the intervention probability corresponding to the short-term prediction time domain is not less than the preset high-risk threshold, or when the defect risk is not less than the preset defect risk threshold, the action includes rescan correction and power reduction downskin; when the intervention probability corresponding to the printing end state is not less than the preset out-of-tolerance threshold, the action includes adjusting compensation parameters and marking machining margin; in other cases, the action includes acceptance. Trend verification: When the retrieval confidence is not less than a preset precedent threshold, compensation measures are determined according to historical precedents; when the retrieval confidence is less than a preset rare situation threshold, the action includes switching the scanning strategy or pausing hot relaxation, and encrypting monitoring. Constraints must be met: cladding layers cannot be reverted or redone; support structures are prohibited within conformal cooling channels; the execution of the actions must be aligned with the pauseable thermal relaxation window; power reduction downskin is prioritized for high-risk overhanging layers; and multiple high-risk layers are processed together. The intervention probability corresponding to the intermediate prediction time domain is used as a monitoring signal and is not used for the threshold determination of the action; the compensation decision also outputs an evidence chain consisting of the layer number of each search hit layer and the similarity, and executes the current layer printing according to the compensation decision.
13. The layer-by-layer scanning compensation generation method according to claim 10, characterized in that, Step S5 is followed by a consistency check: the residual between the predicted warpage value and the measured warpage calculated from the measured morphology is calculated. When the residual exceeds a preset threshold, the prediction deviation of the current layer is marked and a review is triggered.
14. A method for training a retrieval embedding space and a scan compensation generator, used in the layer-by-layer scan compensation generation method according to any one of claims 1 to 13, characterized in that, include: During the training period, the dense representation of the printed layer and its derived printed layer history library are filled with expert-compensated true values and measured warping true values. The encoder and decoder of the layer-embedded autoencoder, the scan compensation generator, the scoring head and prediction head of the layer semantic encoder are jointly trained. The total loss function includes: The loss includes: reconstruction loss, which enables the decoder to reconstruct the dense representation of the printed layer from the retrieval embeddings; inter-layer redundancy suppression loss, which penalizes the portion where the cosine similarity of the retrieval embeddings of adjacent layers exceeds a preset boundary m within a local temporal window, thereby suppressing the embedding collapse of adjacent entity layers; trajectory smoothing loss, which constrains the second-order difference of the normalized retrieval embedding sequence; and compensation imitation loss, warping prediction loss, defect risk loss, intervention probability loss, and semantic scoring head loss, at least one of these. In this process, the Top-K selection in the self-retrieval is discrete and non-differentiable. The training gradient is backpropagated to the attention parameters through the softmax weights of the context attention. The layer-embedded autoencoder is indirectly shaped by the reconstruction loss, inter-layer redundancy suppression loss and trajectory smoothing loss, thus achieving end-to-end coupling between retrieval and generation.
15. The training method according to claim 14, characterized in that, The inter-layer redundancy suppression loss is: ; in, To suppress losses due to interlayer redundancy, Let t be the normalized retrieval embedding for layer t, T be the total number of training and printing sequences, m be the preset boundary, and w be the local temporal window. The number of lag layers; The interlayer redundancy suppression loss only penalizes the similarity between retrieval embeddings that exceeds the preset boundary within a local temporal window, and does not exclude isomorphic layers that are repeated at long distances.
16. The training method according to claim 14, characterized in that, The trajectory smoothing loss is: ; in, For trajectory smoothing loss, The normalized retrieval embedding is the t-th layer, and T is the total number of layers in the training and printing sequence; the trajectory smoothing loss is applied to the normalized retrieval embedding and uses the L2 norm instead of the square norm to constrain the second-order stability of the embedding direction trajectory.
17. A layer-by-layer scanning compensation generation system for conformal cooling inserts in molds, characterized in that, include: The layer semantic encoder is used to encode the geometry, measured thermal field and measured morphology of the current layer slice, and outputs the layer semantic embedding, overhang severity score, thermal accumulation score and defect risk score. The printed layer dense representation construction module is used to embed the layer semantics, the overhang severity score, the thermal accumulation score, the defect risk score, the embedded data with applied scan path compensation, the measured warp, the overhang angle, and the layer type, and then perform linear projection to obtain the printed layer dense representation. A layer embedding autoencoder is used to compress the dense representation of the printed layer into a retrieval embedding. Its embedding space is trained to suppress the similarity between retrieval embeddings of adjacent entity layers within a local temporal window that exceeds a preset boundary, and to smooth the trajectory of the normalized retrieval embedding sequence. The memory includes a printed layer history library, a near-layer sliding window cache, and a reference anchor point cache. The printed layer history library consists of a retrieval embedding library and a context library, which correspond to each other by layer number. The self-retrieval module is used to select non-local historical printed layers from the printed layer history database according to the similarity from high to low as the retrieval hit layers, and output the printed layer context of each retrieval hit layer. A layer compensation context assembly module is used to assemble the baseline anchor cache, the printed layer context of each of the search hit layers, and the near-layer sliding window cache into a layer compensation context. A scan compensation generator is used to generate scan path compensation for the current layer, taking the current layer slice geometry, the measured thermal field of the most recently printed layer, and the layer compensation context as input. The printing and measurement module is used to compensate for printing the current layer according to the scanning path, and to obtain the measured thermal field and measured morphology after printing; An update module is used to update the current layer's retrieval embedding and the printed layer context to the memory.
18. The layer-by-layer scan compensation generation system according to claim 17, characterized in that, The self-retrieval module is specifically used for: Exclude the preset number of printed layers recently moved into the retrieval embedding library, retain only the historical printed layers with the same layer type as the current layer and whose absolute value of the overhang angle difference does not exceed the preset tolerance as the candidate set, and select the retrieval hit layer from the candidate set in descending order of similarity; The preset number of excluded entries is the R entries most recently moved into the retrieval embedding library, and R is equal to the preset capacity of the near-layer sliding window cache; the similarity is cosine similarity, and the upper bound K of the retrieval budget increases with the size of the retrieval embedding library and is not less than the preset minimum number of retrievals; The number of retrieval hit layers is the smaller of the upper bound of the retrieval budget and the size of the candidate set.
19. The layer-by-layer scan compensation generation system according to claim 17, characterized in that, The scan compensation generator includes: A query representation encoding unit is used to encode the current layer slice geometry and the measured thermal field of the most recently printed layer into a query representation; The context attention unit is used to perform attention calculations using the query representation as the query and each context entry in the layer compensation context as the key and value, to obtain an attention-enhanced representation. The fusion unit is used to fuse the query representation with the attention enhancement representation to obtain the retrieval enhancement hidden state; The decoding unit is used to decode the retrieval enhancement hidden state and generate the scan path compensation for the current layer.
20. The layer-by-layer scanning compensation generation system according to claim 19, characterized in that, Also includes: The prediction head module is used to predict the warpage prediction value and defect risk of the current layer based on the retrieval enhancement hidden state. The warpage prediction value is non-negative, and the defect risk ranges from 0 to 1. Based on the retrieval enhancement hidden state, the warpage prediction value, the defect risk, and the retrieval confidence, it generates at least one intervention probability in the prediction time domain. The intervention probability is the probability that the current layer compensation is insufficient and online intervention or post-processing rework is required. The prediction time domain includes at least one of the short-term prediction time domain after the current layer, the medium-term prediction time domain after the current layer, and the printing end state. Each prediction time domain is distinguished by prediction time domain embedding. The retrieval confidence calculation module is used to determine the retrieval confidence based on the similarity and the consistency between the current layer prediction quality and the measured quality of the retrieval hit layer. The decision module is used to generate an executable compensation decision based on the intervention probability, the defect risk and the retrieval confidence. The action of the compensation decision is selected from at least one of acceptance, adjustment of compensation parameters, switching of scanning strategy, power reduction downskin, rescan correction, suspension of thermal relaxation, and labeling of machine margin, and outputs an evidence chain consisting of the layer number of each retrieval hit and similarity. The printing and measurement module executes the printing of the current layer according to the compensation decision.
21. The layer-by-layer scanning compensation generation system according to claim 17, characterized in that, The printing and measurement module includes an off-axis infrared thermal imager and a profilometer or stripe projection device, which are used to acquire the measured thermal field and measured morphology of the current layer after printing.
22. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it performs the layer-by-layer scan compensation generation method as described in any one of claims 1 to 13, or the training method as described in any one of claims 14 to 16.
23. An electronic device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method according to any one of claims 1 to 13, or the training method according to any one of claims 14 to 16.
24. An additive manufacturing apparatus, comprising a laser powder bed melting unit, characterized in that, It also includes the layer-by-layer scan compensation generation system as described in any one of claims 17 to 21; The layer-by-layer scanning compensation generation system generates scanning path compensation for each layer during the layer-by-layer printing process of the forming unit, and controls the forming unit to execute the printing of the current layer according to the scanning path compensation.
25. The additive manufacturing equipment according to claim 24, characterized in that, The additive manufacturing equipment is used to print mold conformal cooling inserts. The conformal cooling channel of the mold conformal cooling insert has a self-supporting cross-section, and its top wall overhang angle does not exceed the material self-supporting critical angle. Furthermore, no support structure is allowed to be placed in the conformal cooling channel. The layer-by-layer scanning compensation generation system generates downskin compensation and scanning path pre-compensation offset components for the channel top overhang layer to suppress top wall collapse and warping accumulation.
