Skip to content

Commit

Permalink
Merge pull request #10 from davidraker/docs
Browse files Browse the repository at this point in the history
Docs
  • Loading branch information
schandrika authored Oct 3, 2023
2 parents f50e502 + 136c1c2 commit ccfb276
Show file tree
Hide file tree
Showing 7 changed files with 631 additions and 102 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:

strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
python: ['3.8', '3.9', '3.10']
os: [ubuntu-22.04]
python: ['3.10', '3.11']

runs-on: ${{ matrix.os }}

Expand Down
166 changes: 68 additions & 98 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,130 +1,100 @@
# volttron-lib-bacnet-driver
# VOLTTRON BACnet Driver Interface

![Python 3.10](https://img.shields.io/badge/python-3.10-blue.svg)
![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)
[![Passing?](https://github.com/VOLTTRON/volttron-lib-bacnet-driver/actions/workflows/run-tests.yml/badge.svg)](https://github.com/VOLTTRON/volttron-lib-bacnet-driver/actions/workflows/run-tests.yml)
[![pypi version](https://img.shields.io/pypi/v/volttron-lib-bacnet-driver.svg)](https://pypi.org/project/volttron-lib-bacnet-driver/)

# Prerequisites
# Requires
# Requires

* Python 3.8
* python >= 3.10
* bacpypes == "0.16.7"
* volttron >= 10.0
* volttron-lib-base-driver
* volttron-bacnet-proxy

## Python
# Documentation
More detailed documentation can be found on [ReadTheDocs](https://eclipse-volttron.readthedocs.io/en/latest/external-docs/volttron-platform-driver/docs/source/index.html). The RST source
of the documentation for this component is located in the "docs" directory of this repository.

<details>
<summary>To install Python 3.8, we recommend using <a href="https://github.com/pyenv/pyenv"><code>pyenv</code></a>.</summary>

```bash
# install pyenv
git clone https://github.com/pyenv/pyenv ~/.pyenv

# setup pyenv (you should also put these three lines in .bashrc or similar)
export PATH="${HOME}/.pyenv/bin:${PATH}"
export PYENV_ROOT="${HOME}/.pyenv"
eval "$(pyenv init -)"

# install Python 3.8
pyenv install 3.8.10

# make it available globally
pyenv global system 3.8.10
```
</details>


## Poetry

This project uses `poetry` to install and manage dependencies. To install poetry,
follow these [instructions](https://python-poetry.org/docs/master/#installation).

# Installation

1. Create and activate a virtual environment.

```shell
python -m venv env
source env/bin/activate
```

2. Installing volttron-platform-driver requires a running volttron instance. Install volttron and start an instance in the background and save log output to a file named 'volttron.log'

```shell
pip install volttron
volttron -vv -l volttron.log &
```

3. Install the volttron platform driver:

```shell
vctl install volttron-platform-driver --vip-identity platform.driver --start
```

4. Install the BACnetProxy agent:
Before installing, VOLTTRON should be installed and running. Its virtual environment should be active.
Information on how to install of the VOLTTRON platform can be found
[here](https://github.com/eclipse-volttron/volttron-core).

```shell
vctl install volttron-bacnet-proxy --agent-config <path to bacnet proxy agent configuration file> \
--vip-identity platform.bacnet_proxy \
--start
```
1. If it is not already, install the VOLTTRON Platform Driver Agent:

5. Install the volttron bacnet driver library:
```shell
vctl install volttron-platform-driver --vip-identity platform.driver --start
```

```shell
pip install volttron-lib-bacnet-driver
```
2. Install the BACnetProxy Agent:

6. Install a BACnet Driver onto the Platform Driver.
```shell
vctl install volttron-bacnet-proxy --agent-config <path to bacnet proxy agent configuration file> --vip-identity platform.bacnet_proxy --start
```

Installing a BACnet driver in the Platform Driver Agent requires adding copies of the device configuration and registry configuration files to the Platform Driver’s configuration store.
3. Install the VOLTTRON BACnet Driver Library:

* Create a config directory and navigate to it:
```shell
pip install volttron-lib-bacnet-driver
```

```shell
mkdir config
cd config
```
4. Store device and registry files for the BACnet device to the Platform Driver configuration store:

* Create a file called `bacnet.config`; it should contain a JSON object that specifies the configuration of your BACnet driver. An example of such a file is provided at the root of this project; the example file is named 'bacnet.config'. The following JSON is an example of a `bacnet.config`:
* Create a config directory and navigate to it:

```json
{
"driver_config": {"device_address": "123.45.67.890",
"device_id": 123456},
"driver_type": "bacnet",
"registry_config":"config://bacnet.csv",
"interval": 15,
"timezone": "US/Pacific"
}
```
```shell
mkdir config
cd config
```

ℹ️ **TIP:** In the `driver_config`, `device_address` is the address bound to the network port over which BACnet communication will happen on the computer running VOLTTRON. This is NOT the address of any target device. See [BACnet Router Addressing](https://volttron.readthedocs.io/en/develop/agent-framework/driver-framework/bacnet/bacnet-router-addressing.html#bacnet-router-addressing).
* Create a file called `bacnet.config`; it should contain a JSON object that specifies the configuration of your BACnet driver. An example of such a file is provided at the root of this project; the example file is named 'bacnet.config'. The following JSON is an example of a `bacnet.config`:

```json
{
"driver_config": {"device_address": "123.45.67.890",
"device_id": 123456},
"driver_type": "bacnet",
"registry_config":"config://bacnet.csv",
"interval": 15,
"timezone": "US/Pacific"
}
```

* Create another file called `bacnet.csv`; it should contain all the points on the device that you want published to Volttron. An example of such a CSV file is provided at the root of this project; the example CSV file is named 'bacnet.csv'. The following CSV file is an example:
ℹ️ **TIP:** In the `driver_config`, `device_address` is the address bound to the network port over which BACnet communication will happen on the computer running VOLTTRON. This is NOT the address of any target device. See [BACnet Router Addressing](https://eclipse-volttron.readthedocs.io/en/latest/external-docs/volttron-bacnet-proxy/docs/source/bacnet-router-addressing.html).

```csv
Point Name,Volttron Point Name,Units,Unit Details,BACnet Object Type,Property,Writable,Index,Notes
12345a/Field Bus.12345A CHILLER.AHU-COIL-CHWR-T,12345a/Field Bus.12345A CHILLER.AHU-COIL-CHWR-T,degreesFahrenheit,-50.00 to 250.00,analogInput,presentValue,FALSE,3000741,,Primary CHW Return Temp
```
* Create another file called `bacnet.csv`; it should contain all the points on the device that you want published to Volttron. An example of such a CSV file is provided at the root of this project; the example CSV file is named 'bacnet.csv'. The following CSV file is an example:

* Add the bacnet driver config and bacnet csv file to the Platform Driver configuration store:
```csv
Point Name,Volttron Point Name,Units,Unit Details,BACnet Object Type,Property,Writable,Index,Notes
12345a/Field Bus.12345A CHILLER.AHU-COIL-CHWR-T,12345a/Field Bus.12345A CHILLER.AHU-COIL-CHWR-T,degreesFahrenheit,-50.00 to 250.00,analogInput,presentValue,FALSE,3000741,,Primary CHW Return Temp
```

* Add the bacnet driver config and bacnet csv file to the Platform Driver configuration store:

```
vctl config store platform.driver bacnet.csv bacnet.csv --csv
vctl config store platform.driver devices/bacnet bacnet.config
```
```
vctl config store platform.driver bacnet.csv bacnet.csv --csv
vctl config store platform.driver devices/bacnet bacnet.config
```

7. Observe Data
5. Observe Data

To see data being published to the bus, install a [Listener Agent](https://pypi.org/project/volttron-listener/):
To see data being published to the bus, install a [Listener Agent](https://pypi.org/project/volttron-listener/):

```
vctl install volttron-listener --start
```
```
vctl install volttron-listener --start
```

Once installed, you should see the data being published by viewing the Volttron logs file that was created in step 2.
To watch the logs, open a separate terminal and run the following command:
Once installed, you should see the data being published by viewing the Volttron logs file that was created in step 2.
To watch the logs, open a separate terminal and run the following command:

```
tail -f <path to folder containing volttron.log>/volttron.log
```
```
tail -f <path to folder containing volttron.log>/volttron.log
```

# Development

Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Loading

0 comments on commit ccfb276

Please sign in to comment.