Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var costs = {};
- costs.enrgyHT = 0.06499;
- costs.enrgyLT = 0.03599;
- costs.exciseDuty = 0.00305;
- costs.contrib67ActEZ = 0.00050;
- costs.ntwrkChrgHT = 0.04177;
- costs.ntwrkChrgLT = 0.03219;
- costs.taxFactor = 1.22;
- var cumuEnrgyHT = 0;
- var cumuEnrgyLT = 0;
- var cumuEnrgy = 0;
- var cumulativeCostArray = [];
- chart1Series.powerTotal.forEach(function (point) {
- var enrgy = point[1] / 1000;
- var timestamp = new Date(point[0]);
- if (isHighTariff(timestamp)) {
- var cost = enrgy * (costs.enrgyHT + costs.exciseDuty + costs.contrib67ActEZ + costs.ntwrkChrgHT) * costs.taxFactor;
- cumuEnrgyHT += enrgy;
- }
- else {
- var cost = enrgy * (costs.enrgyLT + costs.exciseDuty + costs.contrib67ActEZ + costs.ntwrkChrgLT) * costs.taxFactor;
- cumuEnrgyLT += enrgy;
- }
- cost = parseFloat(cost.toFixed(2));
- if (!chart3Series.cumulativeCost.length)
- chart3Series.cumulativeCost.push([point[0], cost]);
- else
- chart3Series.cumulativeCost.push([point[0], cost + chart3Series.cumulativeCost[chart3Series.cumulativeCost.length - 1][1]]);
- cumuEnrgy += enrgy;
- var cumuEnrgyKW = parseFloat((cumuEnrgy / 1000).toFixed(2));
- if (!chart3Series.cumulativeEnergy.length)
- chart3Series.cumulativeEnergy.push([point[0], cumuEnrgyKW]);
- else
- chart3Series.cumulativeEnergy.push([point[0], cumuEnrgyKW + chart3Series.cumulativeEnergy[chart3Series.cumulativeEnergy.length - 1][1]]);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement