# openinverter CAN tool
[![Build status](../../actions/workflows/test.yml/badge.svg)](../../actions/workflows/test.yml)
A tool to allow configuration and operating of openinverter systems for
electric vehicles over a CAN connection.
## Features
* Display all available modifiable parameters and read-only values supported by a given inverter firmware version
* Read a specified parameter/value
* Write a new value to a specified parameter
* Display the current value of each parameter/value on a given device
* Save and load all parameters to and from a JSON file
* Runs on Linux, Windows and MacOS with python 3.7+
* Works with any CAN adapter supported by [python-can](https://pypi.org/project/python-can/)
* Supports [stm32-sine](https://github.com/jsphuebner/stm32-sine) 5.24.R or later
## Installation
The most recent release may be installed using pip:
```text
pip install openinverter_can_tool
```
To install directly from github:
```text
git clone https://github.com/davefiddes/openinverter_can_tool.git
cd openinverter_can_tool
pip install -e .
```
### Linux
Linux users may reduce the potential of package conflicts by installing python dependencies from their package manager. This should be done before running `pip`.
#### Fedora
```text
sudo dnf install python3-setuptools python3-pip python3-click python3-can
```
#### Ubuntu/Debian
```text
sudo apt install python3-setuptools python3-pip python3-click python3-can
```
## Configuration
Before the tool can be used the CAN interface adapter needs to be configured. To do this create `~/.canrc` on Linux or `%USERPROFILE%/can.conf` on Windows. Details on interfaces supported and the configuration file format can be found in the [python-can](https://python-can.readthedocs.io/en/stable/installation.html) documentation.
An example configuration file for a [SocketCAN](https://python-can.readthedocs.io/en/stable/interfaces/socketcan.html) compatible adapter on Linux would look like:
```text
[default]
interface = socketcan
channel = can0
bitrate = 500000
```
Note: Before the tool can on Linux run the SocketCAN network interface needs to be started:
```text
sudo ip link set can0 up type can bitrate 500000
```
An example configuration file for a [SLCAN](https://python-can.readthedocs.io/en/stable/interfaces/slcan.html) adapter such as [GVRET](https://github.com/collin80/GVRET) on Windows would look like:
```text
[default]
interface = slcan
channel = COM8
bitrate = 500000
```
Tested interfaces:
* [Innomaker USB2CAN](https://www.inno-maker.com/product/usb2can-cable/) CAN interface in Linux.
Let me know if you have used a particular CAN interface successfully and I can expand this list.
## Usage
The parameters and values supported by a given openinverter firmware will often vary from release to release and by firmware type (e.g. Sine to Field Oriented Control(FOC)). The tool comes with a small collection of parameter databases for recent openinverter releases. These can be found in the parameter-databases directory in the install location.
To get the usage information for the tool run the `oic` command with no parameters:
```text
$ oic
Usage: oic [OPTIONS] COMMAND [ARGS]...
openinverter CAN Tool allows querying and setting configuration of inverter
parameters over a CAN connection
Options:
-d, --database FILE openinverter JSON parameter database to use
-c, --context TEXT Which python-can configuration context to use
-n, --node INTEGER The CAN SDO node ID to communicate with [default: 1]
--version Show the version and exit.
--help Show this message and exit.
Commands:
dumpall Dump the values of all available parameters and values
listparams List all available parameters and values
load Load all parameters from json IN_FILE
read Read the value of PARAM from the device
save Save all parameters in json to OUT_FILE
write Write the value to the parameter PARAM on the device
```
To read a specific parameter:
```text
$ oic -d parameter-databases/stm32-sine.5.24.R-foc.json read brakeregen
brakeregen: -13 [%]
```
To write a new value to a parameter:
```text
oic -d parameter-databases/stm32-sine.5.24.R-foc.json write brakeregen -30.5
```
## Development
If you want to be able to change the code while using it, clone it then install
it in development mode:
```text
git clone https://github.com/davefiddes/openinverter_can_tool.git
cd openinverter_can_tool
pip install -e .[dev,test]
```
Unit tests and python code linting can be run on all supported python versions using the `tox` test framework.
Code is written to conform to PEP8 conventions and enforced by `pylint` and `flake8` linting.
Raw data
{
"_id": null,
"home_page": "https://github.com/davefiddes/openinverter-can-tool",
"name": "openinverter-can-tool",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7, <4",
"maintainer_email": "",
"keywords": "openinverter,canopen",
"author": "David J. Fiddes",
"author_email": "D.J@fiddes.net",
"download_url": "https://files.pythonhosted.org/packages/4b/21/2778f62b7d155e41f1cb8c6d9a15ce0e99be9edc14eb2aecd130c5314a4a/openinverter-can-tool-0.0.3.tar.gz",
"platform": null,
"description": "# openinverter CAN tool\n\n[![Build status](../../actions/workflows/test.yml/badge.svg)](../../actions/workflows/test.yml)\n\nA tool to allow configuration and operating of openinverter systems for\nelectric vehicles over a CAN connection.\n\n## Features\n\n* Display all available modifiable parameters and read-only values supported by a given inverter firmware version\n* Read a specified parameter/value\n* Write a new value to a specified parameter\n* Display the current value of each parameter/value on a given device\n* Save and load all parameters to and from a JSON file\n* Runs on Linux, Windows and MacOS with python 3.7+\n* Works with any CAN adapter supported by [python-can](https://pypi.org/project/python-can/)\n* Supports [stm32-sine](https://github.com/jsphuebner/stm32-sine) 5.24.R or later\n\n## Installation\n\nThe most recent release may be installed using pip:\n\n```text\n pip install openinverter_can_tool\n```\n\nTo install directly from github:\n\n```text\n git clone https://github.com/davefiddes/openinverter_can_tool.git\n cd openinverter_can_tool\n pip install -e .\n```\n\n### Linux\n\nLinux users may reduce the potential of package conflicts by installing python dependencies from their package manager. This should be done before running `pip`.\n\n#### Fedora\n\n```text\n sudo dnf install python3-setuptools python3-pip python3-click python3-can\n```\n\n#### Ubuntu/Debian\n\n```text\n sudo apt install python3-setuptools python3-pip python3-click python3-can\n```\n\n## Configuration\n\nBefore the tool can be used the CAN interface adapter needs to be configured. To do this create `~/.canrc` on Linux or `%USERPROFILE%/can.conf` on Windows. Details on interfaces supported and the configuration file format can be found in the [python-can](https://python-can.readthedocs.io/en/stable/installation.html) documentation.\n\nAn example configuration file for a [SocketCAN](https://python-can.readthedocs.io/en/stable/interfaces/socketcan.html) compatible adapter on Linux would look like:\n\n```text\n[default]\ninterface = socketcan\nchannel = can0\nbitrate = 500000\n```\n\nNote: Before the tool can on Linux run the SocketCAN network interface needs to be started:\n\n```text\n sudo ip link set can0 up type can bitrate 500000\n```\n\nAn example configuration file for a [SLCAN](https://python-can.readthedocs.io/en/stable/interfaces/slcan.html) adapter such as [GVRET](https://github.com/collin80/GVRET) on Windows would look like:\n\n```text\n[default]\ninterface = slcan\nchannel = COM8\nbitrate = 500000\n```\n\nTested interfaces:\n\n* [Innomaker USB2CAN](https://www.inno-maker.com/product/usb2can-cable/) CAN interface in Linux.\n\nLet me know if you have used a particular CAN interface successfully and I can expand this list.\n\n## Usage\n\nThe parameters and values supported by a given openinverter firmware will often vary from release to release and by firmware type (e.g. Sine to Field Oriented Control(FOC)). The tool comes with a small collection of parameter databases for recent openinverter releases. These can be found in the parameter-databases directory in the install location.\n\nTo get the usage information for the tool run the `oic` command with no parameters:\n\n```text\n $ oic\n Usage: oic [OPTIONS] COMMAND [ARGS]...\n\n openinverter CAN Tool allows querying and setting configuration of inverter\n parameters over a CAN connection\n\n Options:\n -d, --database FILE openinverter JSON parameter database to use\n -c, --context TEXT Which python-can configuration context to use\n -n, --node INTEGER The CAN SDO node ID to communicate with [default: 1]\n --version Show the version and exit.\n --help Show this message and exit.\n\n Commands:\n dumpall Dump the values of all available parameters and values\n listparams List all available parameters and values\n load Load all parameters from json IN_FILE\n read Read the value of PARAM from the device\n save Save all parameters in json to OUT_FILE\n write Write the value to the parameter PARAM on the device\n```\n\nTo read a specific parameter:\n\n```text\n $ oic -d parameter-databases/stm32-sine.5.24.R-foc.json read brakeregen\n brakeregen: -13 [%]\n```\n\nTo write a new value to a parameter:\n\n```text\n oic -d parameter-databases/stm32-sine.5.24.R-foc.json write brakeregen -30.5\n```\n\n## Development\n\nIf you want to be able to change the code while using it, clone it then install\nit in development mode:\n\n```text\n git clone https://github.com/davefiddes/openinverter_can_tool.git\n cd openinverter_can_tool\n pip install -e .[dev,test]\n```\n\nUnit tests and python code linting can be run on all supported python versions using the `tox` test framework.\n\nCode is written to conform to PEP8 conventions and enforced by `pylint` and `flake8` linting.\n",
"bugtrack_url": null,
"license": "",
"summary": "Tool to configure and operate openinverter systems over CAN",
"version": "0.0.3",
"split_keywords": [
"openinverter",
"canopen"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d6c108ea38292b36bf19bbef98d3d5b1f0fc7d2e22cb714148c97a1117c86a1a",
"md5": "04d9d5515d048ce8dd131e8772800ec5",
"sha256": "497a085804339e8c6fc04ed1ca9e5cb34e7868c307c5e164981ea643d278a5eb"
},
"downloads": -1,
"filename": "openinverter_can_tool-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "04d9d5515d048ce8dd131e8772800ec5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7, <4",
"size": 19207,
"upload_time": "2023-02-06T18:08:52",
"upload_time_iso_8601": "2023-02-06T18:08:52.215461Z",
"url": "https://files.pythonhosted.org/packages/d6/c1/08ea38292b36bf19bbef98d3d5b1f0fc7d2e22cb714148c97a1117c86a1a/openinverter_can_tool-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4b212778f62b7d155e41f1cb8c6d9a15ce0e99be9edc14eb2aecd130c5314a4a",
"md5": "3e637cbcf81d4e5e7a9d8f6a90d4f7d0",
"sha256": "26f3a2fae85c359914b99cb0b5e1a88701964b055fe5a7f4b6f236ce690778d4"
},
"downloads": -1,
"filename": "openinverter-can-tool-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "3e637cbcf81d4e5e7a9d8f6a90d4f7d0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7, <4",
"size": 13720,
"upload_time": "2023-02-06T18:08:54",
"upload_time_iso_8601": "2023-02-06T18:08:54.170847Z",
"url": "https://files.pythonhosted.org/packages/4b/21/2778f62b7d155e41f1cb8c6d9a15ce0e99be9edc14eb2aecd130c5314a4a/openinverter-can-tool-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-06 18:08:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "davefiddes",
"github_project": "openinverter-can-tool",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "openinverter-can-tool"
}