From 7d5f6ee1978d5c9fc58a946887594bbe41c385c9 Mon Sep 17 00:00:00 2001 From: jmc <33655003+jmcook1186@users.noreply.github.com> Date: Fri, 13 Oct 2023 10:00:18 +0100 Subject: [PATCH 1/2] docs: add sci-e documentation --- docs/implementations/sci-e.md | 57 +++++++++++++++++++++++++++++++++++ examples/impls/sci-e.yml | 18 +++++++++++ 2 files changed, 75 insertions(+) create mode 100644 docs/implementations/sci-e.md create mode 100644 examples/impls/sci-e.yml 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..8123b3ef4 --- /dev/null +++ b/examples/impls/sci-e.yml @@ -0,0 +1,18 @@ +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 From 5d364ce15ab129e9f15b1148753a8d488c562e54 Mon Sep 17 00:00:00 2001 From: jmc <33655003+jmcook1186@users.noreply.github.com> Date: Fri, 13 Oct 2023 10:01:59 +0100 Subject: [PATCH 2/2] docs: add newline to impl --- examples/impls/sci-e.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/impls/sci-e.yml b/examples/impls/sci-e.yml index 8123b3ef4..c508395f5 100644 --- a/examples/impls/sci-e.yml +++ b/examples/impls/sci-e.yml @@ -16,3 +16,4 @@ graph: - timestamp: 2023-08-06T00:00 duration: 3600 e-cpu: 0.001 + \ No newline at end of file