Coder Social home page Coder Social logo

snd_card_power_meter's People

Contributors

jackkelly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

snd_card_power_meter's Issues

Compress using FLAC

I think the easiest way to do this might be something like this:

  • split each audio recording into hour-long files
  • when the time comes to create a new recording:
    • close the previous file
    • open a new file
    • first check the previous compression task completed. Then subprocess to call ffmpeg to compress the previous recording to FLAC

There are Python audio libraries e.g.:

But I don't want to have to load the entire previous file into memory in Python. Instead I want to just fire off an ffmpeg instance to compress the file.

Handle errors from WattsUp

e.g.
wattsup: [error] Blech. Giving up on read: Bad address
wattsup: [error] Reading final time stamp: Bad address

Better variable naming

"volts" -> "voltage" if it isn't in units of volts
"amps" -> "current" if it isn't in units of amps!

Why don't we get "program not found" error when trying to run sox when it isn't installed

If sox isn't installed then we just get this error:

13-03-16 09:00:01 WARNING start WARNING: Previous conversion FAILED: sox --no-dither vi\
-1363417200.348878.wav --bits 24 --compression 8 vi-1363417200.348878.flac rate -v -L 1\
6000 && rm vi-1363417200.348878.wav
13-03-16 09:00:01 INFO start Running: sox --no-dither vi-1363420800.549942.wav --bits 2\
4 --compression 8 vi-1363420800.549942.flac rate -v -L 16000 && rm vi-1363420800.549942\
.wav

Why don't we get the full error message?

Seems to have died on March 31st

-rw-r--r--   1 root root 187M Mar 30 17:05 vi-2013_03_30_16_00_00_636767.flac
-rw-r--r--   1 root root 189M Mar 30 18:05 vi-2013_03_30_17_00_00_450238.flac
-rw-r--r--   1 root root 190M Mar 30 19:05 vi-2013_03_30_18_00_00_669354.flac
-rw-r--r--   1 root root 193M Mar 30 20:05 vi-2013_03_30_19_00_00_889285.flac
-rw-r--r--   1 root root 194M Mar 30 21:05 vi-2013_03_30_20_00_00_64461.flac
-rw-r--r--   1 root root 189M Mar 30 22:05 vi-2013_03_30_21_00_00_817415.flac
-rw-r--r--   1 root root 187M Mar 30 23:05 vi-2013_03_30_22_00_00_759095.flac
-rw-r--r--   1 root root 187M Mar 31 00:05 vi-2013_03_30_23_00_00_999147.flac
-rw-r--r--   1 root root 2.1G Mar 31 02:33 vi-2013_03_31_00_00_00_962376.wav

jack@jack-logger:/usr/local/logger/snd_card_power_meter$ tail *.log
13-03-31 05:27:27 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-31 05:27:27 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-31 05:27:41 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-31 05:27:41 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-31 05:28:01 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-31 05:28:01 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-31 05:28:02 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-31 05:29:15 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-31 05:29:20 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-31 05:29:28 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981

probably a BST problem

Experiment with using audioop.findfit to find phase difference

The current (I) data is just too nuts to try to calculate a phase difference using zero crossings or peaks.

One possible solution:

For 1 second of data, try to fit the voltage waveform to the current waveform using audioop.findfit().

BEFORE PUTTING ANY EFFORT INTO THIS: see if SMETS 2 specifies four quadrant recording or not

plot.py needs to work without a calibration.cfg file

jack@dave-logger:/usr/local/logger/snd_card_power_meter/scripts$ sudo ./plot.py
13-04-09 19:29:48 INFO Starting up...
13-04-09 19:29:48 INFO Opening Sampler...
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
13-04-09 19:29:48 INFO Successfully opened Sampler.
13-04-09 19:29:48 INFO Running sampler...
13-04-09 19:29:48 INFO Opening calibration file...
13-04-09 19:29:48 WARNING Error loading option from config file: No section: 'Calibration'
13-04-09 19:29:49 INFO Terminating Sampler
Traceback (most recent call last):
  File "./plot.py", line 38, in <module>
    main()
  File "./plot.py", line 29, in main
    adc_rms, calibration)
  File "/usr/local/logger/snd_card_power_meter/snd_card_power_meter/scpm.py", line 152, in calculate_calibrated_power
    data.real_power = inst_power.mean() * calibration.watts_per_adc_step
AttributeError: 'NoneType' object has no attribute 'watts_per_adc_step'

WARNING get_adc_data ERROR: [Errno Input overflowed] -9981

13-03-16 09:01:53 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-16 09:14:29 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-16 09:17:17 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-16 09:19:36 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-16 09:21:35 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-16 09:22:13 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-16 09:25:06 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-16 09:26:18 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-16 09:26:37 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-16 09:37:56 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981
13-03-16 09:47:06 WARNING get_adc_data ERROR: [Errno Input overflowed] -9981

Store calibration.cfg in /flac

Just need to modify config.py ?

Manually move it on my Atom PC.

Also move it on Dave's PC (if it's still there in college!)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.