diff --git a/tools/cumdist.py b/tools/cumdist.py deleted file mode 100644 index e7dc3a836..000000000 --- a/tools/cumdist.py +++ /dev/null @@ -1,63 +0,0 @@ -import csv -import sys -import numpy as np -import matplotlib.pyplot as plt -import re - -# check if called correctly -if len(sys.argv) < 2: - sys.exit('Usage: %s FILE1 FILE2' % sys.argv[0]) - -plt.figure(figsize=(8,4)) - -for fn in sys.argv[1:]: - -# m = re.match('[a-zA-Z-]+[-_](\d+)[-_](\d+).', fn) -# rate = m.group(1) -# values = m.group(2) -# print 'Processing file %s (rate=%s, values=%s)' % (fn, rate, values) - - # read data from file - data = [ ] - with open(fn) as f: - reader = csv.reader(f, delimiter='\t') - - for row in reader: - offset = float(row[0]) - -# if fn != 'nrel-test1_offset.log': -# offset = offset * 0.001 - - if offset > 100: - continue - - data.append(offset) - - # evaluate the histogram - values, base = np.histogram(data, bins='fd') - - # evaluate the cumulative - cumulative = np.cumsum(values) - cumscaled = [ float(x) / len(data) for x in cumulative ] - - # plot the cumulative function - plt.plot(base[:-1], cumscaled, label=fn, linewidth=1) - - # plot the distribution - #valscaled = [ float(x) / len(data) for x in values ] - #plt.plot(base[:-1], valscaled, label=fn, linewidth=1) - -plt.xlabel('RTT (s)') -plt.ylabel('Cum. Probability') -plt.grid(color='0.75') - -#plt.yscale('log') - -#plt.ylim([0, 1.03]) -#plt.xlim([0.025, 0.05]) - -lgd = plt.legend(title='Rate (p/s)', loc='center left', bbox_to_anchor=(1, 0.5)) - -plt.show() - -#plt.savefig('cumdist.png', dpi=600, bbox_extra_artists=(lgd,), bbox_inches='tight') diff --git a/tools/extract_rtt.py b/tools/extract_rtt.py deleted file mode 100644 index aaf51b337..000000000 --- a/tools/extract_rtt.py +++ /dev/null @@ -1,22 +0,0 @@ -import csv -import sys -import re - -# check if called correctly -if len(sys.argv) != 2: - sys.exit('Usage: %s FILE' % sys.argv[0]) - -prog = re.compile('(\d+)(?:\.(\d+))?([-+]\d+(?:\.\d+)?(?:e[+-]?\d+)?)?(?:\((\d+)\))?') - -with open(sys.argv[1]) as f: - reader = csv.reader(f, delimiter='\t') - - for row in reader: - m = prog.match(row[0]) - - if m == None or m.group(3) == None: - continue - - offset = float(m.group(3)) - - print(offset) diff --git a/tools/file-filter.py b/tools/file-filter.py deleted file mode 100755 index de9e145d6..000000000 --- a/tools/file-filter.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python - -import sys - -import villas -from villas import * - -def main(): - if len(sys.argv) != 3: - print "Usage: %s from to" % (sys.argv[0]) - sys.exit(-1) - - start = villas.Timestamp.parse(sys.argv[1]) - end = villas.Timestamp.parse(sys.argv[2]) - - for line in sys.stdin: - msg = villas.Message.parse(line) - - if start <= msg.ts <= end: - print msg - -if __name__ == "__main__": - main() diff --git a/tools/file-merge.py b/tools/file-merge.py deleted file mode 100755 index 3b67b12b0..000000000 --- a/tools/file-merge.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python - -import sys - -import villas -from villas import * - -def main(): - files = sys.argv[1:] - - all = [ ] - last = { } - - for file in files: - handle = sys.stdin if file == '-' else open(file, "r") - - msgs = [ ] - for line in handle.xreadlines(): - msgs.append(villas.Message.parse(line, file)) - - all += msgs - last[file] = villas.Message(villas.Timestamp(), [0] * len(msgs[0].values), file) - - all.sort() - for msg in all: - last[msg.source] = msg - - values = [ ] - for file in files: - values += last[file].values - - print villas.Message(msg.ts, values, "") - -if __name__ == "__main__": - main() diff --git a/tools/fiware/fiware-query.sh b/tools/fiware/fiware-query.sh deleted file mode 100755 index f67ba1069..000000000 --- a/tools/fiware/fiware-query.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# Query FIWARE Orion Context Broker -# -# @author Steffen Vogel -# @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC -# @license GNU General Public License (version 3) -# -# VILLASnode -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -################################################################################## - -(curl http://46.101.131.212:1026/v1/queryContext -s -S \ - --header 'Content-Type: application/json' \ - --header 'Accept: application/json' -d @- | python -mjson.tool) < -# @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC -# @license GNU General Public License (version 3) -# -# VILLASnode -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -################################################################################## - -(curl http://46.101.131.212:1026/v1/updateContext -s -S \ - --header 'Content-Type: application/json' \ - --header 'Accept: application/json' -d @- | python -mjson.tool) < -# @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC -# @license GNU General Public License (version 3) -# -# VILLASnode -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -################################################################################### - -function usage() { - echo "Usage: villas-signal [OPTIONS] SIGNAL" - echo " SIGNAL is on of the following signal types:" - echo " mixed" - echo " random" - echo " sine" - echo " triangle" - echo " square" - echo " ramp" - echo " constants" - echo " counter" - echo "" - echo " OPTIONS is one or more of the following options:" - echo " -d LVL set debug level" - echo " -f FMT set the format" - echo " -v NUM specifies how many values a message should contain" - echo " -r HZ how many messages per second" - echo " -n non real-time mode. do not throttle output." - echo " -F HZ the frequency of the signal" - echo " -a FLT the amplitude" - echo " -D FLT the standard deviation for 'random' signals" - echo " -o OFF the DC bias" - echo " -l NUM only send LIMIT messages and stop" - echo - echo "VILLASnode $(villas-node -v)" - echo " Copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC" - echo " Steffen Vogel " - exit 1 -} - -OPTS=() - -while getopts "v:r:f:l:a:D:no:h" OPT; do - case $OPT in - n) OPTS+=("-o realtime=false") ;; - l) OPTS+=("-o limit=$OPTARG") ;; - v) OPTS+=("-o values=$OPTARG") ;; - r) OPTS+=("-o rate=$OPTARG") ;; - o) OPTS+=("-o offset=$OPTARG") ;; - f) OPTS+=("-o frequency=$OPTARG") ;; - a) OPTS+=("-o amplitude=$OPTARG") ;; - D) OPTS+=("-o stddev=$OPTARG") ;; - h) - usage - exit 0 - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - usage - exit 1 - ;; - esac -done - -# and shift them away -shift $((OPTIND - 1)) - -if (( $# != 1 )); then - usage - exit 1 -fi - -echo villas-pipe -r -t signal -o signal=$1 ${OPTS[@]}