def wait(self):
        """
        Blocks until the requested temperature is achieved.
        """
        if not self.presetDone:
            return

        # Waiting is done in two steps. First step waits until the program reaches
        # the next synchronization step. Second step waits util the measured temperature
        # reaches the requested temperature
        self.newStep.clear()
        while self.getStepNumber() != self.waitStep:
            ca.flush_io()
            self.newStep.wait(60)
            self.newStep.clear()

        self.newTemperature.clear()
        while self.getValue() != self.valueTarget:
            ca.flush_io()

            # Safety timeout, temperature didn't change after a long time
            if not self.newTemperature.wait(120):
                return

            self.newTemperature.clear()
Exemple #2
0
    def preset(self):
        """
        Makes the controler enter a well defined known state. This method creates and
        runs an "empty" ramp program. The program simply mantains the current
        temperature forever, whatever that temperature is. This is mostly a helper
        function, to allow making complex temperature ramps starting from a known
        state and reusing the preset values.

        .. note::
            Running a new program requires stopping the current program. While the
            program is stopped, the controller power generation drops to zero. Because
            of this power drop, this method may be slow to stabilize.
        """
        self.stop()
        current = self.getValue()

        # Steps 0 and 2 are fake steps, steps 1 and 3 are the real ones.
        # The fake steps are used for synchronizing with the device.
        program = [self.PROGRAM_LENGTH] + self.PROGRAM_LENGTH*[current, 99]
        self.programmingDone.clear()
        self.device.put('setPatternCount', 9999)
        self.device.put('programTable', array(program))
        ca.flush_io()
        self.programmingDone.wait(10)
        self.run()
        self.presetDone = True
    def preset(self):
        """
        Makes the controler enter a well defined known state. This method creates and
        runs an "empty" ramp program. The program simply mantains the current
        temperature forever, whatever that temperature is. This is mostly a helper
        function, to allow making complex temperature ramps starting from a known
        state and reusing the preset values.

        .. note::
            Running a new program requires stopping the current program. While the
            program is stopped, the controller power generation drops to zero. Because
            of this power drop, this method may be slow to stabilize.
        """
        self.stop()
        current = self.getValue()

        # Steps 0 and 2 are fake steps, steps 1 and 3 are the real ones.
        # The fake steps are used for synchronizing with the device.
        program = [self.PROGRAM_LENGTH] + self.PROGRAM_LENGTH*[current, 99]
        self.programmingDone.clear()
        self.device.put('setPatternCount', 9999)
        self.device.put('programTable', array(program))
        ca.flush_io()
        self.programmingDone.wait(10)
        self.run()
        self.presetDone = True
Exemple #4
0
    def wait(self):
        """
        Blocks until the requested temperature is achieved.
        """
        if not self.presetDone:
            return

        # Waiting is done in two steps. First step waits until the program reaches
        # the next synchronization step. Second step waits util the measured temperature
        # reaches the requested temperature
        self.newStep.clear()
        while self.getStepNumber() != self.waitStep:
            ca.flush_io()
            self.newStep.wait(60)
            self.newStep.clear()

        self.newTemperature.clear()
        while self.getValue() != self.valueTarget:
            ca.flush_io()

            # Safety timeout, temperature didn't change after a long time
            if not self.newTemperature.wait(120):
                return

            self.newTemperature.clear()
Exemple #5
0
 def program(self, programTable):
     """
     Set a programTable to the furnace
     """
     self.programmingDone.clear()
     self.device.put('programTable', array(programTable))
     ca.flush_io()
     self.programmingDone.wait(10)
Exemple #6
0
 def wait(self):
     """
     Blocks until the requested temperature is achieved.
     """
     self.newTemp.clear()
     while not self.reachTemp():
         ca.flush_io()
         self.newTemp.wait(5)
         self.newTemp.clear()
Exemple #7
0
    def change(self, open, wait=False):
        if self.isOpen() == open:
            self.changed.set()
            return

        self.changed.clear()
        self.toggle.put(1)
        ca.flush_io()

        if wait:
            self.wait()
Exemple #8
0
    def change(self, open, wait=False):
        if self.isOpen() == open:
            self.changed.set()
            return

        self.changed.clear()
        self.toggle.put(1)
        ca.flush_io()

        if wait:
            self.wait()
Exemple #9
0
    def wait(self):
        """
        Blocks until the requested temperature is achieved.
        """

        ca.flush_io()
        self.newTemperature.clear()

        while abs(self.getValue() - self.requestedValue) > self.EPSILON:
            # Give up after 60 seconds without an update
            if not self.newTemperature.wait(60):
                break

            self.newTemperature.clear()
Exemple #10
0
    def wait(self):
        """
        Blocks until the configured count time passes since the call to
        :meth:`startCount`. The time amount is configured with :meth:`setCountTime`, or
        1 second by default.

        If an acquisition has not been started, this method returns immediatelly.

        See: :meth:`setCountTime`, :meth:`startCount`
        """
        if not self.isCounting():
            return

        ca.flush_io()
        self.timer.wait()
Exemple #11
0
    def wait(self):
        """
        Blocks until the configured count time passes since the call to
        :meth:`startCount`. The time amount is configured with :meth:`setCountTime`, or
        1 second by default.

        If an acquisition has not been started, this method returns immediatelly.

        See: :meth:`setCountTime`, :meth:`startCount`
        """
        if not self.isCounting():
            return

        ca.flush_io()
        self.timer.wait()
    def wait(self):
        """
        Blocks until the requested temperature is achieved.
        """
        if not self.pending:
            return

        # Waiting is done in two steps. First step waits until the IOC deasserts
        # the pending flag to indicate a complete operation. Second step waits util the
        # measured temperature reaches the requested temperature.
        ca.flush_io()
        self.done.wait()

        self.newTemperature.clear()
        timeout = Timer(7)
        while self.getValue() != self.requestedValue and timeout.check():
            self.newTemperature.wait(1)
            self.newTemperature.clear()
Exemple #13
0
 def wait(self, timeout=3):
     ca.flush_io()
     self.changed.wait(timeout)
Exemple #14
0
 def wait(self, timeout=3):
     ca.flush_io()
     self.changed.wait(timeout)