Skip to content

Commit 3a72039

Browse files
author
Jan Červený
authored
Merge pull request #9 from GCRI-DoAB/devel
Devel
2 parents 158d55c + 4c1d131 commit 3a72039

2 files changed

Lines changed: 139 additions & 133 deletions

File tree

O2-PIcurveMeasurement.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ var UserDefinedProtocol = {
1414
photosynthesisCurveLightMultiplierValues: [ 1 ]
1515
}
1616

17+
/* globals
18+
importPackage, java, Packages, theGroup, theAccessory, theExperiment, theLogger, ProtoConfig, ETrendFunction, result:true
19+
*/
20+
1721
/**
1822
* PI-Curves Measurement
1923
*
@@ -41,8 +45,6 @@ var UserDefinedProtocol = {
4145
*
4246
*/
4347

44-
/* global importPackage, java, Packages, theGroup, theAccessory, theExperiment, theLogger, ProtoConfig, ETrendFunction, result:true */
45-
4648
// Libraries to import
4749
importPackage(java.util)
4850
importPackage(java.lang)

PP-GrowthOptimizer.js

Lines changed: 135 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -4,70 +4,73 @@ var UserDefinedProtocol = {
44
turbidostatODMax: 0.425,
55
turbidostatODType: 720,
66
ODReadoutInterval: 60,
7-
// -peristaltic pump settings
8-
peristalticPumpID: 5,
9-
peristalticPumpSpeed: 100,
10-
peristalticPumpSlowDownRange: 25,
11-
peristalticPumpSlowDownFactor: 75,
7+
// -optimizer parameters
8+
controlledParameter: 'none',
9+
controlledParameterSteps: [[ 1100, 25 ], [ 440, 25 ], [ 55, 25 ]],
1210
// -optimizer stability check
1311
growthStatistics: true,
1412
regressionODType: 680,
13+
stabilizationTimeMin: 8,
14+
stabilizationTimeMax: 24,
15+
growthRateEvalFrac: 2 / 3,
1516
analyzedSteps: 6,
1617
intervalOfConfidenceMax: 3.0,
1718
growthTrendMax: 1.5,
18-
stabilizationTimeMin: 8,
19-
stabilizationTimeMax: 24,
19+
// -peristaltic pump settings
20+
peristalticPumpID: 5,
21+
peristalticPumpSpeed: 100,
22+
peristalticPumpSlowDownRange: 25,
23+
peristalticPumpSlowDownFactor: 75,
24+
// -advanced options
2025
growthRateEvalDelay: 420,
21-
growthRateEvalFrac: 2 / 3,
22-
// -optimizer parameters
23-
controlledParameter: 'none',
24-
controlledParameterSteps: [[ 1100, 25 ], [ 440, 25 ], [ 55, 25 ]],
2526
groupGMS: theGroup
2627
}
2728

28-
/* global importPackage, java, Packages, theGroup, theAccessory, theExperiment, theLogger, ProtoConfig, ETrendFunction, result:true */
29+
/* globals
30+
importPackage, java, Packages, theGroup, theAccessory, theExperiment, theLogger, ProtoConfig, ETrendFunction, result:true
31+
*/
2932

3033
/**
31-
* OD Regulator Using External/Additional Pump
32-
*
33-
* @script Peristaltic Pump - Automatic Growth Characterization
34-
* @author CzechGlobe - Department of Adaptive Biotechnologies (JaCe)
35-
* @version 3.1.3
36-
* @modified 24.4.2018 (JaCe)
37-
*
38-
* @notes For proper functionality of the script "OD Regulator" protocol has to be disabled as well as chosen
39-
* controlled accessory protocols (i.e. Lights, Thermoregulation, GMS, Stirrer).
40-
* The controlled pump has to be set to ID 5 to allow compatibility with other scripts
41-
*
42-
* @param {number} turbidostatODMin [AU] - Minimum OD/lower bound for OD regulator/turbidostat
43-
* @param {number} turbidostatODMax [AU] - Maximum OD/upper bound for OD regulator/turbidostat
44-
* @param {number} turbidostatODType [680/720/735] - OD sensor used for turbidostat control
45-
* @param {number} ODReadoutInterval [s] - Defines how often is the OD measured
46-
* @param {number} peristalticPumpSpeed [%] - Nominal pump speed used for dilution of the suspension
47-
* @param {number} peristalticPumpSlowDownRange [%] - Lower range where the pump slows down
48-
* @param {number} peristalticPumpSlowDownFactor [%] - Slow down factor for the pump
49-
* @param {number} growthStatistics [true/false] - Enable or disable calculation of growth statistics. Note that the doubling time (Dt) calculation also includes information about the fit coefficient of determination (CoD in %), known as R-squared
50-
* @param {number} regressionODType [680/720/735] - OD sensor used for doubling time determination
51-
* @param {number} analyzedSteps [-] - Number of steps to be analyzed for stability check
52-
* @param {number} intervalOfConfidenceMax [%] - Maximum allowed percents of 95% Confidence Interval
53-
* @param {number} growthTrendMax [%] - Maximum growth speed trend in time
54-
* @param {number} stabilizationTimeMin [h] - Minimum duration of each characterization step
55-
* @param {number} stabilizationTimeMax [h] - Maximum duration of each characterization step
56-
* @param {number} growthRateEvalDelay [s] - Time after dilution where data for doubling time determination are ignored. By default growthRateEvalFrac, i.e. only limited fraction of the data points is used for calculations.
57-
* @param {number} growthRateEvalFrac [0-1] - Defines whether to use particular fraction of the data points for doubling time determination.
58-
* This is to prevent influence of post dilution effect on doubling time evaluation. If 0 or false, growthRateEvalDelay is used instead. Note that to completely disable data limitation you need to set both growthRateEvalFrac and growthRateEvalDelay to 0.
59-
* @param {string} controlledParameter ['none'/'temperature'/'lights'/'GMS'/'stirrer'/'ODRange'] - Supported parameters to control by the script
60-
* @param {array} controlledParameterSteps - List of values for the controlled parameter. Examples:
61-
* temperature = [ 28, 32, 34, 30, 26, 22 ]; // [oC]
62-
* lights = [[ 55, 25 ],[ 110, 25 ],[ 220, 25 ],[ 440, 25 ],[ 880,25 ]]; // [uE]
63-
* GMS = [[ 195.88, 5.873 ],[ 195.88, 12.478 ],[ 185.30, 18.257 ],[ 185.30,25.274 ]]; // [ml/min]
64-
* stirrer = [ 30, 50, 65, 80, 95 ]; // [%] !!! works only with SW version 0.7.14 and later
65-
* ODRange = [[0.4, 0.425], [0.2, 0.215], [0.1, 0.113]]; // [AU]
66-
* @param {string} groupGMS - Identifies the group that contains Gas Mixing System.
67-
*
68-
* @return Flow of external/additional pump
69-
*
70-
*/
34+
* OD Regulator Using External/Additional Pump
35+
*
36+
* @script Peristaltic Pump - Automatic Growth Characterization
37+
* @author CzechGlobe - Department of Adaptive Biotechnologies (JaCe)
38+
* @version 3.1.3
39+
* @modified 24.4.2018 (JaCe)
40+
*
41+
* @notes For proper functionality of the script "OD Regulator" protocol has to be disabled as well as chosen
42+
* controlled accessory protocols (i.e. Lights, Thermoregulation, GMS, Stirrer).
43+
* The controlled pump has to be set to ID 5 to allow compatibility with other scripts
44+
*
45+
* @param {number} turbidostatODMin [AU] - Minimum OD/lower bound for OD regulator/turbidostat
46+
* @param {number} turbidostatODMax [AU] - Maximum OD/upper bound for OD regulator/turbidostat
47+
* @param {number} turbidostatODType [680/720/735] - OD sensor used for turbidostat control
48+
* @param {number} ODReadoutInterval [s] - Defines how often is the OD measured
49+
* @param {number} peristalticPumpSpeed [%] - Nominal pump speed used for dilution of the suspension
50+
* @param {number} peristalticPumpSlowDownRange [%] - Lower range where the pump slows down
51+
* @param {number} peristalticPumpSlowDownFactor [%] - Slow down factor for the pump
52+
* @param {number} growthStatistics [true/false] - Enable or disable calculation of growth statistics. Note that the doubling time (Dt) calculation also includes information about the fit coefficient of determination (CoD in %), known as R-squared
53+
* @param {number} regressionODType [680/720/735] - OD sensor used for doubling time determination
54+
* @param {number} analyzedSteps [-] - Number of steps to be analyzed for stability check
55+
* @param {number} intervalOfConfidenceMax [%] - Maximum allowed percents of 95% Confidence Interval
56+
* @param {number} growthTrendMax [%] - Maximum growth speed trend in time
57+
* @param {number} stabilizationTimeMin [h] - Minimum duration of each characterization step
58+
* @param {number} stabilizationTimeMax [h] - Maximum duration of each characterization step
59+
* @param {number} growthRateEvalDelay [s] - Time after dilution where data for doubling time determination are ignored. By default growthRateEvalFrac, i.e. only limited fraction of the data points is used for calculations.
60+
* @param {number} growthRateEvalFrac [0-1] - Defines whether to use particular fraction of the data points for doubling time determination.
61+
* This is to prevent influence of post dilution effect on doubling time evaluation. If 0 or false, growthRateEvalDelay is used instead. Note that to completely disable data limitation you need to set both growthRateEvalFrac and growthRateEvalDelay to 0.
62+
* @param {string} controlledParameter ['none'/'temperature'/'lights'/'GMS'/'stirrer'/'ODRange'] - Supported parameters to control by the script
63+
* @param {array} controlledParameterSteps - List of values for the controlled parameter. Examples:
64+
* temperature = [ 28, 32, 34, 30, 26, 22 ]; // [oC]
65+
* lights = [[ 55, 25 ],[ 110, 25 ],[ 220, 25 ],[ 440, 25 ],[ 880,25 ]]; // [uE]
66+
* GMS = [[ 195.88, 5.873 ],[ 195.88, 12.478 ],[ 185.30, 18.257 ],[ 185.30,25.274 ]]; // [ml/min]
67+
* stirrer = [ 30, 50, 65, 80, 95 ]; // [%] !!! works only with SW version 0.7.14 and later
68+
* ODRange = [[0.4, 0.425], [0.2, 0.215], [0.1, 0.113]]; // [AU]
69+
* @param {string} groupGMS - Identifies the group that contains Gas Mixing System.
70+
*
71+
* @return Flow of external/additional pump
72+
*
73+
*/
7174

7275
// Libraries import
7376
importPackage(java.util)
@@ -94,44 +97,44 @@ function controlParameter (parameter, values) {
9497
}
9598
var unit
9699
switch (parameter) {
97-
case 'lights':
98-
var light0 = theGroup.getAccessory('actinic-lights.light-Red')
99-
var light1 = theGroup.getAccessory('actinic-lights.light-Blue')
100-
unit = ' uE'
101-
light0.setRunningProtoConfig(new ProtoConfig(Number(values[0]))) // Red
102-
light1.setRunningProtoConfig(new ProtoConfig(Number(values[1]))) // Blue
103-
debugLogger('Lights changed.')
104-
break
105-
case 'temperature':
106-
var thermoreg = theGroup.getAccessory('thermo.thermo-reg')
107-
unit = String.fromCharCode(176) + 'C'
108-
thermoreg.setRunningProtoConfig(new ProtoConfig(Number(values)))
109-
debugLogger('Temperature changed.')
110-
break
111-
case 'GMS':
112-
var valve0 = UserDefinedProtocol.groupGMS.getAccessory('gas-mixer.valve-0-reg') // CO2
113-
var valve1 = UserDefinedProtocol.groupGMS.getAccessory('gas-mixer.valve-1-reg') // Air
114-
unit = ' ml/min'
115-
valve0.setRunningProtoConfig(new ProtoConfig(Number(values[0])))
116-
valve1.setRunningProtoConfig(new ProtoConfig(Number(values[1])))
117-
var flowAir = valve0.getProtoConfigValue()
118-
var flowCO2 = valve1.getProtoConfigValue()
119-
debugLogger('GMS settings changed. Gas Mixing set to Air flow ' + round(flowAir, 2) + ' ml/min and CO2 flow ' + round(flowCO2, 2) + ' ml/min (' + round((flowCO2 / (flowCO2 + flowAir) + 400 / 1e6) * 100, 1) + '%)')
120-
break
121-
case 'stirrer':
122-
var stirrer = theGroup.getAccessory('pwm.stirrer')
123-
unit = '%'
124-
stirrer.setRunningProtoConfig(new ProtoConfig(Number(values)))
125-
debugLogger('Stirrer changed.')
126-
break
127-
case 'ODRange':
128-
theAccessory.context().put('odMinModifier', Number(values[0]) / UserDefinedProtocol.turbidostatODMin)
129-
theAccessory.context().put('odMaxModifier', Number(values[1]) / UserDefinedProtocol.turbidostatODMax)
130-
unit = ' AU'
131-
debugLogger('Turbidostat OD range changed.')
132-
break
133-
default:
134-
return null
100+
case 'lights':
101+
var light0 = theGroup.getAccessory('actinic-lights.light-Red')
102+
var light1 = theGroup.getAccessory('actinic-lights.light-Blue')
103+
unit = ' uE'
104+
light0.setRunningProtoConfig(new ProtoConfig(Number(values[0]))) // Red
105+
light1.setRunningProtoConfig(new ProtoConfig(Number(values[1]))) // Blue
106+
debugLogger('Lights changed.')
107+
break
108+
case 'temperature':
109+
var thermoreg = theGroup.getAccessory('thermo.thermo-reg')
110+
unit = String.fromCharCode(176) + 'C'
111+
thermoreg.setRunningProtoConfig(new ProtoConfig(Number(values)))
112+
debugLogger('Temperature changed.')
113+
break
114+
case 'GMS':
115+
var valve0 = UserDefinedProtocol.groupGMS.getAccessory('gas-mixer.valve-0-reg') // CO2
116+
var valve1 = UserDefinedProtocol.groupGMS.getAccessory('gas-mixer.valve-1-reg') // Air
117+
unit = ' ml/min'
118+
valve0.setRunningProtoConfig(new ProtoConfig(Number(values[0])))
119+
valve1.setRunningProtoConfig(new ProtoConfig(Number(values[1])))
120+
var flowAir = valve0.getProtoConfigValue()
121+
var flowCO2 = valve1.getProtoConfigValue()
122+
debugLogger('GMS settings changed. Gas Mixing set to Air flow ' + round(flowAir, 2) + ' ml/min and CO2 flow ' + round(flowCO2, 2) + ' ml/min (' + round((flowCO2 / (flowCO2 + flowAir) + 400 / 1e6) * 100, 1) + '%)')
123+
break
124+
case 'stirrer':
125+
var stirrer = theGroup.getAccessory('pwm.stirrer')
126+
unit = '%'
127+
stirrer.setRunningProtoConfig(new ProtoConfig(Number(values)))
128+
debugLogger('Stirrer changed.')
129+
break
130+
case 'ODRange':
131+
theAccessory.context().put('odMinModifier', Number(values[0]) / UserDefinedProtocol.turbidostatODMin)
132+
theAccessory.context().put('odMaxModifier', Number(values[1]) / UserDefinedProtocol.turbidostatODMax)
133+
unit = ' AU'
134+
debugLogger('Turbidostat OD range changed.')
135+
break
136+
default:
137+
return null
135138
}
136139
theAccessory.context().put('controlledParameterText', parameter + ' ' + (Array.isArray(values) ? values.join(' and ') : values) + unit)
137140
theExperiment.addEvent(parameter[0].toUpperCase() + parameter.slice(1) + ' changed to ' + (Array.isArray(values) ? values.join(' and ') : values) + unit)
@@ -140,36 +143,38 @@ function controlParameter (parameter, values) {
140143
if (!theAccessory.context().getInt('initialization', 0)) {
141144
theAccessory.context().clear()
142145
switch (UserDefinedProtocol.controlledParameter) {
143-
case 'lights':
144-
if (theGroup.getAccessory('actinic-lights.light-Red').getProtoConfigValue()) {
145-
theExperiment.addEvent('!!! Disable red light protocol')
146-
}
147-
if (theGroup.getAccessory('actinic-lights.light-Blue').getProtoConfigValue()) {
148-
theExperiment.addEvent('!!! Disable red light protocol')
149-
}
150-
break
151-
case 'temperature':
152-
if (theGroup.getAccessory('thermo.thermo-reg').getProtoConfigValue()) {
153-
theExperiment.addEvent('!!! Disable thermoregulator protocol')
154-
}
155-
break
156-
case 'GMS':
157-
if (UserDefinedProtocol.groupGMS.getAccessory('gas-mixer.valve-0-reg').getProtoConfigValue()) {
158-
theExperiment.addEvent('!!! Disable GMS CO2 protocol')
159-
}
160-
if (UserDefinedProtocol.groupGMS.getAccessory('gas-mixer.valve-1-reg').getProtoConfigValue()) {
161-
theExperiment.addEvent('!!! Disable GMS Air/N2 protocol')
162-
}
163-
break
164-
case 'stirrer':
165-
if (theGroup.getAccessory('pwm.stirrer').getProtoConfigValue()) {
166-
theExperiment.addEvent('!!! Disable stirrer protocol')
167-
}
168-
break
169-
case 'none':
170-
break
171-
default:
172-
theExperiment.addEvent('!!! Unknown parameter set for control - check controlledParameter setting')
146+
case 'lights':
147+
if (theGroup.getAccessory('actinic-lights.light-Red').getProtoConfigValue()) {
148+
theExperiment.addEvent('!!! Disable red light protocol')
149+
}
150+
if (theGroup.getAccessory('actinic-lights.light-Blue').getProtoConfigValue()) {
151+
theExperiment.addEvent('!!! Disable red light protocol')
152+
}
153+
break
154+
case 'temperature':
155+
if (theGroup.getAccessory('thermo.thermo-reg').getProtoConfigValue()) {
156+
theExperiment.addEvent('!!! Disable thermoregulator protocol')
157+
}
158+
break
159+
case 'GMS':
160+
if (UserDefinedProtocol.groupGMS.getAccessory('gas-mixer.valve-0-reg').getProtoConfigValue()) {
161+
theExperiment.addEvent('!!! Disable GMS CO2 protocol')
162+
}
163+
if (UserDefinedProtocol.groupGMS.getAccessory('gas-mixer.valve-1-reg').getProtoConfigValue()) {
164+
theExperiment.addEvent('!!! Disable GMS Air/N2 protocol')
165+
}
166+
break
167+
case 'stirrer':
168+
if (theGroup.getAccessory('pwm.stirrer').getProtoConfigValue()) {
169+
theExperiment.addEvent('!!! Disable stirrer protocol')
170+
}
171+
break
172+
case 'ODRange':
173+
break
174+
case 'none':
175+
break
176+
default:
177+
theExperiment.addEvent('!!! Unknown parameter set for control - check controlledParameter setting')
173178
}
174179
// TODO rewrite following part
175180
if (UserDefinedProtocol.turbidostatODType === 720 || 735) {
@@ -251,18 +256,18 @@ function controlPump () {
251256
// setODSensorString("regression");
252257
var odSensorString, odSensorRegressionString
253258
switch (UserDefinedProtocol.turbidostatODType) {
254-
case 680:
255-
odSensorString = 'od-sensors.od-680'
256-
break
257-
default:
258-
odSensorString = theAccessory.context().get('OD7XYString', 'od-sensors.od-720')
259+
case 680:
260+
odSensorString = 'od-sensors.od-680'
261+
break
262+
default:
263+
odSensorString = theAccessory.context().get('OD7XYString', 'od-sensors.od-720')
259264
}
260265
switch (UserDefinedProtocol.regressionODType) {
261-
case 680:
262-
odSensorRegressionString = 'od-sensors.od-680'
263-
break
264-
default:
265-
odSensorRegressionString = theAccessory.context().get('RegOD7XYString', 'od-sensors.od-720')
266+
case 680:
267+
odSensorRegressionString = 'od-sensors.od-680'
268+
break
269+
default:
270+
odSensorRegressionString = theAccessory.context().get('RegOD7XYString', 'od-sensors.od-720')
266271
}
267272
var odSensor = theGroup.getAccessory(odSensorString)
268273
var odSensorRegression = theGroup.getAccessory(odSensorRegressionString)
@@ -331,7 +336,6 @@ function controlPump () {
331336
var stepDoublingTimeSD = 0
332337
var stepDoublingTimeIC95 = 0
333338
var stepTrend = 0
334-
var stepCoD = 0
335339
var sumXY = 0
336340
var sumX = 0
337341
var sumY = 0

0 commit comments

Comments
 (0)