Skip to content

Commit

Permalink
DCSequencer features extended
Browse files Browse the repository at this point in the history
The sequencer now supports up to 8 ACQ channels. Sequencer parameters
are now adjustable via remote.
  • Loading branch information
maxkrapp1 committed Aug 9, 2023
1 parent a244155 commit 34a884d
Show file tree
Hide file tree
Showing 31 changed files with 3,349 additions and 2,758 deletions.
70 changes: 35 additions & 35 deletions Examples/BCMuxInterface/BCMuxInterface.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
"metadata": {},
"outputs": [],
"source": [
"class BCMuxInterface():\n",
" \"\"\" BC-Mux control class.\n",
" \n",
"class BCMuxInterface:\n",
" \"\"\"BC-Mux control class.\n",
"\n",
" With this class the `BC-MUX Multiplexer <https://zahner.de/products-details/multiplexer/bc-mux>`_ can\n",
" be controlled remotely without the BC-Mux Controller software.\n",
" \n",
"\n",
" The USB interface of the BC Mux is not supported by Python. Also the network settings must be\n",
" done with the program BC-Mux Network Config before using python.\n",
" \n",
"\n",
" The BC-MUX is an extension which makes it possible to separate up to 16 channels of a cyclizer\n",
" individually with switch boxes from the cyclizer and to switch them to the Zennium for e.g.\n",
" impedance measurements. This allows the cyclizer to be extended up to 16 channels with sequential\n",
Expand All @@ -53,76 +53,76 @@
" This class makes it possible to control the Zennium and the Multiplexer from one Python instance\n",
" via Remote2, which makes the use more flexible than with the BC-Mux Controller.\n",
" Also, if the cyclizer supports it, the complete system can be controlled from a single Python software.\n",
" \n",
"\n",
" :param ip: SerialCommandInterface object to control the device.\n",
" :type ip: str\n",
" :param port: SerialDataInterface object for online data.\n",
" :type port: int\n",
" \"\"\"\n",
" \n",
"\n",
" BUFFER_SIZE = 1024\n",
" \n",
"\n",
" def __init__(self, ip, port):\n",
" self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n",
" self.ip = ip\n",
" self.port = port\n",
" self.socket.connect((self.ip, self.port))\n",
" return\n",
" \n",
"\n",
" def close(self):\n",
" \"\"\" Closing the connection.\n",
" \n",
" \"\"\"Closing the connection.\n",
"\n",
" Disconnects the TCP/IP connection to the BC-MUX.\n",
" \"\"\"\n",
" self.socket.close()\n",
" return\n",
" \n",
"\n",
" def connectChannel(self, channel):\n",
" \"\"\" Connects the channel to the zennium.\n",
" \n",
" \"\"\"Connects the channel to the zennium.\n",
"\n",
" With this command, a channel is disconnected from the cyclizer and switched to the Zennium,\n",
" for example for impedance measurements.\n",
" \n",
"\n",
" :param channel: The channel to connect to the zennium.\n",
" :returns: The response string from the device.\n",
" :rtype: string\n",
" \"\"\"\n",
" command = \"ch {}\"\n",
" return self._executeCommandAndReadReply(command.format(channel))\n",
" \n",
"\n",
" def disconnectChannel(self):\n",
" \"\"\" Disconnects all channels from the zennium.\n",
" \n",
" \"\"\"Disconnects all channels from the zennium.\n",
"\n",
" All channels are disconnected from the Zennium and switched to the specific cyclizer channel.\n",
" \n",
"\n",
" :returns: The response string from the device.\n",
" :rtype: string\n",
" \"\"\"\n",
" command = \"ch 0\"\n",
" return self._executeCommandAndReadReply(command)\n",
" \n",
"\n",
" def setPulseLength(self, length):\n",
" \"\"\" Setting the relais control.\n",
" \n",
" \"\"\"Setting the relais control.\n",
"\n",
" The BC-MUX supports switchboxes containing monostable or bistable relais. With this command,\n",
" the control of the relais is set.\n",
" \n",
"\n",
" If a number other than 0 is set, the relay is switched with a pulse.\n",
" The pulse is then the number in milliseconds long.\n",
" \n",
"\n",
" :param length: The length of the switching pulse in milliseconds. 0 for monostable relays.\n",
" :returns: The response string from the device.\n",
" :rtype: string\n",
" \"\"\"\n",
" command = \"puls {}\"\n",
" return self._executeCommandAndReadReply(command.format(length))\n",
" \n",
"\n",
" def _executeCommandAndReadReply(self, command):\n",
" \"\"\" Private function to send a command to the device and read a string.\n",
" \n",
" \"\"\"Private function to send a command to the device and read a string.\n",
"\n",
" This command sends the command to the device and returns the response from the device.\n",
" \n",
" :returns: Response string from the device. \n",
"\n",
" :returns: Response string from the device.\n",
" :rtype: string\n",
" \"\"\"\n",
" command += \"\\r\\n\"\n",
Expand Down Expand Up @@ -150,20 +150,20 @@
"metadata": {},
"outputs": [],
"source": [
"if __name__ == '__main__':\n",
"if __name__ == \"__main__\":\n",
" TCP_IP = \"169.169.169.169\"\n",
" TCP_PORT = 4223\n",
" \n",
"\n",
" bcMux = BCMuxInterface(TCP_IP, TCP_PORT)\n",
" \n",
"\n",
" bcMux.setPulseLength(250)\n",
" bcMux.disconnectChannel()\n",
" \n",
"\n",
" for i in range(16):\n",
" print(f\"Channel: {i+1}\")\n",
" bcMux.connectChannel(i+1)\n",
" bcMux.connectChannel(i + 1)\n",
" bcMux.disconnectChannel()\n",
" \n",
"\n",
" bcMux.close()\n",
"\n",
" print(\"finish\")"
Expand Down
Loading

0 comments on commit 34a884d

Please sign in to comment.