#!/bin/sh # tnetplug host export TNETPLUG_HOST=192.168.1.31 export TNETPLUG_PORT=3131 # Smart USB hub host # (uhubctl must be installed on the host) export HOST=rpi-3 export HOSTPORT=22 # Hub port where the RedPitaya is connected export HUBPORT=4 # Simultaneously, start testing RP's network connectivity, while # powering on MCH using tnetplug, and RP using uhubctl # Display power-on time TIMESTAMP_PRETTY=$(date '+%Y-%m-%d %H:%M:%S') echo "MCH powered on at $TIMESTAMP_PRETTY." # Power on MCH echo "A" | nc -W1 $TNETPLUG_HOST $TNETPLUG_PORT & # Power on RedPitaya connected to the smart USB hub # (assume that only 1 hub is connected) ssh -p $HOSTPORT $HOST "uhubctl -a on -p $HUBPORT" & # Wait 2 minutes before measurement sleep 120 # Get and plot Sayma data # NOTE: Change the RP hostname and LV/HV arguments according to # which two channels you are measuring! nix-shell -p python3Packages.matplotlib python3Packages.numpy python3Packages.scipy --run "./get_and_plot_sayma_data mlabs-raw mlabs-1 1 mlabs-1 2 mlabs-1:LV,LV" & # Wait 1 minute before powering off MCH and RP sleep 60 # Wait 30 seconds sleep 30 # Simultaneously power off MCH and RP # Display power-off time TIMESTAMP_PRETTY=$(date '+%Y-%m-%d %H:%M:%S') echo "MCH powered off at $TIMESTAMP_PRETTY." # Power off MCH echo "a" | nc -W1 $TNETPLUG_HOST $TNETPLUG_PORT & # Power off RedPitaya connected to the smart USB hub ssh -p $HOSTPORT $HOST "uhubctl -a off -p $HUBPORT"