Skip to content

Commit

Permalink
Adding data and config
Browse files Browse the repository at this point in the history
Signed-off-by: Gnanakeethan Balasubramaniam <[email protected]>
  • Loading branch information
gnanakeethan committed Sep 25, 2023
1 parent 490df02 commit c8b7553
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const CONFIG = {
SCI_M: 'org.gsf.sci-m',
SCI_O: 'org.gsf.sci-o',
SHELL_MODEL: 'shellModel',
TDP: 'tdp',
TEADS_AWS: 'teads.cloud.sci',
TEADS_CURVE: 'teads.curve',
WATT_TIME: 'org.wattime.grid',
Expand Down
1 change: 1 addition & 0 deletions src/lib/tdp-finder/compact.json

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions src/lib/tdp-finder/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import {IImpactModelInterface} from '../interfaces';

import {CONFIG} from '../../config';

import {KeyValuePair} from '../../types/common';

const {MODEL_IDS} = CONFIG;
const {TDP} = MODEL_IDS;

export class TdpFinderModel implements IImpactModelInterface {
authParams: object | undefined = undefined;
staticParams: object | undefined;
name: string | undefined;

authenticate(authParams: object): void {
this.authParams = authParams;
}

/**
* Calculate the total emissions for a list of observations.
*
* Each Observation require:
* @param {Object[]} observations
* @param {string} observations[].timestamp RFC3339 timestamp string
*/
async calculate(observations: object | object[] | undefined): Promise<any[]> {
if (observations === undefined) {
throw new Error('Required Parameters not provided');
} else if (!Array.isArray(observations)) {
throw new Error('Observations must be an array');
}

return observations.map((observation: KeyValuePair) => {
return observation;
});
}

async configure(
name: string,
staticParams: object | undefined
): Promise<IImpactModelInterface> {
this.staticParams = staticParams;
this.name = name;
return this;
}

modelIdentifier(): string {
return TDP;
}
}

0 comments on commit c8b7553

Please sign in to comment.