@grnsft/if 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CONTRIBUTING.md +1 -1
  2. package/README.md +1 -34
  3. package/build/config/units.yaml +112 -0
  4. package/build/index.js +2 -2
  5. package/coverage/clover.xml +396 -0
  6. package/coverage/coverage-final.json +14 -0
  7. package/coverage/lcov-report/base.css +224 -0
  8. package/coverage/lcov-report/block-navigation.js +87 -0
  9. package/coverage/lcov-report/config/config.ts.html +256 -0
  10. package/coverage/lcov-report/config/index.html +146 -0
  11. package/coverage/lcov-report/config/index.ts.html +91 -0
  12. package/coverage/lcov-report/config/strings.ts.html +196 -0
  13. package/coverage/lcov-report/favicon.png +0 -0
  14. package/coverage/lcov-report/index.html +161 -0
  15. package/coverage/lcov-report/lib/index.html +161 -0
  16. package/coverage/lcov-report/lib/models-universe.ts.html +517 -0
  17. package/coverage/lcov-report/lib/observatory.ts.html +187 -0
  18. package/coverage/lcov-report/lib/planet-aggregator.ts.html +244 -0
  19. package/coverage/lcov-report/lib/supercomputer.ts.html +712 -0
  20. package/coverage/lcov-report/models/index.html +131 -0
  21. package/coverage/lcov-report/models/index.ts.html +88 -0
  22. package/coverage/lcov-report/models/time-sync.ts.html +1153 -0
  23. package/coverage/lcov-report/prettify.css +1 -0
  24. package/coverage/lcov-report/prettify.js +2 -0
  25. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  26. package/coverage/lcov-report/sorter.js +196 -0
  27. package/coverage/lcov-report/util/args.ts.html +289 -0
  28. package/coverage/lcov-report/util/errors.ts.html +166 -0
  29. package/coverage/lcov-report/util/index.html +161 -0
  30. package/coverage/lcov-report/util/units-dealer.ts.html +199 -0
  31. package/coverage/lcov-report/util/yaml.ts.html +193 -0
  32. package/coverage/lcov.info +666 -0
  33. package/examples/impls/test/e-net.yml +21 -0
  34. package/grafana/IF_GRAFANA_SETUP.md +71 -0
  35. package/grafana/if_grafana_config.json +370 -0
  36. package/package.json +4 -4
  37. package/src/config/units.yaml +1 -1
  38. package/examples/ompls/test/time-sync.yml +0 -255
@@ -0,0 +1,71 @@
1
+ # Setting up the Impact Framework Grafana dashboard
2
+ (for any questions please contact paz.barda@intel.com / pazbarda@gmail.com)
3
+
4
+ ## Download and Install Grafana
5
+ https://grafana.com/get/?plcmt=top-nav&cta=downloads&tab=self-managed
6
+
7
+ This is the self managed version: you install it and can run it on your local machine.
8
+
9
+ ## Open Grafana on your local machine
10
+ Web browser: localhost:3000
11
+
12
+ You should see the Grafana welcome page.
13
+
14
+ ## Download and Install Grafana CSV plugin
15
+ https://grafana.com/grafana/plugins/marcusolsson-csv-datasource/?tab=installation
16
+
17
+ After installation, go to Menu -> Plugins, search for "CSV" and make sure CSV plugin is there
18
+
19
+ ## Import the dashboard json config
20
+
21
+ Menu -> Dashboards -> New -> Import
22
+
23
+ 1. Drag and drop "grafana_config.json" from this folder to Grafana webpage
24
+ 2. Optional - change the name of the dashboard and the details text on the right
25
+ 3. Click import.
26
+
27
+ Dashboard should now appear, but with no data fed into the charts (yet).
28
+
29
+ ## Create a data source for your OMPL CSV file
30
+ Menu -> Connections -> Data Sources -> Add data source
31
+
32
+ 1. Search for "CSV", you should see the CSV plugin. Click it.
33
+ 2. Name you new data source.
34
+ 3. Switch from "HTTP" to "Local".
35
+ 4. Type/paste in the path to your ompl csv ("your/path/to/csvs/if-iee-demo.csv" in our example)
36
+
37
+ Click Save & Test
38
+
39
+
40
+
41
+ ## Connect your OMPL CSV data source to your dashboard
42
+
43
+ Menu -> Dashboards -> Select your new dashboard
44
+
45
+ For each blank chart:
46
+
47
+ 1. Click the chart menu -> edit
48
+ 2. Below the chart go to Quary tab
49
+ 3. At the top of the tab select the ompl CSV datasource you created
50
+ 4. Go to Transform tab, and select the fields you'd like to show on the chart.
51
+ 5. Start with "timestamp" and convert it to "Time".
52
+ 6. Any other numeric value you'd like to show should be converted to "Number"
53
+
54
+ Click Apply
55
+
56
+ Click Save
57
+
58
+ NOTE: when you select a CSV file (step 3) it might initially not show the columns in the transformation dropdown. if that happens - save the dashboard, exit it refresh the Grafana webpage (localhost:3000). Once you go into the dashboard again it should show the columns for transformation.
59
+
60
+
61
+ ## Enable auto-refresh of the dashboard
62
+
63
+ On the top right of the dashboard, look for the "refresh dashboard" button
64
+
65
+ Click the dropdown next to it, and choose the auto-refresh interval
66
+
67
+ Click Save
68
+
69
+ ## Your dashboard is now ready to go!
70
+ With every change to you CSV file you should see it reflect on the dashboard momentarily.
71
+
@@ -0,0 +1,370 @@
1
+ {
2
+ "annotations": {
3
+ "list": [
4
+ {
5
+ "builtIn": 1,
6
+ "datasource": {
7
+ "type": "grafana",
8
+ "uid": "-- Grafana --"
9
+ },
10
+ "enable": true,
11
+ "hide": true,
12
+ "iconColor": "rgba(0, 211, 255, 1)",
13
+ "name": "Annotations & Alerts",
14
+ "type": "dashboard"
15
+ }
16
+ ]
17
+ },
18
+ "editable": true,
19
+ "fiscalYearStartMonth": 0,
20
+ "graphTooltip": 0,
21
+ "id": 5,
22
+ "links": [],
23
+ "liveNow": false,
24
+ "panels": [
25
+ {
26
+ "datasource": {
27
+ "type": "marcusolsson-csv-datasource",
28
+ "uid": "<SOURCE_ID>"
29
+ },
30
+ "gridPos": {
31
+ "h": 3,
32
+ "w": 18,
33
+ "x": 0,
34
+ "y": 0
35
+ },
36
+ "id": 3,
37
+ "options": {
38
+ "code": {
39
+ "language": "plaintext",
40
+ "showLineNumbers": false,
41
+ "showMiniMap": false
42
+ },
43
+ "content": "<h1 style=\"font-size: 80px;\">\n <span style=\"color: #0071C5;\">Dashboard Title</span> <b>goes here</b>",
44
+ "mode": "html"
45
+ },
46
+ "pluginVersion": "10.1.1",
47
+ "targets": [
48
+ {
49
+ "datasource": {
50
+ "type": "marcusolsson-csv-datasource",
51
+ "uid": "<SOURCE_ID>"
52
+ },
53
+ "decimalSeparator": ".",
54
+ "delimiter": ",",
55
+ "header": true,
56
+ "ignoreUnknown": false,
57
+ "refId": "A",
58
+ "schema": [
59
+ {
60
+ "name": "",
61
+ "type": "string"
62
+ }
63
+ ],
64
+ "skipRows": 0
65
+ }
66
+ ],
67
+ "transparent": true,
68
+ "type": "text"
69
+ },
70
+ {
71
+ "datasource": {
72
+ "type": "marcusolsson-csv-datasource",
73
+ "uid": "<SOURCE_ID>"
74
+ },
75
+ "description": "",
76
+ "gridPos": {
77
+ "h": 3,
78
+ "w": 5,
79
+ "x": 19,
80
+ "y": 0
81
+ },
82
+ "id": 2,
83
+ "options": {
84
+ "code": {
85
+ "language": "plaintext",
86
+ "showLineNumbers": false,
87
+ "showMiniMap": false
88
+ },
89
+ "content": "<p style=\"font-size: 8px; color: gray;\">\n <u>Some detailed text</u>:<br> goes here</p>",
90
+ "mode": "html"
91
+ },
92
+ "pluginVersion": "10.1.1",
93
+ "targets": [
94
+ {
95
+ "datasource": {
96
+ "type": "marcusolsson-csv-datasource",
97
+ "uid": "<SOURCE_ID>"
98
+ },
99
+ "decimalSeparator": ".",
100
+ "delimiter": ",",
101
+ "header": true,
102
+ "ignoreUnknown": false,
103
+ "refId": "A",
104
+ "schema": [
105
+ {
106
+ "name": "",
107
+ "type": "string"
108
+ }
109
+ ],
110
+ "skipRows": 0
111
+ }
112
+ ],
113
+ "transparent": true,
114
+ "type": "text"
115
+ },
116
+ {
117
+ "datasource": {
118
+ "type": "marcusolsson-csv-datasource",
119
+ "uid": "<SOURCE_ID>"
120
+ },
121
+ "fieldConfig": {
122
+ "defaults": {
123
+ "color": {
124
+ "mode": "palette-classic"
125
+ },
126
+ "custom": {
127
+ "axisCenteredZero": false,
128
+ "axisColorMode": "text",
129
+ "axisLabel": "",
130
+ "axisPlacement": "auto",
131
+ "barAlignment": 0,
132
+ "drawStyle": "line",
133
+ "fillOpacity": 0,
134
+ "gradientMode": "none",
135
+ "hideFrom": {
136
+ "legend": false,
137
+ "tooltip": false,
138
+ "viz": false
139
+ },
140
+ "insertNulls": false,
141
+ "lineInterpolation": "linear",
142
+ "lineWidth": 1,
143
+ "pointSize": 5,
144
+ "scaleDistribution": {
145
+ "type": "linear"
146
+ },
147
+ "showPoints": "auto",
148
+ "spanNulls": false,
149
+ "stacking": {
150
+ "group": "A",
151
+ "mode": "none"
152
+ },
153
+ "thresholdsStyle": {
154
+ "mode": "off"
155
+ }
156
+ },
157
+ "mappings": [],
158
+ "thresholds": {
159
+ "mode": "absolute",
160
+ "steps": [
161
+ {
162
+ "color": "green",
163
+ "value": null
164
+ },
165
+ {
166
+ "color": "red",
167
+ "value": 80
168
+ }
169
+ ]
170
+ }
171
+ },
172
+ "overrides": []
173
+ },
174
+ "gridPos": {
175
+ "h": 9,
176
+ "w": 24,
177
+ "x": 0,
178
+ "y": 3
179
+ },
180
+ "id": 1,
181
+ "options": {
182
+ "legend": {
183
+ "calcs": [],
184
+ "displayMode": "list",
185
+ "placement": "bottom",
186
+ "showLegend": true
187
+ },
188
+ "tooltip": {
189
+ "mode": "single",
190
+ "sort": "none"
191
+ }
192
+ },
193
+ "targets": [
194
+ {
195
+ "datasource": {
196
+ "type": "marcusolsson-csv-datasource",
197
+ "uid": "<SOURCE_ID>"
198
+ },
199
+ "decimalSeparator": ".",
200
+ "delimiter": ",",
201
+ "header": true,
202
+ "ignoreUnknown": false,
203
+ "refId": "A",
204
+ "schema": [
205
+ {
206
+ "name": "",
207
+ "type": "string"
208
+ }
209
+ ],
210
+ "skipRows": 0
211
+ }
212
+ ],
213
+ "title": "Energy [kWh]",
214
+ "transformations": [
215
+ {
216
+ "id": "convertFieldType",
217
+ "options": {
218
+ "conversions": [
219
+ {
220
+ "destinationType": "time",
221
+ "targetField": "timestamp"
222
+ },
223
+ {
224
+ "destinationType": "number",
225
+ "targetField": "energy"
226
+ }
227
+ ],
228
+ "fields": {}
229
+ }
230
+ }
231
+ ],
232
+ "type": "timeseries"
233
+ },
234
+ {
235
+ "datasource": {
236
+ "type": "marcusolsson-csv-datasource",
237
+ "uid": "<SOURCE_ID>"
238
+ },
239
+ "fieldConfig": {
240
+ "defaults": {
241
+ "color": {
242
+ "mode": "palette-classic"
243
+ },
244
+ "custom": {
245
+ "axisCenteredZero": false,
246
+ "axisColorMode": "text",
247
+ "axisLabel": "",
248
+ "axisPlacement": "auto",
249
+ "barAlignment": 0,
250
+ "drawStyle": "line",
251
+ "fillOpacity": 0,
252
+ "gradientMode": "none",
253
+ "hideFrom": {
254
+ "legend": false,
255
+ "tooltip": false,
256
+ "viz": false
257
+ },
258
+ "insertNulls": false,
259
+ "lineInterpolation": "linear",
260
+ "lineWidth": 1,
261
+ "pointSize": 5,
262
+ "scaleDistribution": {
263
+ "type": "linear"
264
+ },
265
+ "showPoints": "auto",
266
+ "spanNulls": false,
267
+ "stacking": {
268
+ "group": "A",
269
+ "mode": "none"
270
+ },
271
+ "thresholdsStyle": {
272
+ "mode": "off"
273
+ }
274
+ },
275
+ "mappings": [],
276
+ "thresholds": {
277
+ "mode": "absolute",
278
+ "steps": [
279
+ {
280
+ "color": "green",
281
+ "value": null
282
+ },
283
+ {
284
+ "color": "red",
285
+ "value": 80
286
+ }
287
+ ]
288
+ }
289
+ },
290
+ "overrides": []
291
+ },
292
+ "gridPos": {
293
+ "h": 8,
294
+ "w": 24,
295
+ "x": 0,
296
+ "y": 12
297
+ },
298
+ "id": 5,
299
+ "options": {
300
+ "legend": {
301
+ "calcs": [],
302
+ "displayMode": "list",
303
+ "placement": "bottom",
304
+ "showLegend": true
305
+ },
306
+ "tooltip": {
307
+ "mode": "single",
308
+ "sort": "none"
309
+ }
310
+ },
311
+ "targets": [
312
+ {
313
+ "datasource": {
314
+ "type": "marcusolsson-csv-datasource",
315
+ "uid": "<SOURCE_ID>"
316
+ },
317
+ "decimalSeparator": ".",
318
+ "delimiter": ",",
319
+ "header": true,
320
+ "ignoreUnknown": false,
321
+ "refId": "A",
322
+ "schema": [
323
+ {
324
+ "name": "",
325
+ "type": "string"
326
+ }
327
+ ],
328
+ "skipRows": 0
329
+ }
330
+ ],
331
+ "title": "Carbon [gCO2]",
332
+ "transformations": [
333
+ {
334
+ "id": "convertFieldType",
335
+ "options": {
336
+ "conversions": [
337
+ {
338
+ "destinationType": "time",
339
+ "targetField": "timestamp"
340
+ },
341
+ {
342
+ "destinationType": "number",
343
+ "targetField": "carbon"
344
+ }
345
+ ],
346
+ "fields": {}
347
+ }
348
+ }
349
+ ],
350
+ "type": "timeseries"
351
+ }
352
+ ],
353
+ "refresh": "",
354
+ "schemaVersion": 38,
355
+ "style": "dark",
356
+ "tags": [],
357
+ "templating": {
358
+ "list": []
359
+ },
360
+ "time": {
361
+ "from": "2023-11-02T08:35:31.000Z",
362
+ "to": "2023-11-02T08:35:42.000Z"
363
+ },
364
+ "timepicker": {},
365
+ "timezone": "",
366
+ "title": "IF_dashboard",
367
+ "uid": "",
368
+ "version": 40,
369
+ "weekStart": ""
370
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@grnsft/if",
3
3
  "description": "Impact Framework",
4
- "version": "v0.1.5",
4
+ "version": "v0.1.7",
5
5
  "author": {
6
6
  "name": "Green Software Foundation",
7
7
  "email": "info@gsf.com"
@@ -13,6 +13,7 @@
13
13
  "url": "https://github.com/Green-Software-Foundation/if/issues/new?assignees=&labels=feedback&projects=&template=feedback.md&title=Feedback+-+"
14
14
  },
15
15
  "dependencies": {
16
+ "copyfiles": "^2.4.1",
16
17
  "js-yaml": "^4.1.0",
17
18
  "moment": "^2.29.4",
18
19
  "moment-range": "^4.0.2",
@@ -34,7 +35,6 @@
34
35
  },
35
36
  "engines": {
36
37
  "node": ">=18",
37
- "yarn": ">=1.22",
38
38
  "npm": ">=8"
39
39
  },
40
40
  "homepage": "https://greensoftware.foundation",
@@ -55,13 +55,13 @@
55
55
  "url": "https://github.com/Green-Software-Foundation/if"
56
56
  },
57
57
  "scripts": {
58
- "build": "rm -rf build && tsc --project tsconfig.build.json",
58
+ "build": "rm -rf build && tsc --project tsconfig.build.json && copyfiles -u 2 src/config/units.yaml build/config",
59
59
  "coverage": "jest --verbose --coverage",
60
60
  "fix": "gts fix",
61
61
  "fix:package": "fixpack",
62
62
  "impact-engine": "npx ts-node src/index.ts",
63
63
  "lint": "gts lint",
64
- "prepublish": "yarn build",
64
+ "prepublish": "npm run build",
65
65
  "test": "jest --verbose"
66
66
  },
67
67
  "stability": "stable",
@@ -105,7 +105,7 @@ timestamp:
105
105
  time-reserved:
106
106
  description: time reserved for a component
107
107
  unit: seconds
108
- aggregation: none
108
+ aggregation: avg
109
109
  total-resources:
110
110
  description: total resources available
111
111
  unit: count