Abstract
In the realm of large format additive manufacturing (LFAM), determining an effective printing strategy before actual printing involves predicting temperature behaviors and controlling layer time, which has consistently been challenging. Currently, temperature prediction for controlling layer time in LFAM is primarily conducted through offline simulations or online monitoring. However, these approaches are typically tailored to specific cases and lack generalizability. Consequently, there exists a significant gap in the development of a universal model that can leverage historical data to predict temperature across various new geometries and positions. In this article, a novel approach to optimize printing strategies for LFAM is proposed through the development and application of a transformer-based model focused on the dynamic prediction and management of temperature profiles across the print surface. Subsequently, the authors input the predicted temperature into an optimization model to determine the optimal layer time. A series of experiments were conducted to validate the effectiveness of the proposed model. Using historical temperature data collected from the real printing processes, the model demonstrated a high degree of accuracy in predicting temperature profiles for new design, enabling the optimization of layer time settings far beyond the capabilities of traditional fixed-time methods. This process significantly enhances the printing strategy, thereby increasing both the efficiency of the printing process and the quality of the printed objects.
1 Introduction
Additive manufacturing (AM), also known as 3D printing, typically involves creating objects by layering material successively. This method offers significant advantages over traditional subtractive manufacturing techniques. It enables more complex and customized designs, reduces material waste, and allows for faster prototyping and production. Several methods of AM have been developed to meet the demand of specific application scope, such as powder bed fusion, direct energy deposition, as well as laminated object manufacturing. Fused filament fabrication (FFF), commonly known as fused deposition modeling (FDM), stands out for its low cost, high speed, and simplicity of the process [1]. A continuous filament of a thermoplastic polymer is heated to a semi-liquid state and extruded through a nozzle to form layers, which solidify upon cooling. The process’s success hinges on the polymer’s thermoplasticity, enabling layer fusion during printing and solidification postprinting [2].
FFF was originally designed as a desktop facility for creating small but complex parts. Over the years, it has evolved into large format additive manufacturing (LFAM) [3–5]. LFAM is particularly advantageous for producing large parts with a volume greater than in one piece, eliminating the need for joining or welding multiple smaller components [6]. This capability streamlines the manufacturing process, leading to time and cost savings, and simplifies the overall production workflow. In addition, LFAM allows for greater design flexibility and can produce complex structures that might be challenging or impossible to create with traditional manufacturing methods. The LFAM printer called Big Area Additive Manufacturing (BAAMTM) has been developed at Oak Ridge National Laboratory (ORNL) [7]. A similar machine, AM Flexbot printer, is shown in Fig. 1.
In LFAM, the printing process involves a critical cooling step after the deposition of each layer. The print head must wait for the newly added layer to cool before applying the next one. This cooling phase is essential as the surface temperature of the layer being printed on greatly influences the mechanical properties of the final product [8]. Achieving the optimal temperature range is crucial to ensure that each layer properly bonds to the previous one, enhancing the strength and structural integrity of the manufactured item. To be specific, a temperature below the material’s glass transition point can increase the risk of warping and cracking, while excessively high temperatures can cause parts to lose stiffness and deform [9]. The lower and upper bound temperatures are determined based on the type of thermoplastic material being used [10].
Therefore, determining the appropriate printing strategy becomes crucial in LFAM, especially managing the time interval between printing adjacent layers, known as layer time. This strategy significantly influences the cooling duration, which determines whether the base layer for the next level can be printed within the optimal temperature range, thereby affecting the quality of the final product. Currently, the common practice is to set the layer time fixed based on empirical data and experiences. However, this approach is not ideal because the geometry of the object being printed affects heat conduction. Consequently, the cooling rate varies across different locations on the object and is dynamic, influencing each other. To establish an effective printing strategy, extensive experimental work is needed for each specific geometry, making the process complex and time consuming. To address this issue, the first step is to predict the cooling temperature profile of different locations of the object being printed in a dynamic environment. This prediction will enable the temperature at various locations on the object to be known at each moment. With these data, an optimization model can be fed to determine the ideal layer time. This optimal layer time should ensure that when the next layer is printed, the temperature at every location of the base layer falls between the lower and upper bound temperatures, specific to the material used. Moreover, the model should aim to have as many locations as possible to approach the ideal temperature at which the material achieves its maximum mechanical strength. By adopting this approach, the optimal printing strategy can be identified, which allows for a significant reduction in time compared to the fixed layer time method. This strategy not only enhances the efficiency of the printing process but also potentially improves the mechanical properties of the final product by ensuring more precise thermal control during fabrication.
The previous research has primarily used two methods to accurately predict the cooling temperature profiles across different areas of a printed object: offline simulation and online data-driven methods. However, both approaches have their limitations. Offline simulation’s strength lies in its ability to fully consider all factors that could influence predictive outcomes, thereby yielding accurate predictions. However, it is limited to specific cases and performed in ideal conditions, which can differ from real-world printing results, making it computationally expensive and reducing its generalizability. While the online data-driven method can quickly yield accurate results, it requires real printing data and struggles to effectively utilize historical printing data. To predict the temperature for different geometries, it is necessary to first physically print each geometry. In LFAM, each printing session can take several hours, making the data from each print highly valuable. Considering the strengths and weaknesses of both offline and online methods, there is a gap in the current approaches. An ideal solution would leverage historical printing data to predict temperatures at different positions on a geometry before actual printing, while also being adaptable to various geometries and capable of rapid computation.
In this article, an offline solution is proposed that utilizes a transformer architecture to thoroughly learn from historical data collected during actual printing processes. Due to its unique self-attention mechanism, this model is able to capture the interdependencies of temperature at various positions across different geometries. After learning from a sufficient number of samples, the model can quickly provide temperature predictions for new geometry designs even before printing begins. Additionally, new data can be continuously collected during production and used to further fine-tune the pretrained transformer model, enhancing the accuracy of predictions and effectively utilizing historical data. A framework for data collection and processing from thermal images captured by a FLIRTM thermal camera is first proposed [11]. Subsequently, the authors use the cleaned data to train the transformer-based model, which can generate the predicted temperature profiles at each location on the printing surfaces of complex geometry. Ultimately, an optimization model for layer time control is developed to determine the final printing strategy.
The rest of this article is structured as follows. Section 2 reviews the related works. Section 3 describes the experiment setup information. Section 4 presents data extraction and processing. Section 5 introduces the proposed transformer model for temperature profile prediction and analysis methods. Section 6 shows the proposed layer time control method. Finally, Sec. 7 provides a conclusion and suggests the future research direction.
2 Literature Review
LFAM has seen significant development since its origins in the 1980s [12]. It was initially limited to small-scale applications like stereolithography and FDM for rapid prototyping. The technology expanded in the early 2000s with the introduction of selective laser sintering and metal printing, accommodating larger and more complex part production [13]. By the 2010s, as the technology matured and costs declined, LFAM began to be applied in industries requiring large, high-performance, and complex structures such as aerospace, automotive, construction [14,15]. Notable developments included the Oak Ridge National Laboratory and Cincinnati Inc.’s large-scale 3D printer, the BAAM machine [16]. It is capable of creating parts up to 6 m in length, 2.4 m in width, and 1.8 m in height [17]. Similarly, Thermwood developed the LFAM machine, outscaling BAAM with the capacity to produce parts 30.4 m long, 3 m wide, and 1.5 m high [18,19]. These advancements were partly due to incorporating carbon fiber or glass fiber to enhance the mechanical properties of the thermoplastic materials used in LFAM, addressing the demands of large part production and the substantial volume of materials required. Both BAAM and large scale additive manufacturing (LSAM) machines were innovated by utilizing the thermoplastic material in the pellet form instead of the traditional thin filament, optimizing the feedstock for large format manufacturing. In recent years, with the rise of smart manufacturing and the Industry 4.0 paradigm, LFAM has been increasingly incorporating intelligent and automated technologies. Machine learning and artificial intelligence are now being utilized to refine the printing process and enhance the efficiency of material usage [1,10,20–23].
As previously discussed in Sec. 1, to optimize the printing process, it is essential to be aware of the thermal dynamics during printing. Understanding these temperature changes allows for the determination of the appropriate layer time, which in turn informs the development of an effective printing strategy. Liu et al. developed an offline simulation for layer time optimization that relies on a physics-based 1D heat transfer model for temperature prediction [22]. A key innovation of their work is the development of a layer time optimization framework that integrates these temperature predictions with geometric considerations from finite element analysis (FEA). This integration allows for taking into account varying cooling patterns at different positions within the geometry. Despite the advances in the offline simulation, Liu et al. noted that the results still deviate from real-world outcomes. To address this, they introduced an integrated offline and online optimization framework, which refines offline results using real-time online printing data [21]. This approach enhances prediction accuracy and manufacturing efficiency. However, Liu et al.’s methods still rely on FEA for initialization, which requires extensive configuration for each geometry, limiting its generalizability. Although it is significantly faster than traditional simulations, each run still requires several hours.
Wang et al. introduced an online, data-driven method that employs thermal images and linear regression to predict temperatures on the print surface [20]. Their approach assumes a homogeneous cooling pattern across the surface, which simplifies the process but is less effective for complex geometries where temperature variations are significant. This limitation in handling diverse thermal dynamics underscores the need for more effective models that can account for nonhomogeneous temperature variations across different surfaces. Additionally, this online model can only initiate predictions during the actual printing process, preventing it from fully utilizing historical data. On the basis of Wang’s work, Fathizadan et al. introduced a model to dynamically control the extruder speed during the printing process [23]. This model involves selecting various representative regions of interest (ROIs) on the print surface and conducting regression analysis to predict temperatures, which can be somewhat inefficient. A more sophisticated method that could analyze the mutual influences between different positions on the print surface, and then simultaneously predict temperature changes for all ROIs, would significantly improve the efficiency of dynamic extruder speed control. To address this issue, Guo et al. proposed a convolutional neural network-long short-term memory (CNN-LSTM) model to capture spatial and temporal dependencies for temperature prediction on print surfaces [24]. The model uses CNNs for feature extraction and LSTMs for cooling temperature prediction but struggles with detailed information in complex geometries and long-term predictions, limiting its application in LFAM printing strategies.
Therefore, there is an urgent demand to develop a method that is fast and universally applicable, eliminating the need for separate runs for each geometry type. This method should be capable of analyzing the spatiotemporal relationships within complex geometries, allowing for simultaneous temperature predictions across all locations of the geometry. By utilizing historical data from the actual printing process, it can forecast long-term temperature changes, enabling the determination of the printing strategy for the entire layer before the printing process. In this context, generative AI has captured attention as a method to better achieve this objective [25–28]. Recent advancements in generative AI hold a significant potential for LFAM. A representative example is the transformer architecture [29]. For example, Fernandez-Zelaia et al. proposed that the framework uses the video vision transformer (ViViT) to analyze spatiotemporal thermal signatures in additive manufacturing [30]. This approach processes video sequences of heat transfer simulations, learning latent representations that predict and control microstructure. The self-attention mechanism of the transformer allows each element in the input sequence to consider and weigh the importance of all other elements, enabling the model to capture complex dependencies and relationships regardless of distance between elements in the sequence. What is more, the transformer’s parallel processing capability speeds up training, thus reducing the need for extensive computational time. These characteristics allow the transformer to learn from actual printing data from diverse geometries in LFAM, analyze how different positions interact, and affect each other to identify spatiotemporal relationships. As a result, the trained model exhibits universality, applicable across diverse geometries. With knowledge of the shape of a newly designed geometry, the authors can predict the temperature at all positions simultaneously. However, it is important to note that in this article, the authors assume consistent printing settings and materials used. The proposed model has demonstrated good predictive accuracy and universality, offering a viable method for using historical data to predict the overall layer temperatures of a new design before printing.
3 Experiment Setup
The machine used to perform experiments in this article is the large format additive manufacturing machine as shown in Fig. 1. Previous research primarily focused on printing single geometric products with simple shapes, such as rectangles, characterized by homogeneity and consisting mainly of straight lines, often excluding curves [21,23]. To validate that the transformer architecture can not only capture the spatiotemporal relationships within individual components but also manage the interplay between multiple components during simultaneous printing, and additionally, to demonstrate its capability in analyzing more complex geometric shapes such as various curves and corners, Three representative and complex geometries have been chosen for the case study. They are four planters, four totems, and a table. Their geometries and printing path are shown in Fig. 2. The used material is 30% glass fiber-reinforced Polyethylene Terephthalate Glycol (PETG) for all three cases. For each component of the planters and totems cases, the printer head starts from the starting point shown by the circle in the figures. The printing path of each component also shown in the figures by the arrows. The process is completed once the printer head return to the starting point. In these two cases, the left bottom component is printed first, then left top one, then right top component, and the right bottom component is the last one to be printed. For the table case, the printing path is shown and ordered by the arrows and number.
The FLIRTM thermal camera captures and stores the stream of images containing temperature values during the whole printing process with resolution. The frame rate is around 0.5 frame/s. Examples of RGB image taken by the camera for all three cases along with their color maps are shown in Fig. 3. Each frame is paired with a file that contains the temperature values for each pixel. To ensure accuracy, the actual temperature values are used rather than relying on the RGB intensities in the images during subsequent analyses.
The experiment setting is shown in Table 1. Deposition temperature is the temperature of the thermoplastic material when it is deposited. Ambient temperature is the temperature of the printing environment when the experiments were conducted. The upper bound of print surface temperature , the lower bound of print surface temperature , and the ideal surface temperature are decided by material scientists based on extensive experiments. This means the base layer surface temperature, when the printer head is going to print next layer, should be within and as close to the as possible to achieve good quality. Table 1 also provides the specific settings for each case. The deposition time per layer is the time that extruder spends adding a new layer. For planters and totems, which have four components, it means the time adding a new layer for all components. The total amount of time to add a new layer, including the deposition time and cooling time, is referred to as the layer time.
Experiment setting
Parameter | Setting |
---|---|
Deposition temperature, | |
Ambient temperature, | |
Upper bound of surface temperature, | |
Lower bound of surface temperature, | |
The ideal surface temperature, | |
Layer time for four planters | 376 s |
Deposition time per layer for four planters | 376 s |
Layer time for table | 400 s |
Deposition time per layer for table | 280 s |
Layer time for four totems | 236 s |
Deposition time per layer for four totems | 236 s |
Printer head speed | 535 in./min |
Bead width | 0.8 in. |
Thickness | 0.2 in. |
Parameter | Setting |
---|---|
Deposition temperature, | |
Ambient temperature, | |
Upper bound of surface temperature, | |
Lower bound of surface temperature, | |
The ideal surface temperature, | |
Layer time for four planters | 376 s |
Deposition time per layer for four planters | 376 s |
Layer time for table | 400 s |
Deposition time per layer for table | 280 s |
Layer time for four totems | 236 s |
Deposition time per layer for four totems | 236 s |
Printer head speed | 535 in./min |
Bead width | 0.8 in. |
Thickness | 0.2 in. |
4 Data Extraction and Processing
4.1 Image Processing and Data Extraction.
To accurately predict the temperature profiles at various positions on the surface of a printed object, it is first necessary to select these specific locations, particularly focusing on the path of the extruder during the printing process. This involves captured images with the FLIRTM camera, which contains numerous pixel coordinates.
Since the object changes after each layer is printed—increasing in height, width, and sometimes even altering its shape—the extruder path is selected for each layer. Initially, the authors filter for the extruder path based on the thermodynamic properties of FFF, where the temperature is highest immediately after deposition and gradually decreases, outlining the contour of the object. Due to the numerous background and extruder interference in the captured images, relying solely on a single image to accurately determine the contour is insufficient. The authors have designed a system that uses a temperature threshold and a constraint of consecutive frames. If a pixel coordinate maintains a temperature above this threshold across frames, it can be considered as part of the extruder’s path. However, capturing such a high number of pixel coordinates can be counterproductive for training, as the surface of the printed object is typically large and gathering numerous coordinates in a small area is not meaningful. To address this, a kernel is employed in a max pooling operation to select the highest temperature point within each kernel, ultimately determining the optimal print path.
This approach not only captures the complete contour of the object but also keeps the number of captured pixel coordinates within a reasonable range. Typically, based on the geometry of each layer, this method captures between 500 and 1000 pixel coordinates for each layer. The transformer architecture is well suited for processing data sequences of this length. Figure 4 illustrates the extruder path for one layer of each selected geometry.
Besides contour detection, it is also crucial to sort the contours according to the printing sequence. Even with identical contours, the order in which they are printed can significantly affect the thermal interaction between different locations. For example, consider points A, B, and C, where points B and C are equidistant from point A. If point B is printed immediately following point A, while point C is printed 20 s later, their impacts on point A will be markedly different. The temperature profile of points A and B will be similar, but point C, being printed after point A has cooled for 20 s, will influence the cooling pattern of point A differently. This illustrates the importance of sorting these pixel coordinates.
To enable the transformer architecture to capture the temporal relationships between different positions, the authors have developed a method for sorting the captured pixel coordinates. By employing all frame images of each layer, the temperature profile for each pixel coordinate can be determined. Each profile typically exhibits a significant temperature jump—from approximately (base layer temperature) to between 160 and (deposition temperature)—indicating the passage and printing of that pixel coordinate by the extruder. The time at which each temperature jump occurs is recorded and used to sort the pixel coordinates. Coordinates with earlier jumps were printed first, while those with later jumps were printed subsequently. Using this method, the pixel coordinates have been successfully sorted, significantly enhancing the subsequent training of the transformer model.
4.2 Data Processing and Cleansing.
The primary challenge with using the FLIRTM camera to record data during printing is the extruder’s constant movement across the camera’s field of view. Due to the camera’s placement angle, the extruder periodically obscures parts of the object being printed. This results in temperature readings from the obscured pixel coordinates that reflect the extruder’s temperature, not the object’s. These discrepancies appear as numerous outliers in the temperature profile. Figure 5 shows the raw temperature profile with multiple outliers. Since the transformer model relies on these profiles for training, such outliers can significantly degrade the accuracy of the predictions. Therefore, it is crucial to find a method to obtain the complete and smooth temperature profile, free from extruder interference.
As demonstrated in Fig. 6, an extruder detection model has been successfully trained, achieving a mAP of 99.5% and a precision of 99.3%. This allows the position of the extruder to be monitored in real time in every frame. Consequently, the temperature values of pixel coordinates obstructed by the extruder can be replaced with NaN (not a number) values. Based on physical theorems and previous work, it is known that the cooling profile is exponential. Therefore, linear interpolation is employed to replace the NaN values, thereby obtaining a complete and smooth temperature profile. Figure 7 displays the temperature profiles for each pixel coordinate filtered from one layer of every geometry. Notably, each temperature profile begins at the moment extruder passes through the pixel coordinate. From Figs. 7(a)–7(c), numerous outliers can be observed, indicating that the data are extremely noisy. In contrast, Figs. 7(d)–7(f) show the data after cleaning, where all outliers have been removed, resulting in very smooth data. These clean data are now suitable for use in subsequent model training.

Collection of temperature profiles heatmap: four planters raw, four totems raw, table raw, four planters cleaned, four totems cleaned, and table cleaned
5 Temperature Profile Modeling
5.1 Model Inputs and Outputs.
During the printing process, although the shape of the object being printed changes—becoming taller and wider, the temperature profiles at different locations exhibit periodicity, as illustrated in the Fig. 8. Therefore, the temperature prediction focuses on a per-layer basis. As discussed in Sec. 4, the authors also process the data by layers to obtain the cleaned temperature profiles at various positions within each layer for each geometry. The methodology is applied to analyze the spatiotemporal impact and interrelationships of different pixel coordinates within each layer.
The input of the transformer model, denoted as , consists of pixel coordinates, where each represents the spatial position of a pixel within a layer. The output, represented as , comprises temperature profiles for these pixels, with each . encapsulating the temperature change of a pixel over the printing process, capturing the essential thermal dynamics associated with that pixel. The length of each is set to 120 frames, as justified by the experiment setting in Table 1, which indicates that the upper bound of base layer surface temperature is and the lower bound is . For all three cases considered, the temperature drops to approximately after 120 frames. If the temperature of the base layer falls below , it can lead to structural collapse of the printed object, rendering it defective. Therefore, the prediction focuses on the temperature changes of pixel coordinates over 120 frames, corresponding to 240 s, after being printed. This strategic choice not only enhances the accuracy of the model by concentrating on the most relevant thermal dynamics but also improves the model’s efficiency by eliminating unnecessary computational overhead associated with processing frames beyond this critical period.
5.2 Model Architecture
5.2.1 Pixel Coordinates Embedding.
In the context of processing sequences of discrete pixel coordinates on a single layer, as described earlier, the approach involves an embedding technique that transforms each pixel’s coordinates into a high-dimensional vector . First, all pixel coordinates that appear in the printing path were collected from the datasets to build a vocabulary. Each pixel coordinate’s two-dimensional coordinate was combined into a single string. Then, the authors tokenized these strings, assigning a unique ID to each one. Finally, an embedding technique was used to project these unique IDs into a high-dimensional vector space. Since each pixel coordinate has its own unique ID, the model gradually learns how different IDs influence each other during training, thereby understanding how different positions on the object’s surface affect one another during the printing process. This method leverages the potential of embeddings to encapsulate complex spatial interrelations among input coordinates through an iterative training process, significantly enhancing the model’s capability for predicting temperature profiles.
5.2.2 Positional Encoding.
5.2.3 Spatial Self-attention Mechanism.
In these equations, , , and are the projection matrices for queries, keys, and values, respectively, for each attention head. is the projection matrix for the output of the concatenated heads, and denotes the number of heads used.
By deploying multihead attention, the model not only gains a comprehensive understanding of spatial and temporal relationships but also enhances its capability to generalize across different scenarios in LFAM. This enriched analytical depth allows for more precise and reliable predictions of temperature profiles, essential for optimizing the printing process and ensuring product quality.
5.2.4 Residual Connections, Layer Normalization, and Feedforward Networks.
In the transformer architecture, the processing of input through self-attention is followed by a sequence of crucial steps: residual connections, layer normalization, and a feedforward network. Each component plays a vital role in the transformer’s effective learning process:
Residual Connection: This technique addresses the vanishing gradient problem in deep networks by adding the input directly to the output of each sublayer (e.g., self-attention, feedforward). This method ensures the preservation of initial layer information across deeper layers, facilitating more profound learning without significant information loss.
Layer Normalization [32]: Following the residual connection, layer normalization standardizes the output across features for each data point in a batch. This standardization stabilizes the learning process and accelerates convergence, implemented as , where includes the residual sum.
Feedforward Network: Positioned within each transformer layer, this network consists of two linear transformations separated by a rectified linear unit (ReLU) activation. Applied uniformly but operating independently across all positions, it introduces necessary nonlinearity, allowing the model to capture more complex patterns.
5.3 Experiment and Results Analysis.
The experimental configuration of hyperparameters was established as follows: was set to 256 and was set to 1024. The architecture comprises six layers each in the encoder and decoder stacks (), with eight attention heads () employed to facilitate multiple representations of the input data. To avoid overfitting, a dropout rate of 0.1 was implemented. The learning rate was carefully selected at . The selection of these hyperparameters was based on the guidelines provided in the article [29]. Since the sequence length in the dataset is around 500–1000, the maximum sequence length for coordinates was limited to 1100 to optimize processing efficiency. Since no previous researchers have conducted a related work, the transformer model was trained from scratch.
The dataset comprised layers from three distinct printed objects: 14 layers from 4 planters, 46 from a table, and 90 layers from 4 totems. For a representative inference analysis, and to ensure robust model validation, the authors excluded the 8th layer of the planters, the 20th of the table, and the 50th of the totems from the training process. These layers were instead used for posttraining inference to assess the model’s performance. The remaining layers constituted the training dataset for the model development.
For the training process, the Adam optimizer was utilized on an NVIDIA 80GB A100 GPU. The model underwent extensive training over 300 epochs, using mean squared error (MSE) as the loss function. After 300 epochs, the model’s loss stabilized at a value of 0.012, indicating effective learning and convergence of the network.
After the model was successfully trained, I utilized the 8th layer of planters, the 20th layer of table, and the 50th layer of totems to verify the model’s performance. As shown in Fig. 10, during the printing process, totems not only increase in height but also their shapes evolve gradually. The positions of the totems’ corners are continuously changing, making this case particularly representative. It almost equates to printing a new geometry. Figure 11 illustrates the temperature profiles at all positions generated simultaneously by the transformer model after all pixel coordinates in the layer were inputted. It is observable that the model captures the spatiotemporal influences among different positions, thereby generating distinct profiles for each location. In the subsequent analysis, the focus is on the case of four totems.
Four representative positions within the totems were selected to analyze their predicted temperature profiles. Figure 12(a) displays the positions of these four positions. It can be observed that positions 1 and 3 are located adjacent to other totems, which affects their cooling process. Not only are they influenced by the totem they belong to but they also receive thermal effects from neighboring totems. Conversely, positions 2 and 4 are isolated, with no adjacent totems. Their cooling is influenced only by nearby locations within the same totem.

Comparison of prediction and observation: four sample positions, comparison of position 1, comparison of position 2, comparison of position 3, comparison of position 4, and comparison of prediction of sample positions
Figures 12(b)–12(e) each depict the comparison between the predicted results from the transformer model and the actual temperature profiles recorded during the printing process at these four positions. The predictions align remarkably well with the actual temperature changes, demonstrating the model’s accuracy. This level of precision is highly beneficial for the subsequent applications in controlling layer time through temperature prediction. Figure 12(f) compares the predicted temperature profiles for these four positions. It is evident that the temperature profiles for positions 1 and 3, which are influenced not only by other locations on their own totem but also by nearby totems, are noticeably higher than those of positions 2 and 4. This indicates that the cooling process is slower for positions 1 and 3. The alignment of the predictions with actual observations further demonstrates that the transformer model successfully captures the mutual temperature influences among different geometric positions.
Table 2 provides a comprehensive overview of the statistical measures reflecting the accuracy of the model predictions across all three cases. The outstanding performance of the model for totems is likely because this case involved a larger number of layers, which allowed the model to become more adept at recognizing and learning from the cooling patterns present in the data. This success also highlights the current limitation of the dataset’s size. To enhance the model’s generalizability and robustness, the future work will require training with an expanded dataset encompassing a broader variety of cases.
6 Layer Time Control
6.1 Model for Layer Time Optimization.
As previously mentioned, the temperature of the base layer during the printing of subsequent layers significantly influences the quality and mechanical properties of the final product. There is an optimal temperature range defined by an upper temperature limit and a lower temperature limit . Exceeding can lead to stiffness and decomposition of the product, whereas temperatures below may cause the structure to collapse. Moreover, there is an ideal temperature that is most conducive to achieving optimal product quality. The authors have employed a transformer model in Sec. 5 to predict the temperature profile across all positions of the object being printed. This allows the temperature change over time at every location to be monitored. To ensure the quality of the product, it is essential to maintain the temperature of all positions within this acceptable range , while aiming to keep as many positions as possible close to .
In Eq. (7), the first term of objective function is the weighted summation with the weight for each position denoted by , for . represents the importance of temperature variations at the th position in terms of the final product’s quality. In the upcoming experiments, it is assumed that each position is equally crucial for this analysis; therefore, a weight of 1 is assigned to for all positions. represents the sum of how close each position’s temperature is to the target temperature , which is as shown in Table 1. The second term takes the weight of layer time into consideration. By combining these two terms, getting more minor differences between element temperature and target temperature among positions and minimizing layer time can be considered simultaneously by minimizing the objective function.
This optimization model can be efficiently and effectively solved using the sequential quadratic programming method [10].
6.2 Experiment and Results Analysis.
In this experiments, the 8th layer of the four planters, the 20th layer of the table, and the 50th layer of the four totems were selected as the dataset. The temperature prediction profiles for these specific layers were generated using the transformer model described in Sec. 5. Due to the inherent variance in the output of the transformer model, each predicted temperature profile was first subjected to a regression analysis in order to obtain a smooth, monotonically decreasing exponential temperature function . The resulting refined profiles were then utilized as inputs to the optimization model, which facilitated the determination of the optimal layer time.
The 8th layer of the planters includes 742 pixel coordinates, the 20th layer of the table contains 935 pixel coordinates, and the 50th layer of the totems comprises 534 pixel coordinates, as shown in Table 3. Therefore, regression analyses were performed on all pixel coordinates for each case, as illustrated in Fig. 13. Figure 13 presents the regression results for one of the temperature profiles from the planters.
Summary of regression
Planters | Table | Totems | |
---|---|---|---|
Number of regression profiles | 742 | 935 | 534 |
MSE | 0.021 | 0.023 | 0.014 |
RMSE | 0.1425 | 0.149 | 0.119 |
0.994 | 0.995 | 0.997 |
Planters | Table | Totems | |
---|---|---|---|
Number of regression profiles | 742 | 935 | 534 |
MSE | 0.021 | 0.023 | 0.014 |
RMSE | 0.1425 | 0.149 | 0.119 |
0.994 | 0.995 | 0.997 |
Table 3 provides key statistical metrics indicative of the regression model’s performance, including the overall MSE, root mean squared error (RMSE), and the coefficient of determination () for each case. These metrics reflect the reliability of the regression models across the dataset, with the planters, tables, and totems demonstrating MSEs of 0.021, 0.023, and 0.014, respectively; RMSEs of 0.1425, 0.149, and 0.119; and values of 0.994, 0.995, and 0.997. The high values across all objects indicate an excellent level of variance explained by the models. Consequently, reliable estimates of all the for all three cases have been obtained, which can be subsequently incorporated into the optimization model to determine the optimal layer time.
Figure 14 illustrates the results of optimization model for the selected layers of all three cases. It identifies the lower and upper bounds and specifies the ideal temperature. Additionally, it contrasts the fixed layer time of the current printing strategy with the model-optimized optimal layer time. The specific outcomes are detailed in Table 4. This visual representation not only proves the reliability of the predictive model but also emphasizes the significant improvements in layer time achieved through the optimization process, which aligns closely with the predefined criteria for temperature bounds and ideal operational parameters.
Layer time descriptions
Planters | Table | Totems | |
---|---|---|---|
Fixed layer time | 376 s | 400 s | 236 s |
Optimal layer time | 128.2 s | 163.4 s | 74.2 s |
Improvement % | 65.9 | 59.1 | 68.6 |
Planters | Table | Totems | |
---|---|---|---|
Fixed layer time | 376 s | 400 s | 236 s |
Optimal layer time | 128.2 s | 163.4 s | 74.2 s |
Improvement % | 65.9 | 59.1 | 68.6 |
It can be observed that layer time has been substantially reduced across all cases, with reductions from 376 s to 128.2 s for planters, 400 s to 163.4 s for table, and 236 s to 74.2 s for totems, corresponding to improvements of 65.9%, 59.1%, and 68.6%, respectively. These significant enhancements serve as a robust validation of the work’s value. By predicting temperature variations at different locations on the surface of the object being printed using the transformer model and incorporating these results into the optimization model, printing times have been considerably reduced, thereby optimizing the printing strategy.
7 Conclusion
In LFAM, an optimal printing strategy is crucial to guarantee the quality of the final product. In this article, a comprehensive series of works has been conducted to design an optimal printing strategy. The study was initiated by employing the YOLO algorithm to track the extruder’s position in real time during the printing process, enabling effective data cleansing. Subsequently, a novel approach was developed for optimizing printing strategies using a transformer-based model for temperature prediction and an optimization model for layer time control to determine the printing strategy. The transformer model, as a form of generative AI, differs from traditional methods by being able to generate temperature profile predictions at all positions within a layer simultaneously, and for various geometries. The optimization model significantly reduces layer time. The experiments have demonstrated that the transformer architecture can effectively capture the complex spatiotemporal relationships at different positions on the surface of the printed object. This allows for a more nuanced understanding of the thermal dynamics during printing, leading to more precise control over the manufacturing process. However, due to the characteristics of LFAM, printing new geometries is both time consuming and economically expensive. As a result, our dataset is limited, leading to a certain degree of error in temperature predictions. Future works can be directed toward improving model architecture, expanding the dataset and exploring additional variables that may influence the printing process.
Conflict of Interest
There are no conflicts of interest.
Data Availability Statement
The datasets generated and supporting the findings of this article are obtainable from the corresponding author upon reasonable request.