Source code for atomiq.components.electronics.misc

from __future__ import annotations

from atomiq.components.primitives import Component, Switchable

from artiq.experiment import kernel
from artiq.language.types import TFloat
from artiq.language.core import delay
from artiq.language.units import s


[docs] class DelayedSwitch(Component, Switchable): """A switch for voltages and currents the has finite switching time Switching of currents or voltages might take some time due to the used technology. For example MOSFETS have finite switiching times. This can be accounted for by using this class. Args: switch: The (fast) switch that controls the delayed switch switching_delay: The delay of the switch """ kernel_invariants = {"switch", "switching_delay"} def __init__(self, switch: Switchable, switching_delay: TFloat = 0, *args, **kwargs): Component.__init__(self, *args, **kwargs) Switchable.__init__(self, ["switch"]) self.switch = switch self.switching_delay = switching_delay
[docs] @kernel def on(self): delay(-self.switching_delay*s) self.switch.on()
[docs] @kernel def off(self): delay(-self.switching_delay*s) self.switch.off()