Skip to main content

Delta Elektronika SM15K Power Supply Controller

Project description

Delta Elektronika SM15K Power Supply

image image image

This is a created package for functional operation of SM15K.

Avaliable oeprations and functions

  1. Functions from datasheet Delta Electronika
  2. Datalogging thread for three type of frames (Basic, Ah and Wh)
  3. Watchdog thread for safe operation
  4. Charging thread for 3 step charging algorithm
  5. Discharging thread for discharging algorithm
  6. Cycling thread for battery cycling algorithm

Used build-in modules

  1. Socket Module / import socket
  2. Threading Module / import threading
  3. Time Module / import time
  4. Csv Module / import csv
  5. Datetime Module / import datetime
  6. Sys Module / import sys
  7. Logging Module / import logging

Note: Datalogger logs as txt and comma seperated base.

Installation

pip install SM15K

How to use it?

Code and Syntax Examples

from deltaelektronika import SM15K
import time
# IP Address of the power supply, can be obtain the device itself.
IPV4 = '0.0.0.0' 

# To activate debugging option. Creates systemlog file and logs there
#SM15K.activateDebugLogger = True 

# To deactivate debugging option. Creates systemlog file and logs there
SM15K.activateDebugLogger = False 

ColorPrint = SM15K.ColorPrinter()

#Be sure Watchdog timer is higher than sleeptime of the thread
Watchdog = SM15K.WatchdogOperation(IPV4, timer=5000, sleeptime=4)  

# Default color is green, available colors are;
# purple, blue, cyan, green, yellow, red and normal                            
BasicDatalogger = SM15K.BasicDataloggerOperation(IPV4, loggingTime=10,
                printColor= 'purple')    
                
# Default color is green, available colors are;
# purple, blue, cyan, green, yellow, red and normal 
AhDatalogger = SM15K.AhDataloggerOperation(IPV4, loggingTime=10, 
                printColor= 'red')
 
# Default color is green, available colors are;
# purple, blue, cyan, green, yellow, red and normal            
WhDatalogger = SM15K.WhDataloggerOperation(IPV4, loggingTime=5, 
                printColor='blue')  
                            
Charging = SM15K.ChargingOperation(IPV4, sleeptime=5, bulkCurrent=100, 
                bulkVoltage= 14.5, floatVoltage=13.8, floatTime=300)
                
Discharging = SM15K.DischargingOperation(IPV4, sleeptime=5, 
                dischargeCurrent=100, dischargeVoltage=10.5, 
                cutoffCurrent=2)
                
Cycling = SM15K.CyclingOperation(IPV4, sleeptime=5, cycletime=10, 
                bulkCurrent=100, bulkVoltage=14.5, floatVoltage=13.8, 
                floatTime=300, dischargeCurrent=100, 
                dischargeVoltage=10.5, cutoffCurrent=2, restTime=30)

Each functionality has been created with related parameters at above.
To be able to use them python object.start() must be used to start the thread operation

Watchdog.start()        # To start watchdog thread class
BasicDatalogger.start() # To start BasicDatalogger thread class
AhDatalogger.start()    # To start AhDatalogger thread class
WhDatalogger.start()    # To start WhDatalogger thread class
Charging.start()        # To start Charging thread class
Discharging.start()     # To start Discharging thread class
Cycling.start()         # To start Cycling thread class

After calling thread start, if main loop ends, thread is going to end as well because of being deamong thread true. That is why infinity loop or long term loop needed to run. Or it can be used as thread.join() to be sure that main does not end before the thread is done.

Note: Do not operate charging and discharging threads at the same operation.

Note: Do not operate Ah and Wh datalogger threads at the same operation. Delta can log one of them at a time.

Note: Watchdog is being set to delta itself, that is why be sure timer is bigger than sleep time to have healty operation.

while True:
    # Main Code Runs Here in infinity loop.
    time.sleep(30)
    print(f'Main loop runs in here!')

You can run anything you want here as well to have multifunctional operation while system runs with multiple threads.

Note: All threads are created as deamon thread which means, if main finishes its operation threads are going to stop operation. That is why you should keep them in infinite loop.

License

© 2021 Yusuf Keklik

This repository is licensed under the MIT license. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SM15K-0.0.6.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

SM15K-0.0.6-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file SM15K-0.0.6.tar.gz.

File metadata

  • Download URL: SM15K-0.0.6.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1

File hashes

Hashes for SM15K-0.0.6.tar.gz
Algorithm Hash digest
SHA256 3cf7b8cb149b126d11ff08a58fb402bea959b47ab6bd7c321e7c6e1edc389b3f
MD5 88738eac43856a5c62c04c88f0cda1a1
BLAKE2b-256 f6c9b6c6cd86db4162d2b3da124490e06cd2a2470f0d81e9b5e450cfb02f3f45

See more details on using hashes here.

File details

Details for the file SM15K-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: SM15K-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 22.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1

File hashes

Hashes for SM15K-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e741c9ea3edabeabe9825dc8979e09b50eed6477755c5ca717d05266ff98e2c5
MD5 7c6e447c9d85aa572e2803eaed66cb48
BLAKE2b-256 3ee4d2d844ff30a5c993091eea0b8aaa0906b3b6c099decefa319de3b438c399

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page