diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2019-05-09 08:02:02 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2019-05-09 08:02:02 +0200 |
commit | 8e547294b0fd4c8041f4ee61f0a01b3a84b9a97d (patch) | |
tree | c7baf772fbb56fe2bb81611efef907a4903c60bd | |
parent | 3205e3149914c8421f1179f3538f331267902244 (diff) |
size_to_radio_energy: Add nRF24L01+ datasheet values
-rw-r--r-- | lib/size_to_radio_energy.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/size_to_radio_energy.py b/lib/size_to_radio_energy.py index 0b5cfd2..1cc9fd0 100644 --- a/lib/size_to_radio_energy.py +++ b/lib/size_to_radio_energy.py @@ -11,6 +11,8 @@ def get_class(radio_name: str): """Return model class for radio_name.""" if radio_name == 'CC1200tx': return CC1200tx + if radio_name == 'NRF24L01dtx': + return NRF24L01dtx def _param_list_to_dict(device, param_list): param_dict = dict() @@ -19,6 +21,7 @@ def _param_list_to_dict(device, param_list): return param_dict class CC1200tx: + """CC1200 TX energy based on aemr measurements.""" name = 'CC1200tx' parameters = { 'symbolrate' : [6, 12, 25, 50, 100, 200, 250], # ksps @@ -49,3 +52,43 @@ class CC1200tx: duration += 8.00029860e+03 * 1/(params['symbolrate']) * params['txbytes'] return power * 1e-6 * duration * 1e-6 + +class NRF24L01dtx: + """nRF24L01+ TX energy based on datasheet values (probably unerestimated)""" + name = 'NRF24L01' + parameters = { + 'symbolrate' : [250, 1000, 2000], # kbps + 'txbytes' : [], + 'txpower' : [-18, -12, -6, 0], # dBm + 'voltage' : [1.9, 3.6], + } + default_params = { + 'symbolrate' : 1000, + 'txpower' : -6, + 'voltage' : 3, + } + + # 130 us RX settling: 8.9 mE + # 130 us TX settling: 8 mA + + def get_energy(params): + if type(params) != dict: + return NRF24L01dtx.get_energy(_param_list_to_dict(NRF24L01dtx, params)) + + header_bytes = 7 + + # TX settling: 130 us @ 8 mA + energy = 8e-3 * params['voltage'] * 130e-6 + + if params['txpower'] == -18: + current = 7e-3 + elif params['txpower'] == -12: + current = 7.5e-3 + elif params['txpower'] == -6: + current = 9e-3 + elif params['txpower'] == 0: + current = 11.3e-3 + + energy += current * params['voltage'] * ((header_bytes + params['txbytes']) * 8 / (params['symbolrate'] * 1e3)) + + return energy |