The study of Higher-order function in Python(20170913)

本文介绍了Python中高阶函数的概念及应用。详细解释了变量如何指向函数、不同函数如何作为参数传递等内容,并通过实例展示了高阶函数的具体用法。

The study of Higher-order function in Python(20170913)

the variable can point to the function

print(abs) #
f = abs
print(f) #
print(f(-2)) # the variable point to the function abs()
# now f is amount to the abs(), this is a function f()

the function name is also a variable name

that means the functional name is just a variable name

which is point to the function

Afferent function(传入参数)

一个函数可以接收另一个函数作为参数,这种函数就称之为高阶函数

def fun1(x,y,fun):
return fun(x) + fun(y)
print(fun1(-9,-8,abs))

编写高阶函数,就是让函数的参数能够接收别的函数

把函数作为参数传入,这样的函数称为高阶函数,函数式编程就是指这种高度抽象的编程范式。

Stage-based Neural Network for Reflow Profile Prediction and Reflow Recipe Optimization for Quality and Energy Saving Zhenxuan Zhang1, Yuanyuan Li1, Sang Won Yoon1, Daehan Won1* 1*System Science and Industry Engineering, State University of the New York at Binghamton, Binghamton, 13902, NY, United States. *Corresponding author(s). E-mail(s): dhwon@binghamton.edu; Contributing authors: zzhang98@binghamton.edu; yli352@binghamton.edu; yoons@binghamton.edu; Abstract During the reflow process, solder joints are formed on the boards with the placed components, so the temperature settings in the reflow oven chamber are vital to the quality of the PCB. Inappropriate profiles cause various defects such as cracks, bridging, delamination, etc. Solder paste manufacturers have generally provided the ideal thermal profile (i.e., target profile), and PCB manufacturers have attempted to meet the given profile by fine-tuning the oven’s recipe. The conventional method tunes the recipe to gather thermal data with a thermal measurement device. It adjusts the profile, which relies on the trial-and-error method which takes much time and effort. This paper proposes (1) a recipe initialization method for determining the initial recipe for collecting training data, (2) a stage-based (ramp, soak, and reflow) input data segmentation method for data preprocessing, (3) a backpropagation neural network, (BPNN) model for predicting the required zone temperature to reduce the gap between the actual processing profile and the target profile, (4) a mixed-integer linear programming (MILP) algorithm for generates the optimal recipe to minimize the temperature settings. This paper aims to enable non-contact prediction of required air temperature from one experiment. The MILP optimization model utilized the constraints of the upper and lower bounds obtained from the prediction result. The model has been cross-validated with different initial recipes and different target profiles. As a result, within 10 minutes of starting the experiment, the generated optimal recipe improved the fitness to the targeted profile by 4.2%, which resulted in 99% and, in the meanwhile, lowered the energy cost by 23%. Keywords: reflow thermal recipe optimization, machine learning, stage-based segmentation, backpropagation neural network (BPNN), mixed-integer linear programming (MILP). 1 1 Introduction After solder paste printing and components are picked and placed, the soldering reflow process (SRP) is the final process on the surface mount technology assembly line. The SRP is of utmost importance as part of the SMT assembly line process [1]. Meanwhile, the reflow process is also the most critical part of the green manufacturing concept because the process requirement of the reflow process has an acceptable range in the key features of the reflow profile (temperature curve). Thus, the energy consumption can be different for multiple candidate target profiles, which have different energy consumption levels. To optimize the reflow process, the fitness of the actual reflow profile and the target profile needs to be considered. Additionally, energy consumption should be optimized. The combination of the temperature settings of the heating zones in the reflow oven controls the reflow profiles. In the SRP process, several processes are involved, which include ramping, soaking, reflow, and cooling. The printed solder paste melts into a liquid to connect the copper pads and the component joints during the heating period. It becomes solid and forms solder joints during the cooling period. A target thermal profile (temperature curve) is usually recommended by the manufacturer based on the physical properties of each solder paste, which results in an ideal solder joint. Fig. 1 shows the target thermal profile for Indium 8.9HF Pb-free SAC305 (96.5% Sn, 3.0% Ag, and 0.5% Cu) solder paste, used in this research. The entire SRP includes four stages: ramping, soaking, reflow, and cooling. The target thermal profile has some key features, which include the climbing slope liquidus temperature, which is 220◦C. The target peak temperature is 240◦C, as shown in the Fig. 1, with an acceptable range of 220 − 260◦C. The target time above liquidus (TAL) is 60 seconds, with an acceptable range of 30-120. The optimized reflow recipe should satisfy the target values of the features if not within the recommended or acceptable ranges. This research aims to (1) identify the required air temperature range for the zones in the reflow oven to fit the target thermal profile using a backpropagation neural network (BPNN); (2) optimize the reflow recipe to minimize the energy consumption from the candidate recipes using MILP. The comparable study proved that the reflow profile is highly related to the long-term reliability of the solder joints [2]. The reflow profile has better fitness to the target profile and outperforms in terms of long-term reliability [3]. The solder paste manufacturer suggests the target profile, the tested outperforming reflow profile. Thus, the reflow recipe that approaches a high fitness to the target profile can optimize solder joint long-term reliability. The experimental profile is obtained from the k-type thermocouples, which are attached to the solder joints, and a non-contact prediction model proposed by the previous research [4] is used to predict the solder joint temperature to improve the testing efficiency and reduce the redundancy of experiments and by comparison of the predicted thermal 2 Fig. 1 Target profile of Indium 8.9HF SAC305 Pb-free solder paste profile and the target profile, the result can also be regarded as an evaluation method of the oven status in real-time for quality control. The main determinant of a thermal profile is the environment inside the reflow oven. Heller 1707MKEV forced convection reflow oven is used in this study, which contains seven heating zones, followed by one cooling zone. Based on the test results, one of the studies shows that heat transfer coefficients differ between periods [5]. In this study, the heat transfer coefficients are calculated separately for each zone. In this research, the required temperature-adjustable range (upper and lower bounds) of the reflow recipe for each of the 7 zones can be obtained within one iteration using ANN. The model works well with the data collected from any random initial recipe and can be applied to different target thermal profiles. To evaluate the reflow energy cost of the recipe, the reflow energy index (REI) was proposed, and an optimization model using MILP was used to obtain the optimal reflow recipe. This study is extended from tentative research we previously published [18]. The remainder of this article is organized as follows: Section 2 introduces related literature; Section 3 discusses the proposed methods in this research; Section 4 contains the experiment material, parameter settings, and results; and Section 5 considers conclusions and future work. 2 Literature Review The SRP-related publications are described in this section. The thermal profile simulation of the solder joint during SRP in the SMT assembly line has been widely studied in 2 major directions. The first one is using the physics-based model, including computational fluid 3 dynamics (CFD), finite element (FE), and finite difference (FD). The other one is the data driven approaches, especially with machine learning (ML) and artificial intelligence (AI) [6]. As far as physics-based models are concerned, FD is most commonly used to solve differential equations that govern the flow of fluid in order to simulate the thermal behavior of fluids [7, 8]. Mathematical solutions to complex equations can be obtained through the application of FE and FD techniques [6]. Several studies have demonstrated that these methods are capable of producing reliable and accurate results from simulations since the simulation results are derived from the model constructed using the physics equations [9]. Meanwhile, the disadvantage of the physics-based model is notably significant since such models require intermediate knowledge of physics equations as well as field-specific knowledge [10]. The data-driven approach, on the other hand, has the advantage of being less dependent on physics, which contributes to better generalizability, as well as improved computational efficiency [11]. In contrast to physics-based simulations, which always produce the results of a perfect environment, the data-driven model can capture the general pattern of a real-production experimental environment based on experimental data and can be compared to the data-driven model projected into the future [12]. As for the data-driven AI approaches, multiple approaches have been proposed from comparable research using numerical simulation. A simulation function was realized from a different perspective by developing equations relating to the heat transfer process. The data driven AI approach requires experimentation, and according to the experiment-based studies used in this research, the characteristics of the PCB boards and components affect heat transfer activities. The time to reach the melting point on the solder paste has a linear relationship with the thickness of the board [19, 20]. Thinner boards have larger heating factors, which can be heated up and cooled down faster, which has a higher peak temperature under the same recipe settings [21]. The thermal profile was utilized to develop a mathematical simulation model that accurately predicted solvent loss during the heating process [13] and achieved excellent simulation results. During multiple impinging jets in solder reflow, a mathematical model has been developed to predict surface temperatures, which are closely matched by the predicted surface temperatures [14]. The increasing prevalence of large data sets is giving rise to the use of Artificial Intelligence and Machine Learning (ML) to obtain classification and prediction functions in many fields. For the ML approaches in the reflow setting optimization studies, multiple approaches were used, i.e., artificial neural networks (ANN), non-linear programming (NLP), and genetic algorithm (GA) [15, 16, 22–24]. From the comparative studies, heating factor Qn is presented as a comprehensive formulation of the two parameters, the peak temperature Tp and the time above liquidus (TAL) [22, 23]. With the heating factor, the BPNN, one of the ANN approaches, was introduced to describe the non-linear relationship between the recipe settings and the reflow thermal profiles [18]. By inputting factors such as soak time, reflow time, and peak temperature in the SMT domain, ANNs were also applied to predict and optimize with high 4 accuracy obtained [22]. ANN has many advantages, including the ability to handle non-linear data with high generalization capability. The ANN models are widely used due to their capability of handling multiple-inputmultiple-output (MIMO) problems, which also offer the advantage of fitting complex non-linear relationships with low requirements of data format and knowledge of data [1, 15, 16]. Additionally, ANN was developed to predict the tolerance for shear forces in reflowed solder joints by taking into account factors such as soak time, reflow time, and peak temperature. As a result of the predictions, it was determined that the experimental shear force was highly accurate [16]. As compared to the high accuracy performance of the ANN approach, the computational cost of deep-learning approaches is significantly higher than that of data-driven machine-learning approaches [4]. It has been proposed that artificial neural networks be combined with physical equations to develop a hybrid artificial intelligence model that can accurately predict the thermal profile and temperature. Artificial intelligence-based methods have the advantage of being efficient and performing well. In addition to the drawbacks of all the physicsbased approaches, hybrid AI models require higher levels of physics knowledge, which is also inefficient from a computational perspective. Furthermore, regression-based methods of machine learning and artificial intelligence-based methods were incorporated. For example, a regression model trained using experimental data would be able to simulate the thermal profile during a solder reflow process. The optimal thermal profile was determined by utilizing a simulation model to determine a number of heat factor values based on a well-shaped thermal profile [17]. The regression-based methods have the advantage of computational efficiency but, in exchange, have a lower level of accuracy. Since this study focuses on obtaining the maximum fitness to the target reflow profile and then minimizing the energy cost, an improved version of BPNN was proposed to get the adjustable range of the recipe settings. Then, the mixed-integer linear programming (MILP) approach was used rather than the NLP approach in comparable studies. This would be beneficial in lowering computational complexity.
最新发布
08-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值