TypeScript를 사용하여 자체 계산을 만들 수 있습니다. 이 페이지 하단의 코드를 사용하면 태양광 패널을 설치하는 것이 장기적으로 더 저렴한지 아니면 전기 요금을 그대로 계속 지불하는 것이 더 저렴한지 확인할 수 있습니다.
다음은 코드가 태양광 패널 비용을 결정하는 방법을 대략적으로 보여주는 내용입니다.
1부: 시스템 요구사항 및 설정
먼저 현재 전기 사용량과 청구 내역을 정의합니다.
매달 전기를 얼마나 사용하시나요? (monthlyKwhEnergyConsumption)
전기 요금은 얼마인가요? (energyCostPerKwh)
다음으로 태양계 계획을 입력합니다.
패널 수는 몇 개인가요? (panelsCount)
패널의 성능은 어느 정도인가요? (panelCapacityWatts)
설치 비용은 얼마인가요? (installationCostPerWatt)
시스템에 할인이 있나요? (solarIncentives)
2단계: 계산
입력된 값을 기반으로 코드는 다음을 계산합니다.
yearlyProductionAcKwh: 태양광 패널에서 연간 생성할 수 있는 총 전기입니다.
totalCostWithSolar: 태양광 패널을 사용하는 경우 여러 해 동안의 전기 비용입니다.
totalCostWithoutSolar: 태양광 패널을 사용하지 않는 경우 여러 해 동안의 전기 요금입니다.
3단계: 결과
또한 코드는 다음과 같은 정보를 제공합니다.
savings: 태양광 패널 유무에 따른 비용 차이입니다.
breakEvenYear: 태양광 패널의 비용이 전기 절약액과 같아질 때까지의 년 수입니다.
예시 코드
// Solar configuration, from buildingInsights.solarPotential.solarPanelConfigsletpanelsCount=20;letyearlyEnergyDcKwh=12000;// Basic settingsletmonthlyAverageEnergyBill:number=300;letenergyCostPerKwh=0.31;letpanelCapacityWatts=400;letsolarIncentives:number=7000;letinstallationCostPerWatt:number=4.0;letinstallationLifeSpan:number=20;// Advanced settingsletdcToAcDerate=0.85;letefficiencyDepreciationFactor=0.995;letcostIncreaseFactor=1.022;letdiscountRate=1.04;// Solar installationletinstallationSizeKw:number=(panelsCount*panelCapacityWatts)/1000;letinstallationCostTotal:number=installationCostPerWatt*installationSizeKw*1000;// Energy consumptionletmonthlyKwhEnergyConsumption:number=monthlyAverageEnergyBill/energyCostPerKwh;letyearlyKwhEnergyConsumption:number=monthlyKwhEnergyConsumption*12;// Energy produced for installation life spanletinitialAcKwhPerYear:number=yearlyEnergyDcKwh*dcToAcDerate;letyearlyProductionAcKwh:number[]=[...Array(installationLifeSpan).keys()].map((year)=>initialAcKwhPerYear*efficiencyDepreciationFactor**year,);// Cost with solar for installation life spanletyearlyUtilityBillEstimates:number[]=yearlyProductionAcKwh.map((yearlyKwhEnergyProduced,year)=>{constbillEnergyKwh=yearlyKwhEnergyConsumption-yearlyKwhEnergyProduced;constbillEstimate=(billEnergyKwh*energyCostPerKwh*costIncreaseFactor**year)/discountRate**year;returnMath.max(billEstimate,0);// bill cannot be negative},);letremainingLifetimeUtilityBill:number=yearlyUtilityBillEstimates.reduce((x,y)=>x+y,0);lettotalCostWithSolar:number=installationCostTotal+remainingLifetimeUtilityBill-solarIncentives;console.log(`Cost with solar: $${totalCostWithSolar.toFixed(2)}`);// Cost without solar for installation life spanletyearlyCostWithoutSolar:number[]=[...Array(installationLifeSpan).keys()].map((year)=>(monthlyAverageEnergyBill*12*costIncreaseFactor**year)/discountRate**year,);lettotalCostWithoutSolar:number=yearlyCostWithoutSolar.reduce((x,y)=>x+y,0);console.log(`Cost without solar: $${totalCostWithoutSolar.toFixed(2)}`);// Savings with solar for installation life spanletsavings:number=totalCostWithoutSolar-totalCostWithSolar;console.log(`Savings: $${savings.toFixed(2)} in ${installationLifeSpan} years`);
[null,null,["최종 업데이트: 2025-03-09(UTC)"],[[["\u003cp\u003eThis webpage provides TypeScript code to calculate and compare the long-term costs of using solar panels versus continuing with your current electricity bill.\u003c/p\u003e\n"],["\u003cp\u003eThe code considers factors such as electricity consumption, solar panel system specifications, installation costs, incentives, and energy cost inflation to project expenses over time.\u003c/p\u003e\n"],["\u003cp\u003eBy comparing the total cost with and without solar, you can determine the potential savings and the break-even point for your solar panel investment.\u003c/p\u003e\n"],["\u003cp\u003eThe provided code requires inputting your specific energy usage, solar panel system details, and financial parameters to generate personalized results.\u003c/p\u003e\n"]]],["The provided TypeScript code calculates the long-term cost-effectiveness of installing solar panels. It takes inputs like monthly energy consumption, electricity cost, panel count, panel capacity, installation cost, and incentives. The code then computes the annual electricity generation from solar panels, the total electricity cost with and without solar over a set lifespan, the difference in savings between both options, and the break-even year where the savings match the investment cost.\n"],null,["# Calculate costs and savings in TypeScript\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google\n| Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. [Learn more](/maps/comms/eea/faq). In addition, certain content from the Solar API will no longer be returned. [Learn more](/maps/comms/eea/solar).\n\nYou can create your own calculations using TypeScript. The code at the bottom of\nthis page helps you determine whether it's cheaper in the long run to install\nsolar panels or continue paying your electricity bill as is.\n\nHere's a high-level breakdown of how the code determines solar panel costs.\n\nPart 1: System needs and setup\n------------------------------\n\nFirst, define your current electricity usage and bills:\n\n- How much electricity do you use each month? (`monthlyKwhEnergyConsumption`)\n- How much does that electricity cost? (`energyCostPerKwh`)\n\nNext, enter your solar system plans:\n\n- How many panels? (`panelsCount`)\n- How powerful are the panels? (`panelCapacityWatts`)\n- How much does installation cost? (`installationCostPerWatt`)\n- Any discounts on the system? (`solarIncentives`)\n\nPart 2: Calculations\n--------------------\n\nBased on the inputted values, the code calculates:\n\n- `yearlyProductionAcKwh`: The total annual electricity your solar panels can generate.\n- `totalCostWithSolar`: The cost of electricity over many years **with** solar panels.\n- `totalCostWithoutSolar`: The cost of electricity over many years **without** solar panels.\n\nPart 3: Results\n---------------\n\nThe code also tells you the following:\n\n- `savings`: The difference between the cost with and without solar panels.\n- `breakEvenYear`: How many years until the cost of solar panels equals the savings on electricity.\n\nExample code\n------------\n\n\n```typescript\n// Solar configuration, from buildingInsights.solarPotential.solarPanelConfigs\nlet panelsCount = 20;\nlet yearlyEnergyDcKwh = 12000;\n\n// Basic settings\nlet monthlyAverageEnergyBill: number = 300;\nlet energyCostPerKwh = 0.31;\nlet panelCapacityWatts = 400;\nlet solarIncentives: number = 7000;\nlet installationCostPerWatt: number = 4.0;\nlet installationLifeSpan: number = 20;\n\n// Advanced settings\nlet dcToAcDerate = 0.85;\nlet efficiencyDepreciationFactor = 0.995;\nlet costIncreaseFactor = 1.022;\nlet discountRate = 1.04;\n\n// Solar installation\nlet installationSizeKw: number = (panelsCount * panelCapacityWatts) / 1000;\nlet installationCostTotal: number = installationCostPerWatt * installationSizeKw * 1000;\n\n// Energy consumption\nlet monthlyKwhEnergyConsumption: number = monthlyAverageEnergyBill / energyCostPerKwh;\nlet yearlyKwhEnergyConsumption: number = monthlyKwhEnergyConsumption * 12;\n\n// Energy produced for installation life span\nlet initialAcKwhPerYear: number = yearlyEnergyDcKwh * dcToAcDerate;\nlet yearlyProductionAcKwh: number[] = [...Array(installationLifeSpan).keys()].map(\n (year) =\u003e initialAcKwhPerYear * efficiencyDepreciationFactor ** year,\n);\n\n// Cost with solar for installation life span\nlet yearlyUtilityBillEstimates: number[] = yearlyProductionAcKwh.map(\n (yearlyKwhEnergyProduced, year) =\u003e {\n const billEnergyKwh = yearlyKwhEnergyConsumption - yearlyKwhEnergyProduced;\n const billEstimate =\n (billEnergyKwh * energyCostPerKwh * costIncreaseFactor ** year) / discountRate ** year;\n return Math.max(billEstimate, 0); // bill cannot be negative\n },\n);\nlet remainingLifetimeUtilityBill: number = yearlyUtilityBillEstimates.reduce((x, y) =\u003e x + y, 0);\nlet totalCostWithSolar: number =\n installationCostTotal + remainingLifetimeUtilityBill - solarIncentives;\nconsole.log(`Cost with solar: $${totalCostWithSolar.toFixed(2)}`);\n\n// Cost without solar for installation life span\nlet yearlyCostWithoutSolar: number[] = [...Array(installationLifeSpan).keys()].map(\n (year) =\u003e (monthlyAverageEnergyBill * 12 * costIncreaseFactor ** year) / discountRate ** year,\n);\nlet totalCostWithoutSolar: number = yearlyCostWithoutSolar.reduce((x, y) =\u003e x + y, 0);\nconsole.log(`Cost without solar: $${totalCostWithoutSolar.toFixed(2)}`);\n\n// Savings with solar for installation life span\nlet savings: number = totalCostWithoutSolar - totalCostWithSolar;\nconsole.log(`Savings: $${savings.toFixed(2)} in ${installationLifeSpan} years`);https://github.com/googlemaps-samples/js-solar-potential/blob/1892b99f1a8e4d7254c8b4426cfe9c8d492108b2/src/routes/sections/SolarPotentialSection.svelte#L53-L108\n```\n| **Note:** Read the [guide](/maps/documentation/javascript/using-typescript) on using TypeScript and Google Maps.\n\n\u003cbr /\u003e"]]