本文整理汇总了Python中numpy.npv函数的典型用法代码示例。如果您正苦于以下问题:Python npv函数的具体用法?Python npv怎么用?Python npv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了npv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: choose_tech
def choose_tech(VE,D,j,N,energy,prices_lamp,tt,interes):
method=strategy(VE[j,2])
#returns the strategy to use over the different profiles
#(1)rational, (2) social, (3) conservative
#Rational method
if method==1: #180 hours of consume in average per month
cost=np.zeros((3,139)) #Payments over time of the different techs
cost_present=np.zeros(3) #Total present cost
#Analysis of energy consume
for i in range(139):
if VE[j,3]==1:
cost[0,i]=(-40*180/100)*energy[i+tt]*0.8
cost[1,i]=(-15*180/100)*energy[i+tt]*0.8
cost[2,i]=(-9*180/100)*energy[i+tt]*0.8
elif VE[j,3]==2:
cost[0,i]=(-40*180/100)*energy[i+tt]*1.2
cost[1,i]=(-15*180/100)*energy[i+tt]*1.2
cost[2,i]=(-9*180/100)*energy[i+tt]*1.2
#LED lamp cost
cost[2,0]=cost[2,0]-prices_lamp[2,tt]
#Fluorescent lamp cost (1:36:139)
for i in range(0,138,36):
cost[1,i]=cost[1,i]-prices_lamp[1,tt+i]
#Incandescent lamp cost (i=1:4:139)
for i in range(0,138,4):
cost[0,i]=cost[0,i]-prices_lamp[0,tt+i]
#Cost in present value
cost_present[0]=-np.npv(interes,cost[0,:])
cost_present[1]=-np.npv(interes,cost[1,:])
cost_present[2]=-np.npv(interes,cost[2,:])
#Selection of the best npv performance
tech=cost_present.argmin()
tech=tech+1
#Conservative method
if method==3:
tech=VE[j,0]
#Social method
if method==2:
S_t=np.zeros(3) #Counter of technologies in vicinity
D_N=D.neighbors(j) #Returns the list of neighbors
D_N_len=len(D_N) #Dimension of neighbors list
for k in range(D_N_len): #Iteration of evaluation
S_t[VE[D_N[k],0]-1]=S_t[VE[D_N[k],0]-1]+1
tech=S_t.argmax()+1
return(tech)
示例2: outputRow
def outputRow():
#NOTE: The fields of the db row, such a loan_id, are no longer available when this is called.
discountRate = principalDiscountRates[finalStatus]
numeratorNARdiscount = prev_balance_end * discountRate
cashflowLen = len(cashflow)
while cashflow[cashflowLen-1]==0: cashflowLen -= 1
cashflow.resize(max(cashflowLen, receivedMonthIndex+1))
npv = np.npv(monthlyDiscountRate-1, cashflow)
if printCashflow: print(cashflow)
if finalStatus != 'Charged Off':
cashflow[receivedMonthIndex] += prev_balance_end * (1-discountRate) / prev_investment
if printCashflow: print(cashflow)
npvForecast = np.npv(monthlyDiscountRate-1, cashflow)
irrForecast = (1+np.irr(cashflow))**12 - 1
finalStatusIsComplete = finalStatus in ["Charged Off", "Default", "Fully Paid"]
output.append((
prev_loan_id,
finalStatus,
prev_mob,
missedPayment,
firstMissed,
dueWhenFirstMissed,
receivedAfterMissed,
riskFreeRate,
npv,
npvForecast,
firstMissedOrLastObserved,
(numeratorNAR-numeratorNARdiscount)/prev_investment,
denominatorNAR/prev_investment,
finalStatusIsComplete,
irrForecast,
#cashflow
))
示例3: net_present_value_aggregate_for_portfolio
def net_present_value_aggregate_for_portfolio(self):
""" Gets the portfolio's aggregate net present value.
Returns: The portfolio's aggregate net present value.
"""
npv = np.npv(self.discount_rate / 12, list(self.aggregate_flows_df['total_payments']))
return float(npv)
示例4: net_present_value_for_loan
def net_present_value_for_loan(self, loan):
""" Calculates a loan's net present value from its cash flows.
Args:
loan: The loan which is being valued.
Returns: The net present value of the loan.
"""
cash_flows = self.cash_flows_df[self.cash_flows_df['loan_df_pk'] == loan.name]
npv = np.npv(self.discount_rate / 12, cash_flows['total_payments'])
return npv
示例5: create_company_simulation
def create_company_simulation(simulation_id, stock_id):
getcontext().prec = 4
mu = 0.02
sigma = 0.1
simulation = Simulation.objects.get(pk=simulation_id)
stock = Stock.objects.get(pk=stock_id)
ticker = Ticker.objects.get(simulation=simulation)
company = TickerCompany(ticker=ticker, stock=stock, symbol=stock.symbol, name="Company %s" % stock.symbol)
company.save()
rounds = ticker.nb_rounds + 1
brownian_motion = geometric_brownian(rounds, mu, sigma, ticker.initial_value, rounds/(ticker.nb_days*rounds), stock_id)
i = 0
simulation_dividends = []
simulation_net_income = []
for sim_round in range(0, rounds):
round_dividend = 0
round_net_income = 0
for sim_day in range(1, ticker.nb_days+1):
# We have each round/day and the corresponding dividend
daily_dividend = brownian_motion[i]
daily_net_income = brownian_motion[i] / float(ticker.dividend_payoff_rate) * 100 * stock.quantity
c = CompanyFinancial(company=company, daily_dividend=Decimal(daily_dividend), daily_net_income=Decimal(daily_net_income),
sim_round=sim_round, sim_day=sim_day, sim_date=sim_round*100+sim_day)
c.save()
round_dividend += daily_dividend
round_net_income += daily_net_income
i += 1
simulation_dividends.append(round_dividend)
simulation_net_income.append(round_net_income)
# Share price estimation
G = simulation_dividends[-1]/simulation_dividends[-2]-1
R = 0.15
g = R
drift = 0
simulation_stock_price = []
previous_company_income = None
for sim_round in range(0, rounds):
stock_price = np.npv(0.15, simulation_dividends[sim_round:rounds]) + (simulation_dividends[-1]*(1+g)/(R-G))/np.power(1+R, rounds-sim_round)
simulation_stock_price.append(stock_price)
if previous_company_income:
drift = simulation_net_income[sim_round] / float(previous_company_income.net_income) - 1
previous_company_income.drift = Decimal(drift)
previous_company_income.save()
company_share = CompanyShare(company=company, share_value=Decimal(stock_price), dividends=Decimal(simulation_dividends[sim_round]),
net_income=Decimal(simulation_net_income[sim_round]), drift=Decimal(drift), sim_round=sim_round)
company_share.save()
previous_company_income = company_share
if sim_round == 0:
stock.price = Decimal(stock_price)
stock.save()
return company.id
示例6: metrics
def metrics(price, percentDown, closingCosts,repairCosts,rate,term,fedTaxRate,stTaxRate,capitalGains,propTaxRate,insPremiumYr, HOA,hoaIncRate, repairsYr, vacancyPc, propMgmtMo, rent, rentIncRate,appreciationRate, inflation,bldgValPct,sellYear):
years = linspace(0, term, term+1)
cashflowND = [0]*len(years)
for year in years:
y = int(year)
if y <= sellYear:
payment, downPayment, cashToClose, cashToOperate = loanCalcs(price, percentDown, closingCosts, repairCosts, rate, term)
equity, mortBal, appVal, interestYr = equityCalcs(y, price, downPayment, payment, rate, appreciationRate)
capex = capexF(y, sellYear, repairsYr, cashToOperate, appVal, price)
revenue, vacancy = revenueF(rent, rentIncRate, vacancyPc, y)
opexTotal, opexLessDS, deductibles = opexF(payment, propTaxRate, insPremiumYr, HOA, hoaIncRate, propMgmtMo, price, y, interestYr, vacancy)
NOI = NOIF(revenue, opexLessDS)
if y is 1:
NOI1=NOI
deductions = deductionsF(deductibles, price, bldgValPct)
taxes = taxesF(price, appVal, revenue, deductions, capex, fedTaxRate, stTaxRate, capitalGains, y, sellYear)
cashflowND[y] = cashflowATF(revenue, opexTotal, taxes, capex, equity, y, sellYear)
capRateYr1 = price/NOI1
NFV = sum(cashflowND)
PV10 = npv(.1,cashflowND)
ROR = irr(cashflowND)
cashPayout = payoutCalc(cashflowND, cashToOperate)
cashOnCashYr1 = cashToOperate/cashflowND[1]
moCashflowYr1 = cashflowND[1]/12.
metricsDict = {
"NFV" : NFV,
"PV10" : PV10,
"ROR" : ROR,
"capRateYr1" : capRateYr1,
"cashPayout" : cashPayout,
"cashOnCashYr1" : cashOnCashYr1,
"moCashflowYr1" : moCashflowYr1,
"cashToClose" : cashToClose,
"cashToOperate" : cashToOperate,
}
# print "NFV = $%s" %"{:,}".format(int(NFV))
# print "PV10 = $%s" %"{:,}".format(int(PV10))
# print "IRR = %s" %round(ROR*100,2) + '%'
# print "Cash payout occurs in year %s" %cashPayout
# print "Cash on cash return in year 1 = %s" %int(cashOnCashYr1)+'%'
# print "Monthly cashflow in year 1 = $%s" % int(moCashflowYr1)
#return NFV, PV10, ROR, capRateYr1, cashPayout, cashOnCashYr1, moCashflowYr1, cashToClose, cashToOperate
return metricsDict
示例7: mirr
def mirr(values, finance_rate, reinvest_rate):
"""
Modified internal rate of return.
Parameters
----------
values : array_like
Cash flows (must contain at least one positive and one negative value)
or nan is returned.
finance_rate : scalar
Interest rate paid on the cash flows
reinvest_rate : scalar
Interest rate received on the cash flows upon reinvestment
Returns
-------
out : float
Modified internal rate of return
"""
values = np.asarray(values)
initial = values[0]
values = values[1:]
n = values.size
pos = values * (values>0)
neg = values * (values<0)
if not (pos.size > 0 and neg.size > 0):
return np.nan
numer = np.abs(np.npv(reinvest_rate, pos))
denom = np.abs(np.npv(finance_rate, neg))
if initial>0:
return ((initial + numer) / denom)**(1.0/n)*(1+reinvest_rate) - 1
else:
return ((numer / (-initial + denom)))**(1.0/n)*(1+reinvest_rate) - 1
示例8: eq_subvention
def eq_subvention(montant, duree, taux):
""" Calcule l' "équivalent subvention" par rapport à un taux 0%
pour chacune des différentes combinaisons d'hypothèses possibles"""
# RAZ des résultats
equivalent_subvention = np.zeros((len(montant), len(duree), len(taux)))
part_subventionee = np.zeros((len(montant), len(duree), len(taux)))
# Calcule de l' "équivalent subvention"
for i in range(len(montant)):
for j in range(len(duree)):
# Périodicité des remboursements
per = np.arange(duree[j]) + 1
for k in range(len(taux)):
# Calcule l'échancier des intérêts perçus
echeancier_interets = -np.ipmt(taux[k], per, duree[j], montant[i])
# Calcule et enregistre l' "équivalent subvention" comparé
# à un taux 0 pour le jeu d'hypothèses considéré, les flux
# d'intérêt étant actualisés à 4%
equivalent_subvention[i, j, k] = np.npv(0.04, echeancier_interets)
# ou alternativemen, sans actualiser:
# equivalent_subvention[i,j,k]=np.sum(echeancier_interets)
part_subventionee[i, j, k] = (equivalent_subvention[i, j, k] / montant[i]) * 100
return equivalent_subvention, part_subventionee
示例9: calc_npv
def calc_npv(r, ubi, inputs, n):
x = np.zeros((ubi['Years Post Transfer'], n))
y = np.zeros((ubi['Years Post Transfer'], n))
# iterate through years of benefits
for j in range(1, ubi['Years Post Transfer'] + 1):
# sum benefits during program
if(j < r):
x[j - 1] += ubi['Expected baseline per capita consumption (nominal USD)']* \
np.power((1.0 + inputs['UBI']['Expected annual consumption increase (without the UBI program)']), float(j))* \
inputs['UBI']['Work participation adjustment'] + \
ubi['Annual quantity of transfer money used for immediate consumtion (pre-discounting)']
# benefits after program
else:
x[j - 1] += ubi['Expected baseline per capita consumption (nominal USD)']* \
np.power((1.0 + inputs['UBI']['Expected annual consumption increase (without the UBI program)']), float(j))
# investments calculations
for k in range(n):
if(j < r + inputs['UBI']['Duration of investment benefits (in years) - UBI'][k]):
x[j - 1][k] += ubi['Annual return for each year of transfer investments (pre-discounting)'][k]* \
np.min([j, inputs['UBI']['Duration of investment benefits (in years) - UBI'][k], \
r, (inputs['UBI']['Duration of investment benefits (in years) - UBI'][k] + r - j)])
if(j > r):
x[j - 1][k] += ubi['Value eventually returned from one years investment (pre-discounting)'][k]
# log transform and subtact baseline
y[j - 1] = np.log(x[j - 1])
y[j - 1] -= np.log(ubi['Expected baseline per capita consumption (nominal USD)']* \
np.power((1.0 + inputs['UBI']['Expected annual consumption increase (without the UBI program)']), float(j)))
# npv on yearly data
z = np.zeros(n)
for i in range(n):
z[i] = np.npv(inputs['Shared']['Discount rate'][i], y[:, i])
return z
示例10: print
import numpy as np
cashflows = [-45.45, 50]
npv = np.npv(0.1, cashflows)
print(round(50 / (1 + 0.1), 2))
print(round(npv, 2))
示例11: sum
energySaleChange = sum(energySaleDRyear) - sum(energySaleArray)
peakDemandRed = PeakDemandCharge - PeakDemandChargeDR
# Calculating the Purchase Cost, Operation and Maint. Cost and Total Cost
outData["AnnualOpCost"] = [- AnnDROM for x in lifeYears[0:]]
LifetimeOperationCost = (sum(outData["AnnualOpCost"]))
outData["LifetimeOperationCost"] = abs(LifetimeOperationCost)
outData["lifePurchaseCosts"] = [-1.0 * DrTechCost] + [0 for x in lifeYears[1:]]
outData["TotalCost"] = abs(outData["LifetimeOperationCost"] + DrTechCost)
# Outputs of the Program Lifetime Cash Flow figure
outData["EnergySaleChangeBenefit"] = [energySaleChange * ScalingAnnual ** x for x in range(lifeSpan)]
outData["PeakDemandReduction"] = [peakDemandRed * ScalingAnnual ** x for x in range(lifeSpan)]
BenefitCurve = [x+y for x,y in zip(outData["EnergySaleChangeBenefit"], outData["PeakDemandReduction"])]
outData["TotalBenefit"] = sum(BenefitCurve)
outData["BenefittoCostRatio"] = float(outData["TotalBenefit"] / outData["TotalCost"])
netBenefit = [x+y+z for x,y,z in zip(outData["AnnualOpCost"],outData["lifePurchaseCosts"],BenefitCurve)]
outData["npv"] = npv(DiscountRate, netBenefit)
outData["cumulativeNetBenefit"] = [sum(netBenefit[0:i+1]) for i,d in enumerate(netBenefit)]
outData["SimplePaybackPeriod"] = DrTechCost / (outData["TotalBenefit"] / lifeSpan)
# Stdout/stderr.
outData["stdout"] = "Success"
outData["stderr"] = ""
# Write the output.
with open(pJoin(modelDir,"allOutputData.json"),"w") as outFile:
json.dump(outData, outFile, indent=4)
# Update the runTime in the input file.
endTime = datetime.datetime.now()
inputDict["runTime"] = str(datetime.timedelta(seconds=int((endTime - startTime).total_seconds())))
with open(pJoin(modelDir,"allInputData.json"),"w") as inFile:
json.dump(inputDict, inFile, indent=4)
except:
# If input range wasn't valid delete output, write error to disk.
示例12: value_can_afford
def value_can_afford(monthly_payment):
# this is a 10 year average freddie mac interest rate
ten_year_average_interest = .055
return np.npv(ten_year_average_interest/12, [monthly_payment]*30*12)
示例13: work
def work(modelDir, inputDict):
''' Run the model in its directory.'''
if inputDict['dispatch_type'] == 'prediction':
return workForecast(modelDir, inputDict)
out = {}
try:
with open(pJoin(modelDir, 'demand.csv'), 'w') as f:
f.write(inputDict['demandCurve'].replace('\r', ''))
with open(pJoin(modelDir, 'demand.csv')) as f:
demand = [float(r[0]) for r in csv.reader(f)]
assert len(demand) == 8760
with open(pJoin(modelDir, 'temp.csv'), 'w') as f:
lines = inputDict['tempCurve'].split('\n')
out["tempData"] = [float(x) if x != '999.0' else float(inputDict['setpoint']) for x in lines[:-1]]
correctData = [x+'\n' if x != '999.0' else inputDict['setpoint']+'\n' for x in lines][:-1]
f.write(''.join(correctData))
assert len(correctData) == 8760
except:
raise Exception("CSV file is incorrect format. Please see valid format "
"definition at <a target='_blank' href = 'https://github.com/dpinney/"
"omf/wiki/Models-~-storagePeakShave#demand-file-csv-format'>\nOMF Wiki "
"storagePeakShave - Demand File CSV Format</a>")
# # created using calendar = {'1': 31, '2': 28, ..., '12': 31}
# m = [calendar[key]*24 for key in calendar]
# monthHours = [(sum(m[:i]), sum(m[:i+1])) for i, _ in enumerate(m)]
monthHours = [(0, 744), (744, 1416), (1416, 2160), (2160, 2880),
(2880, 3624), (3624, 4344), (4344, 5088), (5088, 5832),
(5832, 6552), (6552, 7296), (7296, 8016), (8016, 8760)]
P_lower, P_upper, E_UL = pyVbat(modelDir, inputDict)
P_lower, P_upper, E_UL = list(P_lower), list(P_upper), list(E_UL)
out["minPowerSeries"] = [-1*x for x in P_lower]
out["maxPowerSeries"] = P_upper
out["minEnergySeries"] = [-1*x for x in E_UL]
out["maxEnergySeries"] = E_UL
VBpower, out["VBenergy"] = pulpFunc(inputDict, demand, P_lower, P_upper, E_UL, monthHours)
out["VBpower"] = VBpower
out["dispatch_number"] = [len([p for p in VBpower[s:f] if p != 0]) for (s, f) in monthHours]
peakDemand = [max(demand[s:f]) for s, f in monthHours]
energyMonthly = [sum(demand[s:f]) for s, f in monthHours]
demandAdj = [d+p for d, p in zip(demand, out["VBpower"])]
peakAdjustedDemand = [max(demandAdj[s:f]) for s, f in monthHours]
energyAdjustedMonthly = [sum(demandAdj[s:f]) for s, f in monthHours]
rms = all([x == 0 for x in P_lower]) and all([x == 0 for x in P_upper])
out["dataCheck"] = 'VBAT returns no values for your inputs' if rms else ''
out["demand"] = demand
out["peakDemand"] = peakDemand
out["energyMonthly"] = energyMonthly
out["demandAdjusted"] = demandAdj
out["peakAdjustedDemand"] = peakAdjustedDemand
out["energyAdjustedMonthly"] = energyAdjustedMonthly
cellCost = float(inputDict["unitDeviceCost"])*float(inputDict["number_devices"])
eCost = float(inputDict["electricityCost"])
dCharge = float(inputDict["demandChargeCost"])
out["VBdispatch"] = [dal-d for dal, d in zip(demandAdj, demand)]
out["energyCost"] = [em*eCost for em in energyMonthly]
out["energyCostAdjusted"] = [eam*eCost for eam in energyAdjustedMonthly]
out["demandCharge"] = [peak*dCharge for peak in peakDemand]
out["demandChargeAdjusted"] = [pad*dCharge for pad in out["peakAdjustedDemand"]]
out["totalCost"] = [ec+dcm for ec, dcm in zip(out["energyCost"], out["demandCharge"])]
out["totalCostAdjusted"] = [eca+dca for eca, dca in zip(out["energyCostAdjusted"], out["demandChargeAdjusted"])]
out["savings"] = [tot-tota for tot, tota in zip(out["totalCost"], out["totalCostAdjusted"])]
annualEarnings = sum(out["savings"]) - float(inputDict["unitUpkeepCost"])*float(inputDict["number_devices"])
cashFlowList = [annualEarnings] * int(inputDict["projectionLength"])
cashFlowList.insert(0, -1*cellCost)
out["NPV"] = npv(float(inputDict["discountRate"])/100, cashFlowList)
out["SPP"] = cellCost / annualEarnings
out["netCashflow"] = cashFlowList
out["cumulativeCashflow"] = [sum(cashFlowList[:i+1]) for i, d in enumerate(cashFlowList)]
out["stdout"] = "Success"
return out
示例14: workForecast
#.........这里部分代码省略.........
dailyPl = [P_lower[i:i+24] for i in range(0, len(P_lower), 24)]
dailyPu = [P_upper[i:i+24] for i in range(0, len(P_upper), 24)]
dailyEu = [E_UL[i:i+24] for i in range(0, len(E_UL), 24)]
vbp, vbe = [], []
dispatched_d = [False]*365
# Decide what days to dispatch
zipped = zip(dailyLoadPredictions, df['month'][-8760:], dailyPl, dailyPu, dailyEu)
for i, (load, m, pl, pu, eu) in enumerate(zipped):
peak = max(load)
if fc.shouldDispatchPS(peak, m, df, float(ind['confidence'])/100):
dispatched_d[i] = True
p, e = fc.pulp24hrVbat(ind, load, pl, pu, eu)
vbp.extend(p)
vbe.extend(e)
else:
vbp.extend([0]*24)
vbe.extend([0]*24)
### TESTING FOR ACCURACY ###
assert len(dailyPl) == 365
assert all([len(i) == 24 for i in dailyPl])
VB_power, VB_energy = vbp, vbe
# -------------------- MODEL ACCURACY ANALYSIS -------------------------- #
o['predictedLoad'] = list(clf.predict(X_test))
o['trainAccuracy'] = round(clf.score(X_train, y_train) * 100, 2)
o['testAccuracy'] = round(clf.score(X_test, y_test) * 100, 2)
# PRECISION AND RECALL
maxDays = []
for month in range(1, 13):
test = df[df['month'] == month]
maxDays.append(test.loc[test['load'].idxmax()]['dayOfYear'])
shouldHaveDispatched = [False]*365
for day in maxDays:
shouldHaveDispatched[day] = True
truePositive = len([b for b in [i and j for (i, j) in zip(dispatched_d, shouldHaveDispatched)] if b])
falsePositive = len([b for b in [i and (not j) for (i, j) in zip(dispatched_d, shouldHaveDispatched)] if b])
falseNegative = len([b for b in [(not i) and j for (i, j) in zip(dispatched_d, shouldHaveDispatched)] if b])
o['confidence'] = ind['confidence']
o['precision'] = round(truePositive / float(truePositive + falsePositive) * 100, 2)
o['recall'] = round(truePositive / float(truePositive + falseNegative) * 100, 2)
o['number_of_dispatches'] = len([i for i in dispatched_d if i])
o['MAE'] = round(sum([abs(l-m)/m*100 for l, m in zip(predictions, list(y_test))])/8760., 2)
# ---------------------- FINANCIAL ANALYSIS ----------------------------- #
o['VBpower'], o['VBenergy'] = list(VB_power), list(VB_energy)
# Calculate monthHours
year = df[-8760:].copy()
year.reset_index(inplace=True)
year['hour'] = list(year.index)
start = list(year.groupby('month').first()['hour'])
finish = list(year.groupby('month').last()['hour'])
monthHours = [(s, f+1) for (s, f) in zip(start, finish)]
demand = list(y_test)
peakDemand = [max(demand[s:f]) for s, f in monthHours]
energyMonthly = [sum(demand[s:f]) for s, f in monthHours]
demandAdj = [d+p for d, p in zip(demand, o['VBpower'])]
peakAdjustedDemand = [max(demandAdj[s:f]) for s, f in monthHours]
energyAdjustedMonthly = [sum(demandAdj[s:f]) for s, f in monthHours]
o['demand'] = demand
o['peakDemand'] = peakDemand
o['energyMonthly'] = energyMonthly
o['demandAdjusted'] = demandAdj
o['peakAdjustedDemand'] = peakAdjustedDemand
o['energyAdjustedMonthly'] = energyAdjustedMonthly
cellCost = float(ind['unitDeviceCost'])*float(ind['number_devices'])
eCost = float(ind['electricityCost'])
dCharge = float(ind['demandChargeCost'])
o['VBdispatch'] = [dal-d for dal, d in zip(demandAdj, demand)]
o['energyCost'] = [em*eCost for em in energyMonthly]
o['energyCostAdjusted'] = [eam*eCost for eam in energyAdjustedMonthly]
o['demandCharge'] = [peak*dCharge for peak in peakDemand]
o['demandChargeAdjusted'] = [pad*dCharge for pad in o['peakAdjustedDemand']]
o['totalCost'] = [ec+dcm for ec, dcm in zip(o['energyCost'], o['demandCharge'])]
o['totalCostAdjusted'] = [eca+dca for eca, dca in zip(o['energyCostAdjusted'], o['demandChargeAdjusted'])]
o['savings'] = [tot-tota for tot, tota in zip(o['totalCost'], o['totalCostAdjusted'])]
annualEarnings = sum(o['savings']) - float(ind['unitUpkeepCost'])*float(ind['number_devices'])
cashFlowList = [annualEarnings] * int(ind['projectionLength'])
cashFlowList.insert(0, -1*cellCost)
o['NPV'] = np.npv(float(ind['discountRate'])/100, cashFlowList)
o['SPP'] = cellCost / annualEarnings
o['netCashflow'] = cashFlowList
o['cumulativeCashflow'] = [sum(cashFlowList[:i+1]) for i, d in enumerate(cashFlowList)]
o['stdout'] = 'Success'
return o
示例15: taxEquityFlip
#.........这里部分代码省略.........
for i in range(1, len(SPERevenueTE) + 1):
SPEMgmtFeeTE.append(-managementFee *
math.pow((1 + .01), (i - 1)))
EBITDATE.append(float(SPERevenueTE[
i - 1]) + float(OMTE[i - 1]) + float(insuranceTE[i - 1]) + float(SPEMgmtFeeTE[i - 1]))
if (i <= 6):
cashFromSPEToBlockerTE.append(float(EBITDATE[i - 1]) * .01)
else:
cashFromSPEToBlockerTE.append(0)
EBITDATEREDUCED.append(EBITDATE[i - 1])
# Output Tax Equity Flip [I]
# TEI Calcs [Y21]
cashRevenueTE = -totalCost * (1 - 0.53)
buyoutAmountTE = 0
for i in range(1, len(EBITDATEREDUCED) + 1):
buyoutAmountTE = buyoutAmountTE + \
EBITDATEREDUCED[i - 1] / (math.pow(1 + 0.12, i))
buyoutAmountTE = buyoutAmountTE * 0.05
cashFromBlockerTE = - (buyoutAmountTE) + 0.0725 * cashRevenueTE
# Output Tax Equity Flip [K] [L]
for i in range(1, len(allYearGenerationMWh) + 1):
if (i == 6):
netCoopPaymentsTaxEquity.append(financeCostCashTaxEquity + cashToSPEOForPPATE[
i - 1] + cashFromSPEToBlockerTE[i - 1] + OMInsuranceETCTE[i - 1] + cashFromBlockerTE)
else:
netCoopPaymentsTaxEquity.append(financeCostCashTaxEquity + cashFromSPEToBlockerTE[
i - 1] + cashToSPEOForPPATE[i - 1] + OMInsuranceETCTE[i - 1])
costToCustomerTaxEquity.append(
netCoopPaymentsTaxEquity[i - 1] - distAdderTaxEquity[i - 1])
# Output Tax Equity Flip [L37]
NPVLoanTaxEquity = npv(
float(inputDict.get("discRate", 0)) / 100, [0, 0] + costToCustomerTaxEquity)
# Output - Tax Equity [F42]
Rate_Levelized_TaxEquity = - \
NPVLoanTaxEquity / NPVallYearGenerationMWh
# TEI Calcs - Achieved Return [AW 21]
#[AK]
MACRDepreciation = []
MACRDepreciation.append(-0.99 * 0.2 *
(totalCost - totalCost * 0.5 * 0.9822 * 0.3))
MACRDepreciation.append(-0.99 * 0.32 *
(totalCost - totalCost * 0.5 * 0.9822 * 0.3))
MACRDepreciation.append(-0.99 * 0.192 *
(totalCost - totalCost * 0.5 * 0.9822 * 0.3))
MACRDepreciation.append(-0.99 * 0.1152 *
(totalCost - totalCost * 0.5 * 0.9822 * 0.3))
MACRDepreciation.append(-0.99 * 0.1152 *
(totalCost - totalCost * 0.5 * 0.9822 * 0.3))
MACRDepreciation.append(-0.99 * 0.0576 *
(totalCost - totalCost * 0.5 * 0.9822 * 0.3))
#[AI] [AL] [AN]
cashRevenueTEI = [] # [AI]
slDepreciation = [] # [AL]
totalDistributions = [] # [AN]
cashRevenueTEI.append(-totalCost * 0.53)
for i in range(1, 7):
cashRevenueTEI.append(EBITDATE[i - 1] * 0.99)
slDepreciation.append(totalCost / 25)
totalDistributions.append(-cashRevenueTEI[i])
#[AJ]
ITC = totalCost * 0.9822 * 0.3 * 0.99