0
I Use This!
Activity Not Available

Project Summary

PyBreweryPython library for controlling an automated brewery.

Current DevelopmentCurrently the brewery uses a Arduino for the I/O. You can also use a couple of Velleman K8055 IO boards. Other devices will be supported in the future, but unsupported boards can be used if you write a driver for it that implements the interface that is defined in this project.

The GUI in this project is up in the air, but GUI can be anything, included a web-based application, or an iPhone app, which I have started (see http://code.google.com/p/pybrewery/source/browse/#svn/guis/iPhone/Robot.)

Usage Example
"Pyrobot.brewery is being developed as a way to brew beer. It is just a
collection of tanks, and the tanks hold devices. The devices respond to
messages from the pyrobot.notification system. For this example I'm
going to make a system that only has one tank, and that tank has four
devices - a thermometer, a valve (represents a solenoid valve that is
used to fill the tank), a burner, and a level indictator (represents a device that
monitors how much liquid is in the tank)."

>>> from pyrobot.brewery.devices import Thermometer, LevelIndicator, ValveSwitch, Burner
>>> from pyrobot.brewery.tests.mock_driver import MockDriver

"The MockDriver class is a fake i/o device, but for a real brewery it
would be a python class that follows the api defined by
pyrobot.drivers.interfaces.IDriver. This project has drivers defined
for an Arduio, and a velleman k8055. Currently I am using an Arduino
Mega for all hardware interaction. If you want to use something else,
all you have to do is write your own.

The easiest way to define your setup is with a dictionary. Here is the
one for this example."

>>> definition = {
... 'io_device': {
... 'class': MockDriver,
... 'kw' : {},
... },
... 'tanks' : {
... 'my_tank' : {
... 'input_devices': {
... 'thermometer': {
... 'class': Thermometer,
... 'channel': 0,
... 'calibration_data': None,
... },
... 'level_indicator' : {
... 'class': LevelIndicator,
... 'channel' : 1,
... 'calibration_data' : [[0, 0.0], [255, 12.0]],
... },
... },
... 'output_devices' : {
... 'fill_valve' : {
... 'class': ValveSwitch,
... 'channel' : 2,
... },
... 'burner' : {
... 'class': Burner,
... 'channel' : 3,
... },
... },
... },
... }
... }
... }

"Now, just pass the definition to the brewery factory."

>>> from pyrobot.brewery import Factory
>>> factory = Factory(brewery_def = definition)
>>> brewery = factory.brewery

"Since this brewery uses a fake io device, we must manipulate it by hand
to simulate real temperature changes, etc. The brewery is callable, and
the __call__ method takes a method as its argument. So I will make a
simple method that fills the tank with 10.0 liters of water, then heats
the water to 80 degrees C."

>>> my_method = [
... ('fill my_tank', {'volume': 10.0}),
... ('wait', {'message': 'my_tank target volume reached'}),
... ('heat my_tank', {'temperature': 80.0}),
... ]

"A method is just a list of messages. The devices respond to the
messages. Each tank in the system must have a unique name in order for
the devices of the tank to respond to the messages for the tank.

I'll make sure the fill valve isn't on"

>>> print brewery.tanks['my_tank'].devices['fill_valve'].state
False

"Now, start the method:"

>>> brewery(my_method)

"Since the first part of the method fills the tank, then that device must
be on."

>>> print brewery.tanks['my_tank'].devices['fill_valve'].state
True

"Now I will simulate water going into the tank."

>>> io_device = factory.io_device
>>> for i in xrange(213):
... io_device.analog_channels[1] += 1
... brewery.notification_center.post_message(message = 'new brew cycle')
>>> brewery.notification_center.post_message(message = 'new brew cycle')

>>> print '%.01f' % brewery.tanks['my_tank'].devices['level_indicator'].value
10.0
>>> print brewery.tanks['my_tank'].devices['fill_valve'].state
False

"The tank now has 10.0 liters in it. The method says that it should now
be heating the tank up:"

>>> print brewery.tanks['my_tank'].devices['burner'].state
True

"Once again, I must fake the heating of the tank:"

>>> for i in xrange(80):
... io_device.analog_channels[0] += 1
... brewery.notification_center.post_message(message = 'new brew cycle')
>>> brewery.notification_center.post_message(message = 'new brew cycle')

>>> print '%.01f' % brewery.tanks['my_tank'].devices['thermometer'].value
80.0
>>> print brewery.tanks['my_tank'].devices['burner'].state
False

"Hooray! The tank is now filled and heated. A complete brew system
would contain more tanks and a brew method would do more stuff. See
pyrobot.brewery.definitions.default for the default setup, and see
pyrobot.brewery.methods.brew for the default brew method."

>>> brewery.stop()Current Version0.1a1

Dependenciespybrewery depends on PyNotification and NotificationTimer. These emulate the NSNotificationCenter and NSTimer behavior (Objective C). These were written by Chris Perkins and Craig Swank and will also be PyPI packages.

ConstructionThe brewery is finally taking shape! As you can see, I'm in test mode, the wires will be neatened up when I get farther along.

Tags

beer brewery home-brew k8055 pybrewery python

In a Nutshell, pybrewery...

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

MIT License
Permitted

Commercial Use

Modify

Distribute

Private Use

Sub-License

Forbidden

Hold Liable

Required

Include Copyright

Include License

These details are provided for information only. No information here is legal advice and should not be used as such.

All Licenses

This Project has No vulnerabilities Reported Against it

Did You Know...

  • ...
    Black Duck offers a free trial so you can discover if there are open source vulnerabilities in your code
  • ...
    you can embed statistics from Open Hub on your site
  • ...
    use of OSS increased in 65% of companies in 2016
  • ...
    data presented on the Open Hub is available through our API

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

Community Rating

Be the first to rate this project
Click to add your rating
   Spinner
Review this Project!
Sample ohloh analysis