Skip to content

Commit 7a96b51

Browse files
author
Jan Červený
committed
FIX changeCounter vs. stepCounter
1 parent 4ad82f0 commit 7a96b51

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

PP-GrowthOptimizer.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ function controlPump () {
299299
var odNoise = theAccessory.context().getInt('odNoise', 1)
300300
var odMinModifier = theAccessory.context().getDouble('odMinModifier', 1.0)
301301
var odMaxModifier = theAccessory.context().getDouble('odMaxModifier', 1.0)
302+
var changeCounter = theAccessory.context().getInt('changeCounter', 0)
303+
var stepCounter = theAccessory.context().getInt('stepCounter', 0)
302304
// Check for OD noise/overshots and primitive OD averaging
303305
if (!isNaN(odValue) && (round(odValue, 3) !== round(odLast, 3))) {
304306
if (odNoise) {
@@ -322,8 +324,7 @@ function controlPump () {
322324
UserDefinedProtocol.turbidostatODMin = (UserDefinedProtocol.turbidostatODMax - UserDefinedProtocol.turbidostatODMin) + (UserDefinedProtocol.turbidostatODMax = UserDefinedProtocol.turbidostatODMin)
323325
debugLogger('OD range reversed.', 0)
324326
}
325-
var changeCounter = theAccessory.context().getInt('changeCounter', 0)
326-
if (theAccessory.context().getInt('stabilizedTimeMax', 0) <= Number(theExperiment.getDurationSec()) && (changeCounter !== 0)) {
327+
if (theAccessory.context().getInt('stabilizedTimeMax', 0) <= Number(theExperiment.getDurationSec()) && (stepCounter !== 0)) {
327328
theAccessory.context().put('stabilizedTimeMax', theExperiment.getDurationSec() + UserDefinedProtocol.stabilizationTimeMax * 3600)
328329
if (UserDefinedProtocol.controlledParameterSteps.length > 1) {
329330
if (changeCounter < (UserDefinedProtocol.controlledParameterSteps.length - 1)) {
@@ -346,7 +347,7 @@ function controlPump () {
346347
if (((odValue > (UserDefinedProtocol.turbidostatODMax * odMaxModifier)) && !pumpState)) {
347348
theAccessory.context().put('modeDilution', 1)
348349
theAccessory.context().put('modeStabilized', 0)
349-
var stepCounter = theAccessory.context().getInt('stepCounter', 0)
350+
// var stepCounter = theAccessory.context().getInt('stepCounter', 0)
350351
var expDuration = theAccessory.context().get('expDuration', 0.0)
351352
var stepDuration = theAccessory.context().get('stepDuration', 0.0)
352353
var stepDoublingTime = theAccessory.context().get('stepDoublingTime', 0.0)

0 commit comments

Comments
 (0)