-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2ca3f9a
Showing
3 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,104 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import heartsStep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,67 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from modules.core.props import Property, StepProperty | ||
from modules.core.step import StepBase | ||
from modules import cbpi | ||
|
||
@cbpi.step | ||
class HeartsStep(StepBase): | ||
actor = StepProperty.Actor("Actor", description="Collecting device") | ||
kettle = StepProperty.Kettle("Kettle", description="Pot-still") | ||
|
||
refluxRatio = Property.Number("Reflux ratio", configurable=True,default_value=3) | ||
maxSpeed = Property.Number("Maximum collecting speed of actor, ml/h", configurable=True, default_value=1000) | ||
heaterPower = Property.Number("Heater power, watt", configurable=True, default_value=1000) | ||
endTemp = Property.Number("Completion temperature, degree Celsius", configurable=True, default_value=93) | ||
|
||
isPaused = False | ||
collecting = 0.0 | ||
temperature = 0 | ||
power = 0 | ||
|
||
@cbpi.action("Start collecting") | ||
def start(self): | ||
self.notify("", "Collection of hearts continued", type="warning", timeout=2000) | ||
self.isPaused = False | ||
|
||
@cbpi.action("Stop collecting") | ||
def stop(self): | ||
self.notify("", "Collecting hearts is paused", type="warning", timeout=2000) | ||
self.isPaused = True | ||
|
||
def finish(self): | ||
self.actor_off(int(self.actor)) | ||
self.notify("", "Collecting hearts completed", type="success", timeout=2000) | ||
|
||
def execute(self): | ||
self.updateAndCheckTemperature() | ||
self.recountCollecting() | ||
self.calculateActorPower() | ||
self.manageActor() | ||
|
||
def calculateActorPower(self): | ||
self.power = min(round(self.collecting / float(self.maxSpeed) * 100), 100) | ||
|
||
def manageActor(self): | ||
actorId = int(self.actor) | ||
self.actor_power(power=self.power, id=actorId) | ||
if self.isPaused: | ||
self.actor_off(self.actorId()) | ||
else: | ||
self.actor_on(power=self.power, id=actorId) | ||
|
||
def recountCollecting(self): | ||
K = 0.174 | ||
T = float(self.temperature) | ||
W = float(self.heaterPower) | ||
R = float(self.refluxRatio) | ||
Q = K*(100 - T)*W/(R 1) | ||
if abs(self.collecting - Q) > 0: | ||
self.notify("", "Now collecting speed is " str(Q) "ml/h", type="warning", timeout=2000) | ||
self.collecting = Q | ||
|
||
def updateAndCheckTemperature(self): | ||
self.temperature = self.get_kettle_temp(self.kettle) | ||
if self.temperature >= int(self.endTemp): | ||
self.next() | ||
|