Package: pycti-arbin
PyCTI-Arbinpycti-arbinis a Python module that provides cycler and channel level interfaces for communication and control ofArbin cyclersvia their Console TCP/IP Interface (CTI).OverviewMotivationInstallationSource InstallationGetting StartedConfigurationCyclerInterface ConfigurationChannelInterface ConfigurationEnvGetting Channel ReadingsDevelopmentContributingTestingArbinSpooferDocumentationLicenseMotivationWhy did we createpycti-arbin? This package enables a wide variety of applications such as:Real-time data logging, monitoring and alertingpycti-arbincan be used to passively monitor running tests and log readings directly to a database, bypassing the need to manually export data. Moreover, it's possible to create automated alerts based on incoming real-time data. For example, if a test were to fault or temperature were to exceed a set threshold. While Arbin already has a built-in notification system with MacNotify,pycti-arbinprovides a more flexible and customizable solution without having to directly modify test procedures.Automated test managementThe GUI provided by Arbin for test management is straight-forward and easy to use, but requires significant manual work. Withpycti-arbinit is possible to write programs to automatically start tests simultaneously across many channels (or even many cyclers) at once.Testing of next generation closed-loop charging methodsWhile conventional constant-current followed by constant-voltage (CCCV) charging has been the industry standard for many years and is well supported by cyclers, there is movement towards advancedclosed-loop control charging techniques that provide improved battery life and decreased charge times.pycti-arbinenables testing of closed-loop battery charging methods by providing an interface between software hosting battery charging algorithms and active Arbin tests, allowing the charge current to be dynamically set.Well tested, easy to use, community supported interface in the most popular programming language.It is entirely possible to write one's own CTI wrapper, butpycti-arbinprovides a well-tested ready to use package that takes care of lower level communication, providing a simple yet powerful interface in the most popular programming language.InstallationUsing pippycti-arbincan be installed using pip:pipinstallpycti-arbinSource InstallationTo install from source, type the following into the command line:gitclonehttps://github.com/BattGenie/pycti.gitcdpycti
pipinstall-rrequirements.txt
pipinstall.Getting Startedpycti-arbinprovides two distinct classes for interacting with Arbin cyclers:CyclerInterface: A cycler-level interface for reading channel status of any channel on the cycler. This class is capable of read only operations on the cycler.ChannelInterface: A channel-level interface for reading status of a specific channel, starting/stopping tests on that channel, and assigning meta variables during active tests on the channel. This class is capable of read and write operations on a single channel.ConfigurationBothCyclerInterfaceandChannelInterfacerequire configuration dictionaries upon initialization. The fields of these configuration dictionaries are detailed in the following sections.CyclerInterface ConfigurationAn exampleCyclerInterfaceconfiguration dictionary is shown below:CYCLER_INTERFACE_CONFIG={"ip_address":127.0.0.1,"port":1234,"timeout_s":3,"msg_buffer_size":4096}Where the fields are as follows:ip_address: str
The IP address of the Arbin host computer.port: int
The TCP port to communicate through. This is generally going to be 9031timeout_s:optional: float
How long to wait before timing out on TCP communication. Defaults to 3 seconds.msg_buffer_size:optional: int
How big of a message buffer to use for sending/receiving messages.
A minimum of 1024 bytes is recommended. Defaults to 4096 bytes.ChannelInterface ConfigurationAn exampleChannelInterfaceconfiguration dictionary is shown below:CHANNEL_INTERFACE_CONFIG={"channel":1,"test_name":"fake_test_name","schedule_name":"Rest+207855.sdx","ip_address":127.0.0.1,"port":1234,"timeout_s":3,"msg_buffer_size":4096}Where the fields are as follows:channel: int
The channel to target with the ChannelInterface class instance.test_name:optional: str
The test name to use if using the ChannelInterface to start a test.schedule_name:optional: str
The name of the schedule file to use if using the ChannelInterface to start a test.ip_address: str
The IP address of the Arbin host computer.port: int
The TCP port to communicate through. This is generally going to be 7031timeout_s:optional: float
How long to wait before timing out on TCP communication. Defaults to 3 seconds.msg_buffer_size:optional: int
How big of a message buffer to use for sending/receiving messages.
A minimum of 1024 bytes is recommended. Defaults to 4096 bytes.EnvIn addition to a configuration dictionary, both interfaces require a.envfile containing the Arbin CTI username and password to use for communication. The.envfile path can be passed as a constructor argument. If it is not specified, the the program looks in the working directly for a.envfile.The.envfile must contain the following fields:ARBIN_CTI_USERNAME='your_username'ARBIN_CTI_PASSWORD='your_password'Whereyour_usernameandyour_passwordshould be replaced with your username and password.Getting Channel ReadingsTo get channel readings with aCyclerInterfaceyou must specify which channel you want to read from:frompyctiarbinimportCyclerInterfaceCYCLER_INTERFACE_CONFIG={"ip_address":"127.0.0.1""port":1234,"timeout_s":3,"msg_buffer_size":4096}cycler_interface=CyclerInterface(CYCLER_INTERFACE_CONFIG)cycler_interface.read_channel_status(channel=1)For aChannelInterfacethere is no need to specify the channel since we define it in the config:frompyctiarbinimportChannelInterfaceCHANNEL_INTERFACE_CONFIG={"channel":1,"test_name":"fake_test_name","schedule_name":"Rest+207855.sdx","ip_address":"127.0.0.1""port":1234,"timeout_s":3,"msg_buffer_size":4096}channel_interface=ChannelInterface(CHANNEL_INTERFACE_CONFIG)channel_interface.read_channel_status()For more examples of how to use theCyclerInterfaceandChannelInterfaceclass see thedemo_notebook.ipynband documentation.Tested MITS Pro VersionVersionBuildpycti-arbinMits8 PV.202110Oct 4 20210.0.4DevelopmentThis section contains various information to help developers further extend and testpycti-arbinContributingAs it exists nowpycti-arbinonly implements a fraction of the messages supported by CTI. Further work can be done to expandpycti-arbinto include more of the messages detailed in the CTI documentationdocs/ArbinCTI_Protocol v1.1.pdf.We welcome your help in expandingpycti-arbin! Please see theCONTRIBUTING.mdfile in this repository for contribution guidelines.TestingTo run the tests navigate to the "tests" directory and type the following:pytest.To run tests and generate a coverage report:coveragerun-mpytestTo view the generated coverage report:coveragereport-mArbinSpooferTesting software on a real cycler is dangerous so we've created a submodulearbinspooferto emulate some of the behavior of the Arbin software with a classArbinSpoofer. This class creates a local TCP server and that accepts connections from n number of clients. TheArbinSpooferdoes not perfectly emulate a Arbin cycler (for example, it does not track if a test is already running on a channel) and merely checks that the message format is correct and responds with standard messages.DocumentationAll documentation was generated withpydoc. To re-generate the documentation type the following command from the top level directory of the repository:pydoc--html.LicenseMIT LicenseCopyright (c) 2023 BattGenie Inc.Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE