I want to evaluate the energy flow in a battery powered system. So when the system runs a specific task the energy distribution between the different loads can be obtained ( similar to a Sankey diagram). For this a timescale in the range of [100..10] ms in the processed data would suffice.
Electric energy can be calculated as \$W = \int_{t_{0}}^{t_{1}}u(t)\cdot i(t) dt\$. Thus measuring voltage and current at a given sample rate will provide the necessary data. For further processing on a PC voltage and current should be logged.
As can be seen in the image the power supply converts the input of the batteries to a steady 24V. The motor drivers use a 40 kHz pulse-width-modulation (PWM) to control the brushless direct current (BLDC) motors. Up to 9 motor/driver combinations can be in such a system. There are more loads supplied by the power supply which show only slow changes in energy "consumption". The measuring will be controlled by an Arduino Due (84 MHz). The ADCs will likely have multiple channels and will be connected via SPI.
My concern is to measure with good accuracy whithout hitting a bottleneck in the processing:
Speed of the bus (SPI) to the ADCs, data processing ( both limited by microcontroller ), and especially the write speed to SD card ( limited by the Arduino lib <700 kB/s? )
The voltage of the batteries only changes slowly under load and thus the sampling rate can be low. However the motors show multiple harmonics in response to the 40 kHz PWM.
Considering the nyquist criterion measuring frequency would need to be more than twice as large then the fastest signal of interest (here the n-th harmonic with significant magnitude). Other signals need to be low pass filtered to prevent aliasing.
Question 1: Which steps for measurement and processing can be taken to maintain accuracy while reducing demand on the bottlenecks?
My thoughts are:
- Using arithmetic averages over a set interval \$\Delta T\$ to reduce data to log: \$\overline{W}=\overline{u}\cdot \overline{i} \cdot \Delta T\$
- Writing binary data to the SD card instead of plain text.
- Measuring only one phase per motor, assuming phases are driven equal while maintaining constant speed at constand torque. Thus this approach is limited by the conditions.
Question 2:Is it possible to get a good approximation by measuring slower than the PWM frequency?
I get that undersampling is not applicable here, as it uses the alias of a higher frequency band in an empty lower frequency band.