Skip to main content

tools for communicating with Bronkhorst MFCs with the API for BM31

Project description

repository for a client/server program for communicating with Bronkhorst MFCs remotely. Intended to be used with Pylatus or similar scripting environment. To install, clone the repository, then run 'pip install -e .' inside. This will create the bronkhorstServer program. Can also get from PyPi, 'pip install bronkhorstControlbm31'

Usage: On the PC connected to the MFCs run bronkhorstServer in a terminal. Options are -c/--com input the com number as an integer (default 1, but check com ports in Device Manager), this will save next time you run so you shouldn't need to input it again. -p/--port port number, (default is value in the script, probably unnecessary to change). A positional argument which can be 'local' ('localhost'), 'remote' (hostname), or remoteip (ip address) (default local). If remote the hostname will be displayed to connect from another computer, otherwise it will be 'localhost'. The port number will also be displayed.

The best way to run is to use the multi client server e.g.

bronkhorstServer remote -c 7

Use remoteip or the IP address itself instead of remote to use the IP address as the hostname, sometimes it works better in cases where the PC has multiple connections.

Use ctrl+c to close the server. May take 10 s to take effect.

To send commands import the MFCclient class and connect function, then run it's methods. Initial arguments are MFC address (will be an integer), the IP address (default localhost) and the port (default is that in the script).

E.g.

from bronkhorstControlbm31 import MFCclient

MFCclient(3,'<hostname or ip address>').pollAll() 

(this gives information about all MFCs that are connected in a dataframe, the MFC address isn't used and can be anything in this case).

To change setpoint on MFC address 3:

MFCclient(3,'<hostname or ip address>').writeSetpoint(value)

There is a gui called mfcgui. Run in the terminal. There is one option: -m/--maxMFCs - the maximum number of MFCs that may be needed (sets the number of columns of widgets), by default this is 10, if you have more, or want to reduce it to make it cleaner, run with the specific number you want. e.g. for 15 MFCs:

mfcgui -m 15

alt text

When plot data is checked, the following data will be plotted:

alt text

There are also 3 plotting programs which can be run independently of the GUI, called barPlot, timePlot, and mfcPlotAll which can be run in conjunction with the bronkhorstMultiServer. Takes host as a positional argument (default 'localhost'). Run e.g. 'timePlot <hostname>'. Use --help to display options. mfcPlotAll plots the same data as the GUI.

I should mention this article https://realpython.com/python-sockets/ and the associated repository which helped me to make this.

Can also be controlled more directly, without the server, using the MFC class in the bronkhorst.py module, but the plotting programs won't work in that case, and it must be on the same PC as the MFCs. e.g.

from bronkhorstControlbm31 import MFC, startMfc

mfcmain = startMfc()
mfc1 = MFC(1,mfcmain)
mfc1.readName()

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

bronkhorstcontrolbm31-1.3.1.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

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

bronkhorstcontrolbm31-1.3.1-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file bronkhorstcontrolbm31-1.3.1.tar.gz.

File metadata

  • Download URL: bronkhorstcontrolbm31-1.3.1.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for bronkhorstcontrolbm31-1.3.1.tar.gz
Algorithm Hash digest
SHA256 c8e209a5bc93075c54cda2c522d10fef7826bdd2bfb910b4566846a5b2d79baf
MD5 15a8e69ba9a9250dce85281ee29ef25b
BLAKE2b-256 3e4d9eb4043c5e284875635c71ae0abd72e9cf2610f1f63bac9d456c50eea2d0

See more details on using hashes here.

File details

Details for the file bronkhorstcontrolbm31-1.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bronkhorstcontrolbm31-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fae79d4ae0bd7d61b90f2586708e2df731b18ff40b15fef447fdb4a2edfbdbca
MD5 437848f8a12c7987cb8cee6a29da4249
BLAKE2b-256 5ee1ae0564499e490a0ef990b6aff596325d072fd11d31530c81a2ad19e49be1

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