-
Notifications
You must be signed in to change notification settings - Fork 0
Drivers: structure of the package and drivers for DC power source #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
62d57f6
a953c6b
48d0ab6
cd31388
a404fc2
68ea660
cfbb3cf
9e09f69
5c3e810
439bbaa
6ea0d66
31e4065
3d4e830
bcd2bde
57c437d
34d3a9c
c3717db
ba00e85
ee10a05
fcfbace
1f09a03
7f7bbb7
d2afda8
cc8790c
363916d
7752a64
3204aae
d3c468b
b730745
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# -*- coding: utf-8 -*- | ||
# ----------------------------------------------------------------------------- | ||
# Copyright 2018 by I3py Authors, see AUTHORS for more details. | ||
# | ||
# Distributed under the terms of the BSD license. | ||
# | ||
# The full license is in the file LICENCE, distributed with this software. | ||
# ----------------------------------------------------------------------------- | ||
"""Package storing all the implemented drivers by manufacturer. | ||
|
||
The package contains also the standards definitions and common utilities such | ||
as support for IEEE488 and SCPI commands. | ||
|
||
""" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
# ----------------------------------------------------------------------------- | ||
# Copyright 2018 by I3py Authors, see AUTHORS for more details. | ||
# | ||
# Distributed under the terms of the BSD license. | ||
# | ||
# The full license is in the file LICENCE, distributed with this software. | ||
# ----------------------------------------------------------------------------- | ||
"""Alias package for the Keysight package. | ||
|
||
""" | ||
import sys | ||
from i3py.core.lazy_package import LazyPackage | ||
|
||
from .. import keysight | ||
|
||
sys.modules[__name__] = LazyPackage({}, __name__, __doc__, locals()) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
# ----------------------------------------------------------------------------- | ||
# Copyright 2018 by I3py Authors, see AUTHORS for more details. | ||
# | ||
# Distributed under the terms of the BSD license. | ||
# | ||
# The full license is in the file LICENCE, distributed with this software. | ||
# ----------------------------------------------------------------------------- | ||
"""Package for the drivers of Alazar Tech instruments. | ||
|
||
""" | ||
import sys | ||
from i3py.core.lazy_package import LazyPackage | ||
|
||
DRIVERS = {} | ||
|
||
sys.modules[__name__] = LazyPackage(DRIVERS, __name__, __doc__, locals()) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
# ----------------------------------------------------------------------------- | ||
# Copyright 2018 by I3py Authors, see AUTHORS for more details. | ||
# | ||
# Distributed under the terms of the BSD license. | ||
# | ||
# The full license is in the file LICENCE, distributed with this software. | ||
# ----------------------------------------------------------------------------- | ||
"""Package for the drivers of Anritsu instruments. | ||
|
||
""" | ||
import sys | ||
from i3py.core.lazy_package import LazyPackage | ||
|
||
DRIVERS = {} | ||
|
||
sys.modules[__name__] = LazyPackage(DRIVERS, __name__, __doc__, locals()) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
# -*- coding: utf-8 -*- | ||
# ----------------------------------------------------------------------------- | ||
# Copyright 2018 by I3py Authors, see AUTHORS for more details. | ||
# | ||
# Distributed under the terms of the BSD license. | ||
# | ||
# The full license is in the file LICENCE, distributed with this software. | ||
# ----------------------------------------------------------------------------- | ||
"""I3py standard for DC sources. | ||
|
||
""" | ||
from i3py.core import HasFeatures, SubSystem, channel | ||
from i3py.core.unit import FLOAT_QUANTITY | ||
from i3py.core.actions import Action | ||
from i3py.core.features import Bool, Float, Str, constant | ||
|
||
|
||
class DCPowerSource(HasFeatures): | ||
"""Standard interface expected from all DC Power sources. | ||
|
||
""" | ||
|
||
#: Outputs of the source. By default we declare a single output on index 0. | ||
outputs = channel((0,)) | ||
|
||
with outputs as o: | ||
|
||
#: Is the output on or off. | ||
#: Care should be taken that this value may not be up to date if a | ||
#: failure occurred. To know the current status of the output use | ||
#: read_output_status, this feature only store the target setting. | ||
o.enabled = Bool(aliases={True: ['On', 'ON', 'on'], | ||
False: ['Off', 'OFF', 'off']}) | ||
|
||
#: Target voltage for the output. If the source is a "current" source | ||
#: this will likely be a fixed value. | ||
o.voltage = Float(unit='V') | ||
|
||
#: Range in which the voltage can be set. | ||
o.voltage_range = Float(unit='V') | ||
|
||
#: How does the source behave if it cannot reach the target voltage | ||
#: because it reached the target current first. | ||
#: - regulate: we stop at the reached voltage when the target current | ||
#: is reached. | ||
#: - trip: the output is disabled if the current reaches or gets | ||
#: greater than the specified current. | ||
o.current_limit_behavior = Str(constant('regulate'), | ||
values=('regulate', 'trip')) | ||
|
||
#: Target voltage for the output. If the source is a "voltage" source | ||
#: this will likely be a fixed value. | ||
o.current = Float(unit='A') | ||
|
||
#: Range in which the current can be set. | ||
o.current_range = Float(unit='A') | ||
|
||
#: How does the source behave if it cannot reach the target current | ||
#: because it reached the target voltage first. | ||
#: - regulate: we stop at the reached voltage when the target current | ||
#: is reached. | ||
#: - trip: the output is disabled if the voltage reaches or gets | ||
#: greater than the specified voltage. | ||
o.voltage_limit_behavior = Str(constant('regulate'), | ||
values=('regulate', 'trip')) | ||
|
||
@o | ||
@Action() | ||
def read_output_status(self) -> str: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Waou what is this syntax ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it the type annatotation that bothers you or the double decoration ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the type annotation. I saw the python page about it. I didn't know it existed ! |
||
"""Determine the status of the output. | ||
|
||
The generic format of the status is status:reason, if the reason is | ||
not known used 'unknown'. The following values correspond to usual | ||
situations. | ||
|
||
Returns | ||
------- | ||
status : {'disabled', | ||
'enabled:constant-voltage', | ||
'enabled:constant-current', | ||
'tripped:over-voltage', | ||
'tripped:over-current', | ||
'unregulated'} | ||
The possible values for the output status are the following. | ||
- 'disabled': the output is currently disabled | ||
- 'enabled:constant-voltage': the target voltage was reached | ||
before the target current and voltage_limit_behavior is | ||
'regulate'. | ||
- 'enabled:constant-current': the target current was reached | ||
before the target voltage and current_limit_behavior is | ||
'regulate'. | ||
- 'tripped:over-voltage': the output tripped after reaching the | ||
voltage limit. | ||
- 'tripped:over-current': the output tripped after reaching the | ||
current limit. | ||
- 'unregulated': The output of the instrument is not stable. | ||
|
||
""" | ||
raise NotImplementedError() | ||
|
||
|
||
class DCPowerSourceWithMeasure(DCPowerSource): | ||
"""DC power source supporting to measure the output current/voltage. | ||
|
||
""" | ||
#: Outputs of the source. By default we declare a single output on index 0. | ||
outputs = channel((0,)) | ||
|
||
with outputs as o: | ||
|
||
@o | ||
@Action() | ||
def measure(self, quantity: str, **kwargs) -> FLOAT_QUANTITY: | ||
"""Measure the output voltage/current. | ||
|
||
Parameters | ||
---------- | ||
quantity : str, {'voltage', 'current'} | ||
Quantity to measure. | ||
|
||
**kwargs : | ||
Optional kwargs to specify the conditions of the measure | ||
(integration time, averages, etc) if applicable. | ||
|
||
Returns | ||
------- | ||
value : float or pint.Quantity | ||
Measured value. If units are supported the value is a Quantity | ||
object. | ||
|
||
""" | ||
raise NotImplementedError() | ||
|
||
|
||
class DCSourceTriggerSubsystem(SubSystem): | ||
"""Subsystem handing the usual triggering mechanism of DC sources. | ||
|
||
It should be added to a DCPowerSource subclass under the name trigger. | ||
|
||
""" | ||
#: Working mode for the trigger. This usually defines how the instrument | ||
#: will answer to a trigger event. | ||
mode = Str(values=('disabled',)) | ||
|
||
#: Possible origin for trigger events. | ||
source = Str(values=('immediate', 'software')) # Will extend later | ||
|
||
#: Delay between the trigger and the time at which the instrument start to | ||
#: modify its output. | ||
delay = Float(unit='s') | ||
|
||
@Action() | ||
def arm(self): | ||
"""Make the system ready to receive a trigger event. | ||
|
||
""" | ||
pass | ||
|
||
|
||
class DCSourceProtectionSubsystem(SubSystem): | ||
"""Interface for DC source protection. | ||
|
||
""" | ||
#: Is the protection enabled. | ||
enabled = Bool(aliases={True: ['On', 'ON', 'On'], | ||
False: ['Off', 'OFF', 'off']}) | ||
|
||
#: How the output behaves when the low/limit is reached. | ||
behavior = Str(constant('trip')) | ||
|
||
#: Lower limit below which the setting is not allowed to go. | ||
low_level = Float() | ||
|
||
#: Higher limit above which the setting is not allowed to go. | ||
high_level = Float() | ||
|
||
@Action() | ||
def read_status(self) -> str: | ||
"""Read the current status of the protection. | ||
|
||
Returns | ||
------- | ||
status : {'working', 'tripped'} | ||
|
||
""" | ||
pass | ||
|
||
@Action() | ||
def reset(self) -> None: | ||
"""Reset the protection after an issue. | ||
|
||
""" | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*- coding: utf-8 -*- | ||
# ----------------------------------------------------------------------------- | ||
# Copyright 2018 by I3py Authors, see AUTHORS for more details. | ||
# | ||
# Distributed under the terms of the BSD license. | ||
# | ||
# The full license is in the file LICENCE, distributed with this software. | ||
# ----------------------------------------------------------------------------- | ||
"""Standard interface of the identity subsystem. | ||
|
||
""" | ||
from i3py.core.base_subsystem import SubSystem | ||
from i3py.core.features import Str | ||
|
||
|
||
class Identity(SubSystem): | ||
"""Standard subsystem defining the expected identity info. | ||
|
||
This should be used as a base class for the identity subsystem of | ||
instruments providing identity information. | ||
|
||
Notes | ||
----- | ||
Some of those info might not be available for a given instrument. In such | ||
a case the Feature should return ''. | ||
|
||
""" | ||
#: Manufacturer as returned by the instrument. | ||
manufacturer = Str(True) | ||
|
||
#: Model name as returned by the instrument. | ||
model = Str(True) | ||
|
||
#: Instrument serial number. | ||
serial = Str(True) | ||
|
||
#: Version of the installed firmware. | ||
firmware = Str(True) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# -*- coding: utf-8 -*- | ||
# ----------------------------------------------------------------------------- | ||
# Copyright 2018 by I3py Authors, see AUTHORS for more details. | ||
# | ||
# Distributed under the terms of the BSD license. | ||
# | ||
# The full license is in the file LICENCE, distributed with this software. | ||
# ----------------------------------------------------------------------------- | ||
"""Common utility to deal with drivers implementation. | ||
|
||
""" | ||
|
||
# This package is always needed so there is no point making it lazy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is a float sufficient ? Don't you need a tuple ?
(certain sources can have a range - lim -> + lim, others 0 ->lim.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the one I add access to so far it is sufficient. But a source can add stricter limitation like the Bilt does. The fact is that there is never a direct mapping between the range and the associated limits.