cycle_analyst_logger 0.3.5 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rdoc_options +23 -0
- data/CODE-OF-CONDUCT.md +74 -0
- data/README.md +258 -0
- data/cycle_analyst_logger.gemspec +3 -3
- data/lib/cycle_analyst_logger/cycle_analyst.rb +1 -1
- data/lib/cycle_analyst_logger/version.rb +1 -1
- metadata +9 -14
- data/README.rdoc +0 -146
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a807236a1abe215d67e3ea9f8943ee3aeb24e4e
|
4
|
+
data.tar.gz: cb7ca7eb58d2f19ea2992aac7116a64e2693d27c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3eed7a8c61f94748b9cce419214356e727fe044e18c9652528aa86ddcc15ab53f03c6b3d7870dc439a7908862516b1d5869d1df7fe7f677af10eec6b9713a5cd
|
7
|
+
data.tar.gz: 35f25835510030871c8fd6f74b082fee0330f5e95387de40b49ffcb71a03d3ed2c39d1a375060ea3ab3b5d60ebab1bbd2d0a5fd02b8eb0d4ca0081ca071b44c9
|
data/.rdoc_options
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
--- !ruby/object:RDoc::Options
|
2
|
+
encoding: UTF-8
|
3
|
+
static_path: []
|
4
|
+
rdoc_include:
|
5
|
+
- "."
|
6
|
+
- "/Users/rberger/Documents/Trike/bike-pi/cycle_analyst_logger"
|
7
|
+
charset: UTF-8
|
8
|
+
exclude:
|
9
|
+
hyperlink_all: false
|
10
|
+
line_numbers: false
|
11
|
+
locale:
|
12
|
+
locale_dir: locale
|
13
|
+
locale_name:
|
14
|
+
main_page:
|
15
|
+
markup: markdown
|
16
|
+
output_decoration: true
|
17
|
+
page_dir:
|
18
|
+
show_hash: false
|
19
|
+
tab_width: 8
|
20
|
+
template_stylesheets: []
|
21
|
+
title:
|
22
|
+
visibility: :protected
|
23
|
+
webcvs:
|
data/CODE-OF-CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
education, socio-economic status, nationality, personal appearance, race,
|
10
|
+
religion, or sexual identity and orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at _rberger at ibd dot com_. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
72
|
+
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
74
|
+
|
data/README.md
ADDED
@@ -0,0 +1,258 @@
|
|
1
|
+
# Cycle_analyst_logger
|
2
|
+
|
3
|
+
Log the streaming data log output of a Grin Cycle Analyst V3 and optionally a Phaserunner and GPS
|
4
|
+
|
5
|
+
[![Gem Version Badge](https://badge.fury.io/rb/cycle_analyst_logger.svg)](https://badge.fury.io/rb/cycle_analyst_logger)
|
6
|
+
|
7
|
+
## Getting Started
|
8
|
+
|
9
|
+
These instructions will get you a copy of the project up and running on your
|
10
|
+
local machine for development and testing purposes. See deployment for notes on
|
11
|
+
how to deploy the project on a live system.
|
12
|
+
|
13
|
+
### Prerequisites
|
14
|
+
|
15
|
+
* Ruby ~2.4 or ~2.5
|
16
|
+
* Bundler
|
17
|
+
|
18
|
+
Bundler / Gemspec automatically pulls in all the dependencies
|
19
|
+
|
20
|
+
### Installing for doing development
|
21
|
+
|
22
|
+
The usual Ruby install from github
|
23
|
+
|
24
|
+
```
|
25
|
+
git clone git@github.com:rberger/phaserunner.git
|
26
|
+
cd phaserunner
|
27
|
+
bundle install
|
28
|
+
```
|
29
|
+
|
30
|
+
### Notes
|
31
|
+
|
32
|
+
* Delegates all Phaserunner operations to [rberger/phaserunner](https://github.com/rberger/phaserunner) [phaserunner ruby gem](https://rubygems.org/gems/phaserunner)
|
33
|
+
* Only tested with [Navspark-BD GPS](http://navspark.mybigcommerce.com/navspark-bd-arduino-compatible-development-board-with-gps-beidou/)
|
34
|
+
* Does not yet apply scaling factors to the Phaserunner data
|
35
|
+
* Log output file is CSV with CA, Phaserunner and GPS Data per line
|
36
|
+
* Also outputs the raw NMEA GPS file so that it can be read into [Grin Trip Analyzer](http://www.ebikes.ca/tools/trip-analyzer.html)
|
37
|
+
* The `to_ca_file` command converts the default log output file to a CALog file suitable for inputing to [Grin Trip Analyzer](http://www.ebikes.ca/tools/trip-analyzer.html)
|
38
|
+
* Sometimes the Trip Analyzer barfs on the NMEA file
|
39
|
+
|
40
|
+
## Usage
|
41
|
+
|
42
|
+
### Help
|
43
|
+
|
44
|
+
Shows a list of commands or help for one command
|
45
|
+
|
46
|
+
```
|
47
|
+
> cycle_analyst_logger help
|
48
|
+
NAME
|
49
|
+
cycle_analyst_logger - Store the streaming data log output of a Grin Cycle Analyst V3 and optionally a Phaserunner
|
50
|
+
|
51
|
+
SYNOPSIS
|
52
|
+
cycle_analyst_logger [global options] command [command options] [arguments...]
|
53
|
+
|
54
|
+
VERSION
|
55
|
+
0.4.0
|
56
|
+
|
57
|
+
GLOBAL OPTIONS
|
58
|
+
-t, --tty_ca=arg - Cycle Analyst Serial (USB) device (default: /dev/cycle_analyst)
|
59
|
+
-b, --baud_ca=arg - Cycle Analyst Serial port baudrate (default: 9600)
|
60
|
+
--tty_pr=arg - Phaserunner Serial (USB) device (default: /dev/phaserunner)
|
61
|
+
--baud_pr=arg - Phaserunner Serial port baudrate (default: 115200)
|
62
|
+
--tty_gps=arg - Gps Serial (USB) device (default: /dev/gps)
|
63
|
+
--baud_gps=arg - Gps Serial port baudrate (default: 115200)
|
64
|
+
-l, --loop_count=arg - How many lines to read (default: forever)
|
65
|
+
--version - Display the program version
|
66
|
+
--[no-]enable_phaserunner - Get PhaseRunner Logs also (default: enabled)
|
67
|
+
--[no-]enable_gps - Get Gps Logs also (default: enabled)
|
68
|
+
-q, --[no-]quiet - Do not output to stdout
|
69
|
+
--help - Show this message
|
70
|
+
|
71
|
+
COMMANDS
|
72
|
+
help - Shows a list of commands or help for one command
|
73
|
+
log - Log the Cycle Analyst and optionally GPS and Phaserunner to a file
|
74
|
+
to_ca_file - Transform logs to CA format
|
75
|
+
```
|
76
|
+
|
77
|
+
### Log
|
78
|
+
|
79
|
+
Capture the logging output of the Cycle Analyst and optionally Phaserunner to a file
|
80
|
+
|
81
|
+
```
|
82
|
+
> cycle_analyst_logger help log
|
83
|
+
NAME
|
84
|
+
log - Log the Cycle Analyst and optionally GPS and Phaserunner to a file
|
85
|
+
|
86
|
+
SYNOPSIS
|
87
|
+
cycle_analyst_logger [global options] log [command options] [tty] [baudrate] [tty] [baudrate] [tty] [baudrate]
|
88
|
+
|
89
|
+
COMMAND OPTIONS
|
90
|
+
--[no-]disable_nmea_out - Disable writing raw nmea to its own file
|
91
|
+
```
|
92
|
+
|
93
|
+
#### Attributes that are Logged
|
94
|
+
|
95
|
+
* Timestamp
|
96
|
+
* Cycle Analyst Amp Hours (Ah)
|
97
|
+
* Cycle Analyst Volts (V)
|
98
|
+
* Cycle Analyst Current (A)
|
99
|
+
* Cycle Analyst Speed (Mph)
|
100
|
+
* Cycle Analyst Distance (Miles)
|
101
|
+
* Cycle Analyst Motor Temp (DegC)
|
102
|
+
* Cycle Analyst Human Cadence (RPM)
|
103
|
+
* Cycle Analyst Human Power (W)
|
104
|
+
* Cycle Analyst Human Torque (Nm)
|
105
|
+
* Cycle Analyst Throttle In (V)
|
106
|
+
* Cycle Analyst Throttle Out (V)
|
107
|
+
* Cycle Analyst AuxA ()
|
108
|
+
* Cycle Analyst AuxD ()
|
109
|
+
* Cycle Analyst Limit Flags (bit flags)
|
110
|
+
* Cycle Analyst Faults
|
111
|
+
* Phaserunner Faults ()
|
112
|
+
* Phaserunner Controller Temperature (deg Celsius)
|
113
|
+
* Phaserunner Vehicle Speed (Km/hour)
|
114
|
+
* Phaserunner Motor Temperature (deg Celsius)
|
115
|
+
* Phaserunner Motor Current (Amps)
|
116
|
+
* Phaserunner Motor RPM (RPM)
|
117
|
+
* Phaserunner Motor Speed (% of rated rpm)
|
118
|
+
* Phaserunner Battery Voltage (Volts)
|
119
|
+
* Phaserunner Battery Current (Amps)
|
120
|
+
* Phaserunner Battery State of Charge (%)
|
121
|
+
* Phaserunner Battery Power (Watts)
|
122
|
+
* Phaserunner Last Fault ()
|
123
|
+
* Phaserunner Throttle Voltage (Volts)
|
124
|
+
* Phaserunner Brake 1 Voltage (Volts)
|
125
|
+
* Phaserunner Brake 2 Voltage (Volts)
|
126
|
+
* Phaserunner Raw Controller Temperature Sensor Voltage (Volts)
|
127
|
+
* Phaserunner Digital Inputs (Bitmap)
|
128
|
+
* Phaserunner Warnings (Bitmap)
|
129
|
+
* Phaserunner Phase A Current (Amps)
|
130
|
+
* Phaserunner Phase B Current (Amps)
|
131
|
+
* Phaserunner Phase C Current (Amps)
|
132
|
+
* Phaserunner Phase A Voltage (Volts)
|
133
|
+
* Phaserunner Phase B Voltage (Volts)
|
134
|
+
* Phaserunner Phase C Voltage (Volts)
|
135
|
+
* Phaserunner Motor Input Power (W)
|
136
|
+
* Phaserunner Torque Command (pu)
|
137
|
+
* Phaserunner Torque Reference (pu)
|
138
|
+
* Phaserunner Speed (Ref/Limit) Command (pu)
|
139
|
+
* GPS Time
|
140
|
+
* GPS Latitude
|
141
|
+
* GPS Longitude
|
142
|
+
* GPS Altitude
|
143
|
+
* GPS Speed
|
144
|
+
* GPS Fix Quality
|
145
|
+
* GPS Satellites
|
146
|
+
* GPS Geoid Height
|
147
|
+
* GPS Horizontal Dilution
|
148
|
+
* GPS FAA Mode
|
149
|
+
|
150
|
+
### to_ca_file
|
151
|
+
|
152
|
+
Transform logs to CA format
|
153
|
+
|
154
|
+
```
|
155
|
+
> cycle_analyst_logger help to_ca_file
|
156
|
+
NAME
|
157
|
+
to_ca_file - Transform logs to CA format
|
158
|
+
|
159
|
+
SYNOPSIS
|
160
|
+
cycle_analyst_logger [global options] to_ca_file log_filename
|
161
|
+
```
|
162
|
+
## Deployment
|
163
|
+
|
164
|
+
Deploy as usual. If you are not doing it from a git clone just want to install from Rubygems:
|
165
|
+
|
166
|
+
```
|
167
|
+
gem install phaserunner
|
168
|
+
```
|
169
|
+
|
170
|
+
### Udev set up
|
171
|
+
|
172
|
+
A sample udev rules file is in `resources/99-cycle_analyst.rules`. It is based on
|
173
|
+
the information from [Persistent names for usb-serial
|
174
|
+
devices](http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/)
|
175
|
+
|
176
|
+
This one assumes we have the TTL to USB Cable based on the FTDI chipset like the
|
177
|
+
[USB Cables from Grin Tech](http://www.ebikes.ca/ca-usb.html) We have one for
|
178
|
+
the Cycle Analyst (CA) and one for the Phaserunner. If you always use the same
|
179
|
+
cable with the CA and the other cable always for the Phaserunner (Label them).
|
180
|
+
Then you can get away with using the serial numbers that the UDEV system sees to
|
181
|
+
automatically link whatever USB port the cable is plugged into to the right
|
182
|
+
`/dev` name.
|
183
|
+
|
184
|
+
The Navspark-BD GPS I used has a built in PL2303 chipset and doesn't seem to
|
185
|
+
have a serial number like the FTDI chipsets does. So the setup assumes there is
|
186
|
+
only one PL2303 USB and its the GPS.
|
187
|
+
|
188
|
+
### Systemd startup
|
189
|
+
|
190
|
+
There is a working systemd service unit file
|
191
|
+
`resources/cycle_analyst_logger.service`. You can copy it into
|
192
|
+
`/lib/systemd/system` and do a
|
193
|
+
|
194
|
+
`systemctl daemon-reload` to load it into systemd
|
195
|
+
|
196
|
+
* If you want it to start when the system is booted say:
|
197
|
+
|
198
|
+
`systemctl enable cycle_analyst_logger.service`
|
199
|
+
|
200
|
+
* To disable:
|
201
|
+
|
202
|
+
`systemctl disable cycle_analyst_logger.service`
|
203
|
+
|
204
|
+
* To start it manually (have to do this also the first time you do an enable and
|
205
|
+
want it to run then):
|
206
|
+
|
207
|
+
`systemctl start cycle_analyst_logger.service`
|
208
|
+
|
209
|
+
* You can check the status:
|
210
|
+
|
211
|
+
`systemctl status cycle_analyst_logger.service`
|
212
|
+
|
213
|
+
* To see the logs:
|
214
|
+
|
215
|
+
`journalctl -u cycle_analyst_logger.service`
|
216
|
+
|
217
|
+
This file assumed that rvm was installed in my home directory and an rvm wrapper
|
218
|
+
was created so it the service unit file could just exec it. I am currently using
|
219
|
+
Ruby 2.4.1.
|
220
|
+
|
221
|
+
The command used to create the wrapper was run as my normal user:
|
222
|
+
|
223
|
+
`rvm alias create cycle_analyst_logger 2.4.1`
|
224
|
+
|
225
|
+
## Built With
|
226
|
+
|
227
|
+
* [Ruby](https://www.ruby-lang.org/) - Language
|
228
|
+
* [Bundler](http://bundler.io) - Package / Dependency Management
|
229
|
+
* [asi_bod](https://rubygems.org/gems/asi_bod) - Grin Phaserunner / [Accelerated System](http://accelerated-systems.com) Register Defs
|
230
|
+
* [Grin Tech Phaserunner](http://www.ebikes.ca/product-info/phaserunner.html) - Controller were interfacing to
|
231
|
+
|
232
|
+
## Contributing
|
233
|
+
|
234
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rberger/rmodbus_cli.
|
235
|
+
|
236
|
+
|
237
|
+
### Code of Conduct in Contriubing
|
238
|
+
|
239
|
+
This project is intended to be a safe, welcoming space for collaboration.
|
240
|
+
|
241
|
+
Everyone interacting in this project’s codebases, issue trackers, chat rooms and
|
242
|
+
mailing lists is expected to follow the [Contributor Code of Conduct](CODE_OF_CONDUCT.md).
|
243
|
+
|
244
|
+
## Versioning
|
245
|
+
|
246
|
+
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/rberger/phaserunner/tags).
|
247
|
+
|
248
|
+
## Authors
|
249
|
+
|
250
|
+
* **[Robert Berger](https://github.com/rberger)**
|
251
|
+
|
252
|
+
## License and Copyright
|
253
|
+
|
254
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE.txt) file for details
|
255
|
+
|
256
|
+
* Copyright (c) 2018 Robert J. Berger
|
257
|
+
* License: MIT
|
258
|
+
|
@@ -23,12 +23,12 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.required_ruby_version = '~> 2'
|
24
24
|
|
25
25
|
spec.has_rdoc = true
|
26
|
-
spec.extra_rdoc_files = ['README.
|
27
|
-
spec.rdoc_options << '--title' << 'cycle_analyst_logger' << '--main' << 'README.
|
26
|
+
spec.extra_rdoc_files = ['README.md']
|
27
|
+
spec.rdoc_options << '--title' << 'cycle_analyst_logger' << '--main' << 'README.md' << '-ri'
|
28
28
|
|
29
29
|
spec.add_runtime_dependency 'gli', '~> 2.17'
|
30
30
|
spec.add_runtime_dependency 'serialport', '~> 1.3'
|
31
|
-
spec.add_runtime_dependency 'phaserunner', '~> 0.
|
31
|
+
spec.add_runtime_dependency 'phaserunner', '~> 0.2'
|
32
32
|
spec.add_runtime_dependency 'haversine', '~> 0.3.2'
|
33
33
|
spec.add_runtime_dependency 'gpx', '~> 0.9.0'
|
34
34
|
spec.add_runtime_dependency 'nmea_plus', '~> 1.0', '>= 1.0.20'
|
@@ -108,7 +108,7 @@ module CycleAnalystLogger
|
|
108
108
|
# @param quite [Boolean] Don't output to stdout if true
|
109
109
|
def get_logs(loop_count, quiet, disable_nmea_out)
|
110
110
|
timestamp = Time.now.strftime('%Y-%m-%d_%H-%M-%S')
|
111
|
-
filename = "cycle_analyst
|
111
|
+
filename = "cycle_analyst-v#{VERSION}-#{timestamp}.csv"
|
112
112
|
output_fd = File.open(filename, 'w')
|
113
113
|
|
114
114
|
if enable_gps
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cycle_analyst_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert J. Berger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -44,20 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: 0.1.5
|
47
|
+
version: '0.2'
|
51
48
|
type: :runtime
|
52
49
|
prerelease: false
|
53
50
|
version_requirements: !ruby/object:Gem::Requirement
|
54
51
|
requirements:
|
55
52
|
- - "~>"
|
56
53
|
- !ruby/object:Gem::Version
|
57
|
-
version: '0.
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 0.1.5
|
54
|
+
version: '0.2'
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
56
|
name: haversine
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,13 +192,14 @@ executables:
|
|
198
192
|
- cycle_analyst_logger
|
199
193
|
extensions: []
|
200
194
|
extra_rdoc_files:
|
201
|
-
- README.
|
202
|
-
- cycle_analyst_logger.rdoc
|
195
|
+
- README.md
|
203
196
|
files:
|
204
197
|
- ".gitignore"
|
198
|
+
- ".rdoc_options"
|
199
|
+
- CODE-OF-CONDUCT.md
|
205
200
|
- Gemfile
|
206
201
|
- LICENSE.txt
|
207
|
-
- README.
|
202
|
+
- README.md
|
208
203
|
- Rakefile
|
209
204
|
- cycle_analyst_logger.gemspec
|
210
205
|
- cycle_analyst_logger.rdoc
|
@@ -228,7 +223,7 @@ rdoc_options:
|
|
228
223
|
- "--title"
|
229
224
|
- cycle_analyst_logger
|
230
225
|
- "--main"
|
231
|
-
- README.
|
226
|
+
- README.md
|
232
227
|
- "-ri"
|
233
228
|
require_paths:
|
234
229
|
- lib
|
data/README.rdoc
DELETED
@@ -1,146 +0,0 @@
|
|
1
|
-
= cycle_analyst_logger
|
2
|
-
|
3
|
-
{<img src="https://badge.fury.io/rb/cycle_analyst_logger.svg" alt="Gem Version" />}[https://badge.fury.io/rb/cycle_analyst_logger]
|
4
|
-
|
5
|
-
== NAME
|
6
|
-
cycle_analyst_logger - Store the streaming data log output of a Grin Cycle Analyst V3 and optionally a Phaserunner and GPS
|
7
|
-
|
8
|
-
== SYNOPSIS
|
9
|
-
cycle_analyst_logger [global options] command [command options] [arguments...]
|
10
|
-
cycle_analyst_logger [global options] log [tty] [baudrate] [enable_phaserunner] [tty] [baudrate]
|
11
|
-
cycle_analyst_logger [global options] to_ca_file log_filename
|
12
|
-
|
13
|
-
== Notes
|
14
|
-
|
15
|
-
* Only tested with {Navspark-BD GPS}[http://navspark.mybigcommerce.com/navspark-bd-arduino-compatible-development-board-with-gps-beidou/]
|
16
|
-
* Does not yet apply scaling factors to the Phaserunner data
|
17
|
-
* Log output file is CSV with CA, Phaserunner and GPS Data per line
|
18
|
-
* Also outputs the raw NMEA GPS file so that it can be read into {Grin Trip Analyzer}[http://www.ebikes.ca/tools/trip-analyzer.html]
|
19
|
-
* The +to_ca_file+ command converts the default log output file to a CALog file suitable for inputing to {Grin Trip Analyzer}[http://www.ebikes.ca/tools/trip-analyzer.html]
|
20
|
-
* Sometimes the Trip Analyzer barfs on the NMEA file
|
21
|
-
|
22
|
-
== GLOBAL OPTIONS
|
23
|
-
-t, --tty_ca=arg - Cycle Analyst Serial (USB) device (default: /dev/cycle_analyst)
|
24
|
-
-b, --baud_ca=arg - Cycle Analyst Serial port baudrate (default: 9600)
|
25
|
-
--tty_pr=arg - Phaserunner Serial (USB) device (default: /dev/phaserunner)
|
26
|
-
--baud_pr=arg - Phaserunner Serial port baudrate (default: 115200)
|
27
|
-
--tty_gps=arg - Gps Serial (USB) device (default: /dev/gps)
|
28
|
-
--baud_gps=arg - Gps Serial port baudrate (default: 115200)
|
29
|
-
-l, --loop_count=arg - How many lines to read (default: forever)
|
30
|
-
--version - Display the program version
|
31
|
-
--[no-]enable_phaserunner - Get PhaseRunner Logs also (default: enabled)
|
32
|
-
--[no-]enable_gps - Get Gps Logs also (default: enabled)
|
33
|
-
-q, --[no-]quiet - Do not output to stdout
|
34
|
-
--help - Show this message
|
35
|
-
|
36
|
-
== COMMANDS
|
37
|
-
help - Shows a list of commands or help for one command
|
38
|
-
log - Capture the logging output of the Cycle Analyst and optionally Phaserunner to a file
|
39
|
-
to_ca_file - Transform logs to CA format
|
40
|
-
|
41
|
-
=== Attributes that are Logged
|
42
|
-
|
43
|
-
* Timestamp
|
44
|
-
* Cycle Analyst Amp Hours (Ah)
|
45
|
-
* Cycle Analyst Volts (V)
|
46
|
-
* Cycle Analyst Current (A)
|
47
|
-
* Cycle Analyst Speed (Mph)
|
48
|
-
* Cycle Analyst Distance (Miles)
|
49
|
-
* Cycle Analyst Motor Temp (DegC)
|
50
|
-
* Cycle Analyst Human Cadence (RPM)
|
51
|
-
* Cycle Analyst Human Power (W)
|
52
|
-
* Cycle Analyst Human Torque (Nm)
|
53
|
-
* Cycle Analyst Throttle In (V)
|
54
|
-
* Cycle Analyst Throttle Out (V)
|
55
|
-
* Cycle Analyst AuxA ()
|
56
|
-
* Cycle Analyst AuxD ()
|
57
|
-
* Cycle Analyst Limit Flags (bit flags)
|
58
|
-
* Cycle Analyst Faults
|
59
|
-
* Phaserunner Faults ()
|
60
|
-
* Phaserunner Controller Temperature (deg Celsius)
|
61
|
-
* Phaserunner Vehicle Speed (Km/hour)
|
62
|
-
* Phaserunner Motor Temperature (deg Celsius)
|
63
|
-
* Phaserunner Motor Current (Amps)
|
64
|
-
* Phaserunner Motor RPM (RPM)
|
65
|
-
* Phaserunner Motor Speed (% of rated rpm)
|
66
|
-
* Phaserunner Battery Voltage (Volts)
|
67
|
-
* Phaserunner Battery Current (Amps)
|
68
|
-
* Phaserunner Battery State of Charge (%)
|
69
|
-
* Phaserunner Battery Power (Watts)
|
70
|
-
* Phaserunner Last Fault ()
|
71
|
-
* Phaserunner Warnings ()
|
72
|
-
* Phaserunner Motor Input Power (W)
|
73
|
-
* GPS Time
|
74
|
-
* GPS Latitude
|
75
|
-
* GPS Longitude
|
76
|
-
* GPS Altitude
|
77
|
-
* GPS Speed
|
78
|
-
* GPS Fix Quality
|
79
|
-
* GPS Satellites
|
80
|
-
* GPS Geoid Height
|
81
|
-
* GPS Horizontal Dilution
|
82
|
-
* GPS FAA Mode
|
83
|
-
|
84
|
-
== Udev set up
|
85
|
-
|
86
|
-
A sample udev rules file is in +resources/99-cycle_analyst.rules+. It is based on
|
87
|
-
the information from {Persistent names for usb-serial
|
88
|
-
devices}[http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/]
|
89
|
-
|
90
|
-
This one assumes we have the TTL to USB Cable based on the FTDI chipset like the
|
91
|
-
{USB Cables from Grin Tech}[http://www.ebikes.ca/ca-usb.html] We have one for
|
92
|
-
the Cycle Analyst (CA) and one for the Phaserunner. If you always use the same
|
93
|
-
cable with the CA and the other cable always for the Phaserunner (Label them).
|
94
|
-
Then you can get away with using the serial numbers that the UDEV system sees to
|
95
|
-
automatically link whatever USB port the cable is plugged into to the right
|
96
|
-
+/dev+ name.
|
97
|
-
|
98
|
-
The Navspark-BD GPS I used has a built in PL2303 chipset and doesn't seem to
|
99
|
-
have a serial number like the FTDI chipsets does. So the setup assumes there is
|
100
|
-
only one PL2303 USB and its the GPS.
|
101
|
-
|
102
|
-
== Systemd startup
|
103
|
-
|
104
|
-
There is a working systemd service unit file
|
105
|
-
+resources/cycle_analyst_logger.service+. You can copy it into
|
106
|
-
+/lib/systemd/system+ and do a
|
107
|
-
|
108
|
-
<tt>systemctl daemon-reload</tt> to load it into systemd
|
109
|
-
|
110
|
-
* If you want it to start when the system is booted say:
|
111
|
-
|
112
|
-
<tt>systemctl enable cycle_analyst_logger.service</tt>
|
113
|
-
|
114
|
-
* To disable:
|
115
|
-
|
116
|
-
<tt>systemctl disable cycle_analyst_logger.service</tt>
|
117
|
-
|
118
|
-
* To start it manually (have to do this also the first time you do an enable and
|
119
|
-
want it to run then):
|
120
|
-
|
121
|
-
<tt>systemctl start cycle_analyst_logger.service</tt>
|
122
|
-
|
123
|
-
* You can check the status:
|
124
|
-
|
125
|
-
<tt>systemctl status cycle_analyst_logger.service</tt>
|
126
|
-
|
127
|
-
* To see the logs:
|
128
|
-
|
129
|
-
<tt>journalctl -u cycle_analyst_logger.service</tt>
|
130
|
-
|
131
|
-
This file assumed that rvm was installed in my home directory and an rvm wrapper
|
132
|
-
was created so it the service unit file could just exec it. I am currently using
|
133
|
-
Ruby 2.4.1.
|
134
|
-
|
135
|
-
The command used to create the wrapper was run as my normal user:
|
136
|
-
|
137
|
-
<tt>rvm alias create cycle_analyst_logger 2.4.1</tt>
|
138
|
-
|
139
|
-
== License and Copyright
|
140
|
-
|
141
|
-
* Copyright (c) 2018 Robert J. Berger
|
142
|
-
* License: MIT
|
143
|
-
|
144
|
-
|
145
|
-
:include:cycle_analyst_logger.rdoc
|
146
|
-
|