from quantities import year, markup markup.config.use_unicode = False building = Building.objects.get(pk='O03') standards = Standard.objects.filter(name__in=('2007', 'LEC')) locations = Location.objects.filter(representative=True) years = ((10 * year), (25 * year), (40 * year)) for location in Location.objects.filter(name='Anchorage'): for standard in standards: for year in years: file = open(os.path.join('scripts', 'output', '%s-%s-%s-%s.txt' % ( building.pk, location.name, standard.name, year.item())), 'w') r = Results(building, standard, location, year, '0.03') print >> file, 'Lifecycle:', price(r.lifecycle.cost()) print >> file, 'Investment:', price(r.investment.cost()) print >> file, '---------------------------------------------' ########################### # First print >> file, 'First Costs:', price(r.first.cost()) print >> file, '\tDelta Energy Efficiency:', price(r.energy_efficiency.delta()) print >> file, '\tBuilding Subtotal:', price(r.first.index(r.building.subtotal, 'weighted-average')) ########################### # Components print >> file, '\tComponent:', price(r.components.cost()) print >> file, '\t\tInsulation:', price(r.components.insulation.cost())
from results import Results from quantities import year, markup markup.config.use_unicode = False building = Building.objects.get(pk='O03') standards = Standard.objects.filter(name__in=('2007', 'LEC')) locations = Location.objects.filter(representative=True) years = ((10 * year), (25 * year), (40 * year)) for location in Location.objects.filter(name='Anchorage'): for standard in standards: for year in years: file = open( os.path.join( 'scripts', 'output', '%s-%s-%s-%s.txt' % (building.pk, location.name, standard.name, year.item())), 'w') r = Results(building, standard, location, year, '0.03') print >> file, 'Lifecycle:', price(r.lifecycle.cost()) print >> file, 'Investment:', price(r.investment.cost()) print >> file, '---------------------------------------------' ########################### # First print >> file, 'First Costs:', price(r.first.cost()) print >> file, '\tDelta Energy Efficiency:', price( r.energy_efficiency.delta()) print >> file, '\tBuilding Subtotal:', price( r.first.index(r.building.subtotal, 'weighted-average')) ###########################
'Electricity BTU/yr', )) exceptions = [] for building in buildings: for location in locations: for standard in standards: for year in periods: try: r = Results(building, standard, location, year, 0.03) print >> file, ','.join( map(str, ( building.type, location.name, location.state, year.item(), standard.name, r.lifecycle.cost(), r.energy_efficiency.cost(), r.energy.cost(), r.energy.use(), r.energy.fuel('Gas').use, r.energy.fuel('Electric').use, ))) print building, location, standard, year except Exception as e: exceptions.append(e) file.close() errors = open(path.join('scripts', 'errors.txt'), 'w') print >> errors, '\n'.join(exceptions) errors.close()
from locations.models import Location from standards.models import Standard from structures.models import Building from results.templatetags.comparison import delta, percent, airr from results.comparison import Comparison from quantities import year building = Building.objects.get(pk='O03') locations = Location.objects.filter(representative=True) years = ((10 * year), (25 * year), (40 * year)) file = open('deltas.csv', 'w') print >> file, ','.join(('Study Length', 'Location', '% Reduction LCC', '% Reduction Energy', 'AIRR')) for location in locations: for year in years: standards = Standard.objects.filter(name__in=('2007', 'LEC')) c = Comparison(standards, building, location, year, '0.03') baseline = c.baseline() for results in c.rest(): plc = percent(results.lifecycle.cost(), baseline.lifecycle.cost()) pe = percent(results.energy.use(), baseline.energy.use()) print >> file, ','.join( map(str, (year.item(), location.name, plc, pe, results.airr(baseline)))) print location, year file.write('\n') file.close()
'Gas BTU/yr', 'Electricity BTU/yr', )) exceptions = [] for building in buildings: for location in locations: for standard in standards: for year in periods: try: r = Results(building, standard, location, year, 0.03) print >> file, ','.join(map(str, ( building.type, location.name, location.state, year.item(), standard.name, r.lifecycle.cost(), r.energy_efficiency.cost(), r.energy.cost(), r.energy.use(), r.energy.fuel('Gas').use, r.energy.fuel('Electric').use, ))) print building, location, standard, year except Exception as e: exceptions.append(e) file.close() errors = open(path.join('scripts', 'errors.txt'), 'w') print >> errors, '\n'.join(exceptions) errors.close()