Commit bffd824b authored by Cyril Guilloud's avatar Cyril Guilloud Committed by Anthony Mauro

super tony refurbishment

parent ab92b0a0
......@@ -2,7 +2,7 @@
#
# This file is part of the bliss project
#
# Copyright (c) 2016 Beamline Control Unit, ESRF
# Copyright (c) 2015-2019 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
from bliss.controllers.motors.soft import SoftController
......
......@@ -13,9 +13,11 @@ import math
import gevent
import gevent.event
from bliss.common.task import task
from bliss.common import mapping
from bliss.common.logtools import LogMixin
from bliss.common.utils import with_custom_members
from bliss.common.utils import with_custom_members, autocomplete_property
from bliss.common.measurement import SamplingCounter, counter_namespace
......@@ -42,12 +44,13 @@ class Input(LogMixin):
def __init__(self, controller, config):
""" Constructor """
# log.debug(" config type is: %s" % type(config))
# log.debug(" controller type is: %s" % type(controller))
self.__controller = controller
self.__name = config["name"]
self.__config = config
mapping.register(self, children_list=[controller])
mapping.register(
self.counter, parents_list=[self, "counters"], children_list=[controller]
)
# useful attribute for a temperature controller writer
self._attr_dict = {}
......@@ -112,6 +115,8 @@ class Output(LogMixin):
# if defined as self.__deadband, not available.
# in that case, use of decorator property offers it (read only) to world
mapping.register(self, children_list=[controller])
# useful attribute for a temperature controller writer
self._attr_dict = {}
......@@ -325,7 +330,7 @@ class Output(LogMixin):
for setpoint being reached (== read value inside the deadband)
default is 0.02 sec
"""
if new_poll:
if new_poll is not None:
self.__setpoint_event_poll = new_poll
else:
return self.__setpoint_event_poll
......@@ -336,7 +341,7 @@ class Output(LogMixin):
"""
self._logger.debug("On Output:ramprate: %s " % (new_ramp))
if new_ramp:
if new_ramp is not None:
self.controller.set_ramprate(self, new_ramp)
else:
return self.controller.read_ramprate(self)
......@@ -347,7 +352,7 @@ class Output(LogMixin):
"""
self._logger.debug("On Output:step: %s " % (new_step))
if new_step:
if new_step is not None:
self.controller.set_step(self, new_step)
else:
return self.controller.read_step(self)
......@@ -358,7 +363,7 @@ class Output(LogMixin):
"""
self._logger.debug("On Output:setpoint dwell: %s " % (new_dwell))
if new_dwell:
if new_dwell is not None:
self.controller.set_dwell(self, new_dwell)
else:
return self.controller.read_dwell(self)
......@@ -378,12 +383,19 @@ class Loop(LogMixin):
self.__controller = controller
self.__name = config["name"]
self.__config = config
self.__input = config.get("input")
self.__output = config.get("output")
self.__input = controller.get_object(config["input"][1:])
self.__output = controller.get_object(config["output"][1:])
self._Pval = None
self._Ival = None
self._Dval = None
mapping.register(self, children_list=[controller])
mapping.register(
self.input.counter,
parents_list=[self, "counters"],
children_list=[controller],
)
# useful attribute for a temperature controller writer
self._attr_dict = {}
......@@ -402,18 +414,14 @@ class Loop(LogMixin):
""" returns the loop config """
return self.__config
@property
@autocomplete_property
def input(self):
""" returns the loop input object """
if not isinstance(self.__input, Input):
self.__input = self.__input()
return self.__input
@property
@autocomplete_property
def output(self):
""" returns the loop output object """
if not isinstance(self.__output, Output):
self.__output = self.__output()
return self.__output
def set(self, new_setpoint=None, wait=False, **kwargs):
......@@ -451,7 +459,7 @@ class Loop(LogMixin):
"""
self._logger.debug("On Loop: kp (PID): ")
if new_kp:
if new_kp is not None:
self.controller.set_kp(self, new_kp)
else:
return self.controller.read_kp(self)
......@@ -462,7 +470,7 @@ class Loop(LogMixin):
"""
self._logger.debug("On Loop: ki (PID): ")
if new_ki:
if new_ki is not None:
self.controller.set_ki(self, new_ki)
else:
return self.controller.read_ki(self)
......@@ -473,7 +481,7 @@ class Loop(LogMixin):
"""
self._logger.debug("On Loop: kd (PID): ")
if new_kd:
if new_kd is not None:
self.controller.set_kd(self, new_kd)
else:
return self.controller.read_kd(self)
......@@ -2,7 +2,7 @@
#
# This file is part of the bliss project
#
# Copyright (c) 2017 Beamline Control Unit, ESRF
# Copyright (c) 2015-2019 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
from bliss.comm.util import get_comm_type, get_comm, SERIAL
......
......@@ -32,11 +32,10 @@ controller:
input: $thermo_sample <- mandatory
output: $heater <- mandatory
"""
import itertools
from bliss.common.temperature import *
from bliss.common.utils import set_custom_members
from bliss.common import session
from bliss.common import mapping
from bliss.common.logtools import LogMixin
......@@ -45,24 +44,67 @@ class Controller(LogMixin):
Temperature controller base class
"""
def __init__(self, config, inputs, outputs, loops):
def __init__(
self,
config,
inputs,
outputs,
loops,
input_class=Input,
output_class=Output,
loop_class=Loop,
):
mapping.register(self, parents_list=["temperature"])
# self._logger.info("on Controller")
self.__config = config
self.__name = config.get("name")
self._objects = {}
self._objects = dict()
self._inputs = dict()
self._outputs = dict()
self._loops = dict()
for name, klass, cfg in itertools.chain(inputs, outputs, loops):
self._logger.debug(f" {klass.__name__} name: {name}")
self._logger.debug(f" {klass.__name__} config: {cfg}")
new_obj = klass(self, cfg)
self.initialize()
self._objects[name] = new_obj
for name, cfg in inputs:
self._logger.debug(" input name: %s" % (name))
self._logger.debug(" input config: %s" % (cfg))
self._objects[name] = input_class(self, cfg)
self._inputs[name] = input_class(self, cfg)
# For custom attributes and commands.
set_custom_members(self, new_obj)
set_custom_members(self, self._inputs[name])
set_custom_members(self, self._objects[name])
@property
def name(self):
return self.__name
# input object is got from call of get_object
# and not as self._objects[name]
self.initialize_input(self.get_object(name))
for name, cfg in outputs:
self._logger.debug(" output name: %s" % (name))
self._logger.debug(" output config: %s" % (cfg))
self._objects[name] = output_class(self, cfg)
self._outputs[name] = output_class(self, cfg)
# output object is got from call of get_object
# and not as self._objects[name]
self.initialize_output(self.get_object(name))
# For custom attributes and commands.
set_custom_members(self, self._outputs[name])
set_custom_members(self, self._objects[name])
for name, cfg in loops:
self._logger.debug(" loops name: %s" % (name))
self._logger.debug(" loops config: %s" % (cfg))
self._objects[name] = loop_class(self, cfg)
self._loops[name] = loop_class(self, cfg)
# Loop object is got from call of get_object
# and not as self._objects[name]
self.initialize_loop(self.get_object(name))
# For custom attributes and commands.
set_custom_members(self, self._loops[name])
set_custom_members(self, self._objects[name])
@property
def config(self):
......@@ -85,17 +127,6 @@ class Controller(LogMixin):
# it is used by Loop class
return self._objects.get(name)
def _init(self):
self.initialize()
for obj in self._objects.values():
if isinstance(obj, Input):
self.initialize_input(obj)
elif isinstance(obj, Output):
self.initialize_output(obj)
elif isinstance(obj, Loop):
self.initialize_loop(obj)
def initialize(self):
"""
Initializes the controller.
......
This diff is collapsed.
This diff is collapsed.
......@@ -147,6 +147,11 @@ class TypingHelper(object):
ji = jedi.Interpreter(
source=text, namespaces=[repl.get_locals(), repl.get_globals()]
)
try:
if "(enum." in ji.goto_definitions()[0].get_line_code():
return False
except:
pass
try:
cs = ji.call_signatures()
except:
......
# Lakeshore cryostat
## Configuration of ls330, ls332, and ls336
## Configuration of ls336
for connection via gpib
```YAML
- class: lakeshore336
......@@ -33,5 +33,14 @@ for connection via tcp
- name: ls336Gt
channel: A
```
Last alternative for the model 336 would be to use USB interface.
Other models (used at ESRF and fow which BLISS controller exists)
have the following possible interfaces:
model 331 can use RS232.
model 332 can use GPIB or RS232.
model 335 can use GPIB or USB.
model 340 can use GPIB or RS232.
Note that ls335 is treated differently in bliss.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment