-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from IFAEControl/devel
Devel
- Loading branch information
Showing
14 changed files
with
637 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Library to communicate with TTi power supplies over LAN | ||
|
||
This library has been implemented by IFAE (www.ifae.es) control software department. | ||
|
||
It implements the commands detailed on TTi documentation for several power supply series: | ||
|
||
* CPx: [TTi manual for CPx series power supplies](http://resources.aimtti.com/manuals/CPX400DP_Instruction_Manual-Iss1.pdf) | ||
|
||
* PL: [TTi manual for PL series power supplies](https://resources.aimtti.com/manuals/New_PL+PL-P_Series_Instruction_Manual-Iss18.pdf) | ||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
from pyttilan.backend import PLBackend, TTiBackendExc | ||
|
||
import time | ||
import logging | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
if __name__ == "__main__": | ||
import argparse | ||
parser = argparse.ArgumentParser(description="Example of use of pyttilan library on a PL068 model") | ||
parser.add_argument('ip', help="IP of the power supply to connect to") | ||
|
||
args = parser.parse_args() | ||
|
||
ttipl = PLBackend(num_outputs=1) | ||
ttipl.connect(ip=args.ip) | ||
print(ttipl.get_identifier()) | ||
|
||
print("\nRunning setVoltage commands") | ||
ttipl.set_voltage(1, 3.30) | ||
try: | ||
ttipl.set_voltage(0, 10) # It reports an error | ||
except TTiBackendExc: | ||
print("Correctly raised an exception because output 0 does not exist") | ||
else: | ||
print("This is an error! It should have raised an exception") | ||
|
||
try: | ||
ttipl.set_voltage(1, 900) # IT reports an error | ||
except TTiBackendExc: | ||
print("Correctly rised an exception because we have asked for a too high value") | ||
else: | ||
print("This is an error!! It should have raised an exception") | ||
|
||
print("\nRunning getVoltage commands") | ||
print(ttipl.get_configured_voltage(1)) | ||
|
||
print("\nRunning read voltage command") | ||
print(ttipl.read_voltage(1)) | ||
|
||
print("\nRunning setCurrent commands") | ||
ttipl.set_current_limit(1, 0.5) | ||
|
||
try: | ||
ttipl.set_current_limit(3, 8) # It reports an error | ||
except TTiBackendExc: | ||
print("Correctly rised an exception because we have asked for an incorrect output") | ||
else: | ||
print("This is an error!! It should have raised an exception") | ||
|
||
try: | ||
ttipl.set_current_limit(1, -1) | ||
except TTiBackendExc: | ||
print("Correctly rised an exception because we have asked for a negative current value") | ||
else: | ||
print("This is an error!! It should have raised an exception") | ||
|
||
print("\nRunning getCurrent commands") | ||
print(ttipl.get_current_limit(1)) | ||
|
||
print("\nRunning readCurrent command") | ||
print(ttipl.read_current(1)) | ||
|
||
print(ttipl.local()) | ||
|
||
ttipl.disconnect() | ||
|
||
# this should fail | ||
try: | ||
print(ttipl.local()) | ||
except TTiBackendExc: | ||
print("Correctly rised an exception because client is not connected anymore") | ||
else: | ||
print("This is an error!! It should have raised an exception") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
""" A simple python script | ||
""" | ||
__author__ = 'Otger Ballester' | ||
__copyright__ = 'Copyright 2020' | ||
__date__ = '27/11/20' | ||
__credits__ = ['Otger Ballester', ] | ||
__license__ = 'CC0 1.0 Universal' | ||
__version__ = '0.1' | ||
__maintainer__ = 'Otger Ballester' | ||
__email__ = '[email protected]' | ||
|
||
|
||
IP = '172.16.7.253' | ||
|
||
from pyttilan.backend import PLBackend, TTiBackendExc, IRangeValues | ||
from pyttilan.commands import TTiPLCommands | ||
|
||
|
||
def write_to_file(fp, backend, comment): | ||
fp.write(f"{backend.last_tx}, {backend.last_rx}, {backend.last_esr}, {backend.last_eer}, {comment}\n") | ||
|
||
|
||
pl = PLBackend(valid_commands=TTiPLCommands(), num_outputs=1) | ||
pl.connect(IP) | ||
with open('raw_output.txt', 'w') as fp: | ||
fp.write("Sent, Received, ESR, EER, Meaning\n") | ||
|
||
pl.set_voltage(1, 1.35) | ||
write_to_file(fp, pl, "Set output 1 voltage to 1.35V") | ||
|
||
# pl.set_voltage_verify(1, 2.35) | ||
# write_to_file(fp, pl, "Set output 1 voltage to 1.35V with verify") | ||
|
||
pl.set_OVP(1, 4) | ||
write_to_file(fp, pl, "Set output 1 over voltage protection to 4V") | ||
|
||
pl.set_current_limit(1, 0.100) | ||
write_to_file(fp, pl, "Set current limit of output 1 to 0.1A") | ||
|
||
pl.set_OCP(1, 2.2) | ||
write_to_file(fp, pl, "Set overcurrent protection for output 1 at 2.2A") | ||
|
||
print(pl.get_configured_voltage(1)) | ||
write_to_file(fp, pl, "Get configured voltage for output 1") | ||
|
||
print(pl.get_current_limit(1)) | ||
write_to_file(fp, pl, "Get configured current limit for output 1") | ||
|
||
print(pl.get_OVP(1)) | ||
write_to_file(fp, pl, "Get voltage trip setting for output 1 in Volts") | ||
|
||
print(pl.get_OCP(1)) | ||
write_to_file(fp, pl, "Get current trip setting for output 1 in Amperes") | ||
|
||
print(pl.read_voltage(1)) | ||
write_to_file(fp, pl, "Read output 1 voltage") | ||
|
||
print(pl.read_current(1)) | ||
write_to_file(fp, pl, "Read output 1 current") | ||
|
||
pl.set_irange(1, IRangeValues.low) | ||
write_to_file(fp, pl, "Set current range of output 1 to high values") | ||
|
||
pl.set_irange(1, IRangeValues.high) | ||
write_to_file(fp, pl, "Set current range of output 1 to low values") | ||
|
||
print(pl.get_irange(1) == IRangeValues.high) | ||
write_to_file(fp, pl, "Get current range of output 1") | ||
|
||
|
||
pl.disconnect() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Sent, Received, ESR, EER, Meaning | ||
V1 1.35, , 0, , Set output 1 voltage to 1.35V | ||
OVP1 4.0, , 0, , Set output 1 over voltage protection to 4V | ||
I1 0.1, , 0, , Set current limit of output 1 to 0.1A | ||
OCP1 2.2, , 0, , Set overcurrent protection for output 1 at 2.2A | ||
V1?, V1 1.350, 0, , Get configured voltage for output 1 | ||
I1?, I1 0.100, 0, , Get configured current limit for output 1 | ||
OVP1?, 4.000, 0, , Get voltage trip setting for output 1 in Volts | ||
OCP1?, 2.2000, 0, , Get current trip setting for output 1 in Amperes | ||
V1O?, -0.006V, 0, , Read output 1 voltage | ||
I1O?, 0.000A, 0, , Read output 1 current | ||
IRANGE1 1, , 0, , Set current range of output 1 to high values | ||
IRANGE1 2, , 0, , Set current range of output 1 to low values | ||
IRANGE1?, 2, 0, , Get current range of output 1 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,52 +6,28 @@ | |
|
||
# Read README and CHANGES files for the long description | ||
here = os.path.abspath(os.path.dirname(__file__)) | ||
README = open(os.path.join(here, 'README.txt')).read() | ||
PACKAGEFULLNAME = 'pytticpx' | ||
PACKAGENAME = 'pytticpx' | ||
DESCRIPTION = 'Library to control remotely a TTi CPX Power Supply' | ||
LONG_DESCRIPTION = '' | ||
AUTHOR = 'David Roman' | ||
AUTHOR_EMAIL = '[email protected]' | ||
LICENSE = open(os.path.join(here, 'LICENSE')).read() | ||
URL = "https://gitlab.pic.es/ifaecontrol/pytticpx" | ||
VERSION = '0.1.2' | ||
RELEASE = 'dev' not in VERSION | ||
with open(os.path.join(here, 'README.md')) as fh: | ||
long_description = fh.read() | ||
|
||
print(find_packages('pytticpx')) | ||
# Read the version information | ||
#execfile(os.path.join(here, '__init__.py')) | ||
print(find_packages(exclude=('tests',))) | ||
setup( | ||
name=PACKAGEFULLNAME, | ||
version=VERSION, | ||
description=DESCRIPTION, | ||
#scripts=scripts, | ||
name="pyttilan", | ||
version="0.2.1", | ||
description="Library to control TTi Power Supplies over network", | ||
long_description_content_type="text/markdown", | ||
long_description=long_description, | ||
requires=[], | ||
install_requires=[], | ||
provides=[PACKAGENAME], | ||
author=AUTHOR, | ||
author_email=AUTHOR_EMAIL, | ||
license=LICENSE, | ||
url=URL, | ||
long_description=LONG_DESCRIPTION, | ||
provides=["pyttilan"], | ||
author="David Roman, Otger Ballester", | ||
author_email="[email protected]", | ||
license="CC0 1.0 Universal", | ||
url="https://github.com/IFAEControl/pyttilan", | ||
zip_safe=False, | ||
classifiers=[ | ||
"Development Status :: 4 - Beta", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
], | ||
#ata=True, | ||
packages=find_packages() | ||
#zip_safe=True, | ||
package_dir={'': 'src'}, | ||
packages=find_packages(where=os.path.join('.', 'src'), exclude=('tests',)) | ||
) | ||
|
||
# from distutils.core import setup | ||
# | ||
# setup( | ||
# name="pytticpx", | ||
# packages=['pytticpx'], | ||
# version="0.1.1", | ||
# description="Library to communicate with TTi CPX power supply", | ||
# author="David Roman", | ||
# author_email="[email protected]", | ||
# url='https://gitlab.pic.es/ifaecontrol/pytticpx', | ||
# ) |
Empty file.
Oops, something went wrong.