36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
from ScEpTIC.emulator.energy import energy_utils
|
|
from ScEpTIC.emulator.energy.voltage_drawner import VoltageDrawner
|
|
|
|
|
|
class D2VFSChangepointDetectorEnergyModel(VoltageDrawner):
|
|
"""
|
|
Energy model of the changepoint detection circuit of D2VFS
|
|
"""
|
|
|
|
circuit_components = {
|
|
'BU4922': '0.26u', # Voltage Detector (2.2V)
|
|
'BU4927': '0.29u', # Voltage Detector (2.7V)
|
|
'BU4933': '0.34u', # Voltage Detector (3.3V)
|
|
'BU4936': '0.35u', # Voltage Detector (3.6V)
|
|
'SN54Lv175A': '20u', # Quadruple D-Type Flip Flop
|
|
'SN74AUP1G08': '0.5u', # 2-input positive-AND gate (max 0.9u)
|
|
'74HC85D': '8u', # 4-bit magnitude comparator
|
|
# + TPS62740x modeled in voltage_regulators
|
|
}
|
|
|
|
def __init__(self):
|
|
self.current_consumption = 0.0
|
|
|
|
for current_draw in self.circuit_components.values():
|
|
self.current_consumption += energy_utils.str_to_float(current_draw)
|
|
|
|
|
|
def get_drained_energy(self, t):
|
|
"""
|
|
Calculates the energy consumed by the component.
|
|
:param t: elapsed time
|
|
:return: the consumed energy
|
|
"""
|
|
return energy_utils.energy_from_I_t(self.voltage_source.get_voltage(), self.current_consumption, t)
|
|
|