Merge branch 'master' of gitlab.com:patek-devs/2019-mfp/particle-accelerator
This commit is contained in:
commit
19b242f02c
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
plotting/speedplot.dat
|
7
plotting/speedplot-shower.sh
Executable file
7
plotting/speedplot-shower.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
while true;
|
||||||
|
do
|
||||||
|
tail -n 1 speedplot.dat | awk '{printf("time since start: %.0f s\ncurrent speed: %.3f m·s¯¹\naverage speed: %.3f m·s¯¹", $1, $2, $3)}'
|
||||||
|
sleep 0.1;
|
||||||
|
clear;
|
||||||
|
done
|
||||||
|
|
2
plotting/speedplot.gnuplot
Normal file
2
plotting/speedplot.gnuplot
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
set terminal qt
|
||||||
|
plot "<cat"
|
33
plotting/speedplot.py
Normal file
33
plotting/speedplot.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/env/python
|
||||||
|
import time
|
||||||
|
|
||||||
|
lastMillis = 0
|
||||||
|
measurements = 0
|
||||||
|
avg = 0
|
||||||
|
|
||||||
|
while True:
|
||||||
|
millis = input()
|
||||||
|
if millis.isspace() or millis == "":
|
||||||
|
continue
|
||||||
|
millis = int(millis)
|
||||||
|
if (millis > 30000):
|
||||||
|
break
|
||||||
|
while True:
|
||||||
|
millis = input()
|
||||||
|
if millis.isspace() or millis == "":
|
||||||
|
continue
|
||||||
|
millis = int(millis)
|
||||||
|
if (millis < 5000):
|
||||||
|
break
|
||||||
|
while True:
|
||||||
|
millis = input()
|
||||||
|
if millis.isspace() or millis == "":
|
||||||
|
continue
|
||||||
|
measurements+=1
|
||||||
|
millis = int(millis)
|
||||||
|
pulseLength = millis - lastMillis
|
||||||
|
lastMillis = millis
|
||||||
|
speed = 0.6666666666666 / (pulseLength / 1000)
|
||||||
|
avg = (avg*(measurements-1)+speed)/measurements
|
||||||
|
print(str(millis/1000) + " " + str(speed) + " " + str(avg))
|
||||||
|
|
12
plotting/speedplot.sh
Executable file
12
plotting/speedplot.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
for i in 1
|
||||||
|
do
|
||||||
|
printf "plot 'speedplot.dat' using 1:2 with lines title 'Current speed', '' using 1:3 with lines title 'Average speed'\nset terminal qt noraise\n";
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
printf "set autoscale xy\n"
|
||||||
|
printf "replot\n"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
done | gnuplot
|
14
plotting/speedplot1.sh
Executable file
14
plotting/speedplot1.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
for i in 1
|
||||||
|
do
|
||||||
|
printf "plot 'speedplot.dat' using 1:2 with lines title 'Current speed', '' using 1:3 with lines title 'Avergage speed'\nset terminal qt noraise\n";
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
printf "set autoscale y\n"
|
||||||
|
export lastMeasurementTime=$(cat speedplot.dat | tail -n 1 | awk '{print $1}')
|
||||||
|
printf "set xrange[$(echo "$lastMeasurementTime - 30" | bc):$lastMeasurementTime]\n"
|
||||||
|
printf "replot\n"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
done | gnuplot
|
Loading…
Reference in New Issue
Block a user