BioSTEAMDevelopmentGroup / Bioindustrial-Park

BioSTEAM's Premier Repository for Biorefinery Models and Results
MIT License
36 stars 17 forks source link

Consultation on product stream price #107

Closed zasddsgg closed 3 months ago

zasddsgg commented 3 months ago

Hello, may I ask you some questions about the price of the product stream? Thanks for your help.

a)The following two ways to get the price of ethanol stream seem to return different results, and it is also different from the input price (https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/blob/master/biorefineries/cellulosic/streams.py#L72-L75) when defining the ethanol stream.

from biorefineries import cellulosic
import biosteam as bst
from biorefineries.tea import create_cellulosic_ethanol_tea
cs = cellulosic.Biorefinery('corn stover ethanol')
tea=create_cellulosic_ethanol_tea(cs.cornstover_sys)
print('MESP:',
      format(tea.solve_price(cs.ethanol), '.6g'),
     'USD/kg') # return 0.691961
print(tea.sales/tea.operating_hours/cs.ethanol.F_mass)  # return 0.6932144893740898

b)Price defined in the product stream (https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/blob/master/biorefineries/cellulosic/streams.py#L72-L75) is the actual price of the product in the market, is that right? Is the price used to calculate tea.sales the price of the product when cumulative NPV is 0 or the price of the product when NPV is 0?

from biorefineries import cellulosic
import biosteam as bst
from biorefineries.tea import create_cellulosic_ethanol_tea
cs = cellulosic.Biorefinery('corn stover ethanol')
tea=create_cellulosic_ethanol_tea(cs.cornstover_sys)
print(tea.sales/tea.operating_hours)  

c)Why does function def solve_sales (https://github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/biosteam/_tea.py#L998 ) return the required additional sales? It seems that the last solution in the code seem to return actual sales, not additional sales (https://github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/biosteam/_tea.py#L1027-L1032)?

yoelcortes commented 3 months ago

Sure thing:

a) You solved for the MESP but did not set the price of ethanol. The results are consistent:

from biorefineries import cellulosic
import biosteam as bst
from biorefineries.tea import create_cellulosic_ethanol_tea
cs = cellulosic.Biorefinery('corn stover ethanol')
tea = create_cellulosic_ethanol_tea(cs.cornstover_sys)
cs.ethanol.price = tea.solve_price(cs.ethanol)
print('MESP:',
      format(cs.ethanol.price, '.6g'),
     'USD/kg') # MESP: 0.693214 USD/kg
print(tea.sales/tea.operating_hours/cs.ethanol.F_mass) # 0.693214

b) The price of ethanol varies widely, this is just an arbitrary price. NPV is always cumulative (its in its name: Net Present Value).

c) Solve sales solves for the additional sales required to achieve an NPV of 0. The local variable sales is short for additional sales (just like the function's name is solve_sales). Please try it if you would like to verify.

zasddsgg commented 3 months ago

Thank you for your suggestion. I have tried the above code, but there are still the following problems. May I ask you for them.

a) I used the same code, but the results both returned 0.691961 instead of 0.693214. I used BioSTEAM 2.43.1 and biorefineries 2.28.0. May I ask you why happens this? The code is as follows:

from biorefineries import cellulosic
import biosteam as bst
from biorefineries.tea import create_cellulosic_ethanol_tea
cs = cellulosic.Biorefinery('corn stover ethanol')
tea = create_cellulosic_ethanol_tea(cs.cornstover_sys)
cs.ethanol.price = tea.solve_price(cs.ethanol)
print('MESP:',
      format(cs.ethanol.price, '.6g'),
     'USD/kg') 
print(tea.sales/tea.operating_hours/cs.ethanol.F_mass) 

In addition, I obtained cs.ethanol.price (0.69196138861517 USD/kg) from cs.ethanol.price = tea.solve_price(cs.ethanol), then multiply by tea.operating_hours(8409.59999999999), multiply by cell Y7 in the Stream table worksheet in excel file of cellulosic_ethanol model, which is cs.ethanol.F_mass (21978.3742839534 kg/hr), The sales obtained is 127.8947643 instead of 128.126374 in the worksheet Cash flow in the excel result of cellulosic_model. May I ask you why happens this? Code and screenshot below

from biorefineries import cellulosic
import biosteam as bst
from biorefineries.tea import create_cellulosic_ethanol_tea
cs = cellulosic.Biorefinery('corn stover ethanol')
tea = create_cellulosic_ethanol_tea(cs.cornstover_sys)
cs.ethanol.price = tea.solve_price(cs.ethanol)
print(cs.ethanol.price*tea.operating_hours*cs.ethanol.F_mass/1000000) 

1

b) When defining ethanol stream through code in https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/blob/master/biorefineries/cellulosic/streams.py#L72-L75, is it OK to set any value for ethanol price, is it OK to set the price to 0, and will it affect all the results of TEA, such as NPV?

c) The worksheet Cash flow in Excel results is not only Net present value (NPV) [MM$], but also Cumulative NPV [MM$]. Therefore, when calculating MESP through tea.solve_price(cs.ethanol), is the price returned by tea.solve_price(cs.ethanol) the price of the product when cumulative NPV is 0 or the price of the product when NPV is 0? Is the price used to calculate tea.sales the price of the product when cumulative NPV is 0 or the price of the product when NPV is 0? Is the sales solved by def solve_sales the sales when cumulative NPV is 0 or the sales when NPV is 0? 2

d) Why is the Cumulative NPV in Cash flow worksheet in the cellulosic_ethanol excel result not 0 at 2036 year? 3

e) What is the difference between the additional sales returned by def solve_sales in https://github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/biosteam/_tea.py#L998 and the sales in the Cash flow worksheet in cellulosic_ethanol excel results (See below screenshot)? What is the difference between additional sales returned by def solve_sales in https://github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/biosteam/_tea.py#L998 and sales returned by tea.sales? 4