Giter Club home page Giter Club logo

meadowlark_d5020's Introduction

Meadowlark D5020

Meadowlark D5020

Meadowlark D5020 with optional tango server and simulator

Apart from the core library, an optional simulator is also provided.

Apart from the core library, an optional tango device server is also provided.

Installation

From within your favorite python environment type:

$ pip install meadowlark_d5020

Library

The core of the meadowlark_d5020 library consists of Meadowlark_d5020 object. To create a Meadowlark_d5020 object you need to pass a communication object.

The communication object can be any object that supports a simple API consisting of two methods (either the sync or async version is supported):

  • write_readline(buff: bytes) -> bytes or

    async write_readline(buff: bytes) -> bytes

  • write(buff: bytes) -> None or

    async write(buff: bytes) -> None

A library that supports this API is sockio (Meadowlark D5020 comes pre-installed so you don't have to worry about installing it).

This library includes both async and sync versions of the TCP object. It also supports a set of features like re-connection and timeout handling.

Here is how to connect to a Meadowlark_d5020 controller:

import asyncio

from sockio.aio import TCP
from meadowlark_d5020 import Meadowlark_d5020


async def main():
    tcp = TCP("192.168.1.123", 5000)  # use host name or IP
    meadowlark_d5020_dev = Meadowlark_d5020(tcp)

    idn = await meadowlark_d5020_dev.idn()
    print("Connected to {} ({})".format(idn))


asyncio.run(main())

Simulator

A Meadowlark_d5020 simulator is provided.

Before using it, make sure everything is installed with:

$ pip install meadowlark_d5020[simulator]

The sinstruments engine is used.

To start a simulator you need to write a YAML config file where you define how many devices you want to simulate and which properties they hold.

The following example exports a hardware device with a minimal configuration using default values:

# config.yml

devices:
- class: Meadowlark_d5020
  package: meadowlark_d5020.simulator
  transports:
  - type: tcp
    url: :5000

To start the simulator type:

$ sinstruments-server -c ./config.yml --log-level=DEBUG
2020-05-14 16:02:35,004 INFO  simulator: Bootstraping server
2020-05-14 16:02:35,004 INFO  simulator: no backdoor declared
2020-05-14 16:02:35,004 INFO  simulator: Creating device Meadowlark_d5020 ('Meadowlark_d5020')
2020-05-14 16:02:35,080 INFO  simulator.Meadowlark_d5020[('', 5000)]: listening on ('', 5000) (newline='\n') (baudrate=None)

(To see the full list of options type sinstruments-server --help)

Tango server

A tango device server is also provided.

Make sure everything is installed with:

$ pip install meadowlark_d5020[tango]

Register a Meadowlark_d5020 tango server in the tango database:

$ tangoctl server add -s Meadowlark_d5020/test -d Meadowlark_d5020 test/meadowlark_d5020/1
$ tangoctl device property write -d test/meadowlark_d5020/1 -p address -v "tcp://192.168.123:5000"

(the above example uses tangoctl. You would need to install it with pip install tangoctl before using it. You are free to use any other tango tool like fandango or Jive)

Launch the server with:

$ Meadowlark_d5020 test

Credits

Development Lead

Contributors

None yet. Why not be the first?

meadowlark_d5020's People

Contributors

catunlock avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.