No changes between revisions
/Modules/Mechanical/WINDGAUGE01A/CAD/SRC/WINDGAUGE01A_D01.scad
87,3 → 87,5
}
}
 
 
//WINDGAUGE01A_D01();
/Modules/Mechanical/WINDGAUGE01A/CAD/SRC/WINDGAUGE01A_D02.scad
15,9 → 15,16
union()
{
//výstuha
translate([-D01_sirka_tyce/2+S01_sila_materialu,0,0])
rotate ([0,-90,0])
linear_extrude (height = S01_sila_materialu, convexity = 10)
polygon(points=[[D02_vyska_uchytky/2,D01_delka_tyce+S01_prumer_vnitrni/2+D01_material_pred_zavitem+D02_sila_materialu-1],[0, D01_delka_tyce+S01_prumer_vnitrni/2+D01_material_pred_zavitem+D02_sila_materialu-1],[0,S01_prumer_vnitrni/2+D01_material_pred_zavitem],[D01_material_pod_zavitem,S01_prumer_vnitrni/2+D01_material_pred_zavitem]]);
//výstuha 2
translate([D01_sirka_tyce/2,0,0])
rotate ([0,-90,0])
linear_extrude (height = S01_sila_materialu, convexity = 10)
polygon(points=[[D02_vyska_uchytky/2,D01_delka_tyce+S01_prumer_vnitrni/2+D01_material_pred_zavitem+D02_sila_materialu-1],[0, D01_delka_tyce+S01_prumer_vnitrni/2+D01_material_pred_zavitem+D02_sila_materialu-1],[0,S01_prumer_vnitrni/2+D01_material_pred_zavitem],[D01_material_pod_zavitem,S01_prumer_vnitrni/2+D01_material_pred_zavitem]]);
//zavit
translate([0,0,D01_material_pod_zavitem])
49,7 → 56,7
//uchyt na sloupek
translate([0,D01_delka_tyce+(S01_prumer_vnitrni-S01_tolerance_zavit)/2+D01_material_pred_zavitem+D02_sila_materialu+(D02_prumer_obruby)/2,D02_vyska_uchytky/2])
rotate(a=[0,0,270])
WINDGAUGE01A_D01_2();
WINDGAUGE01A_D01();
 
}
 
/Modules/Mechanical/WINDGAUGE01A/CAD/assembly.scad
29,26 → 29,31
{
union()
{
//WINDGAUGE02A_D01 DRŽÁK
//WINDGAUGE1A_D01 DRŽÁK
//-------------------------------------------------------------
//-------------------------------------------------------------
 
 
color(barva_D01)
translate([0,0,-2*posunuti_dilu])
WINDGAUGE01A_D01();
translate([0,90,-2*posunuti_dilu+D02_vyska_uchytky/2])
rotate(a=[0,0,90])
WINDGAUGE01A_D01_2();
//WINDGAUGE02A_D02 DRŽÁK druhy dil
//WINDGAUGE01A_D02 DRŽÁK druhy dil
//-------------------------------------------------------------
//-------------------------------------------------------------
 
 
 
//WINDGAUGE02A_S01 stator velky dil
//-------------------------------------------------------------
color(barva_D01)
translate([0,0,-2*posunuti_dilu])
WINDGAUGE01A_D02();
//-------------------------------------------------------------
 
color(barva_S01)
56,8 → 61,8
rotate(a=[0,180,0])
WINDGAUGE01A_S01();
 
//color(barva_S02)
//WINDGAUGE01A_S02();
color(barva_S02)
WINDGAUGE01A_S02();
 
color(barva_S03)
translate([0,0,S01_vyska_spodniho_zavitu+S01_sila_drzaku_RJ11-0.3-4*posunuti_dilu])
75,7 → 80,7
rotate(a=[0,0,0])
WINDGAUGE01A_R02();
translate([-R02_sila_materialu_kridla/2,0,S01_vyska+2*S01_sila_materialu+3*posunuti_dilu+6*posunuti_dilu+R04_zavit_vyska+10]) rotate(a=[0,90,0])
translate([-R02_sila_materialu_kridla/2,S01_prumer_vnitrni/2+10,S01_vyska+2*S01_sila_materialu+3*posunuti_dilu+6*posunuti_dilu+R04_zavit_vyska+7]) rotate(a=[90,0,90])
WINDGAUGE01A_R05();
 
color(barva_R03)
/Modules/Mechanical/WINDGAUGE01A/CAD/configuration.scad
75,7 → 75,7
D01_sirka_tyce=10;
 
//WINDGAUGE02A_D02 //uchyt na sloup
D02_sila_materialu=4;
D02_sila_materialu=5;
D02_vyska_uchytky=40;
D02_prumer_obruby=27; // 3/4 trubka
D02_delka_celeho_uchytu=70;
/Modules/Mechanical/WINDGAUGE01A/CAD/print_data/P_WINDGAUGE01A_D01.scad
9,7 → 9,7
PI=3.141592;
rotate([0, 0, 0])
translate([0,0,D02_vyska_uchytky/2])
WINDGAUGE01A_D01();
WINDGAUGE01A_D01_2();
 
 
/Modules/Mechanical/WINDGAUGE01A/PrjInfo.txt
5,9 → 5,9
Mìøení smìru vìtru
 
[InfoLongDescription.en]
Printable variation sensor for measuring the wind direction. The detection is used three-axis magnetometer.
 
 
[InfoLongDescription.cs]
Tisknutelná varianta senzoru pro mìøení smìru vìtru. K detekci je využito tøíosého magnetometru.
 
[End]
/Modules/Mechanical/WINDGAUGE01A/SW/DataLogger.py
File deleted
/Modules/Mechanical/WINDGAUGE01A/SW/wind_gauge.py
File deleted
/Modules/Mechanical/WINDGAUGE01A/SW/Data_analyser.ipynb
File deleted
\ No newline at end of file
/Modules/Mechanical/WINDGAUGE01A/SW/test_rps.hdf5
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/Modules/Mechanical/WINDGAUGE01A/SW/test_rps.log.hdf5
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/Modules/Mechanical/WINDGAUGE01A/TODO.txt
1,9 → 1,0
prejmenovat slozku configuration na src.
 
Kryt musi mit presah nejspis az pod lopatky.
 
Mam pochybnosti o presnosti tisku a pevnosti stredove osy. Myslim, ze by zde mel byt nerezovy sroub o spravnem prurezu primo do loziska.
 
Asi by se mela prodlouzit delka lopatek na maximalni tisknutelny rozmer, protoze vetsi polomer lopatek bude vice tolerantni k promenlivemu odporu statoru vuci rotoru, napriklad namrzanim, navlhnutim atd.. 
 
Musí se pocitat se zamrzanim, mozna bude nutne umistit vyhrivani.

/Modules/Mechanical/WINDGAUGE01A/WINDGAUGE01A_small.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Modules/Mechanical/WINDGAUGE02A/SW/DataLogger.py
0,0 → 1,102
#!/usr/bin/python
 
# plot with >> plot 'last.txt' u 1:2 w l axes x1y1, 'last.txt' u 1:4 w l axes x1y2, 'last.txt' u 1:3
 
import os
import time
import datetime
import sys
import numpy as np
from gps import *
from pymlab import config
import threading
 
gpsd = None
 
class GpsPoller(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
global gpsd #bring it in scope
gpsd = gps(mode=WATCH_ENABLE)
self.current_value = None
self.running = True
def run(self):
global gpsd
while gpsp.running:
gpsd.next()
 
 
 
cfg = config.Config(
i2c = {
"port": 1,
},
bus = [
{
"name": "rps",
"type": "rps01",
},
],
)
 
 
cfg.initialize()
 
print "RPS01A logger"
sensor = cfg.get_device("rps")
 
 
try:
angles = np.zeros(5)
angles[4] = sensor.get_angle(verify = False)
time.sleep(0.01)
angles[3] = sensor.get_angle(verify = False)
time.sleep(0.01)
angles[2] = sensor.get_angle(verify = False)
time.sleep(0.01)
angles[1] = sensor.get_angle(verify = False)
n = 0
speed = 0
AVERAGING = 50
filen = 'log%0.0f.txt'%time.time()
f = open(filen,'w')
os.remove("last.txt")
os.symlink(filen, "last.txt")
gpsp = GpsPoller()
gpsp.start()
 
while True:
for i in range(AVERAGING):
time.sleep(0.01)
angles[0] = sensor.get_angle(verify = False)
if (angles[0] + n*360 - angles[1]) > 300:
n -= 1
angles[0] = angles[0] + n*360
 
elif (angles[0] + n*360 - angles[1]) < -300:
n += 1
angles[0] = angles[0] + n*360
 
else:
angles[0] = angles[0] + n*360
speed += (-angles[4] + 8*angles[3] - 8*angles[1] + angles[0])/12
angles = np.roll(angles, 1)
speed = speed/AVERAGING
 
g_spd = gpsd.fix.speed
print "W_Spd: %0.2f \t Angle: %0.2f \t G_Spd %0.2f" % (speed, angles[0], g_spd)
f.write("%0.2f %0.2f %0.2f %0.2f\r\n" %(time.time(), abs(speed), angles[0], g_spd))
f.flush()
 
except KeyboardInterrupt:
gpsp.running = False
gpsp.join()
sys.exit(0)
/Modules/Mechanical/WINDGAUGE02A/SW/Data_analyser.ipynb
1,7 → 1,7
{
"metadata": {
"name": "",
"signature": "sha256:c35f5f2963a30c62e2bc2437fc0d2422404aec0dbc3c5526df0be8cecdef27ee"
"signature": "sha256:9453f2d297004717b7b0ab5bb80d8d05d3ff319f7e609fa9565e753aa36cef87"
},
"nbformat": 3,
"nbformat_minor": 0,
50,7 → 50,7
]
}
],
"prompt_number": 24
"prompt_number": 3
},
{
"cell_type": "code",
63,7 → 63,7
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 14
"prompt_number": 4
},
{
"cell_type": "code",
71,43 → 71,87
"input": [
"prev_val= dataset.value[0,2]\n",
"n = 0\n",
"angle = np.zeros_like(dataset.value)\n",
"angle = np.zeros((dataset.shape[0]))\n",
"for i in range(dataset.value.shape[0]):\n",
" if (dataset.value[i,2] - prev_val) > 300: \n",
" if (dataset.value[i,2] - prev_val) > 300:\n",
" n -= 1\n",
" angle[i] = dataset.value[i,2] + n*360\n",
" prev_val = dataset.value[i,2]\n",
" elif -(dataset.value[i,2] - prev_val) > 300: # compute angular speed in backward direction.\n",
" n += 1\n",
" angle[i] = dataset.value[i,2] - n*360\n",
" prev_val = dataset.value[i,2]\n",
" else:\n",
" angle[i] = dataset.value[i,2] + n*360\n",
" prev_val = dataset.value[i,2]"
" prev_val = dataset.value[i,2]\n",
" "
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 19
"prompt_number": 6
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Five point difference numerical calculation. Source: http://mathfun528.blogspot.cz/2011/07/numerical-differentiation.html"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"angle"
"angle_speed = np.zeros_like(angle)\n",
"\n",
"for i in range(2,angle.shape[0]-2):\n",
" angle_speed[i] = (-angle[i + 2] + 8*angle[i + 1] - 8*angle[i - 1] + angle[i - 2])/12"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 7
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"fig, ax1 = plt.subplots()\n",
"\n",
"ax2 = ax1.twinx()\n",
"ax1.set_xlabel('Sample #')\n",
"ax1.set_ylabel('Angle')\n",
"ax2.set_ylabel('Angular speed')\n",
"\n",
"ax1.plot(dataset.value[:,0], angle,'b',dataset.value[:,0], dataset.value[:,2],'r')\n",
"ax2.plot(dataset.value[:,0], angle_speed,'g')\n",
"\n",
"plt.show()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 8
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print angle"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 20,
"output_type": "stream",
"stream": "stdout",
"text": [
"array([[ 0., 0., 0.],\n",
" [ 0., 0., 0.],\n",
" [ 0., 0., 0.],\n",
" ..., \n",
" [ 0., 0., 0.],\n",
" [ 0., 0., 0.],\n",
" [ 0., 0., 0.]], dtype=float32)"
"[ 3.64746094e+01 3.65405273e+01 3.77929688e+01 ..., -1.31529551e+05\n",
" -1.31530452e+05 -1.31528452e+05]\n"
]
}
],
"prompt_number": 20
"prompt_number": 10
},
{
"cell_type": "code",
115,6 → 159,38
"input": [],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 45
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 45
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
/Modules/Mechanical/WINDGAUGE02A/SW/wind_gauge.py
1,6 → 1,10
#!/usr/bin/python
 
# Python library for RPS01A MLAB module with AS5048B I2C Magnetic position sensor.
# MLAB meteostation wind speed gauge with magnetic rotation sensor.
# This simple algorithm calculate difference between five time equidistant points during the rotation. The result is angular speed per time step.
# Size of time-step could be varied depending on expected wind speed range to measure.
# Algorithm should be expanded by Kalman filtering to minimize dependence on fast reading.
# The measuring principle could introduce time-stamped reading to increase precision of measurement. It could be possible because the readings are not exactly time equidistant in real Linux word.
 
#uncomment for debbug purposes
#import logging
9,6 → 13,7
import time
import datetime
import sys
import numpy as np
from pymlab import config
 
#### Script Arguments ###############################################
64,24 → 69,39
#### Data Logging ###################################################
 
try:
angles = np.zeros(5)
angles[4] = sensor.get_angle(verify = False)
time.sleep(0.01)
angles[3] = sensor.get_angle(verify = False)
time.sleep(0.01)
angles[2] = sensor.get_angle(verify = False)
time.sleep(0.01)
angles[1] = sensor.get_angle(verify = False)
n = 0
speed = 0
AVERAGING = 50
 
while True:
# for i in range(10):
angle1 = sensor.get_angle(verify = False)
time.sleep(0.1)
angle2 = sensor.get_angle(verify = False)
time.sleep(0.1)
angle3 = sensor.get_angle(verify = False)
if (angle1 < angle2):
speed = (angle2 - angle1)/0.01
else:
speed = (360 - angle1 + angle2)/0.01
for i in range(AVERAGING):
time.sleep(0.01)
angles[0] = sensor.get_angle(verify = False)
sys.stdout.write("Speed: " + str(speed) +"\t"+ str(angle1) +"\t"+ str(angle2) + "\t\tMagnitude: " + str(sensor.get_magnitude())
+ "\tAGC Value: " + str(sensor.get_agc_value()) + "\tDiagnostics: " + str(sensor.get_diagnostics()) + "\r\n")
sys.stdout.flush()
time.sleep(0.01)
if (angles[0] + n*360 - angles[1]) > 300:
n -= 1
angles[0] = angles[0] + n*360
 
elif (angles[0] + n*360 - angles[1]) < -300: # compute angular speed in backward direction.
n += 1
angles[0] = angles[0] + n*360
 
else:
angles[0] = angles[0] + n*360
speed += (-angles[4] + 8*angles[3] - 8*angles[1] + angles[0])/12
angles = np.roll(angles, 1)
 
speed = speed/AVERAGING # apply averaging on acummulated value.
print "Speed: %0.2f \t Total Angle: %0.2f \r\n" % (speed, angles[0])
 
except KeyboardInterrupt:
sys.exit(0)