Skip to content

Commit

Permalink
Make scaling resilient to unavailable entities
Browse files Browse the repository at this point in the history
  • Loading branch information
davet2001 committed Oct 29, 2024
1 parent db9bed5 commit f6ca410
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/elec-sankey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export class ElecSankey extends LitElement {
let totalGen = 0;
for (const key in this.generationInRoutes) {
if (Object.prototype.hasOwnProperty.call(this.generationInRoutes, key)) {
totalGen += this.generationInRoutes[key].rate;
totalGen += this.generationInRoutes[key].rate || 0;
}
}
return totalGen;
Expand Down Expand Up @@ -427,6 +427,7 @@ export class ElecSankey extends LitElement {

const widest_trunk = Math.max(genTotal, gridInTotal, consumerTotal, 1.0);
this._rateToWidthMultplier = TARGET_SCALED_TRUNK_WIDTH / widest_trunk;
console.log("NEW Rate to width multiplier: " + this._rateToWidthMultplier);
}

private _generationToConsumers(): number {
Expand Down

0 comments on commit f6ca410

Please sign in to comment.