Green-Software-Foundation / if-plugins

Impact Framework models owned and maintained by the GSF
MIT License
24 stars 17 forks source link

Milliseconds in SCI Plugin (and others) #98

Open WBurggraaf opened 2 weeks ago

WBurggraaf commented 2 weeks ago

This might not be the best example, but I need support for millisecond precision in these plugins (like duration and functional-unit).

For instance, the duration parameter requires a number greater than or equal to 1, returning an error code too_small when I try to use something like 0.1 seconds. It’s a bit frustrating, as I'd like to handle smaller intervals, such as logging events at 100ms intervals.

A simple example would be handling 100ms interval logging from something like this in my green coding Hello World: Amount of iterations UseCase is running: 10,000,000,000

Use case per iteration: increment sum by 1 for each iteration.

Total Joules 407 over 4829 ms Average of 0.084 J/ms = 84 J/s or Watts E: 0.00011299 kWh in SCI

Manfiest examples

name: sci description: successful path tags: initialize: outputs:

Same here

name: sci-e-demo description: tags: initialize: outputs:

jmcook1186 commented 1 week ago

Hi @WBurggraaf - I'd recommend moving away from using the SciE plugin and any others in this repository - we deprecated them and stopped maintaining them, a while ago. Instead, we recommend using our builtins instead- SciE can be replaced with an instance of Multiply, passing in the relevant params. The SCI plugin has also migrated over to the IF builtins and been simplified.

I'm not sure supporting sub-second time resolution is something we will want to support as it will create problems in some core features such as time-sync and aggregation. Most of our users want to measure across days/weeks/months. It's also common for monitor APIs to have a maximum resolution of 5 minutes.

We've totally moved away from requiring certain named parameter to conform to a set of fixed properties and instead adopted a more flexible model so people can come up with their own solutions to these type of issues. Just because we use integers and interpret them as seconds as standard doesn't mean you can't interpret those same integers as milliseconds, microseconds, or whatever else. You'll just have to be very careful about how your units propagate through your pipeline and the unit in which you express your result.