Evaluating power consumption
Copyright (C) 2022 Miodrag Bolic
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details <https://www.gnu.org/licenses/>.
We would like to acknowledge:
[1] G. Dekkers, F. Rosas, S. Lauwereins, S. Rajendran, S. Pollin, B. Vanrumste, T. van Waterschoot, M. Verhelst and Peter Karsmakers, �A multi-layered energy consumption model for smart wireless acoustic sensor networks,� KU Leuven, Tech. Rep., December 2018. for providing the Matlab code. All the equations are from their paper.
Introduction
A/D Converter
Nadc= 12 ;% # ADC resolution [bit]
FOM= 100*10^(-13)*10^3; % # [mJ/conv]
Padc = 2^Nadc * fs * FOM % [mW] - eq. 10
Eadc = T*Padc*channels; % [mJ] = [s]*[mW] - eq. 9
% Based on the data sheet for sigma delta ADS1114 from TI
i_power_down=1e-3; % [mA]
conversion_time=1/1000; % [s]
Eadc=Vdd*(i_oper*conversion_time+i_power_down*(Ts-conversion_time));
% Based on the data sheet for sucessive approximation AD7684 from Analog Devices
i_power_down=1e-6; % [mA]
conversion_time=10e-6; % [s]
Eadc=Vdd*(i_oper*conversion_time+i_power_down*(Ts-conversion_time));
% Ploting power over sampling rates and Vdd
Padc1(1,:)=Vdd1(1)*(i_oper1(1)*conversion_time+i_power_down*(Ts1-conversion_time))./Ts1;
Padc1(2,:)=Vdd1(2)*(i_oper1(2)*conversion_time+i_power_down*(Ts1-conversion_time))./Ts1;
title('Power consumption of ADC AD7684')
xlabel('Sampling frequency (Hz)')
ylabel('Power consumption (mW)')
PPG Power consumption based on ADPD144RI
Iled=100; % maximum current [mA]
Iafe=8.9+(Iled-25)/250; %[mA]
Tslot=Toffset+Tpulseperiod*num_pulses;
Qproc=Iproc*2*Tslot; %[mC]
Ivdd_ave=(2*Tslot*(Iafe+Iproc)+(Ts-2*Tslot)*Istandby)/Ts % [mA]
Iled_ave=(Tledpulse/Ts)*num_pulses*Iled
Pppg=Ivdd_ave*Vdd+2*Iled_ave*Vled
% Changing the number of pulses
Ivdd_ave=(2*Tslot*(Iafe+Iproc)+(Ts-2*Tslot)*Istandby)/Ts;
Iled_ave=(Tledpulse/Ts)*num_pulses*Iled;
Pppg=Ivdd_ave*Vdd+2*Iled_ave*Vled;
title('Power consumption of the PPG component ADPD144RI versus N_{pulse}')
xlabel('Number of pulses')
ylabel('Power consumption (mW)')
annonation_save('a)',"Fig10.10a.jpg", 1);
Ivdd_ave=(2*Tslot*(Iafe+Iproc)+(Ts-2*Tslot)*Istandby)/Ts;
Iled_ave=(Tledpulse/Ts)*num_pulses*Iled;
Pppg=Ivdd_ave*Vdd+2*Iled_ave*Vled;
title('Power consumption of the PPG component ADPD144RI versus f_s')
xlabel('Sampling rate f_s (sps)')
ylabel('Power consumption (mW)')
annonation_save('b)',"Fig10.10b.jpg", 1);
interval=T_sample+Toffset+i*Tpulseperiod:1e-6:T_sample+Toffset+i*Tpulseperiod+Tledpulse;
out(round(interval*1e6))=ones(1,length(interval));
Tslot=Toffset+Tpulseperiod*num_pulses+Tprocessingtime;
interval=T_sample+Tslot+Toffset+i*Tpulseperiod:1e-6:T_sample+Tslot+Toffset+i*Tpulseperiod+Tledpulse;
out(round(interval*1e6))=ones(1,length(interval));
T_sample=T_sample+800e-6;
title('Pulses at the output of the PPG component ADPD144RI')
exportgraphics(gcf,"Fig10.9_smartdraw.jpg", 'Resolution',600)
Microcontroller
Itot_normal=ICPUnormal+IRTC+Itimer+II2C;
Itot_comm=Itot_normal+Iradio;
elseif t(i)<Tnormal+Tcomm
plot(t,mean(Iout)*ones(1,length(t)))
legend(['Current in each mode'],['Average current'])
exportgraphics(gcf,"Fig10.11.jpg", 'Resolution',600)
Computing the power at the output
Itot_normal=ICPUnormal+IRTC+Itimer+II2C;
Itot_comm=Itot_normal+Iradio;
Iproc_ave=(Itot_normal*Tnormal+Itot_comm*Tcomm+Itot_stop*Tstp)/(Tnormal+Tstp+Tcomm);
P=2.75 +Iproc_ave*1.2+0.05*2.05
TotalDuration=3.6*1000/Ptotal
days=floor(TotalDuration/24)
hours=TotalDuration-days*24
Itot_normal=ICPUnormal+IRTC+Itimer+II2C;
Itot_comm=Itot_normal+Iradio;
Iproc_ave=(Itot_normal*Tnormal+Itot_comm*Tcomm+Itot_stop*Tstp)/(Tnormal+Tstp+Tcomm);
P=2.75 +Iproc_ave*1.2+0.05*2.05
TotalDuration=3.6*1000/Ptotal
days=floor(TotalDuration/24)
hours=TotalDuration-days*24