Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master' into dev-cb…
Browse files Browse the repository at this point in the history
…s-iiith

# Conflicts:
#	README.md
#	bootstrap.py
#	requirements.txt
#	services/core/ActuatorAgent/actuator/agent.py
#	services/core/SQLHistorian/sqlhistorian/db/mysqlfuncts.py
#	services/core/SQLHistorian/sqlhistorian/db/sqlitefuncts.py
#	setup.py
  • Loading branch information
sambabug committed Aug 25, 2018
2 parents 270ec3f + 11c40ce commit 884f064
Show file tree
Hide file tree
Showing 47 changed files with 1,930 additions and 8 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,17 @@ To update the scripts after modifying `setup.py` or after a repository update,
use the following command:

```sh
<<<<<<< HEAD
(volttron) user@machine $ python bootstrap.py
=======
$ env/bin/python bootstrap.py
>>>>>>> refs/remotes/origin/master
```

The bootstrap script creates a virtual Python environment, using virtualenv,
and installs Volttron as an editable (or developer mode) package using pip.

<<<<<<< HEAD
## Testing

VOLTTRON uses py.test as a framework for executing tests. py.test is not installed
Expand All @@ -84,6 +89,8 @@ root directory:
```
(volttron) user@machine $ py.test
```
=======
>>>>>>> refs/remotes/origin/master
## Configuration

Expand Down
40 changes: 40 additions & 0 deletions applications/nrel/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

all: radiothermostatrelay API_test_radiothermostatrelay cea2045relay API_test_cea2045relay schouse_controller vtime_now

radiothermostatrelay:
volttron-ctl remove --force --tag radiothermostatrelay
volttron-pkg package $(AGENTS_HOME)/RadioThermostatRelayAgent/
volttron-pkg configure $(VOLTTRON_HOME)/packaged/radiothermostatrelayagent-3.0-py2-none-any.whl $(AGENTS_HOME)/RadioThermostatRelayAgent/config
volttron-ctl install radiothermostatrelay=$(VOLTTRON_HOME)/packaged/radiothermostatrelayagent-3.0-py2-none-any.whl

API_test_radiothermostatrelay:
volttron-ctl remove --force --tag API_test_radiothermostatrelay
volttron-pkg package $(AGENTS_HOME)/RadioThermostatRelayAgent/
volttron-pkg configure $(VOLTTRON_HOME)/packaged/radiothermostatrelayagent-3.0-py2-none-any.whl $(AGENTS_HOME)/RadioThermostatRelayAgent/config_api_test
volttron-ctl install API_test_radiothermostatrelay=$(VOLTTRON_HOME)/packaged/radiothermostatrelayagent-3.0-py2-none-any.whl

cea2045relay:
volttron-ctl remove --force --tag cea2045relay
volttron-pkg package $(AGENTS_HOME)/CEA2045RelayAgent/
volttron-pkg configure $(VOLTTRON_HOME)/packaged/cea2045relayagent-3.0-py2-none-any.whl $(AGENTS_HOME)/CEA2045RelayAgent/config
volttron-ctl install cea2045relay=$(VOLTTRON_HOME)/packaged/cea2045relayagent-3.0-py2-none-any.whl

schouse_controller:
volttron-ctl remove --force --tag schouse_controller
volttron-pkg package $(AGENTS_HOME)/SC_HouseAgent/
volttron-pkg configure $(VOLTTRON_HOME)/packaged/schouseagent-3.0-py2-none-any.whl $(AGENTS_HOME)/SC_HouseAgent/config
volttron-ctl install schouse_controller=$(VOLTTRON_HOME)/packaged/schouseagent-3.0-py2-none-any.whl


API_test_cea2045relay:
volttron-ctl remove --force --tag API_test_cea2045relay
volttron-pkg package $(AGENTS_HOME)/CEA2045RelayAgent/
volttron-pkg configure $(VOLTTRON_HOME)/packaged/cea2045relayagent-3.0-py2-none-any.whl $(AGENTS_HOME)/CEA2045RelayAgent/config_api_test
volttron-ctl install API_test_cea2045relay=$(VOLTTRON_HOME)/packaged/cea2045relayagent-3.0-py2-none-any.whl


vtime_now:
volttron-ctl remove --force --tag vtime_now
volttron-pkg package $(AGENTS_HOME)/VolttimeAgent
volttron-pkg configure $(VOLTTRON_HOME)/packaged/volttimeagent-3.0-py2-none-any.whl $(AGENTS_HOME)/VolttimeAgent/config
volttron-ctl install vtime_now=$(VOLTTRON_HOME)/packaged/volttimeagent-3.0-py2-none-any.whl
134 changes: 134 additions & 0 deletions applications/nrel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
##NREL Developed Agents:

**Contributors:**

Deepthi Vaidhynathan, Xin Jin, Wesley Jones, Harry Sorensen - National Renewable Energy Laboratory

**Agents:**

This directory contains two example device agents, a test controller, and a time coordintaion agent as as example system of agents.

**CEA-2045:**

The CEA-2045 standard specifies a modular communications interface (MCI) to facilitate communications with residential devices for applications such as energy management. The MCI provides a standard interface for energy management signals and messages to reach devices. Typical devices include energy management controllers, appliances, sensors, and other consumer products. CEA-2045 standard is analogous to the USB standard for the computer electronics; any residential devices that is CEA-2045 compliant should be play-and-plug.

- This agent acts as a relay for CEA2045 compliant appliance, it translates controls from a controller and relays it to the appliance
- This agent can be configured to communicate with a real hardware or to a simulated object.
- For the purpose of API and Functional Test, you would use the simulated object
- To connect with a real device, specify the USB port and baud rate in the config file

```
config
**********************************************
{
"agentid": "CEA2045",
"message": "hello from CEA2045",
"device1_usb_port" : "/dev/cu.usbserial-A603Y394",
"device1_baud_rate" : 19200,
"device_type" : 1
}
**********************************************
config_api_test
**********************************************
{
"agentid": "CEA2045 - Test",
"message": "hello from CEA2045 test",
"device1_usb_port" : "None",
"device1_baud_rate" : 0,
"device_type" : 1
}
**********************************************
```



**Radio Thermostat:**

Implementing the most common functions.
Radio Thermostat Company of America, Wi-Fi USNAP Module API, Version 1.3, March 22, 2012. Available on http://lowpowerlab.com/downloads/RadioThermostat_CT50_Honeywell_Wifi_API_V1.3.pdf. Retrieved on April 6, 2016.

- This agent acts as a relay for a thermostat, it translates controls from a controller and relays it to the appliance
- This agent can be configured to communicate with a real hardware or to a simulated object.
- For the purpose of API and Functional Test, you would use the simulated object
- To connect with a real device specify the url in the config file

```
config
**********************************************
{
"agentid": "Thermostat",
"message": "hello from thermostat",
"url_address" : "http://10.10.47.12/tstat"
}
**********************************************
config_api_test
**********************************************
{
"agentid": "Thermostat Test",
"message": "hello from Thermostat test",
"url_address" : "Fake"
}
**********************************************
```


**SC_House-Agent:**

- This is an example controller to which shows how to write control signals for the above two relays

**Volttime-Agent:**

- This agent publishes the actual time on the bus, all agents subscribe to this, for synchronized execution



**Environment**
- Activate the volttron environment and set VOLTTRON_HOME to point to your volttron home directory
- set export AGENTS_HOME=`pwd`/agents (agents directory) - used by Makefile

**bin**
- This directory contains scripts to start all agents
- make all
- ./bin/api.sh
- ./bin/hardware.sh

**Makefile**
- The Makefile is used to package and install all agents in the agents directory

**Unit-test for API**
- The Thermostat and CEA2045 have API that are used to talk to the appliances.
- There are unittest in those directories to test the APIs
- ***To test the CEA-2045 API:***
```
$cd agents/CEA2045RelayAgent/cea2045relay/
$export PYTHONPATH=./:$PYTHONPATH
$ nosetests API_test.py -v
Test emergency command ... ok
Test normal run ... ok
Test shed command ... ok
----------------------------------------------------------------------
Ran 3 tests in 0.001s
OK
```
- ***To test the Thermostat API:***
```
$cd agents/ThermostatRelayAgent/thermostatrelay/
$export PYTHONPATH=./:$PYTHONPATH
$ nosetests API_test.py -v
Test mode() interface ... ok
Test t_cool() interface ... ok
Test t_heat() interface ... ok
Test the tstat() interface ... ok
----------------------------------------------------------------------
Ran 4 tests in 0.001s
OK
```
5 changes: 5 additions & 0 deletions applications/nrel/TERMS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
THIS SOFTWARE IS PROVIDED BY Alliance for Sustainable Energy, LLC ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Alliance for Sustainable Energy, LLC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This software is an extension of VOLTTRON. The FreeBSD license of the VOLTTRON distribution applies to this software.

National Renewable Energy Laboratory is a national laboratory of the U.S. Department of Energy, Office of Energy Efficiency and Renewable Energy, operated by the Alliance for Sustainable Energy, LLC under Contract No. DE-AC36-08GO28308.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@


import unittest
import CEA_2045

cea = CEA_2045.CEA2045_API("Fake",0)
#cea = CEA_2045.CEA2045_API("/dev/cu.usbserial-A603Y394",19200)
cea.initialize(1)

class CEA2045TestCase(unittest.TestCase):

def test_normal(self):
'''Test normal run'''
return_query = {}
cea.send_msg('normal')
cea.recv_msg()
cea.recv_msg()
cea.send_msg('link_ack')
cea.send_msg('query')
cea.recv_msg()
return_query = cea.recv_msg()
cea.send_msg('link_ack')
self.assertEqual(CEA_2045.switch_query_response(return_query['opcode2']), "Running Normal")

def test_emergency(self):
'''Test emergency command'''
return_query = {}
cea.send_msg('emergency')
cea.recv_msg()
cea.recv_msg()
cea.send_msg('link_ack')
cea.send_msg('query')
cea.recv_msg()
return_query = cea.recv_msg()
cea.send_msg('link_ack')
self.assertEqual(CEA_2045.switch_query_response(return_query['opcode2']), "Idle Grid")

def test_shed(self):
'''Test shed command'''
return_query = {}
cea.send_msg('shed')
cea.recv_msg()
cea.recv_msg()
cea.send_msg('link_ack')
cea.send_msg('query')
cea.recv_msg()
return_query = cea.recv_msg()
cea.send_msg('link_ack')
self.assertEqual(CEA_2045.switch_query_response(return_query['opcode2']), "Running Curtailed Grid")
Loading

0 comments on commit 884f064

Please sign in to comment.