Techno-Economic Study of Castor Oil Crop Biorefinery: Production of Biodiesel without Fossil-Based Methanol and Lignoethanol Improved by Alkali Pretreatment

Castor, a non-edible oil crop that flourishes even under extreme cultivation conditions, can be cultivated in wastewater with a lower cultivation cost than similar plants, e.g., rapeseed and soybean. This plant, containing seeds and lignocellulosic residues, has a promising perspective for biofuel production. The oil extracted from the seeds is inexpensive and can be efficiently converted to biodiesel, while the lignocellulosic parts are suitable for ethanol production after pretreatment with NaOH. Biodiesel typically produced from the fossil-based methanol; however, it can also be produced from the ethanol. In this study, ethanol used for biodiesel production is produced from the lignocellulosic residues (scenario 1), which are more sustainable and environmentally friendly; the process was compared with that of the methanol (scenario 2). In this study, techno-economic analyses were used to compare the technical and economic aspects of producing biodiesel from methanol and the produced ethanol. Simulations of the processes were carried out by Aspen plus software, and economic studies were conducted by Aspen Economic Analyzer. The prices of produced ethanol as a byproduct in scenarios 1 and 2 were USD 0.701 and 0.693 per liter, respectively, which are greater than that of gasoline. The prices of biodiesel produced as a primary product for scenarios 1 and 2 are USD 0.410 and 0.323/L, lower than the price of diesel in the Middle East region. The profitability indices for scenarios 1 and 2 are 1.29 and 1.41, respectively. Therefore, despite environmental benefits, the biorefinery based on producing biodiesel from methanol is more economically feasible than that produced from ethanol.


Introduction
To prevent environmental issues caused by the use of fossil fuels, research on renewable sources of energy has increased. In this regard, biodiesel, bioethanol, and biogas are among the promising alternatives [1]. Biodiesel-the monoalkyl ester of vegetable, algal, and animal oils-is nowadays employed as a replacement to diesel. It is produced from edible oils and non-edible oils, while non-edible oils are more sustainable and promising resources [2][3][4][5]. Among the renewable liquid biofuels, ethanol currently plays a major role as a blend for the improvement of gasoline properties. Ethanol production

Methods
Two scenarios for biodiesel and bioethanol production in a biorefinery based on castor plant using NaOH pretreatment were developed. These processes were designed based on the promising experimental data previously obtained [9,27]. Aspen Plus simulated all the processes, and then APEA evaluated the economic features.

Process Development
In the first scenario, castor oil is used to produce biodiesel by transesterification with ethanol that is produced from the lignocellulosic materials of castor plant, including leaves, stem, and seed cake. In the second scenario, castor oil is used to produce biodiesel by transesterification with methanol and the lignocellulosic materials used for bioethanol production similar to scenario 1.
2.1.1. Scenario 1: The Biorefinery for Biodiesel (from Oil and Ethanol), Bioethanol, and Heat Production This process includes feed handling, transesterification, biodiesel purification, pretreatment, ethanol production via simultaneous saccharification and fermentation (SSF), purification of bioethanol by distillation, and fuel grade production of ethanol by dehydration, heat production, wastewater treatment (WWT), and utility services units. The block flow diagram (BFD) of this scenario is shown in Figure 1.

Methods
Two scenarios for biodiesel and bioethanol production in a biorefinery based on castor plant using NaOH pretreatment were developed. These processes were designed based on the promising experimental data previously obtained [9,27]. Aspen Plus simulated all the processes, and then APEA evaluated the economic features.

Process Development
In the first scenario, castor oil is used to produce biodiesel by transesterification with ethanol that is produced from the lignocellulosic materials of castor plant, including leaves, stem, and seed cake. In the second scenario, castor oil is used to produce biodiesel by transesterification with methanol and the lignocellulosic materials used for bioethanol production similar to scenario 1.

Scenario 1: The Biorefinery for Biodiesel (from Oil and Ethanol), Bioethanol, and Heat Production
This process includes feed handling, transesterification, biodiesel purification, pretreatment, ethanol production via simultaneous saccharification and fermentation (SSF), purification of bioethanol by distillation, and fuel grade production of ethanol by dehydration, heat production, wastewater treatment (WWT), and utility services units. The block flow diagram (BFD) of this scenario is shown in Figure 1. In the harvest time, the seeds are separated, and seeds and residues were then sent to plant with trucks. In the feed handling unit, oil is extracted from the seeds by a cold mechanical press, filtered, kept for 24 h at 80 °C in the tank storage to remove extra moisture, and then sent to the transesterification reactor. Seed cake, stem, and leaves are crushed and dumped into storage piles until transfer to the pretreatment unit. Similar units for feed handling are considered for both scenarios [30].
Biodiesel is produced in a 25 m 3 ransesterification reactor at 62.5 ℃ for 3.46 h by using 1 g potassium hydroxide (KOH) per kg oil and 0.29:1 ethanol to oil mass ratio to obtain 85% biodiesel efficiency. The two-phase stream, i.e., fatty acid esters (biodiesel) rich and glycerol rich streams, is removed from the reactor [1,9,20,27,31].
In the separation unit, the excess alcohol (here ethanol) contents of both biodiesel and glycerin are first recovered. The ethanol recovery is carried out by using a three-phase distillation tower, containing 22 sieve trays with 80% efficiency and operates under vacuum pressure of 0.2 bar (absolute). The product is finally sent to the dehydration unit for water separation, and the bottom stream of the tower sends to the biodiesel purification unit [31]. In the harvest time, the seeds are separated, and seeds and residues were then sent to plant with trucks. In the feed handling unit, oil is extracted from the seeds by a cold mechanical press, filtered, kept for 24 h at 80 • C in the tank storage to remove extra moisture, and then sent to the transesterification reactor. Seed cake, stem, and leaves are crushed and dumped into storage piles until transfer to the pretreatment unit. Similar units for feed handling are considered for both scenarios [30].
Biodiesel is produced in a 25 m 3 ransesterification reactor at 62.5 • C for 3.46 h by using 1 g potassium hydroxide (KOH) per kg oil and 0.29:1 ethanol to oil mass ratio to obtain 85% biodiesel efficiency. The two-phase stream, i.e., fatty acid esters (biodiesel) rich and glycerol rich streams, is removed from the reactor [1,9,20,27,31].
In the separation unit, the excess alcohol (here ethanol) contents of both biodiesel and glycerin are first recovered. The ethanol recovery is carried out by using a three-phase distillation tower, containing 22 sieve trays with 80% efficiency and operates under vacuum pressure of 0.2 bar (absolute). The product is finally sent to the dehydration unit for water separation, and the bottom stream of the tower sends to the biodiesel purification unit [31].
To help the phase separation, water is added to the process in the centrifuge. The products of transesterification are contaminated by the remaining raw material (i.e., oil), ethanol, catalyst (KOH), Agronomy 2020, 10, 1538 4 of 14 and soap. Thus, according to ASTM D6751 or EN 14214, the produced biodiesel is purified to contain less than 0.05% v/v impurities. A distillation tower containing 22 trays (sieve trays, 80% efficiency, operates at 0.1 bar pressure) is used for biodiesel purification. The purified biodiesel (99.95% v/v) obtained from the distillate is sent to the storage tanks, and the unreacted oil that exits from the bottom is sent back to the transesterification reactor. The glycerin-rich stream is first neutralized by the sulfuric acid and then purified in a distillation column with 4 sieve trays (80% efficiency, 0.4 bar pressure). The process flow diagram of the biodiesel production unit is presented in Figure 2 [1,24].
Agronomy 2020, 10, x FOR PEER REVIEW 4 of 15 To help the phase separation, water is added to the process in the centrifuge. The products of transesterification are contaminated by the remaining raw material (i.e., oil), ethanol, catalyst (KOH), and soap. Thus, according to ASTM D6751 or EN 14214, the produced biodiesel is purified to contain less than 0.05% v/v impurities. A distillation tower containing 22 trays (sieve trays, 80% efficiency, operates at 0.1 bar pressure) is used for biodiesel purification. The purified biodiesel (99.95% v/v) obtained from the distillate is sent to the storage tanks, and the unreacted oil that exits from the bottom is sent back to the transesterification reactor. The glycerin-rich stream is first neutralized by the sulfuric acid and then purified in a distillation column with 4 sieve trays (80% efficiency, 0.4 bar pressure). The process flow diagram of the biodiesel production unit is presented in Figure 2 [1,24].  The pretreatment of castor residues is conducted with 8% w/v NaOH (100 ℃, 60 min, 22% solid loading). The pretreated residues are then filtered and washed in a 9-stage counter current solid washer to minimize the freshwater consumption. Water containing the impurities is then sent to WWT unit. SSF is used for ethanol production by hydrolysis of the pretreated solids (13% solid loading) with Cellic CTec3 enzyme (1.8% w/w of cellulose, Novozymes, Denmark [32]) and fermentation with Saccharomyces cerevisiae at 37 ℃ for 72 h under anaerobic conditions [25.33]. The nine main fermenters are designed with a volume of 350 m 3 . The seed yeast is prepared in a series of fermenters (stainless steel 304), starting from 5 L to 300 m 3 final volume with 1:10 scale-up ratio. The beer (fermentation broth) stream, leaving the fermenters, contains 3.86% v/v ethanol, unfermented hexoses and pentoses, and lignin. The beer is stored in a 150 m 3 tank and then sent to distillation step.
The purification of ethanol is conducted using stripper, rectifier, and scrubber columns ( Table  2). The produced carbon dioxide is separated in a flash drum stage, and degassed beer is preheated  Table 1 for process conditions). Table 1. The process conditions for equipment for biodiesel production in scenario 1 in Figure 2. The pretreatment of castor residues is conducted with 8% w/v NaOH (100 • C, 60 min, 22% solid loading). The pretreated residues are then filtered and washed in a 9-stage counter current solid washer to minimize the freshwater consumption. Water containing the impurities is then sent to WWT unit. SSF is used for ethanol production by hydrolysis of the pretreated solids (13% solid loading) with Cellic CTec3 enzyme (1.8% w/w of cellulose, Novozymes, Denmark [32]) and fermentation with Saccharomyces cerevisiae at 37 • C for 72 h under anaerobic conditions [25.33]. The nine main fermenters are designed with a volume of 350 m 3 . The seed yeast is prepared in a series of fermenters (stainless steel 304), starting from 5 L to 300 m 3 final volume with 1:10 scale-up ratio. The beer (fermentation broth) stream, leaving the fermenters, contains 3.86% v/v ethanol, unfermented hexoses and pentoses, and lignin. The beer is stored in a 150 m 3 tank and then sent to distillation step.
The purification of ethanol is conducted using stripper, rectifier, and scrubber columns ( Table 2). The produced carbon dioxide is separated in a flash drum stage, and degassed beer is preheated to enter the second stage of stripper (24 sieve trays, 80% efficiency, 0.2 absolute bar). The vapor side-draw from the third stage, comprising 40.17% v/v ethanol, is fed to the rectifier column (32 sieve trays, 80% efficiency, 1.8 absolute bar). This column produced ethanol in 94% v/v concentration in vapor form. The vent from the top of the beer column, as well as the vents from beer stream storage and fermenters, is sent to the third column that is a water scrubber. The scrubber is a simple packed column Agronomy 2020, 10, 1538 5 of 14 that recovered 99% of vented ethanol by washing with water. The ethanol is exiting from the bottom and returned to the beer column [33]. The solid containing the unconverted residues of the substrate, e.g., lignin, is presented in the wastewater that leaves the distillation. It is sent to the wastewater treatment and used for heat production.
Saturated vapor from the rectifier column, along with the recovered ethanol from biodiesel separation unit, is superheated and fed to the molecular sieve unit for purification to 99.9% v/v concentration of ethanol. This unit includes two adsorption columns. They are used alternatively in adsorbing and regenerating operation. The regeneration of the adsorption columns is performed by pure hot ethanol vapor. The final product, i.e., pure ethanol, is cooled and a part of it (40%) is sent to the biodiesel production unit, and the remaining ethanol pumped to storage to be sold as a fuel [33]. Table 2. The process conditions for the equipment of distillation and dehydration in Figure 3.

Equipment/Conditions Beer Column Rectifier Column Scrubber Column Dehydration Section
Input temperature (  draw from the third stage, comprising 40.17% v/v ethanol, is fed to the rectifier column (32 sieve trays, 80% efficiency, 1.8 absolute bar). This column produced ethanol in 94% v/v concentration in vapor form. The vent from the top of the beer column, as well as the vents from beer stream storage and fermenters, is sent to the third column that is a water scrubber. The scrubber is a simple packed column that recovered 99% of vented ethanol by washing with water. The ethanol is exiting from the bottom and returned to the beer column [33]. The solid containing the unconverted residues of the substrate, e.g., lignin, is presented in the wastewater that leaves the distillation. It is sent to the wastewater treatment and used for heat production. Saturated vapor from the rectifier column, along with the recovered ethanol from biodiesel separation unit, is superheated and fed to the molecular sieve unit for purification to 99.9% v/v concentration of ethanol. This unit includes two adsorption columns. They are used alternatively in adsorbing and regenerating operation. The regeneration of the adsorption columns is performed by pure hot ethanol vapor. The final product, i.e., pure ethanol, is cooled and a part of it (40%) is sent to the biodiesel production unit, and the remaining ethanol pumped to storage to be sold as a fuel [33]. Table 2. The process conditions for the equipment of distillation and dehydration in Figure 3.  The bottom product of the rectifier column is pure water (>99% w/w) that is added to clean process water. The bottom product of the beer column, i.e., stillage, mainly contains non-fermentable sugars and lignin. Lignin is separated from this stream by filtration and is sent to the WWT unit. The liquor that is removed from the lignin separation step and the liquid effluent from the pretreatment unit is sent to the filtration and electrodialysis for the removal of dissolved compounds and NaOH that remained in the liquid. To reduce the COD and produce biogas, an anaerobic digester is used. The produced biogas consists of 44% carbon dioxide and 54% v/v biomethane. The rest of the organic materials are converted to CO2, water, and sludge, using aerobic digestion. A clarifier is used to settle the sludge, and the water is treated and added to clean process water. Biogas, lignin, and dewatered sludge are combusted, and heat is produced as a valuable byproduct in the heat production unit. The bottom product of the rectifier column is pure water (>99% w/w) that is added to clean process water. The bottom product of the beer column, i.e., stillage, mainly contains non-fermentable sugars and lignin. Lignin is separated from this stream by filtration and is sent to the WWT unit. The liquor that is removed from the lignin separation step and the liquid effluent from the pretreatment unit is sent to the filtration and electrodialysis for the removal of dissolved compounds and NaOH that remained in the liquid. To reduce the COD and produce biogas, an anaerobic digester is used. The produced biogas consists of 44% carbon dioxide and 54% v/v biomethane. The rest of the organic materials are converted to CO 2 , water, and sludge, using aerobic digestion. A clarifier is used to settle the sludge, and the water is treated and added to clean process water. Biogas, lignin, and dewatered sludge are combusted, and heat is produced as a valuable byproduct in the heat production unit.

Scenario 2: The Biorefinery for Biodiesel (from Oil and Methanol), Bioethanol, and Heat Production
The overview of the process used in scenario 2 is presented in Figure 4. The castor plant seed and residual handling, oil extraction, and ethanol production units are similar to scenario 1. However, the transesterification of oil and process parameters are different. In this process, methanol is used for the transesterification in 10 m 3 reactor (40 • C, 1.5 h, 1.5 g KOH/kg oil catalyst, 0.4:1 methanol to oil ratio). The excess alcohol is separated in the methanol recovery and recycled.

Production
The overview of the process used in scenario 2 is presented in Figure 4. The castor plant seed and residual handling, oil extraction, and ethanol production units are similar to scenario 1. However, the transesterification of oil and process parameters are different. In this process, methanol is used for the transesterification in 10 m 3 reactor (40 ℃, 1.5 h, 1.5 g KOH/kg oil catalyst, 0.4:1 methanol to oil ratio). The excess alcohol is separated in the methanol recovery and recycled.

Plant Location and Capacity
In this study, Iran is selected as a place for the biorefinery, where fossil fuel resources and methanol are widely available. However, the area has water shortages and is dealing with severe environmental impacts. Therefore, castor, as a low water demanding plant that can be cultivated in wastewater, is used. Considering the total world production of castor [9,27], a plant with the capacity of handling 120,000 tons of castor plant per year (based on the dry weight) is used.

Process Simulation and Economic Calculations
The main processes of the biorefineries are simulated by Aspen Plus to obtain the composition and properties of streams. The physical properties databank of NREL (National Renewable Energy Laboratory, Golden, CO, USA) is used for the definition of lignocellulosic components [34]. The sizing and cost of all equipment are estimated by Aspen PEA. The assumptions are: plant capacity, 120,000 tons/year castor plant (dry basis); plant location, Asia (Iran); costs index, 2019; depreciation, straightline for 7 years with zero salvage value; contingency factor, 18%; construction period, two years with a 6-month start-up; working capital, 5% of the total investment cost; project life, 30 years; tax rate, 0% based on Iran regulation for biofuel production.
The sensitivity analysis to identify the factors affecting the profitability and final price of biodiesel is carried out.

Results
Experimental data [9,27] showed promising results for the production of bioenergy from castor plant oil and residues. The residues are used for ethanol production, and ethanol is used as an

Plant Location and Capacity
In this study, Iran is selected as a place for the biorefinery, where fossil fuel resources and methanol are widely available. However, the area has water shortages and is dealing with severe environmental impacts. Therefore, castor, as a low water demanding plant that can be cultivated in wastewater, is used. Considering the total world production of castor [9,27], a plant with the capacity of handling 120,000 tons of castor plant per year (based on the dry weight) is used.

Process Simulation and Economic Calculations
The main processes of the biorefineries are simulated by Aspen Plus to obtain the composition and properties of streams. The physical properties databank of NREL (National Renewable Energy Laboratory, Golden, CO, USA) is used for the definition of lignocellulosic components [34]. The sizing and cost of all equipment are estimated by Aspen PEA. The assumptions are: plant capacity, 120,000 tons/year castor plant (dry basis); plant location, Asia (Iran); costs index, 2019; depreciation, straight-line for 7 years with zero salvage value; contingency factor, 18%; construction period, two years with a 6-month start-up; working capital, 5% of the total investment cost; project life, 30 years; tax rate, 0% based on Iran regulation for biofuel production.
The sensitivity analysis to identify the factors affecting the profitability and final price of biodiesel is carried out.

Results
Experimental data [9,27] showed promising results for the production of bioenergy from castor plant oil and residues. The residues are used for ethanol production, and ethanol is used as an alternative to methol for biodiesel production. The economic feasibility of this process is evaluated through the simulation by Aspen plus and analysis by Aspen PEA.

Material and Energy Balance
The amounts of feedstocks, products, and utilities are calculated and shown in Table 3. The primary raw materials used in the two scenarios (i.e., NaOH, nutrients, pH control agents, and enzymes) are equal. However, in the biodiesel production unit of scenario 2, based on experimental data, KOH consumption is more than scenario 1, and therefore, the amount of H 2 SO 4 that is used for catalyst neutralization in scenario 2 is more than that in scenario 1. In scenario 1, a part of ethanol produced Agronomy 2020, 10, 1538 7 of 14 from the residues is used in the transesterification unit. Based on the experimental data, the conversion of this reaction in scenario 1 is 85.0%, while it is 88.2% in scenario 2. In scenario 1, 15% of raw oil is unreacted and recycled to the transesterification reactor, resulting in higher biodiesel production than that in scenario 2. Moreover, the biodiesel composition in each scenario is different. It is in the form of fatty acid ethyl ester in scenario 1, while it is fatty acid methyl ester in scenario 2. Consequently, the energy content of biodiesel in each scenario is different from another. The main difference in the scenarios is the production of net ethanol. In scenario 1, about 40% of produced ethanol is used for biodiesel production, resulting in a much lower net ethanol production yield than that in scenario 2.
The prices of all components are shown in Table 3. Based on the price and amount of each component, seeds and solid residuals are the primary feeds of biorefinery. The price of NaOH (due to high consumption) and nutrients, which are expensive, is in the next position.
The distribution of raw material cost and product sales is shown in Figure 5. In scenario 1, the highest income is from biodiesel sale; in scenario 2, the transesterification reaction is conducted with methanol, and the highest revenue is from bioethanol sale.
The type and amount of utilities are shown in Table 3 for the two scenarios. The water is mainly used as makeup in the cooling system, in the pretreatment unit for washing the solid material, and to regulate NaOH concentration and in the fermentation step for adjusting the total solid in the fermenters. High pressure steam is used in distillation towers and also for heating. Low pressure steam is used to regulate the temperature and preheat the feeds. Fuel and hot oil are used for heating the oil streams in the biodiesel production unit in each scenario [33]. The distribution of raw material cost and product sales is shown in Figure 5. In scenario 1, the highest income is from biodiesel sale; in scenario 2, the transesterification reaction is conducted with methanol, and the highest revenue is from bioethanol sale. The type and amount of utilities are shown in Table 3 for the two scenarios. The water is mainly used as makeup in the cooling system, in the pretreatment unit for washing the solid material, and to regulate NaOH concentration and in the fermentation step for adjusting the total solid in the fermenters. High pressure steam is used in distillation towers and also for heating. Low pressure steam is used to regulate the temperature and preheat the feeds. Fuel and hot oil are used for heating the oil streams in the biodiesel production unit in each scenario [33].
The breakdown of energy consumption in different units of each scenario is shown in Figure 6. Distillation towers in ethanol purification and energy consumption in biodiesel production are the most energy demanding units. Pretreatment of lignocellulosic materials at 100 °C and the anaerobic digestion at 55 °C, as well as the filtration system in the wastewater treatment unit, also need considerable amounts of energy.  The breakdown of energy consumption in different units of each scenario is shown in Figure 6. Distillation towers in ethanol purification and energy consumption in biodiesel production are the most energy demanding units. Pretreatment of lignocellulosic materials at 100 • C and the anaerobic digestion at 55 • C, as well as the filtration system in the wastewater treatment unit, also need considerable amounts of energy. The type and amount of utilities are shown in Table 3 for the two scenarios. The water is mainly used as makeup in the cooling system, in the pretreatment unit for washing the solid material, and to regulate NaOH concentration and in the fermentation step for adjusting the total solid in the fermenters. High pressure steam is used in distillation towers and also for heating. Low pressure steam is used to regulate the temperature and preheat the feeds. Fuel and hot oil are used for heating the oil streams in the biodiesel production unit in each scenario [33].

Energy Efficiency
The breakdown of energy consumption in different units of each scenario is shown in Figure 6. Distillation towers in ethanol purification and energy consumption in biodiesel production are the most energy demanding units. Pretreatment of lignocellulosic materials at 100 °C and the anaerobic digestion at 55 °C, as well as the filtration system in the wastewater treatment unit, also need considerable amounts of energy.

Energy Efficiency
The ratio of energy outputs to inputs in the process is defined as energy efficiency [32]. The energy outputs involve the energy available in biodiesel, bioethanol, and glycerol as well as produced heat. The energy inputs comprise the energy available in raw materials as well as steam, electricity, and fuel.
The energy consumptions of the scenarios are presented in Figure 6. The lower heating values are used to calculate the energy content of raw materials and products. The energy efficiency of scenarios 1 and 2 are 64.8% and 64.1%, respectively. In scenario 2, the energy consumption of the biodiesel production unit is more than that in scenario 1. On the other hand, the energy content of biodiesel is higher than that of ethanol, and in scenario 1, the amount of produced biodiesel is considerably higher than scenario 2. Thus, for the production of a higher amount of energy, transesterification with ethanol is preferred.

Total Capital Cost
Based on the simulation results, economic analysis was conducted by Aspen PEA for each scenario. Total project investments are USD 51.69 million and USD 48.90 million for scenarios 1 and 2, respectively. The retention times for transesterification reactions in scenarios 1 and 2 are 3.64 and 1.5 h, respectively. The volume of equipment in scenario 1 is much higher than those in scenario 2, which results in the higher total capital cost of the plant in scenario 1 [31].
The most expensive units of plants are SSF and wastewater treatment (WWT) (Figure 7). SSF needs a long retention time (24 h) and a relatively high number of equipment, and the WWT unit needs filtration together with large anaerobic digesters with a long retention time [13].
are used to calculate the energy content of raw materials and products. The energy efficiency of scenarios 1 and 2 are 64.8% and 64.1%, respectively. In scenario 2, the energy consumption of the biodiesel production unit is more than that in scenario 1. On the other hand, the energy content of biodiesel is higher than that of ethanol, and in scenario 1, the amount of produced biodiesel is considerably higher than scenario 2. Thus, for the production of a higher amount of energy, transesterification with ethanol is preferred.

Total Capital Cost
Based on the simulation results, economic analysis was conducted by Aspen PEA for each scenario. Total project investments are USD 51.69 million and USD 48.90 million for scenarios 1 and 2, respectively. The retention times for transesterification reactions in scenarios 1 and 2 are 3.64 and 1.5 h, respectively. The volume of equipment in scenario 1 is much higher than those in scenario 2, which results in the higher total capital cost of the plant in scenario 1 [31].
The most expensive units of plants are SSF and wastewater treatment (WWT) (Figure 7). SSF needs a long retention time (24 h) and a relatively high number of equipment, and the WWT unit needs filtration together with large anaerobic digesters with a long retention time [13].

Operating Cost
The breakdown of the operating costs is summarised in Figure 8. The direct manufacturing costs include the expenses for labor, supervisory, raw materials, utilities, and equipment maintenance and repairs. Tax and overhead are the fixed charges, while the expenditures for research and development, financing, and administrative form the general expenses [33]. The coziest raw materials are castor seed, plant residues, and sodium hydroxide. The byproducts of plants are bioethanol, glycerin, potassium phosphate, heat, and carbon dioxide. The highest revenue from the byproducts is obtained from bioethanol.

Operating Cost
The breakdown of the operating costs is summarised in Figure 8. The direct manufacturing costs include the expenses for labor, supervisory, raw materials, utilities, and equipment maintenance and repairs. Tax and overhead are the fixed charges, while the expenditures for research and development, financing, and administrative form the general expenses [33]. The coziest raw materials are castor seed, plant residues, and sodium hydroxide. The byproducts of plants are bioethanol, glycerin, potassium phosphate, heat, and carbon dioxide. The highest revenue from the byproducts is obtained from bioethanol.

Manufacturing and Equivalent Costs
The manufacturing costs of biodiesel and bioethanol are calculated by considering the operating cost for all scenarios, and the breakdown is shown in Figure 8. The manufacturing costs of biodiesel for scenarios 1 and 2 are 0.328 and 0.271 USD/L, respectively. The final price of biodiesel is 0.336 and 0.279 USD/L, respectively. In spite of more biodiesel production in scenario 1, the final price is higher

Manufacturing and Equivalent Costs
The manufacturing costs of biodiesel and bioethanol are calculated by considering the operating cost for all scenarios, and the breakdown is shown in Figure 8. The manufacturing costs of biodiesel for scenarios 1 and 2 are 0.328 and 0.271 USD/L, respectively. The final price of biodiesel is 0.336 and 0.279 USD/L, respectively. In spite of more biodiesel production in scenario 1, the final price is higher than that in scenario 2, which is due to the higher operating and total investment costs. The final price of biodiesel in the two scenarios is lower than the diesel fuel price ( Table 4). The diesel equivalent prices of biodiesel, as the main product in each scenario, are presented Table 4. This parameter in scenario 2 is lower than the diesel price; thus, this process is more economically feasible and can compete with fossil-fuel-based diesel. The manufacturing cost, final price, and gasoline-equivalent price were calculated for bioethanol in each scenario (Table 4). In the two scenarios, the gasoline equivalent price of bioethanol is more than the gasoline price. Therefore, bioethanol in Iran could not be an appropriate substitute for gasoline. The amount of ethanol produced in scenario 2 is higher than that in scenario 2.

Profitability Parameters
Considering the interest rate and money time value in the operating costs and total capital investment, discounted cash flow and the profitability parameters, i.e., profitability index, net return rate on investment, and payout period are calculated (Table 5) [33]. The payout period is the minimum time to get back the total capital investment. The minimum time is calculated for scenario 2 because of the lowest capital investment requirement and higher revenue. Net return rate is the ratio of the net present value and the present value (PV) of cumulative outflows. NRR of the two scenarios is positive, indicating the profitability of the two processes.
The relative profitability of processes was evaluated by the profitability index (PI), which is calculated by dividing the income value by the costs. The results (Table 5) show that both scenarios are profitable since the project is profitable when PI is greater than one. However, scenario 2 is more profitable, which is due to the production of higher amounts of ethanol.

Sensitivity Analysis
The effects of changes in the price of the most expensive raw materials ( Figure 5), i.e., seed, castor plant residues, methanol, and NaOH, on bioethanol and biodiesel price are presented in Figure 9. The results indicate that seed oil and methanol prices significantly affect the manufacturing price of biodiesel. For example, 13% and 23% increases in the biodiesel manufacturing cost for scenarios 1 and 2 are observable after a 50% increase in seed oil price, respectively. The next effective parameter is the methanol price. Increasing the methanol price by 50% leads to a 5% increase in the manufacturing cost of biodiesel in scenario 2. The price of plant residuals and NaOH had a direct effect on the bioethanol cost. As shown in Figure 9 A and B, by increasing the price of plant residuals and NaOH, the bioethanol manufacturing cost is increased and has a secure margin compared with the ethanol in the Iranian market. In both scenarios, bioethanol is the main byproduct. The biodiesel price is calculated by dividing the net yearly production expenses into the annual biodiesel production rate. The net yearly production expenses are calculated by subtraction of ethanol revenues from total production costs of the plant. Thus, the biodiesel manufacturing cost is decreased by increasing the ethanol production price.
The effects of bioethanol and heat prices, the main byproducts, on the biodiesel manufacturing cost are presented in Figure 10. The results indicate that there is no revenue from the byproduct by 50% increase in the byproduct price in the base cases. The price and amount of glycerol, CO2, and salts have minimal effects and do not significantly affect the process economy. Moreover, the effects of bioethanol and heat price on biodiesel price are also investigated. For both scenarios, the credit from bioethanol significantly affected the manufacturing cost of biodiesel.  The price of plant residuals and NaOH had a direct effect on the bioethanol cost. As shown in Figure 9A,B by increasing the price of plant residuals and NaOH, the bioethanol manufacturing cost is increased and has a secure margin compared with the ethanol in the Iranian market. In both scenarios, bioethanol is the main byproduct. The biodiesel price is calculated by dividing the net yearly production expenses into the annual biodiesel production rate. The net yearly production expenses are calculated by subtraction of ethanol revenues from total production costs of the plant. Thus, the biodiesel manufacturing cost is decreased by increasing the ethanol production price.
The effects of bioethanol and heat prices, the main byproducts, on the biodiesel manufacturing cost are presented in Figure 10. The results indicate that there is no revenue from the byproduct by 50% increase in the byproduct price in the base cases. The price and amount of glycerol, CO 2 , and salts have minimal effects and do not significantly affect the process economy. Moreover, the effects of bioethanol and heat price on biodiesel price are also investigated. For both scenarios, the credit from bioethanol significantly affected the manufacturing cost of biodiesel. expenses are calculated by subtraction of ethanol revenues from total production costs of the plant. Thus, the biodiesel manufacturing cost is decreased by increasing the ethanol production price.
The effects of bioethanol and heat prices, the main byproducts, on the biodiesel manufacturing cost are presented in Figure 10. The results indicate that there is no revenue from the byproduct by 50% increase in the byproduct price in the base cases. The price and amount of glycerol, CO2, and salts have minimal effects and do not significantly affect the process economy. Moreover, the effects of bioethanol and heat price on biodiesel price are also investigated. For both scenarios, the credit from bioethanol significantly affected the manufacturing cost of biodiesel. The effects of the primary feedstock (castor seeds) price on the profitability index of each scenario are investigated ( Figure 11). Increasing the seed oil price leads to decreasing the profitability The effects of the primary feedstock (castor seeds) price on the profitability index of each scenario are investigated (Figure 11). Increasing the seed oil price leads to decreasing the profitability index. By changing the price of seed oil in the range of 0-400%, the profitability index is larger than one for both scenarios, indicating a wide safe margin for PI. index. By changing the price of seed oil in the range of 0-400%, the profitability index is larger than one for both scenarios, indicating a wide safe margin for PI. Figure 11. The effects of seed oil cost on the profitability index in scenarios 1 (▲) and 2 (♦). The empty sign represents the base case values of the profitability index.

Conclusions
Using ethanol produced from the lignocellulosic waste for biodiesel production from castor oil has excellent environmental benefits. However, the results of this study showed that the production of biodiesel from the castor oil by transesterification with fossil-based methanol is more economically profitable. In other words, there is a trade-off between economic aspects of the process and environmental issues. Moreover, the sensitivity analysis performed on the price of the main product showed that the price of the primary seed oil is the most important determinant of the price of the final product. This analysis also showed that the production of ethanol has an enormous effect on the price of the final product, i.e., biodiesel.

Conclusions
Using ethanol produced from the lignocellulosic waste for biodiesel production from castor oil has excellent environmental benefits. However, the results of this study showed that the production of biodiesel from the castor oil by transesterification with fossil-based methanol is more economically profitable. In other words, there is a trade-off between economic aspects of the process and environmental issues. Moreover, the sensitivity analysis performed on the price of the main product showed that the price of the primary seed oil is the most important determinant of the price of the final product. This analysis also showed that the production of ethanol has an enormous effect on the price of the final product, i.e., biodiesel.