def variableCostSum(components, t): # Name, q, e for each component. If c==0: calc cost from learning curve var_comp = [(name, q, e) for name, q, c, e, _ in components if c == 0] # Collections of components modelled usin ELC lcurveComps = lcurveConf() costs = [] for name, q, e in var_comp: colname = lcurveComps[name] cost_t = collectionCurve(colname, t) costs.append((cost_t, q)) return sum([c * q for c, q in costs])
def variableCostSum(components,t): # Name, q, e for each component. If c==0: calc cost from learning curve var_comp = [ (name,q,e) for name, q, c,e,_ in components if c == 0] # Collections of components modelled usin ELC lcurveComps = lcurveConf() costs = [] for name,q,e in var_comp: colname = lcurveComps[name] cost_t = collectionCurve(colname, t) costs.append((cost_t,q)) return sum([c*q for c,q in costs])
def variableCostList(components, t): var_comp = [(name, q, e, l) for name, q, c, e, l in components if c == 0] # Collections of components modelled usin ELC lcurveComps = lcurveConf() costs = {} for name, q, e, l in var_comp: costs[name] = [] colname = lcurveComps[name] for n in range(t): cost_n = collectionCurve(colname, n) costs[name].append((n, cost_n, q, l)) return costs
def variableCostList(components,t): var_comp = [ (name,q,e,l) for name, q, c,e,l in components if c == 0] # Collections of components modelled usin ELC lcurveComps = lcurveConf() costs = {} for name,q,e,l in var_comp: costs[name] =[] colname = lcurveComps[name] for n in range(t): cost_n = collectionCurve(colname, n) costs[name].append((n,cost_n,q,l)) return costs
def getCostModelResults(t): components = readConfig() curveComponents = lcurveConf() f_costs = fixedCostSum(components) m_costs = [] e_costs = [] c_sum = [] # ADD PURCHASE COST i = 0 init_cost = float(f_costs) + float(variableCostSum(components, 0)) e_cost_sum = 0 m_cost_sum = 0 total_sum = 0 m = maintenenceCost(components, yearsInHours(t)) for i in range(t): e = energyCost(components, yearsInHours(1), 0.24106) e_unit_sum = sum([c for name, c in e]) e_cost_sum += e_unit_sum e_costs.append(e_cost_sum) # print "Ecost for t="+str(i) # print e_costs m_unit_sum = sum([q * c for name, y, h, q, c in m if y == i]) # print "unit m cost sum" # print m_unit_sum m_cost_sum += m_unit_sum m_costs.append(m_cost_sum) # print "Mcost for t="+str(i) # print m_costs if i == 0: total_sum += e_unit_sum + m_unit_sum + init_cost c_sum.append(total_sum) # c_sum.append(e_costs[i] + m_costs[i] + init_cost) else: total_sum += e_unit_sum + m_unit_sum c_sum.append(total_sum) # c_sum.append(e_costs[i] + m_costs[i]) # print "Csum , ecost , mcost" # print c_sum,e_costs[i], m_costs[i],init_cost result = {'Sum': c_sum, 'Energy': e_costs, 'Maintenence': m_costs} return result
def getCostModelResults(t): components = readConfig() curveComponents = lcurveConf() f_costs = fixedCostSum(components) m_costs = [] e_costs = [] c_sum = [] # ADD PURCHASE COST i=0 init_cost = float(f_costs) + float(variableCostSum(components,0)) e_cost_sum = 0 m_cost_sum = 0 total_sum = 0 m = maintenenceCost(components,yearsInHours(t)) for i in range(t): e = energyCost(components,yearsInHours(1),0.24106) e_unit_sum = sum([c for name,c in e]) e_cost_sum += e_unit_sum e_costs.append(e_cost_sum) # print "Ecost for t="+str(i) # print e_costs m_unit_sum = sum([q*c for name,y,h,q,c in m if y==i]) # print "unit m cost sum" # print m_unit_sum m_cost_sum += m_unit_sum m_costs.append(m_cost_sum) # print "Mcost for t="+str(i) # print m_costs if i ==0: total_sum += e_unit_sum + m_unit_sum + init_cost c_sum.append(total_sum) # c_sum.append(e_costs[i] + m_costs[i] + init_cost) else: total_sum += e_unit_sum + m_unit_sum c_sum.append(total_sum) # c_sum.append(e_costs[i] + m_costs[i]) # print "Csum , ecost , mcost" # print c_sum,e_costs[i], m_costs[i],init_cost result = {'Sum':c_sum,'Energy':e_costs,'Maintenence':m_costs} return result
def maintenenceCost(components, hrs): m_data = [(name, q, c, l) for name, q, c, e, l in components] lcurveComps = lcurveConf() result = [] for name, q, c, l in m_data: ltmp = l h = 0 print "-- > " + name + "< --" print "component length: " + str(len(components)) for h in range(hrs): if h >= l: if c == 0: colname = lcurveComps[name] c = collectionCurve(colname, hoursInYears(h)) y = hoursInYears(h) print y result.append((name, y, h, q, c)) l += ltmp return result
def maintenenceCost(components,hrs): m_data = [(name,q,c,l) for name,q,c,e,l in components] lcurveComps = lcurveConf() result = [] for name,q,c,l in m_data: ltmp = l h=0 print "-- > "+name+"< --" print "component length: " + str(len(components)) for h in range(hrs): if h>=l: if c==0: colname = lcurveComps[name] c = collectionCurve(colname,hoursInYears(h)) y = hoursInYears(h) print y result.append((name,y,h,q,c)) l += ltmp return result