-
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
Showing
2 changed files
with
49 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
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,48 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from modules.core.props import Property, StepProperty | ||
from modules.core.step import StepBase | ||
from baseColletingStep import BaseColletingStep | ||
from modules import cbpi | ||
|
||
@cbpi.step | ||
class StartStopStep(StepBase, BaseColletingStep): | ||
temperatureSensor = StepProperty.Sensor("Датчик температуры", description="Датчик температуры в царге") | ||
initialCollecting = Property.Number("Стартовая скорость отбора, мл/ч", configurable=True, default_value=1000) | ||
deltaTemp = Property.Number("Разрешенный залет температуры, °C", configurable=True, default_value=0.3) | ||
decrement = Property.Number("Уменьшение отбора при залете температуры, %", configurable=True, default_value=10) | ||
endTemp = Property.Number("Температура завершения отбора", configurable=True, default_value=93) | ||
|
||
initialTemp = None | ||
currentCollecting = None | ||
collectingSpeed = 0.0 | ||
temperature = 0 | ||
stopped = False | ||
|
||
def finish(self): | ||
self.actor_off(int(self.collectingActor)) | ||
self.notify("", "Отбор тела завершен", type="success", timeout=2000) | ||
|
||
def execute(self): | ||
self.updateAndCheckTemperature() | ||
self.recountCollecting() | ||
self.notifySensor() | ||
self.updateMaxCollectingSpeed() | ||
self.calculateActorPower() | ||
self.manageActor() | ||
|
||
def recountCollecting(self): | ||
if not self.currentCollecting: | ||
self.currentCollecting = int(initialCollecting) | ||
if not self.initialTemp: | ||
self.initialTemp = float(self.temperature) | ||
excess = float(self.temperature) - self.initialTemp > float(self.deltaTemp) | ||
if excess and not self.stopped: | ||
self.currentCollecting = self.currentCollecting * (100 - int(decrement)) / 100 | ||
self.stopped = excess | ||
self.collectingSpeed = 0 if self.stopped else self.currentCollecting | ||
|
||
def updateAndCheckTemperature(self): | ||
self.temperature = float(self.get_sensor_value(int(self.temperatureSensor))) | ||
if self.temperature >= int(self.endTemp): | ||
self.next() |