Skip to content

Commit 98711bb

Browse files
author
Jan Červený
authored
Merge pull request #13 from GCRI-DoAB/devel-GrowthOptimizer
Devel growth optimizer
2 parents 4886519 + 7a96b51 commit 98711bb

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

PP-GrowthOptimizer.js

Lines changed: 5 additions & 5 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)) {
@@ -340,14 +341,13 @@ function controlPump () {
340341
theAccessory.context().remove('expDuration')
341342
theAccessory.context().remove('stepDoublingTime')
342343
theAccessory.context().remove('stabilizedTime')
343-
theAccessory.context().remove('stabilizedTimeMax')
344344
}
345345
}
346346
// Start step growth rate evaluation
347347
if (((odValue > (UserDefinedProtocol.turbidostatODMax * odMaxModifier)) && !pumpState)) {
348348
theAccessory.context().put('modeDilution', 1)
349349
theAccessory.context().put('modeStabilized', 0)
350-
var stepCounter = theAccessory.context().getInt('stepCounter', 0)
350+
// var stepCounter = theAccessory.context().getInt('stepCounter', 0)
351351
var expDuration = theAccessory.context().get('expDuration', 0.0)
352352
var stepDuration = theAccessory.context().get('stepDuration', 0.0)
353353
var stepDoublingTime = theAccessory.context().get('stepDoublingTime', 0.0)
@@ -423,11 +423,11 @@ function controlPump () {
423423
controlParameter(UserDefinedProtocol.controlledParameter, UserDefinedProtocol.controlledParameterSteps[1])
424424
theAccessory.context().put('changeCounter', 1)
425425
}
426+
theAccessory.context().put('stabilizedTimeMax', theExperiment.getDurationSec() + UserDefinedProtocol.stabilizationTimeMax * 3600)
426427
theAccessory.context().remove('stepCounter')
427428
theAccessory.context().remove('expDuration')
428429
theAccessory.context().remove('stepDoublingTime')
429430
theAccessory.context().remove('stabilizedTime')
430-
theAccessory.context().remove('stabilizedTimeMax')
431431
}
432432
}
433433
}

0 commit comments

Comments
 (0)