## 3 Results and Discussion
### Esterification of Extracted Lipids with Methanol and Characterization of Chemical Products  
After the extraction process, both lipids derived from primary sludge and sewage scum (composed mainly of FFAs, 72-89%) were efficiently converted by direct esterification with methanol by using AlCl\({}_{3}\cdot\)6H\({}_{2}\)O [55; 56; 57] with a yield of 98.2 \(\pm\) 0.6% and 99.1 \(\pm\) 0.4%, respectively. The use of AlCl\({}_{3}\cdot\)6H\({}_{2}\)O promoted the production of FAMEs and a favorable phase separation of the products in a single step. Most of the water formed during the reaction, and the remaining FFAs were selectively dissolved in the upper methanol layer, while the methyl esters were in the lower oily phase. The remaining methanol was then evaporated from the oily layer, yielding crude products that were quantified and analyzed (Figure 3). According to the data reported in Table 2, FAMEs, Me-10-HSA and methyl estolides (preferentially 10-(palmitoyloxy) and 10-(oleyloyloxy) stearic acid methyl esters) were detected as main reaction products (see Supplementary Materials of Section S.2) with a very low FFA content (less than 0.5%wt). At the end of the vacuum distillation, three different fractions were then separated: pure FAMEs 98.5-99%wt (according to EN14214) were distilled at 165-180 \({}^{\circ}\)C, 50 \(\pm\) 5 mmHg, Me-10-HSA with a purity of 80-85%wt was obtained at 180-200 \({}^{\circ}\)C, 50 \(\pm\) 5 mmHg, while methyl estolides remained as distillation residue (final purity of 85-88%wt). Figure 3: Gas chromatogram of crude products obtained from the esterification of lipids extracted from primary sludge and sewage scum. Figure 2: Chemical composition of FFAs extracted from primary sludge and sewage scum and determination of Average Molecular Weight (AMW). For this preliminary study, the average composition of samples analyzed in Table 1 was considered: 4.3%wt and 21.7%wt were the initial TS content of primary sludge and sewage scum, while the lipid content was 220 mg/gts and 425 mg/gts of TS, respectively (Table 3). Additional information about the estimated costs can be found in Supplementary Materials of Section S.3. Taking into account the reagents consumed during the process and, in the case of primary sludge, the hexane lost during the recovery (approx. 2% by weight), the net cost of the reagents required to process 1 ton of primary sludge is 3.4 \(\upcels\), compared to 7.4 \(\upcels\) for sewage scum. The total energetic demand was approximately 154.5 MJ and 425.7 MJ. Providing this energy by burning methane (efficiency = 80%, [59]), 0.8 \(\upcels\) and 2.1 \(\upcels\) would entail associated costs. Under these conditions, the costs for carrying out these procedures were 4.2 \(\upcels\) and 9.5 \(\upcels\). Based on 1 ton of initial primary sludge or sewage scum, after the extraction step, 9.3 kg and 84.9 kg of raw lipids were obtained, respectively. Considering that 8.5 kg and 67 kg of biodiesel would be obtained from the two different feedstocks, already yielding a profit of 6.8 \(\upcels\) and 53.6 \(\upcels\), respectively, both processes seem very feasible, especially considering that Me-10-HSA and methyl estolides could be concomitantly produced. From 1 ton of settled primary sludge, 0.5 kg of Me-10-HSA and 0.1 kg of methyl estolides can be recovered, while from 1 ton of sewage scum, 1 kg of Me-10-HSA and 10 kg methyl estolides were recovered. By applying this strategy, the value of these by-products contributed considerably to improving the overall profits (4.4 \(\upcels\) and 76.5 \(\upcels\), respectively). Furthermore, the residual sludge produced at the end of the extraction \begin{table}
\begin{tabular}{c c c c} \hline \hline
**E** & **Chemical Composition (mg/gts)** & **Primary Sludge** & **Sewage Scum** \\ \hline
**1** & FAMEs & 80.9 \(\pm\) 2.7 & 75.2 \(\pm\) 2.0 \\
**2** & Me-10-has & 4.1 \(\pm\) 0.2 & 2.5 \(\pm\) 0.1 \\
**3** & Methyl estolides & 2.1 \(\pm\) 0.2 & 10.7 \(\pm\) 0.4 \\ \hline \hline \end{tabular}
\end{table}