ionopimax: Add LogVoltageInput
This commit is contained in:
parent
9e000528d2
commit
99a58933ec
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
from frappy.core import Readable, Writable, Parameter, BoolType, StringType,\
|
from frappy.core import Readable, Writable, Parameter, BoolType, StringType,\
|
||||||
FloatRange, Property, TupleOf, ERROR, IDLE
|
FloatRange, Property, TupleOf, ERROR, IDLE
|
||||||
|
from math import log
|
||||||
|
|
||||||
|
|
||||||
class Base:
|
class Base:
|
||||||
@ -74,6 +75,15 @@ class VoltageInput(AnalogInput):
|
|||||||
super().initModule()
|
super().initModule()
|
||||||
self.write(f'{self.addr}_mode','U')
|
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):
|
class CurrentInput(AnalogInput):
|
||||||
scale = 1e6
|
scale = 1e6
|
||||||
|
Loading…
x
Reference in New Issue
Block a user