Skip to content

Commit

Permalink
yarn fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcook1186 committed Sep 13, 2023
1 parent b1cfb97 commit 3509ccb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
23 changes: 13 additions & 10 deletions src/lib/case-studies/eshoppen-model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IImpactModelInterface } from '../interfaces';
import { KeyValuePair } from '../../types/boavizta';
import {IImpactModelInterface} from '../interfaces';
import {KeyValuePair} from '../../types/boavizta';

export class EshoppenModel implements IImpactModelInterface {
authParams: object | undefined = undefined;
Expand All @@ -21,11 +21,12 @@ export class EshoppenModel implements IImpactModelInterface {
switch (this.modelType) {
case 'e-cpu': {
// e-cpu = n-hours * n-chips * tdp * tdp-coeff
observation['e-cpu'] = (
observation['n-hours'] *
observation['n-chips'] *
observation['tdp'] *
observation['tdp-coeff']) / 1000;
observation['e-cpu'] =
(observation['n-hours'] *
observation['n-chips'] *
observation['tdp'] *
observation['tdp-coeff']) /
1000;
if (isNaN(observation['e-cpu'])) {
throw new Error('e-cpu not computable');
}
Expand All @@ -37,7 +38,8 @@ export class EshoppenModel implements IImpactModelInterface {
(observation['n-hours'] *
observation['n-chips'] *
observation['tdp-mem'] *
observation['tdp-coeff']) / 1000;
observation['tdp-coeff']) /
1000;
if (isNaN(observation['e-mem'])) {
throw new Error('e-mem not computable');
}
Expand All @@ -47,7 +49,8 @@ export class EshoppenModel implements IImpactModelInterface {
// e-net = data-in + data-out * net-energy
observation['e-net'] =
((observation['data-in'] + observation['data-out']) *
observation['net-energy']) / 1000;
observation['net-energy']) /
1000;
if (isNaN(observation['e-net'])) {
throw new Error('e-net not computable');
}
Expand All @@ -56,7 +59,7 @@ export class EshoppenModel implements IImpactModelInterface {
case 'e-sum': {
// e-sum = e-cpu + e-mem + e-net
observation['energy'] =
(observation['e-cpu'] + observation['e-mem'] + observation['e-net']);
observation['e-cpu'] + observation['e-mem'] + observation['e-net'];
if (isNaN(observation['energy'])) {
throw new Error('energy not computable');
}
Expand Down
9 changes: 6 additions & 3 deletions src/lib/sci-m/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ export class SciMModel implements IImpactModelInterface {
) {
observation['te'] = observation['te'] ?? observation['total-embodied'];
observation['tir'] = observation['tir'] ?? observation['time-reserved'];
observation['el'] = observation['el'] ?? observation['expected-lifespan'];
observation['rr'] = observation['rr'] ?? observation['resources-reserved'];
observation['tor'] = observation['tor'] ?? observation['total-resources'];
observation['el'] =
observation['el'] ?? observation['expected-lifespan'];
observation['rr'] =
observation['rr'] ?? observation['resources-reserved'];
observation['tor'] =
observation['tor'] ?? observation['total-resources'];
if (typeof observation['te'] === 'string') {
te = parseFloat(observation[observation['te']]);
} else if (typeof observation['te'] === 'number') {
Expand Down

0 comments on commit 3509ccb

Please sign in to comment.