"* `OFF`: Everything is powered off. This is also the state the software assumes when powering up (after roll out or LCU reboot),\n",
"* `HIBERNATE`: Connections to translators are on line. System is monitored.\n",
"* `STANDBY`: Critical systems are powered and initialised.\n",
"* `ON`: Everything is powered and initialised. Station is ready for observations.\n",
"\n",
"Valid transitions are: `OFF` -> `HIBERNATE` <-> `STANDBY` <-> `ON`. If the LCU is booted and nothing is known, the following transitions fully reset a station: `OFF` -> `HIBERNATE` -> `STANDBY` -> `HIBERNATE` -> `STANDBY` -> `ON` as that will force powering key hardware off before turning everything on. This ensures that the final `HIBERNATE` -> `STANDBY` -> `ON` starts with a consistent state.\n",
"\n",
"The `stationmanager` device is used to query about the station state and to perform transitions. It exposes the following:\n",
"\n",
"* `stationmanager.station_hibernate()`: Transition to `HIBERNATE`,\n",
"* `stationmanager.station_standby()`: Transition to `STANDBY`,\n",
"* `stationmanager.station_off()`: Transition to `OFF`,\n",
"* `stationmanager.station_state_R.name`: Current/last station state,\n",
"* `stationmanager.station_state_transitioning_R`: Station is currently transitioning between states,\n",
"* `stationmanager.requested_station_state_R`: Requested station state (different from current when transitioning),\n",
"* `stationmanager.last_requested_transition_exceptions_R`: Exceptions thrown by last transition. This is filled when the transition has finished/stopped."
]
},
{
"cell_type": "code",
"execution_count": 55,
"id": "7e3f8189-862f-40b8-b8ed-80605200880c",
"metadata": {},
"outputs": [],
"source": [
"# Enable write access for the whole notebook\n",
"write_access.enable()"
]
},
{
"cell_type": "code",
"execution_count": 56,
"id": "dc277fdc-0e1f-4e51-92a3-383d1f781be6",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"# Helper functions to track state transitions\n",
"\n",
"import time\n",
"\n",
"def timeit():\n",
" \"\"\"Decorator that prints how long the decorated function took.\"\"\"\n",
" \n",
" def wrapper(func):\n",
" def inner(*args, **kwargs):\n",
" start = time.monotonic()\n",
" \n",
" try:\n",
" return func(*args, **kwargs)\n",
" finally:\n",
" end = time.monotonic()\n",
" print(f\"Time elapsed in {func.__name__}: {end-start:.2f} seconds\")\n",
" \n",
" return inner \n",
" return wrapper\n",
" \n",
"def report_transition_until_done():\n",
" if stationmanager.station_state_transitioning_R:\n",
*`OFF`: Everything is powered off. This is also the state the software assumes when powering up (after roll out or LCU reboot),
*`HIBERNATE`: Connections to translators are on line. System is monitored.
*`STANDBY`: Critical systems are powered and initialised.
*`ON`: Everything is powered and initialised. Station is ready for observations.
Valid transitions are: `OFF` -> `HIBERNATE`<->`STANDBY`<->`ON`. If the LCU is booted and nothing is known, the following transitions fully reset a station: `OFF` -> `HIBERNATE` -> `STANDBY` -> `HIBERNATE` -> `STANDBY` -> `ON` as that will force powering key hardware off before turning everything on. This ensures that the final `HIBERNATE` -> `STANDBY` -> `ON` starts with a consistent state.
The `stationmanager` device is used to query about the station state and to perform transitions. It exposes the following:
*`stationmanager.station_hibernate()`: Transition to `HIBERNATE`,
*`stationmanager.station_standby()`: Transition to `STANDBY`,
*`stationmanager.station_off()`: Transition to `OFF`,
*`stationmanager.station_state_R.name`: Current/last station state,
*`stationmanager.station_state_transitioning_R`: Station is currently transitioning between states,
*`stationmanager.requested_station_state_R`: Requested station state (different from current when transitioning),
*`stationmanager.last_requested_transition_exceptions_R`: Exceptions thrown by last transition. This is filled when the transition has finished/stopped.