# *****************************************************************************
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# Module authors:
#   Markus Zolliker <markus.zolliker@psi.ch>
# *****************************************************************************
"""LakeShore Model 336"""

from frappy.core import Parameter, IntRange, FloatRange
import frappy_psi.lakeshore as ls


class IO(ls.IO):
    model = 336


class Device(ls.Device2):
    model = 336


class Sensor(ls.Sensor):
    model = 336


class Loop(ls.Loop, Sensor):
    pass


class MainOutput(ls.MainOutput):
    model = 336
    output_no = Parameter(datatype=IntRange(1, 1))
    imax = 2
    vmax = 50
    # 3 ranges only
    heater_ranges = {3 - i: 10 ** -i for i in range(3)}
    sorted_factors = sorted((v, i) for i, v in heater_ranges.items())


class SecondaryOutput336(MainOutput):
    model = 336
    output_no = Parameter(datatype=IntRange(2, 2))
    imax = 1.414
    vmax = 35.4
    max_power = Parameter(datatype=FloatRange(0, 50, unit='W'))


class AnalogOutput(ls.AnalogOutput):
    model = 336
    output_no = Parameter(datatype=IntRange(3, 4))

