The power consumption model considers as number of components with specified nominal current consumption. These components are spread out among any number of independent threads. Each thread can have any number of stages. Each stage has a configured length of time that it should run for. All threads repeat periodically. This setup mimics an embedded system running an RTOS, with scheduled tasks and interactions with external components. For example, an LED may be toggled at a prescribed frequency with some set on time. It can be given its own thread so that timing can be separate from other power consumption considerations. As another example, consider a sensor which is sampled every 10 seconds, then placed into a low power mode between samples. This can be readily supported in this thread representation. The image below shows this representation.
The implementation is straightforward. The user must know nominal current consumption of each component in each mode, and the timing between each stage. Currently, it is assumed that all components operate on the same voltage, but that may be changed in the future to allow for separate power buses to be considered. The code snippets below show how two separate threads are built. Here, some accelerometer is periodically sampled by an ESP32, and both the ESP32 and accelerometer enter sleep modes between the sampling. An led thread is created separately.
import embedded_power_model as epm accel_thread = epm.Thread(name="Accelerometer Sampling", stages=[ epm.Stage(delta_t_sec=0.5,components=[ epm.Component(name="ESP32",mode_name="Active",current_ma=100.0), epm.Component(name="Accelerometer",mode_name="Active",current_ma=1.5) ]), epm.Stage(delta_t_sec=20.0,components=[ epm.Component(name="ESP32",mode_name="Sleep",current_ma=0.05), epm.Component(name="Accelerometer",mode_name="Sleep",current_ma=0.001) ]) ]) led_thread = epm.Thread(name="LED", stages=[ epm.Stage(delta_t_sec=0.1,components=[ epm.Component(name="LED",mode_name="On",current_ma=5.0) ]), epm.Stage(delta_t_sec=4.9,components=[ epm.Component(name="LED",mode_name="Off",current_ma=0.0) ]) ])
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.