cycle_analyst_logger

<img src=“https://badge.fury.io/rb/cycle_analyst_logger.svg” alt=“Gem Version” />

NAME

cycle_analyst_logger - Store the streaming data log output of a Grin Cycle Analyst V3 and optionally a Phaserunner and GPS

SYNOPSIS

cycle_analyst_logger [global options] command [command options] [arguments...]
cycle_analyst_logger [global options] log [tty] [baudrate] [enable_phaserunner] [tty] [baudrate]

Notes

Only tested with Navspark-BD GPS

GLOBAL OPTIONS

-t, --tty_ca=arg          - Cycle Analyst Serial (USB) device (default: /dev/cycle_analyst)
-b, --baud_ca=arg         - Cycle Analyst Serial port baudrate (default: 9600)
--tty_pr=arg              - Phaserunner Serial (USB) device (default: /dev/phaserunner)
--baud_pr=arg             - Phaserunner Serial port baudrate (default: 115200)
--tty_gps=arg             - Gps Serial (USB) device (default: /dev/gps)
--baud_gps=arg            - Gps Serial port baudrate (default: 115200)
-l, --loop_count=arg      - How many lines to read (default: forever)
--version                 - Display the program version
--[no-]enable_phaserunner - Get PhaseRunner Logs also (default: enabled)
--[no-]enable_gps         - Get Gps Logs also (default: enabled)
-q, --[no-]quiet          - Do not output to stdout
--help                    - Show this message

COMMANDS

help - Shows a list of commands or help for one command
log  - Capture the logging output of the Cycle Analyst and optionally Phaserunner to a file

Attributes that are Logged

  • Timestamp

  • Cycle Analyst Amp Hours (Ah)

  • Cycle Analyst Volts (V)

  • Cycle Analyst Current (A)

  • Cycle Analyst Speed (Mph)

  • Cycle Analyst Distance (Miles)

  • Cycle Analyst Motor Temp (DegC)

  • Cycle Analyst Human Cadence (RPM)

  • Cycle Analyst Human Power (W)

  • Cycle Analyst Human Torque (Nm)

  • Cycle Analyst Throttle In (V)

  • Cycle Analyst Throttle Out (V)

  • Cycle Analyst AuxA ()

  • Cycle Analyst AuxD ()

  • Cycle Analyst Limit Flags (bit flags)

  • Cycle Analyst Faults

  • Phaserunner Faults ()

  • Phaserunner Controller Temperature (deg Celsius)

  • Phaserunner Vehicle Speed (Km/hour)

  • Phaserunner Motor Temperature (deg Celsius)

  • Phaserunner Motor Current (Amps)

  • Phaserunner Motor RPM (RPM)

  • Phaserunner Motor Speed (% of rated rpm)

  • Phaserunner Battery Voltage (Volts)

  • Phaserunner Battery Current (Amps)

  • Phaserunner Battery State of Charge (%)

  • Phaserunner Battery Power (Watts)

  • Phaserunner Last Fault ()

  • Phaserunner Warnings ()

  • Phaserunner Motor Input Power (W)

  • GPS Time

  • GPS Latitude

  • GPS Longitude

  • GPS Altitude

  • GPS Speed

  • GPS Fix Quality

  • GPS Satellites

  • GPS Geoid Height

  • GPS Horizontal Dilution

  • GPS FAA Mode

Udev set up

A sampe udev rules file is in resources/99-cycle_analyst.rules. It is based on the information from Persistent names for usb-serial devices

This one assumes we have the TTL to USB Cable based on the FTDI chipset like the USB Cables from Grin Tech We have one for the Cycle Analyst (CA) and one for the Phaserunner. If you always use the same cable with the CA and the other cable always for the Phaserunner (Label them). Then you can get away with using the serial numbers that the UDEV system sees to automatically link whatever USB port the cable is plugged into to the right /dev name.

The Navspark-BD GPS I used has a built in PL2303 chipset and doesn’t seem to have a serial number like the FTDI chipsets does. So the setup assumes there is only one PL2303 USB and its the GPS.

Systemd startup

There is a working systemd service unit file resources/cycle_analyst_logger.service. You can copy it into /lib/systemd/system and do a

systemctl daemon-reload to load it into systemd

  • If you want it to start when the system is booted say:

    systemctl enable cycle_analyst_logger.service

  • To disable:

    systemctl disable cycle_analyst_logger.service

  • To start it manually (have to do this also the first time you do an enable and want it to run then):

    systemctl start cycle_analyst_logger.service

  • You can check the status:

    systemctl status cycle_analyst_logger.service

  • To see the logs:

    journalctl -u cycle_analyst_logger.service

This file assumed that rvm was installed in my home directory and an rvm wrapper was created so it the service unit file could just exec it. I am currently using Ruby 2.4.1.

The command used to create the wrapper was run as my normal user:

rvm alias create cycle_analyst_logger 2.4.1

License and Copyright

  • Copyright © 2018 Robert J. Berger

  • License: MIT

:include:cycle_analyst_logger.rdoc