Dear all!
Oh gosh, those units… only troubles…
I wanted to do a linear interpolation y = k * x + d
, where [x] is a temperature and [y] is a number, so I set
val QuantityType<Temperature> x1 = -10|°C
val QuantityType<Temperature> x2 = 5|°C
val Number y1 = 6
val Number y2 = 2
var Number k
var Number d
then I did
k = (y2 - y1) / (x2 - x1)
logInfo("test.rules", "k: {}", k)
and the log file gives me nicely:
k: -0.26...67 1/°C
in units 1 over °C, as expected
calculation of the offset d (done by d = y1 - k * x1
) involves the product k * x1
which proves to be problematic:
m = k * x1
gives me an error
Error during the execution of startup rule: °C is non-linear, cannot convert
despite [k] is 1 over °C and [x1] is °C, so the multiplication of 1/°C with °C should yield a dimensionless number.
what am I doing wrong here?
Thanx for support
Sulla