{"id":16190691,"url":"https://github.com/tiagocoutinho/vacuubrand","last_synced_at":"2025-04-02T04:31:53.908Z","repository":{"id":62586910,"uuid":"276618543","full_name":"tiagocoutinho/vacuubrand","owner":"tiagocoutinho","description":"python library control basic features of a Vacuubrand controller (DCP 3000)","archived":false,"fork":false,"pushed_at":"2024-03-11T20:28:33.000Z","size":3528,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-16T11:11:21.827Z","etag":null,"topics":["python","serial","simulator","tango","tango-server","vacuubrand"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tiagocoutinho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-02T10:36:24.000Z","updated_at":"2022-12-15T16:56:21.000Z","dependencies_parsed_at":"2024-11-03T03:32:01.957Z","dependency_job_id":null,"html_url":"https://github.com/tiagocoutinho/vacuubrand","commit_stats":{"total_commits":51,"total_committers":4,"mean_commits":12.75,"dds":0.3137254901960784,"last_synced_commit":"104cf05794307b890594bad6b657dd114e402c0f"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagocoutinho%2Fvacuubrand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagocoutinho%2Fvacuubrand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagocoutinho%2Fvacuubrand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagocoutinho%2Fvacuubrand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiagocoutinho","download_url":"https://codeload.github.com/tiagocoutinho/vacuubrand/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246757524,"owners_count":20828913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","serial","simulator","tango","tango-server","vacuubrand"],"created_at":"2024-10-10T07:43:55.486Z","updated_at":"2025-04-02T04:31:48.899Z","avatar_url":"https://github.com/tiagocoutinho.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vacuubrand library\n\n\u003cimg align=\"right\" alt=\"DCP3000 pirani\" width=\"250\"\n     src=\"https://github.com/tiagocoutinho/vacuubrand/raw/master/docs/dcp_3000_pirani.png\" /\u003e\n\nThis library is used to control basic features of a Vacuubrand controller.\n\nIt is composed of a core library, an optional simulator and\nan optional [tango](https://tango-controls.org/) device server.\n\nSo far only the DCP 3000 is supported.\n\n## Installation\n\nFrom within your favorite python environment type:\n\n`$ pip install vacuubrand`\n\n\n## Library\n\nThe core of the vacuubrand library consists of DCP3000 object.\nTo create a DCP3000 object you need to pass a communication object.\n\nThe communication object can be any object that supports a simple API\nconsisting of two methods (either the sync or async version is supported):\n\n* `write_readline(buff: bytes) -\u003e bytes` *or*\n* `write(buff: bytes) -\u003e None` *or*\n\nUsually you end up using a `connio.connection_for_url()` object.\nHere is how to connect to a DCP 3000 controller:\n\n```python\nimport asyncio\nfrom connio import connection_for_url\nfrom vacuubrand.dcp3000 import DCP3000\n\n\nasync def main():\n    # could also be a socket bridge: 'serial-tcp://\u003chost\u003e:\u003cport\u003e'\n    comm = connection_for_url('serial:///dev/ttyS0')\n    dcp = DCP3000(comm)\n\n    print(await dcp.pressure())\n\n\nasyncio.run(main())\n```\n\n#### Serial line\n\nTo access a serial line based DCP 3000 device it is strongly recommended you spawn\na serial to tcp bridge using [ser2net](https://linux.die.net/man/8/ser2net) or\n[socat](https://linux.die.net/man/1/socat)\n\nAssuming your device is connected to `/dev/ttyS0` and the baudrate is set to 19200,\nhere is how you could use socat to expose your device on the machine port 5000:\n\n`socat -v TCP-LISTEN:8500,reuseaddr,fork file:/dev/ttyS0,rawer,b19200,cs8,eol=10,icanon=1`\n\nThe equivalent line in ser2net config file would be:\n```\n8500:raw:0:/dev/ttyR15:19200 8DATABITS NONE 1STOPBIT\n```\n\nIt might be worth considering starting socat or ser2net as a service using\n[supervisor](http://supervisord.org/) or [circus](https://circus.rtfd.io/).\n\n### Simulator\n\nA DCP 3000 simulator is provided.\n\nBefore using it, make sure everything is installed with:\n\n`$ pip install vacuubrand[simulator]`\n\nThe [sinstruments](https://pypi.org/project/sinstruments/) engine is used.\n\nTo start a simulator you need to write a YAML config file where you define\nhow many devices you want to simulate and which properties they hold.\n\nThe following example exports 2 hardware devices. The first is a minimal\nconfiguration using default values and the second defines some initial values\nexplicitly:\n\n```yaml\n# config.yml\n\ndevices:\n- class: DCP3000\n  package: vacuubrand.simulator\n  name: vacuum-01\n  transports:\n  - type: serial\n    url: /tmp/dcp3000-1\n\n```\n\nTo start the simulator type:\n\n```terminal\n$ sinstruments-server -c ./config.yml --log-level=DEBUG\n2020-07-02 12:18:45,065 INFO  simulator: Bootstraping server\n2020-07-02 12:18:45,065 INFO  simulator: no backdoor declared\n2020-07-02 12:18:45,065 INFO  simulator: Creating device DCP3000 ('DCP3000')\n2020-07-02 12:18:45,067 INFO  simulator: Created symbolic link \"/tmp/dcp3000-1\" to simulator pseudo terminal '/dev/pts/7'\n2020-07-02 12:18:45,067 INFO  simulator.DCP3000[/tmp/dcp3000-1]: listening on /tmp/dcp3000-1 (baud=None)\n```\n\n(To see the full list of options type `sinstruments-server --help`)\n\nYou can access it as you would a real hardware:\n\n```terminal\n$ miniterm.py -e --eol CRLF /tmp/dcp3000-1\nIN_PV_1\n1004.1 mbar\n```\n\nor using the library:\n```python\n$ python\n\u003e\u003e\u003e from connio import connection_for_url\n\u003e\u003e\u003e from vacuubrand.dcp3000 import DCP3000\n\u003e\u003e\u003e conn = connection_for_url(\"serial:///tmp/dcp3000-1\")\n\u003e\u003e\u003e dcp = DCP3000(conn)\n\u003e\u003e\u003e print(await dcp.pressure())\n1004.1\n```\n\n### Tango server\n\nA [tango](https://tango-controls.org/) device server is also provided.\n\nMake sure everything is installed with:\n\n`$ pip install vacuubrand[tango]`\n\nRegister a Vacuubrand tango server in the tango database:\n```\n$ tangoctl server add -s Vacuubrand/test -d DCP3000 test/dcp3000/1\n$ tangoctl device property write -d test/dcp3000/1 -p url -v \"/dev/ttyS0\"\n```\n\n(the above example uses [tangoctl](https://pypi.org/project/tangoctl/). You would need\nto install it with `pip install tangoctl` before using it. You are free to use any other\ntango tool like [fandango](https://pypi.org/project/fandango/) or Jive)\n\nLaunch the server with:\n\n```terminal\n$ Vacuubrand test\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiagocoutinho%2Fvacuubrand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiagocoutinho%2Fvacuubrand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiagocoutinho%2Fvacuubrand/lists"}