@@ -8,23 +8,23 @@ var UserDefinedProtocol = {
88 photosynthesisMeasurementPeriod : 3600 ,
99 turbidostatSynchronization : false ,
1010 growthStabilitySynchronization : false ,
11- stirrerIntensityValues : [ 30 , 60 ] ,
11+ stirrerIntensityValues : [ 50 , 75 ] ,
1212 lightStepMultiplierValues : [ 1 ] ,
1313 lightStepMultiplierColors : [ 'red' ] ,
1414 photosynthesisCurveLightMultiplierValues : [ 1 ]
1515}
1616
1717/* globals
18- importPackage, java, Packages, theGroup, theAccessory, theExperiment, theLogger, ProtoConfig, ETrendFunction, result:true
18+ importPackage, java, Packages, theGroup, theAccessory, theExperiment, theLogger, ProtoConfig, ETrendFunction, result: true
1919*/
2020
2121/**
2222 * PI-Curves Measurement
2323 *
2424 * @script PI-Curves Measurement - Photosynthesis Efficiency Quantification
2525 * @author CzechGlobe - Department of Adaptive Biotechnologies (JaCe)
26- * @version 1.2.1
27- * @modified 21.4 .2018 (JaCe)
26+ * @version 1.2.2
27+ * @modified 26.10 .2018 (JaCe)
2828 * @notes For proper function of the script following protocols have to be disabled: "Lights", "Bubble intr. valve" and "Stirrer"
2929 *
3030 * @param {number } oxygenMeasurementDuration [s] Duration of O2 evolution measurement
@@ -127,32 +127,32 @@ if (experimentDuration >= measurementTime) {
127127 }
128128 if ( ( experimentDuration > ( resumeTime - UserDefinedProtocol . respirationMeasurementDuration ) ) && ! photosynthesis ) {
129129 theAccessory . context ( ) . put ( 'photosynthesis' , 1 )
130+ if ( UserDefinedProtocol . respirationMeasurementDuration > 0 ) {
131+ light0 . suspend ( resumeTime )
132+ light1 . suspend ( resumeTime )
133+ }
130134 regCoefLin = theAccessory . getDataHistory ( ) . regression ( ETrendFunction . LIN , Math . ceil ( UserDefinedProtocol . photosynthesisRateCurveEvalFraction * UserDefinedProtocol . oxygenMeasurementDuration / UserDefinedProtocol . oxygenRapidMeasurementInterval ) )
131135 debugLogger ( 'O2 evol. parameters: ' + regCoefLin . join ( ', ' ) )
132136 rateO2Evol = theAccessory . context ( ) . get ( 'rateO2Evol' , [ ] )
133137 rateO2EvolR2 = theAccessory . context ( ) . get ( 'rateO2EvolR2' , [ ] )
134138 rateO2Evol [ changeCounter ] = round ( regCoefLin [ 1 ] * 600 , 2 )
135139 rateO2EvolR2 [ changeCounter ] = round ( regCoefLin [ 2 ] , 3 )
136- if ( UserDefinedProtocol . respirationMeasurementDuration > 0 ) {
137- light0 . suspend ( resumeTime )
138- light1 . suspend ( resumeTime )
139- // TODO should be function1
140- }
140+ // TODO should be function1
141141 }
142142 if ( ( experimentDuration > resumeTime ) && ! respiration ) {
143143 theAccessory . context ( ) . put ( 'respiration' , 1 )
144144 bubbles . setRunningProtoConfig ( ProtoConfig . ON )
145145 stirrer . setRunningProtoConfig ( new ProtoConfig ( UserDefinedProtocol . stirrerIntensityValues [ 0 ] ) )
146146 if ( UserDefinedProtocol . respirationMeasurementDuration > 0 ) {
147+ light0 . resume ( experimentDuration )
148+ light1 . resume ( experimentDuration )
149+ controlLights ( theAccessory . context ( ) . getDouble ( 'light0Value' , light0 . getValue ( ) ) , theAccessory . context ( ) . getDouble ( 'light1Value' , light1 . getValue ( ) ) )
147150 regCoefLin = theAccessory . getDataHistory ( ) . regression ( ETrendFunction . LIN , Math . ceil ( UserDefinedProtocol . photosynthesisRateCurveEvalFraction * UserDefinedProtocol . respirationMeasurementDuration / UserDefinedProtocol . oxygenRapidMeasurementInterval ) )
148151 debugLogger ( 'O2 resp. parameters: ' + regCoefLin . join ( ', ' ) )
149152 rateO2Resp = theAccessory . context ( ) . get ( 'rateO2Resp' , [ ] )
150153 rateO2RespR2 = theAccessory . context ( ) . get ( 'rateO2RespR2' , [ ] )
151154 rateO2Resp [ changeCounter ] = round ( regCoefLin [ 1 ] * 600 , 2 )
152155 rateO2RespR2 [ changeCounter ] = round ( regCoefLin [ 2 ] , 3 )
153- controlLights ( theAccessory . context ( ) . getDouble ( 'light0Value' , light0 . getValue ( ) ) , theAccessory . context ( ) . getDouble ( 'light1Value' , light1 . getValue ( ) ) )
154- light0 . resume ( experimentDuration )
155- light1 . resume ( experimentDuration )
156156 // TODO should be function1
157157 }
158158 }
@@ -162,29 +162,29 @@ if (experimentDuration >= measurementTime) {
162162 theAccessory . context ( ) . put ( 'respiration' , 0 )
163163 theAccessory . context ( ) . put ( 'changeCounter' , ++ changeCounter )
164164 if ( changeCounter >= UserDefinedProtocol . lightStepMultiplierValues . length ) {
165+ theAccessory . context ( ) . put ( 'changeCounter' , 0 )
166+ theAccessory . context ( ) . put ( 'measurementTime' , experimentDuration + UserDefinedProtocol . photosynthesisMeasurementPeriod - UserDefinedProtocol . lightStepMultiplierValues . length * ( UserDefinedProtocol . oxygenMeasurementDuration + UserDefinedProtocol . respirationMeasurementDuration + UserDefinedProtocol . relaxationPhaseDuration ) )
167+ bubbles . setRunningProtoConfig ( ProtoConfig . ON )
168+ stirrer . setRunningProtoConfig ( new ProtoConfig ( UserDefinedProtocol . stirrerIntensityValues [ 0 ] ) )
169+ theAccessory . context ( ) . put ( 'modeO2EvolResp' , 0 )
170+ multiplierStep = multiplierStep < ( UserDefinedProtocol . photosynthesisCurveLightMultiplierValues . length - 1 ) ? ++ multiplierStep : 0
171+ theAccessory . context ( ) . put ( 'multiplierStep' , multiplierStep )
165172 rateO2Evol = theAccessory . context ( ) . get ( 'rateO2Evol' , [ ] )
166173 rateO2EvolR2 = theAccessory . context ( ) . get ( 'rateO2EvolR2' , [ ] )
167174 rateO2Resp = theAccessory . context ( ) . get ( 'rateO2Resp' , [ ] )
168175 rateO2RespR2 = theAccessory . context ( ) . get ( 'rateO2RespR2' , [ ] )
169- theAccessory . context ( ) . put ( 'changeCounter' , 0 )
170- theAccessory . context ( ) . put ( 'measurementTime' , experimentDuration + UserDefinedProtocol . photosynthesisMeasurementPeriod - UserDefinedProtocol . lightStepMultiplierValues . length * ( UserDefinedProtocol . oxygenMeasurementDuration + UserDefinedProtocol . respirationMeasurementDuration + UserDefinedProtocol . relaxationPhaseDuration ) )
171- theExperiment . addEvent ( 'PI-curve DONE. O2 rates are ' + rateO2Evol . join ( ', ' ) + ' and ' + rateO2Resp . join ( ', ' ) + ' units/min (R2 ' + rateO2EvolR2 . join ( ', ' ) + ' and ' + rateO2RespR2 . join ( ', ' ) + ')' )
172176 theAccessory . context ( ) . put ( 'rateO2Evol' , [ ] )
173177 theAccessory . context ( ) . put ( 'rateO2EvolR2' , [ ] )
174178 theAccessory . context ( ) . put ( 'rateO2Resp' , [ ] )
175179 theAccessory . context ( ) . put ( 'rateO2RespR2' , [ ] )
176- bubbles . setRunningProtoConfig ( ProtoConfig . ON )
177- stirrer . setRunningProtoConfig ( new ProtoConfig ( UserDefinedProtocol . stirrerIntensityValues [ 0 ] ) )
178- theAccessory . context ( ) . put ( 'modeO2EvolResp' , 0 )
179- multiplierStep = multiplierStep < ( UserDefinedProtocol . photosynthesisCurveLightMultiplierValues . length - 1 ) ? ++ multiplierStep : 0
180- theAccessory . context ( ) . put ( 'multiplierStep' , multiplierStep )
180+ theExperiment . addEvent ( 'PI-curve DONE. O2 rates are ' + rateO2Evol . join ( ', ' ) + ' and ' + rateO2Resp . join ( ', ' ) + ' units/min (R2 ' + rateO2EvolR2 . join ( ', ' ) + ' and ' + rateO2RespR2 . join ( ', ' ) + ')' )
181181 debugLogger ( 'PI-curve finished.' )
182182 }
183183 }
184184 result = UserDefinedProtocol . oxygenRapidMeasurementInterval
185185 }
186186} else if ( experimentDuration > theAccessory . context ( ) . getInt ( 'checkupTime' , 0 ) ) {
187- // Here comes a hack that solves an issue with strange periodic behaviour of both bubble interrupting valve and stirrer, when they turn off in uncontrolled manner - most likely bug in the software
187+ // Here comes a hack that solves an issue with strange periodic behaviour of both the bubble interrupting valve and the stirrer, when they turn off in uncontrolled manner - most likely bug in the software
188188 stirrer = theGroup . getAccessory ( 'pwm.stirrer' )
189189 bubbles = theGroup . getAccessory ( 'switches.valve-0' )
190190 theAccessory . context ( ) . put ( 'checkupTime' , experimentDuration + 10 )
0 commit comments