diff --git a/frappy_psi/ionopimax.py b/frappy_psi/ionopimax.py index b3d8bbf..880edef 100644 --- a/frappy_psi/ionopimax.py +++ b/frappy_psi/ionopimax.py @@ -20,6 +20,7 @@ from frappy.core import Readable, Writable, Parameter, BoolType, StringType,\ FloatRange, Property, TupleOf, ERROR, IDLE +from math import log class Base: @@ -73,6 +74,15 @@ class VoltageInput(AnalogInput): def initModule(self): super().initModule() self.write(f'{self.addr}_mode','U') + +class LogVoltageInput(VoltageInput): + + def read_value(self): + x0, x1 = self.rawrange + y0, y1 = self.valuerange + self.x = self.read(self.addr, self.scale) + a = (x1-x0)/log(y1/y0,10) + return 10**((self.x-x1)/a)*y1 class CurrentInput(AnalogInput):