-
-
Notifications
You must be signed in to change notification settings - Fork 213
[Version 3] New heuristic for RAM #804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 18 commits
fb01a32
0918e52
a13db61
c6d6a9d
c02ae05
ff5e4ff
eb53e7a
56e6aa2
0b8e6b3
3bfc92c
4f53a13
4ee7644
d20b71b
40c0af8
4c4fe80
38fa473
aafd5f6
90d6ec9
b3e827d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "3.0.0_rc3" | ||
__version__ = "3.0.0_rc7" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
|
||
from dataclasses import dataclass, field | ||
|
||
# from pydantic.dataclasses import dataclass, field | ||
|
||
|
||
@dataclass | ||
class Time: | ||
|
@@ -61,7 +63,10 @@ class Energy: | |
|
||
@classmethod | ||
def from_power_and_time(cls, *, power: "Power", time: "Time") -> "Energy": | ||
return cls(kWh=power.kW * time.hours) | ||
assert isinstance(power.kW, float) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Quel est l'intérêt de l'assert ici ? ça ne risque pas de casser le programme à un endroit non désiré ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cette endroit est la base du calcul, si jamais il n'y a pas la bonne unité il y a plein d'effets de bord. |
||
assert isinstance(time.hours, float) | ||
energy = power.kW * time.hours | ||
return cls(kWh=energy) | ||
|
||
@classmethod | ||
def from_ujoules(cls, energy: float) -> "Energy": | ||
|
@@ -82,7 +87,10 @@ def __add__(self, other: "Energy") -> "Energy": | |
return Energy(self.kWh + other.kWh) | ||
|
||
def __mul__(self, factor: float) -> "Energy": | ||
return Energy(self.kWh * factor) | ||
assert isinstance(factor, float) | ||
assert isinstance(self.kWh, float) | ||
result = Energy(self.kWh * factor) | ||
return result | ||
|
||
def __float__(self) -> float: | ||
return float(self.kWh) | ||
|
@@ -127,7 +135,9 @@ def from_energies_and_delay(cls, e1: "Energy", e2: "Energy", delay: "Time"): | |
Power: Resulting Power estimation | ||
""" | ||
delta_energy = abs(e2.kWh - e1.kWh) | ||
assert isinstance(delta_energy, float) | ||
kW = delta_energy / delay.hours if delay.hours != 0.0 else 0.0 | ||
assert isinstance(delta_energy, float) | ||
return cls(kW=kW) | ||
|
||
@classmethod | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because on huge CPU, it could be above 0 but under 0.1.