diff --git a/docs/implementations/sci-e.md b/docs/implementations/sci-e.md new file mode 100644 index 000000000..e90a6b107 --- /dev/null +++ b/docs/implementations/sci-e.md @@ -0,0 +1,57 @@ +# SCI-E (total energy) + +`sci-e` is a model that simply sums up the contributions to a component's energy use. The model retunrs `energy` which is used as the input to the `sci-o` model that calculates operational emissions for the component. + +## Calculation + +`energy` is calculated as the sum of the energy due to CPU usage, energy due to network trafic, energy due to memory and energy due to GPU usage. + +``` +energy = e-cpu + e-net + e-mem + e-gpu +``` + +In any model pipeline that includes `sci-o`, `sci-o` must be preceded by `sci-e`. This is because `sci-o` does not recognize the individual contributions, `e-cpu`, `e-net`, etc, but expects to find `energy`. Only `sci-e` takes individual contributions and returns `energy`. + +## Implementation + +To run the model, you must first create an instance of `SciEModel` and call its `configure()` method. Then, you can call `calculate()` to return `energy`. + +```typescript +import { SciEModel } from '@gsf/ief'; + +const sciEModel = new SciEModel(); +sciEModel.configure() +const results = sciEModel.calculate([ + { + e-cpu: 0.001, + e-mem: 0.0005, + e-net: 0.0005, + } +]) +``` + +## Example impl + +IEF users will typically call the model as part of a pipeline defined in an `impl` file. In this case, instantiating and configuring the model is handled by `rimpl` and does not have to be done explicitly by the user. The following is an example `impl` that calls `sci-e`: + +```yaml +name: sci-e-demo +description: +tags: +initialize: + models: + - name: sci-e + kind: builtin +graph: + children: + child: + pipeline: + - sci-e + config: + sci-e: + observations: + - timestamp: 2023-08-06T00:00 + duration: 3600 + e-cpu: 0.001 + +``` \ No newline at end of file diff --git a/examples/impls/sci-e.yml b/examples/impls/sci-e.yml new file mode 100644 index 000000000..c508395f5 --- /dev/null +++ b/examples/impls/sci-e.yml @@ -0,0 +1,19 @@ +name: sci-e-demo +description: +tags: +initialize: + models: + - name: sci-e + kind: builtin +graph: + children: + child: + pipeline: + - sci-e + config: + sci-e: + observations: + - timestamp: 2023-08-06T00:00 + duration: 3600 + e-cpu: 0.001 + \ No newline at end of file