move syslab package

This commit is contained in:
DBras 2024-06-14 13:38:14 +02:00
parent 48849a4f0a
commit ae1fed50f3
51 changed files with 0 additions and 294 deletions

View File

@ -1,109 +0,0 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
\.DS_Store
# Pycharm
.idea/

View File

@ -1,27 +0,0 @@
# SYSLAB Python Interface
This project provides a Python interface to several SYSLAB components.
## Required software
- Python (>=3.7)
- python-requests (>=2.18)
- python-bs4 (>= 4.7)
## Installation
To install the package in your local path, run
```shell
python setup.py install
```
Alternatively, copy the `syslab` folder into your project directory.
# Contributors
- Anders Thavlov: Initial implementation
- Oliver Gehrke
- Daniel Esteban Morales Bondy
- Tue Vissing Jensen
- Federico Zarelli

View File

@ -1,11 +0,0 @@
from syslab import SwitchBoard
name = '319-2'
SB_connection = SwitchBoard(name)
print("Let's look at what is going on in the switchboard {}.".format(name))
for bay in range(SB_connection.getNumBays()):
print(SB_connection.getBayName(bay),' : ',SB_connection.getActivePower(bay))

View File

@ -1,99 +0,0 @@
# Notes on SOAP implementation
- Units should reflect SOAP methods onto their own namespace (1)
- CompositeMeasurement should convert to/from SOAP
- Type checking via client.get\_type('ns0:compositeMeasurement').elements
-
# Notes about this module - to be discussed
SYSLAB\_Unit.py has a whole bunch of static methods - should these be split into a util library instead?
Generally, many places where static methods are used for things that should perhaps just be functions...
The following files are empty:
- BattOpMode.py
- FlowBatteryState.py
- GaiaWindTurbine.py
To check the methods available, use, e.g.:
http://syslab-33.syslab.dk:8080/typebased_WebService_HeatSubstation/HeatSwitchboardWebService/716-h1/resourceNames
To figure out this URL, look at software.xml for the corresponding machine, and use this template:
http://(machineName).syslab.dk:(port)/(interfaceName)/(shortServerName)/(unitname)/resourceNames
| field | corresponds to | notes |
| ----- | -------------- | ----- |
| machineName | N/A | Look this up on the wiki |
| port | N/A | Dynamically allocated, starting at 8080 - good luck! |
| interfaceName | typeBasedWebService, interfaceName | |
| shortServerName | typeBasedWebService, serverClass | Remove the "Server" at the end |
| unitname | dataLogger, unit | Also defined as "name" in hardware.xml |
-------------------------
SYSLAB COMMON
Broadcast event logger:
Transcode to python:
https://git.elektro.dtu.dk/syslab/syslab-common/-/blob/master/src/main/java/risoe/syslab/comm/broadcast/BroadcastLogSender.java
broadcast log sender
:: transcode the "send()" method to python. It byte-encodes the message for UDP.
Java:
send(String origin, byte[] origIP, long timestamp, int ploadType, String message,
int level, int flags, String[] tags)
------------
Python:
----------.
def send(origin, origIP, timestamp, ploadType, message, level, flags, tags):
ploadbytes = message[:min(1024, len(message))].encode()
origbytes = origin[:min(32, len(origin))].encode()
tagbytes = tagsToBytes(tags, 256)
pktlen = 2 + 2 + 1 + len(origbytes) + 4 + 2 + 2 + 8 + 1 + 2 + len(ploadbytes) + len(tagbytes)
buf = bytearray(pktlen)
buf[0] = BroadcastLogConstants.BROADCASTLOG_PKTID >> 8
buf[1] = BroadcastLogConstants.BROADCASTLOG_PKTID & 0xff
buf[2] = (pktlen >> 8) & 0xff
buf[3] = pktlen & 0xff
buf[4] = len(origbytes)
buf[5:5+len(origbytes)] = origbytes
writePtr = 5 + len(origbytes)
buf[writePtr:writePtr+4] = origIP
writePtr += 4
buf[writePtr] = (level >> 8) & 0xff
buf[writePtr+1] = level & 0xff
buf[writePtr+2] = (flags >> 8) & 0xff
buf[writePtr+3] = flags & 0xff
for i in range(8):
buf[writePtr+7-i] = timestamp & 0xff
timestamp >>= 8
writePtr += 8
buf[writePtr] = ploadType & 0xff
buf[writePtr+1] = (len(ploadbytes) >> 8) & 0xff
buf[writePtr+2] = len(ploadbytes) & 0xff
buf[writePtr+3:writePtr+3+len(ploadbytes)] = ploadbytes
writePtr += len(ploadbytes)
buf[writePtr:writePtr+len(tagbytes)] = tagbytes
pack = n
pack = DatagramPacket(buf, len(buf), InetAddress.getByName("localhost"), 4445)
sock.send(pack)
------------
broadcast log receiver
+ needs a logger
listener ist interface for receiver
gui wall (SYSLAB Userspacce)
broadcast log displet
https://git.elektro.dtu.dk/syslab/syslab-userspace/-/blob/master/src/main/java/risoe/syslab/gui/wall/displets/BroadcastLogDisplet.java
... maybe extend with simple log file writer.

View File

@ -1,2 +0,0 @@
requests >= 2.18
beautifulsoup4 >= 3.7

View File

@ -1,10 +0,0 @@
[flake8]
ignore =
max-line-length = 79
max-complexity = 11
[pytest]
addopts = --doctest-glob="*.rst"
[wheel]
universal = True

View File

@ -1,36 +0,0 @@
from setuptools import setup, find_packages
setup(
name='syslab',
version='0.3.0',
author='Tue Vissing Jensen',
author_email='tvjens at elektro.dtu.dk',
description=('SYSLAB webservice client library.'),
long_description=(''),
url='https://www.syslab.dk',
install_requires=[
'requests>=2.18',
'beautifulsoup4>=3.7',
],
packages=find_packages(exclude=['tests*']),
include_package_data=True,
entry_points={
'console_scripts': [
],
},
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Science/Research',
'License :: Other/Proprietary License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Scientific/Engineering',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)