## 2 Materials and Methods
### Numerical Modeling
#### 2.2.5 Particle Swarm Optimization (PSO) Mathematical Model  
The particle swarm optimization (PSO) algorithm is a metaheuristic technique commonly used in high-dimensional search spaces for nonlinear problems [40; 50]. Based on the Arrhenius Equation (1), it is assumed that the factors \(A_{0}\) and \(Ea\) are independent of temperature. The calculation of Arrhenius kinetic parameters in a thermal degradation process using a two-step kinetic model is a complex problem that depends on the integralsof Equations (1)-(6), making the PSO algorithm a robust strategy for finding global optima for different isothermal temperatures. The PSO algorithm is initialized with a random number of particles defined within a search space. This search space will be defined in a range from \(-20\) to \(0\) dB for the Arrhenius kinetic constants for wheat straw. The selection of this range for the kinetic constants is established to give greater importance to the most significant reactions occurring within the torrefaction process. In linear terms, according to Equation (1), by applying the natural logarithm on both sides of the equation, this range represents a variation of two orders of magnitude, which is consistent with the influence of different reaction stages observed experimentally and with typical values reported in the literature [10; 14; 19; 42] for similar reactions within the proposed torrefaction temperature range. For each iteration, the PSO finds an optimal solution, and the particles are updated to their best local position (_pbest_) and their best global position (_gbest_). When these optimal values are found, the particles update their position and velocity according to Equations (13) and (14).  
\[\overset{\rightarrow}{v_{i}}^{l+1}=\omega\times\Delta\overset{ \rightarrow}{v_{i}}^{l}+c_{1}rand()\bigg{(}pbest_{i}-\overset{\rightarrow}{x _{i}}^{l}\bigg{)}+c_{2}rand()\bigg{(}gbest_{i}-\overset{\rightarrow}{x_{i}}^{ l}\bigg{)} \tag{13}\]  
\[\overset{\rightarrow}{x_{i}}^{l+1}=\overset{\rightarrow}{x_{i}}^{l}+ \overset{\rightarrow}{v_{i}}^{l+1} \tag{14}\]  
Here, \(v_{i}\) and \(x_{i}\) are the velocity and position of the ith particle. The variable \(\omega\) indicates the adjustment rate of the position change, \(j\) is the number of iterations performed by the algorithm, and the cognitive and social learning factors are the variables \(c_{1}\) and \(c_{2}\). Finally, _rand_() is a random number between \(0\) and \(1\).  
As the objective function (\(OF\)) of the PSO algorithm, the least squares method is applied. This \(OF\) is used to predict the weight loss curve, according to Equation (15).  
\[OF^{(T)}=\sum_{j=1}^{n}\Big{[}(TGA)^{(T)}_{exp,j}-(TGA)^{(T)}_{cal,j}\Big{]}^ {2} \tag{15}\]  
Here, \(T\) is the isothermal torrefaction temperature; \((TGA)^{(T)}_{exp,j}\) is the jth experimental data point for a sample of the percentage weight loss of wheat straw at a given temperature; \((TGA)^{(T)}_{cal,j}\) is the calculated percentage weight loss of the sample; and \(n\) symbolizes the number of data points measured experimentally.  
To determine the degree of similarity between the weight loss curve calculated using the PSO algorithm and the actual weight loss curve obtained from experimental data, Equation (16), known as the quality of fit (_fit_), is used.  
\[fit(\%)=\left[1-\frac{\sqrt{\frac{OF}{n}}}{\big{(}TGA_{exp}()_{max}\big{)}} \times 100\%\right] \tag{16}\]  
Here, \(\big{(}TGA_{exp}()_{max}\big{)}\) is the maximum weight loss percentage of the sample in the experiment.