Skip to content

Commit

Permalink
Merge pull request #8 from davet2001/issue7-fix-unavailable-gen-entit…
Browse files Browse the repository at this point in the history
…y-breaking-scaling

Make scaling resilient to unavailable entities
  • Loading branch information
davet2001 authored Oct 29, 2024
2 parents db9bed5 + f6ca410 commit 72c720f
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 72c720f

Please sign in to comment.