Data Analysis for Engineers/Module 1

Module 1 · Section 10 of 10

Mini-Project 1: Equipment Energy & Cost Analyzer

Objective: Build a Python function that computes monthly energy use for a piece of equipment, then apply it across a facility's load list to produce a ranked cost table and identify the biggest saving opportunity.

Brief

Every engineering facility - a building, a plant, a production line, a data centre - runs on electricity that shows up as a monthly bill. You are given a list of loads, each as (name, rated_power_kW, hours_per_day, quantity). For each load, compute the monthly energy (assume a 30-day month) and the monthly cost at a tariff of PHP 11.50 / kWh, then rank the loads by consumption and report each one's share of the total.

monthly_kWh = power_kW * hours_per_day * quantity * 30
monthly_cost = monthly_kWh * tariff

Starter Code

# Mini-Project 1 - starter code

TARIFF_PHP_PER_KWH = 11.50      # electricity price (all-caps by convention = a fixed constant)

# Each load: (name, rated power kW, hours run per day, number of identical units)
loads = [
    ("HVAC chillers",   45.0, 10, 2),
    ("Air compressors", 22.0, 8,  3),
    ("Lighting (LED)",   0.06, 12, 400),
    ("Process pumps",    7.5, 16, 6),
    ("Office / servers", 6.0, 24, 1),
]


def monthly_energy_kwh(power_kW, hours_per_day, quantity, days=30):
    """Energy (kWh) used per 30-day month by `quantity` identical units."""
    return power_kW * hours_per_day * quantity * days


# Build a list of {name, kwh, php} dicts, one per load
rows = []
for name, p, h, q in loads:                          # unpack each 4-tuple
    e = monthly_energy_kwh(p, h, q)
    rows.append({"name": name, "kwh": e, "php": e * TARIFF_PHP_PER_KWH})

total_kwh = sum(r["kwh"] for r in rows)
# sort by kwh, biggest first (key = what to sort on; reverse=True = descending)
rows.sort(key=lambda r: r["kwh"], reverse=True)

# formatted table: {:<20} left-align; {:>12,.0f} right-align + thousands + 0 dp
print(f"{'Equipment':<20}{'kWh/mo':>12}{'PHP/mo':>14}{'Share':>9}")
for r in rows:
    print(f"{r['name']:<20}{r['kwh']:>12,.0f}{r['php']:>14,.0f}{r['kwh'] / total_kwh:>8.1%}")
print(f"{'TOTAL':<20}{total_kwh:>12,.0f}{total_kwh * TARIFF_PHP_PER_KWH:>14,.0f}")

Expected output:

Equipment                 kWh/mo        PHP/mo    Share
HVAC chillers             27,000       310,500   34.9%
Process pumps             21,600       248,400   27.9%
Air compressors           15,840       182,160   20.5%
Lighting (LED)             8,640        99,360   11.2%
Office / servers           4,320        49,680    5.6%
TOTAL                     77,400       890,100

Deliverable Checklist

  • monthly_energy_kwh() is defined and documented with a docstring
  • Function is tested against at least one hand-calculated value
  • Output table shows all loads with monthly kWh, cost, and share of the total
  • Brief written comment (2-3 sentences) identifying the largest saving opportunity and a rough estimate of the peso impact of a 10% improvement there

Grading Rubric

CriterionPoints
Function correctly implements the formula40
Function has clear parameter names and docstring15
Output table correctly formatted and ranked25
Written interpretation of results20
Total100

Use the cell below to write your final submission, including your written interpretation as a comment or a markdown cell.

# Your Mini-Project 1 submission

10 / 63 sections · Course home · Join the coaching cohort