# Chellow
A web application for checking UK electricity bills for organizations with
a large number of supplies and / or high consumption.
Website: https://www.chellow.org/
## Licence
Chellow is released under the [GPL v3](http://www.gnu.org/licenses/gpl.html).
## Introduction
Chellow is a web application for checking UK electricity bills. It's designed
for organizations with high electricity consumption. The software is hosted at
https://github.com/WessexWater/chellow.
[![Build Status](https://travis-ci.org/WessexWater/chellow.svg?branch=master)](https://travis-ci.org/WessexWater/chellow)
## Installation
Chellow is a Python web application (with a built-in webserver) that uses the
PostgreSQL database. To install Chellow, follow these steps:
* Install [PostgreSQL](http://www.postgresql.org/) 12
* Install Python 3.6 (tested on the [CPython 3.6.8](http://www.python.org/)
interpreter)
* Create a PostgreSQL database: `createdb --encoding=UTF8 chellow`
* Install Chellow: `pip install chellow`
* Set up the following environment variables to configure Chellow:
| Name | Default | Description
| ---- | ------- | -----------
| `PGUSER` | `postgres` | Postgres user name
| `PGPASSWORD` | `postgres` | Postgres password
| `PGHOST` | `localhost` | Postgres host name
| `PGPORT` | `5432` | Postgres port
| `PGDATABASE` | `chellow` | Postgres database name
| `CHELLOW_PORT` | `80` | Port that the Chellow webserver will listen on
In bash an environment variable can be set by doing:
`export CHELLOW_PORT=8080`
in Windows an environment variable can be set by doing:
`set CHELLOW_PORT=8080`
* Start Chellow by running `chellow start`.
* You should now be able to visit `http://localhost/` in a browser. You should
be prompted to enter a username and password. Enter the admin user name
`admin@example.com` and the password `admin`, and then the home page should
appear. Change the admin password from the `users` page.
* Chellow can be stopped by running `chellow stop`.
### Manual Upgrading
To upgrade to the latest version of Chellow do: `pip install --upgrade chellow`
### Automatic Upgrading
On Unix, set up a cron job to regularly call the updater script by doing:
`crontab -e`
and entering the line:
`\* * * * * source /home/me/venv/bin/activate;chellow_updater.sh`
### Using A Different Webserver
Chellow comes bundled with the
[Waitress](http://docs.pylonsproject.org/projects/waitress/en/latest/)
webserver, but the is also a Python WSGI web application so Chellow can be used
with any WSGI compliant application server, eg Gunicorn. The WSGI app that
should be specified is `chellow.app`.
### Detailed Instructions For Installing On CentOS 6.7 64 bit For Development
Install PostgreSQL 9.5.2
Add the PostgreSQL repository:
`sudo rpm -ivh https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-6-x86_64/pgdg-centos95-9.5-2.noarch.rpm`
Install the PostgreSQL packages:
`sudo yum install postgresql95 postgresql95-server postgresql95-contrib`
Initialize the database:
`sudo service postgresql-9.5 initdb`
Make PostgreSQL start on boot:
`sudo chkconfig postgresql-9.5 on`
Edit PostgreSQL config file to accept all local connections:
`sudo vi /var/lib/pgsql/9.5/data/pg_hba.conf`
Find the lines:
`local all all peer`
`host all all 127.0.0.1/32 peer`
and change them to:
`local all all trust`
`host all all 127.0.0.1/32 trust`
start PostgreSQL:
`sudo service postgresql-9.5 start`
Install Python 3.5.1. Unfortunately there isn't an rpm for this so we have to
compile it:
`sudo yum groupinstall "Development tools"`
`sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel wget`
`wget http://python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz`
`tar xf Python-3.5.1.tar.xz`
`cd Python-3.5.1`
`./configure --prefix=/usr/local --enable-shared LDFLAGS="Wl,-rpath /usr/local/lib"`
`make`
`sudo make altinstall`
We need to tell Chellow which port to listen on, so:
`vi ~/.bashrc`
and add the line:
`export CHELLOW_PORT=8080`
`export PGUSER=postgres`
Clone the Chellow source from GitHub:
`git clone https://github.com/WessexWater/chellow.git`
Change directory to the 'chellow' directory:
`cd chellow`
Create a local `test` branch to track the remote `origin/test` branch:
`git branch --track test origin/test`
Check out the 'test' branch into the working directory:
`git checkout test`
Create a Python virtual environment:
`pyvenv-3.5 venv`
Activate the environment:
`source venv/bin/activate`
Make sure you're running a recent version of pip:
`pip install --upgrade pip`
Install tox:
`pip install tox`
Run tests:
`tox`
Old style tests: run\_tests\_0.sh run\_tests\_1.sh run\_tests\_2.sh
## Getting Started
This is a brief guide to setting things up after you've installed Chellow. It
assumes that you have a basic knowledge of
[UK electricity billing](https://en.wikipedia.org/wiki/Electricity_billing_in_the_UK). It goes through the steps of adding a half-hourly (HH) metered supply,
and producing virtual bills for it, and then importing an actual bill and
running a bill check.
Chellow can handle non-half-hourly supplies as well as half-hourly, and it can
also deal with gas supplies, but we'll use a half-hourly electricity supply for
this example.
### View the Chellow home page
Assuming you've installed Chellow correctly, you should be able to open your
browser, type in the URL of the Chellow application, and see the Chellow home
page.
### Users
Before any users are added, if you access Chellow from `localhost` you'll have
read / write access. Once users are added, you have to log in as one of those
users. Users are added from the 'users' page.
### Add HHDC Contracts
Every supply must a have a data collector. Add in a new HHDC by going to the
'HHDC Contracts' page and then clicking on the 'Add' link.
### Add MOP Contracts
Every supply must a have a meter operator. Add in a new MOP by going to the
'MOP Contracts' page and then clicking on the 'Add' link. For now just put in a
simple virtual bill for the MOP, so in the 'script' field enter:
```
from chellow.utils import reduce_bill_hhs
def virtual_bill_titles():
return ['net-gbp']
def virtual_bill(data_source):
for hh in data_source.hh_data:
bill_hh = data_source.mop_bill_hhs[hh['start-date']]
if hh['utc-is-month-end']:
bill_hh['net-gbp'] = 10
data_source.mop_bill = reduce_bills_hh(data_source.mop_bill_hhs)
```
### Add Supplier Contracts
Click on the 'supplier contracts' link and then fill out the 'Add a contract'
form. For the Charge Script field enter:
```
from chellow.utils import reduce_bill_hhs
def virtual_bill_titles():
return ['net-gbp', 'day-kwh', 'day-gbp', 'night-kwh', 'night-gbp']
def virtual_bill(data_source):
bill = data_source.supplier_bill
for hh in data_source.hh_data:
bill_hh = data_source.supplier_bill_hhs[hh['start-date']]
if 0 < hh['utc-decimal-hour'] < 8:
bill_hh['night-kwh'] = hh['msp-kwh']
bill_hh['night-gbp'] = hh['msp-kwh'] * 0.05
else:
bill_hh['day-kwh'] = hh['msp-kwh']
bill_hh['day-gbp'] = hh['msp-kwh'] * 0.1
bill_hh['net-gbp'] = sum(
v for k, v in bill_hh.items() if k[-4:] == '-gbp')
data_source.supplier_bill = reduce_bill_hhs(
data_source.supplier_bill_hhs)
```
This will generate a simple virtual bill based on a day / night tariff.
Supplier contract scripts can be much more sophisticated than this, including
DUoS, TNUoS, BSUoS, RO and many other standard charges. These will be addressed
later on in this guide.
Also, don't worry about the 'properties' field for now.
### Add a Site
Go to the 'sites' link on the home page, and click 'a
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
PyPI 官网下载 | chellow-2482.tar.gz (1006个子文件)
setup.cfg 784B
chellow.conf 434B
bootstrap.min.css 118KB
font-awesome.css 34KB
font-awesome.min.css 28KB
chellow.css 23KB
tlm.csv 3.95MB
llfc.csv 871KB
clock_interval.csv 264KB
mtc.csv 225KB
rcrc.csv 219KB
party.csv 75KB
ssc.csv 39KB
cv.csv 33KB
participant.csv 26KB
tpr.csv 16KB
measurement_requirement.csv 15KB
meter_type.csv 1KB
market_role.csv 958B
pc.csv 559B
meter_payment_type.csv 390B
gsp_group.csv 286B
fontawesome-webfont.eot 75KB
loader.gif 2KB
supply.html 38KB
base.html 16KB
home.html 14KB
general_imports.html 14KB
era_edit.html 13KB
site_edit.html 12KB
g_supply.html 12KB
supplier_bill_imports.html 11KB
site.html 11KB
supplier_batch_upload_file.html 10KB
supplier_batch_file_add.html 10KB
dc_contract_hh_imports.html 9KB
scenario_edit.html 8KB
report_run_bill_check.html 7KB
supplier_batch.html 7KB
user.html 6KB
mop_batch.html 6KB
dc_batch.html 6KB
dc_bill_edit.html 6KB
csv_crc.html 6KB
site_months.html 6KB
dc_bill_add.html 5KB
mop_bill_add.html 5KB
g_era_edit.html 5KB
report_run.html 5KB
read_edit.html 5KB
mop_bill_edit.html 5KB
report_run_row_bill_check.html 5KB
dc_contract_edit.html 5KB
supplier_bill.html 5KB
supplier_bill_add.html 5KB
supplier_bill_import.html 5KB
g_bill.html 5KB
report_run_row.html 5KB
g_bill_import.html 5KB
supplier_bill_edit.html 5KB
g_read_add.html 4KB
dc_bill_imports.html 4KB
supplies.html 4KB
read_add.html 4KB
site_gen_graph.html 4KB
dc_contract.html 4KB
non_core_contract_edit.html 4KB
supply_hh_data.html 4KB
g_bill_add.html 4KB
supplier_contract.html 4KB
supply_edit.html 4KB
channel_snags.html 4KB
g_batch.html 4KB
site_used_graph.html 4KB
scenarios.html 4KB
channel_edit.html 4KB
g_read_edit.html 4KB
mop_contract_edit.html 4KB
mop_bill_import.html 4KB
g_bill_edit.html 3KB
mop_batch_edit.html 3KB
g_bill_imports.html 3KB
dc_bill_import.html 3KB
hh_datum_edit.html 3KB
mtc_edit.html 3KB
dc_batch_edit.html 3KB
system.html 3KB
local_report.html 3KB
users.html 3KB
supplier_batch_file_edit.html 3KB
g_batch_edit.html 3KB
mop_bill.html 3KB
mop_batch_file_edit.html 3KB
dc_batch_file_edit.html 3KB
dc_rate_script_edit.html 3KB
dno.html 3KB
supplier_rate_script_edit.html 3KB
llfc_edit.html 3KB
channel.html 3KB
dnos.html 3KB
共 1006 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功