Skip to content

Commit af45baf

Browse files
author
unknown
committed
Minor changes
1 parent 06572e2 commit af45baf

1 file changed

Lines changed: 21 additions & 15 deletions

File tree

LL-Luminostat.js

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1+
// static parameters
2+
var odLinMin = 0.5
3+
var odLinMax = 1.23
4+
var lightMin = 400
5+
var expRegMult = 281.9177
6+
var expRegExpo = 1.016269
7+
18
/**
29
* Luminostat regulator
310
*
411
* @script Lights - Luminostat
512
* @author CzechGlobe - Department of Adaptive Biotechnologies (JaCe)
6-
* @version 0.1
7-
* @modified 16.2.2017 (JaCe)
13+
* @version 0.1.1
14+
* @modified 11.7.2018 (JaCe)
815
*
916
* @notes For proper function of the script a pump has to be set to ID 4
1017
*
11-
* @param {number} pHmin Min pH/lower bound for pH stat (base) activation
18+
* @param {number} odLinMin Min OD for linear regulated range
19+
* @param {number} odLinMax Max OD for linear regulated range
20+
* @param {number} lightMin Min light for linear regulated range
21+
* @param {number} expRegMult Exponential regression multiplier
22+
* @param {number} expRegExpo Exponential regression exponent
1223
*
13-
* @return Flow of external/additional pump
24+
* @return Light intensity
1425
*
1526
*/
1627

17-
// static parameters
18-
var odMin = 0.5
19-
var odMax = 1.23
20-
var lightMin = 400
21-
var lightMax = lightMin * (1 + (odMax - odMin) / odMin)
22-
var expMult = 281.9177
23-
var expExpo = 1.016269
28+
// dynamic parameters
29+
var lightMax = lightMin * (1 + (odLinMax - odLinMin) / odLinMin)
2430

2531
importPackage(java.util)
2632
importPackage(java.lang)
@@ -41,10 +47,10 @@ function controlLight(odValue) {
4147
if (Math.abs(1 - odValue / odLast) < 0.04) {
4248
odValue = (odValue + odLast) / 2
4349
theAccessory.context().put('odLast', odValue)
44-
if (odValue > odMax) {
45-
result = Math.min(expMult * Math.exp(expExpo * odValue), theAccessory.getMax());
46-
} else if (odValue > odMin) {
47-
result = Math.min(lightMin + (lightMax - lightMin) * (odValue - odMin) / (odMax - odMin), theAccessory.getMax());
50+
if (odValue > odLinMax) {
51+
result = Math.min(expRegMult * Math.exp(expRegExpo * odValue), theAccessory.getMax());
52+
} else if (odValue > odLinMin) {
53+
result = Math.min(lightMin + (lightMax - lightMin) * (odValue - odLinMin) / (odLinMax - odLinMin), theAccessory.getMax());
4854
} else {
4955
result = theAccessory.getValue();
5056
}

0 commit comments

Comments
 (0)