Skip to content
Snippets Groups Projects
test_device.ipynb 3.14 KiB
Newer Older
{
 "cells": [
  {
   "cell_type": "code",
   "id": "waiting-chance",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time\n",
    "import numpy"
   ]
  },
  {
   "cell_type": "code",
   "id": "moving-alexandria",
   "metadata": {},
   "outputs": [],
   "source": [
Taya Snijder's avatar
Taya Snijder committed
    "d=DeviceProxy(\"LTS/SST/1\")"
   "id": "ranking-aluminum",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Device is now in on state\n"
     ]
    }
   ],
   "source": [
    "state = str(d.state())\n",
    "\n",
    "if state == \"OFF\":\n",
    "    d.initialise()\n",
    "    time.sleep(1)\n",
    "state = str(d.state())\n",
    "if state == \"STANDBY\":\n",
    "    d.on()\n",
    "state = str(d.state())\n",
    "if state == \"ON\":\n",
    "    print(\"Device is now in on state\")\n"
   ]
  },
  {
   "cell_type": "code",
   "id": "beneficial-evidence",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "packet_count_R [55]\n",
      "last_packet_timestamp_R [1623249385]\n",
      "queue_percentage_used_R [0.]\n",
      "State <function __get_command_func.<locals>.f at 0x7fcb205fd0d0>\n",
      "Status <function __get_command_func.<locals>.f at 0x7fcb205fd0d0>\n"
     ]
    }
   ],
   "source": [
    "attr_names = d.get_attribute_list()\n",
    "\n",
    "for i in attr_names:\n",
    "    exec(\"value = print(i, d.{})\".format(i))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "sporting-current",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3.0"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d.RCU_mask_RW = [False, False, False, False, False, False, False, False, False, False, False, False,\n",
    " False, False, False, False, False, False, False, False, False, False, False, False,\n",
    " False, False, False, False, False, False, False, False,]\n",
    "time.sleep(1)\n",
    "print(d.RCU_mask_RW)\n",
    "\n",
    "monitor_rate = d.RCU_monitor_rate_RW\n",
    "print(\"current monitoring rate: {}, setting to {}\".format(monitor_rate, monitor_rate + 1))\n",
    "monitor_rate = monitor_rate + 1\n",
    "\n",
    "time.sleep(1)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "sharing-mechanics",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ruled-tracy",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "StationControl",
   "language": "python",
   "name": "stationcontrol"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}