您可以使用 TypeScript 建立自己的運算作業。本頁底部的程式碼可協助您判斷長期而言,安裝太陽能板是否比繼續支付電費更便宜。
以下是程式碼如何判斷太陽能板費用的概略說明。
第 1 部分:系統需求和設定
首先,請定義目前的電費使用量和帳單:
- 你每個月的用電量為何?(
monthlyKwhEnergyConsumption
) - 電費多少?(
energyCostPerKwh
)
接著,輸入太陽能系統的計畫:
- 有幾個面板?(
panelsCount
) - 面板的效能有多強?(
panelCapacityWatts
) - 安裝費用是多少?(
installationCostPerWatt
) - 系統是否有折扣?(
solarIncentives
)
第 2 部分:計算
根據輸入的值,程式碼會計算:
yearlyProductionAcKwh
:太陽能板每年可產生的總電量。totalCostWithSolar
:使用太陽能板的電費。totalCostWithoutSolar
:不使用太陽能板的電費。
第 3 部分:結果
程式碼也會告知您以下資訊:
savings
:安裝/未安裝太陽能面板的費用差異。breakEvenYear
:太陽能板的成本與省下的電費相等,需要多久時間?
範例程式碼
// Solar configuration, from buildingInsights.solarPotential.solarPanelConfigs let panelsCount = 20; let yearlyEnergyDcKwh = 12000; // Basic settings let monthlyAverageEnergyBill: number = 300; let energyCostPerKwh = 0.31; let panelCapacityWatts = 400; let solarIncentives: number = 7000; let installationCostPerWatt: number = 4.0; let installationLifeSpan: number = 20; // Advanced settings let dcToAcDerate = 0.85; let efficiencyDepreciationFactor = 0.995; let costIncreaseFactor = 1.022; let discountRate = 1.04; // Solar installation let installationSizeKw: number = (panelsCount * panelCapacityWatts) / 1000; let installationCostTotal: number = installationCostPerWatt * installationSizeKw * 1000; // Energy consumption let monthlyKwhEnergyConsumption: number = monthlyAverageEnergyBill / energyCostPerKwh; let yearlyKwhEnergyConsumption: number = monthlyKwhEnergyConsumption * 12; // Energy produced for installation life span let initialAcKwhPerYear: number = yearlyEnergyDcKwh * dcToAcDerate; let yearlyProductionAcKwh: number[] = [...Array(installationLifeSpan).keys()].map( (year) => initialAcKwhPerYear * efficiencyDepreciationFactor ** year, ); // Cost with solar for installation life span let yearlyUtilityBillEstimates: number[] = yearlyProductionAcKwh.map( (yearlyKwhEnergyProduced, year) => { const billEnergyKwh = yearlyKwhEnergyConsumption - yearlyKwhEnergyProduced; const billEstimate = (billEnergyKwh * energyCostPerKwh * costIncreaseFactor ** year) / discountRate ** year; return Math.max(billEstimate, 0); // bill cannot be negative }, ); let remainingLifetimeUtilityBill: number = yearlyUtilityBillEstimates.reduce((x, y) => x + y, 0); let totalCostWithSolar: number = installationCostTotal + remainingLifetimeUtilityBill - solarIncentives; console.log(`Cost with solar: $${totalCostWithSolar.toFixed(2)}`); // Cost without solar for installation life span let yearlyCostWithoutSolar: number[] = [...Array(installationLifeSpan).keys()].map( (year) => (monthlyAverageEnergyBill * 12 * costIncreaseFactor ** year) / discountRate ** year, ); let totalCostWithoutSolar: number = yearlyCostWithoutSolar.reduce((x, y) => x + y, 0); console.log(`Cost without solar: $${totalCostWithoutSolar.toFixed(2)}`); // Savings with solar for installation life span let savings: number = totalCostWithoutSolar - totalCostWithSolar; console.log(`Savings: $${savings.toFixed(2)} in ${installationLifeSpan} years`);