bctl Code
1-wire based boiler/DHW/distribution heating system controller
Status: Beta
Brought to you by:
solarcycle4
Version 1.7 has expanded functionality in multiple areas including multi-zone capability. See git commit notes for details. Since no one has expressed interest in the package I will not keep up the wiki independently. Next efforts will be to add/improve the user interface.
Version 1.2 is a fully functional system for controling dual fuel (i.e.
propane/wood) heating and DHW systems. Mode control inputs from PIO
devices are used to set wood or fuel mode separately for heat and DHW.
Multi zone heating is configurable for an arbitrary number of zones
(minor code modifications needed to adjust) with call for heat inputs
for each zone, and outputs for each zone valve. A single heat
distribution circulator power output is also provided. In wood mode,
heat distribution is disabled when the heat storage tank is cold.
DHW controls two circulators, one each for wood and fuel modes. Fuel
mode is controled by a call for heat from an aquastat, while wood mode
is controlled by boiler state.
Version 1.1 has added heat recovery states for capturing heat from the
boiler when the burn has died down.
Version 1.0 of bctl is a circulation loop controller for a wood fired
boiler with hot water thermal storage and indirect heating of domestic
hot water. The first realease is functional for these elements. Future
releases will include functional improvements for heat recovery
from the boiler, heating loop circulation control, further optimizations,
and provision for additional 1-wire sensors.
Planned additions will include utilties for system configuration,
data logging, and remote access and monitoring (as time allows).
The design relies on the 1-wire library, owlib, which is part of the owfs
package: http://sourceforge.net/projects/owfs/?source=directory
The Quantum Leaps QP framework and QM modeling tool are used for
all state-machine operations: http://sourceforge.net/projects/qpc/?source=directory
State machine templates were generated using the QM code generator and
all design files are included in the source file, BoilerHsmController.qm.
This would be a good place to begin familiarization with the code for
those who are interested.
Implementation is running on a Pandaboard ES with Ubuntu Linux v12.04.
I'm using standard DS18S20 temperature sensors and a 1-wire I/O board
available from Hobby Boards for motor control and switch sensing,
though many other devices could be used for the purpose. I'm
currently using an off-the-shelf thermocouple temperature controller
to sense whether the stack is hot, though I expect to replace this
with a 1-wire thermocouple sensor device in future versions.
The following is the installation procedure for prerequisite packages
as well as bctl.
Required packages for owfs:
php5
php5-dev
python
python-dev
fuse
libfuse2
libfuse-dev
libusb-dev
Build and install owfs according to package instructions. Create symbolic
links to shell executables (sudo ln -s /opt/owfs/bin/* -t .) from a local
bin directory on your path if you wish to use these functions for testing.
This is not necessary for bctl execution.
For bctl build/install the following:
g++
nlohmann-json3-dev (install creates nlohmann directory with all header
files. Create a link to json.hpp in /usr/include using
sudo ln -s nlohmann/json.hpp for compatibility with built packages)
qpcpp (build rel and spy libraries according to package instructions)
libatomic-ops-dev
libboost-all-dev
screen (not required, but very useful to monitor stdout by attach)
Create serial UART rules file with symbolic links for 1-Wire bus.
For hints on this see: http://blog.automated.it/2011/01/18/linkusbi-and-1-wire-setup/
My rules file contents:
----------------------------
# /etc/udev/rules.d/60-usb-serial.rules
# Determine 1wire USB ports
KERNEL=="ttyUSB*", \
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001" \
SYMLINK+="1wire"
----------------------------
Install bctl package:
After moving to a new build system I've found some compatibility issues
with automake utilities. Running the following command sequence resolved
these issues:
------------------------
libtoolize --force
(modify configure.ac according to prompts if necessary then rerun)
libtoolize --force
aclocal
autoheader
automake --force-missing --add-missing
autoconf
configure
-------------------------
Typical build procedure:
make clean
configure
make all
sudo make install
-------------------------
To make an installable release (distribution):
make dist
move to target system
untar
configure --enable-spy
make
To enable SPY output use 'configure --enable-spy'
**NOTE: bctl must be run as root for access to 1-wire devices and for generation of configuration and log files.
Any other compile time definitions must be added to config.site
(such as -DTESTVECTOR...)
Configure to run from boot (using the screen command in /etc/rc.local if desired)
Using screen to attach to existing process:
sudo screen -ls lists existing screen
sudo screen -d -R <PID.SessionID> attaches to process
use Ctl-a Ctl-d to detach process from screen once again
File locations:
busConfig.json: generate bus scan json file
/usr/local/var/bctl/busConfig.json
bCtl.log: execution log file
/usr/local/var/bctl/bCtl.log
devConfig.json: device configuration file for device assignment
/usr/local/share/bctl/devConfig.json
testDataInputs.csv: Test mode data file
/usr/local/share/bctl/testDataInputs.csv