# pymx2
This is a python driver to communicate with an Omron MX2 inverter through Modbus ([manufacturer's page](https://industrial.omron.eu/en/products/mx2)). It is based on datasheet rev.2 (Jan 2013).
## Requirements
- An RS-485 adapter
- [pySerial](https://pypi.org/project/pyserial)
## What is provided
- Commands to handle low-level functions provided by the inverter:
- Read coil status (01h)
- Read holding register (03h)
- Write in coil (05h)
- Write in holding register (06h)
- Loopback test (08h)
- Write in coils (0Fh)
- Write in holding registers (10h)
- Read/write in holding registers (17h)
- A list of available coils and registers in the form of enums in mx2.enums:
- Coil: list of coil addresses
- ModbusRegisters: registers available only through Modbus
- StandardFunctions: A group registers as described in datasheet pp. 90-120
- FineTuningFunctions: B group registers (pp. 121-153)
- IntelligentTerminalFunctions: C group registers (pp. 153-171)
- MonitoringFunctions: D group registers (pp. 74-88)
- MainProfileParameters: F group registers (p. 89)
- MotorConstantsFunctions: H group registers (pp. 172-178)
- OtherParameters: P group registers (pp. 179-190)
- SecondMotorFunctions: registers from different groups assigned to 2nd motor configuration
- Data types to handle returned values and keep tracks of associated coils and registers:
- CoilValue: holds a reference to a coil address and a boolean value
- RegisterValue: holds a reference to a register address and an integer value
There are so many separate coils and registers that I didn't find appropriate to create a class method for each of them. Allowed values and units for each register can be found in the relevant datasheet pages. Register sizes are handled automatically.
An exception is made for fault monitors, for which as specific class method is provided.
Several examples are available in the [examples](examples) folder.
API documentation can be found within the code or in the *docs* folder (see [below](#api)).
Don't hesitate to report bugs [here](https://github.com/vpaeder/pymx2/issues).
## Setup
You can download a release from pypi using pip or clone this repository and install manually.
### From pypi
From command line, use:
```bash
python -m pip install pymx2
```
### From repository
From command line, use:
```bash
git clone https://github.com/vpaeder/pymx2.git
cd pymx2
python -m setup.py install
```
## Examples
See [examples](examples) folder.
## Tests
The [tests](tests) folder contains unit tests for most of the aspects of this package. To run them, use:
```bash
python -m unittest
```
## API
You can find docs in the [docs](docs) folder (generated from python docstrings). Alternatively, you can rely on python docstrings
1) either from the command line, use pydoc:
```bash
python -m pydoc mx2
```
2) or from within python:
```python
import mx2; help(mx2)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/vpaeder/pymx2",
"name": "pymx2",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "omron,mx2,inverter",
"author": "Vincent Paeder",
"author_email": "python@paeder.fi",
"download_url": "https://files.pythonhosted.org/packages/f5/35/3877a2f03da83989685b19a3e490e82d719c5742ef2da265dffe59b89db4/pymx2-0.1.6.tar.gz",
"platform": null,
"description": "# pymx2\n\nThis is a python driver to communicate with an Omron MX2 inverter through Modbus ([manufacturer's page](https://industrial.omron.eu/en/products/mx2)). It is based on datasheet rev.2 (Jan 2013).\n\n## Requirements\n\n- An RS-485 adapter\n- [pySerial](https://pypi.org/project/pyserial)\n\n## What is provided\n\n- Commands to handle low-level functions provided by the inverter:\n - Read coil status (01h)\n - Read holding register (03h)\n - Write in coil (05h)\n - Write in holding register (06h)\n - Loopback test (08h)\n - Write in coils (0Fh)\n - Write in holding registers (10h)\n - Read/write in holding registers (17h)\n- A list of available coils and registers in the form of enums in mx2.enums:\n - Coil: list of coil addresses\n - ModbusRegisters: registers available only through Modbus\n - StandardFunctions: A group registers as described in datasheet pp. 90-120\n - FineTuningFunctions: B group registers (pp. 121-153)\n - IntelligentTerminalFunctions: C group registers (pp. 153-171)\n - MonitoringFunctions: D group registers (pp. 74-88)\n - MainProfileParameters: F group registers (p. 89)\n - MotorConstantsFunctions: H group registers (pp. 172-178)\n - OtherParameters: P group registers (pp. 179-190)\n - SecondMotorFunctions: registers from different groups assigned to 2nd motor configuration\n- Data types to handle returned values and keep tracks of associated coils and registers:\n - CoilValue: holds a reference to a coil address and a boolean value\n - RegisterValue: holds a reference to a register address and an integer value\n\nThere are so many separate coils and registers that I didn't find appropriate to create a class method for each of them. Allowed values and units for each register can be found in the relevant datasheet pages. Register sizes are handled automatically.\nAn exception is made for fault monitors, for which as specific class method is provided.\nSeveral examples are available in the [examples](examples) folder.\nAPI documentation can be found within the code or in the *docs* folder (see [below](#api)).\nDon't hesitate to report bugs [here](https://github.com/vpaeder/pymx2/issues).\n\n## Setup\n\nYou can download a release from pypi using pip or clone this repository and install manually.\n\n### From pypi\n\nFrom command line, use:\n\n```bash\npython -m pip install pymx2\n```\n\n### From repository\n\nFrom command line, use:\n\n```bash\ngit clone https://github.com/vpaeder/pymx2.git\ncd pymx2\npython -m setup.py install\n```\n\n## Examples\n\nSee [examples](examples) folder.\n\n## Tests\n\nThe [tests](tests) folder contains unit tests for most of the aspects of this package. To run them, use:\n\n```bash\npython -m unittest\n```\n\n## API\n\nYou can find docs in the [docs](docs) folder (generated from python docstrings). Alternatively, you can rely on python docstrings\n\n1) either from the command line, use pydoc:\n\n```bash\npython -m pydoc mx2\n```\n\n2) or from within python:\n\n```python\nimport mx2; help(mx2)\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "A Python driver to communicate with an Omron MX2 inverter through Modbus",
"version": "0.1.6",
"project_urls": {
"Bug Tracker": "https://github.com/vpaeder/pymx2/issues",
"Homepage": "https://github.com/vpaeder/pymx2"
},
"split_keywords": [
"omron",
"mx2",
"inverter"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d902886191210cf42e75606ad61642e915805600a197e9c9a8803887e55b5f4c",
"md5": "94a36e7f1811975300c3616e83d6f39c",
"sha256": "44dabb5c4f00eca7d539f825d18bc8cc16d4f5bb1ea8967d029a3cf5bfc13f4d"
},
"downloads": -1,
"filename": "pymx2-0.1.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "94a36e7f1811975300c3616e83d6f39c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 28125,
"upload_time": "2023-05-12T17:32:09",
"upload_time_iso_8601": "2023-05-12T17:32:09.829233Z",
"url": "https://files.pythonhosted.org/packages/d9/02/886191210cf42e75606ad61642e915805600a197e9c9a8803887e55b5f4c/pymx2-0.1.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f5353877a2f03da83989685b19a3e490e82d719c5742ef2da265dffe59b89db4",
"md5": "795f7b078775403c1743ab96cc0b92cf",
"sha256": "9039b8d49f10e3005bb00fee6fddc2a24323e15cd98a68f7fcd8d295fa43515b"
},
"downloads": -1,
"filename": "pymx2-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "795f7b078775403c1743ab96cc0b92cf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 58583,
"upload_time": "2023-05-12T17:32:12",
"upload_time_iso_8601": "2023-05-12T17:32:12.311473Z",
"url": "https://files.pythonhosted.org/packages/f5/35/3877a2f03da83989685b19a3e490e82d719c5742ef2da265dffe59b89db4/pymx2-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-12 17:32:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vpaeder",
"github_project": "pymx2",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pymx2"
}