# Breakeven selling price calculation in R

Hi everyone, I am trying to calculate breakeven selling price for biojet by following the below code (below parameters have certain no, I am not providing them here):

...
irr <- r_eq (.15)
#irr <- r_eq-r_inf
CF0 <- capex0.08(1+irr)^2+capex0.6(1+irr)+capex*0.32

exp_ut <- q_waterp_water+q_elecp_elec+
q_gasp_gas+q_h2p_h2
exp <- exp_ut+q_fdp_fd+q_labp_lab #275.56
exp

sale_by <- q_dslp_dsl+q_lpgp_lpg+q_nap*p_nap

p_jet_range <- seq(0.4,1,by=0.001)

# search within [0.4,1] to find a value yielding a NPV closest to zero

bsp_jet <- 1000 #default
bsp_npv <- 1000 #default
for (p_jet in p_jet_range){
sale <- sale_by+q_jet*p_jet

# cat("revenue share for meal:",q_meal*p_meal/sale,"\n")

ebitda <- sale-exp

dep <- capex*0.8/t_dep
ebit <- ebitda-dep

amort <- amort.table(Loan=capex*debt,n=t_loan,pmt=NA,irr)[["Schedule"]]
CF1 <- as.data.frame(amort) # cash flow for Y1-10
CF1\$Depreciation <- dep

CF2 <- CF10 # cash flow for Y11-20
CF <- rbind(CF1,CF2)
CF <- cbind(Year=1:nrow(CF),CF)
CF\$EBIT <- ebit
CF\$EBT <- CF\$EBIT-CF\$`Interest Paid`
CF\$Flow <- CF\$EBT
(1-r_tax)+CF\$Depreciation-CF\$`Principal Paid`
CF\$Discount <- irr
CF\$PV <- CF\$Flow/(1+CF\$Discount)^CF\$Year
NPV <- sum(CF\$PV)-CF0
if (abs(NPV)<bsp_npv){
bsp_jet <- p_jet
bsp_npv <- abs(NPV)
}
}

bsp_jet (#this will calculate the breakeven price for jet)

...
The p_jet is fixed at .47. But every time I run this code, I get the maximum value which is 1. I have 30 cases like this where I have to calculate breakeven selling price (for each of them, parameters such as capex, q_jet, q_diesel are different) and for most of them I get 1 as breakeven selling price, for 1/2 cases, I get .7/.6. Is there something wrong with this code? does it need any sort of modifications? for example, I have fixed p_jet=.47, so I search within .4 and 1 to get NPV close to zero (from the code: p_jet_range <- seq(0.4,1,by=0.001)). But maybe there is something wrong with this code? I increased the maximum value to 10, even 1000, it gives me that maximum value after running the above code. What I mean is if I change part of this code: _jet_range <- seq(0.4,1000,by=0.001)), the resulting bsp_jet will be 1000. Does this mean that I will have a breakeven price which is infinite? or even might be larger than 1000? But in that case, how do I figure out the exact no for breakeven price?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.