Lightning Talks 2013 Torturando números para que confessem o sumiço das cervejas
Jul 06, 2015
Lightning Talks 2013
Torturando números paraque confessem o sumiço
das cervejas
MAURO ASSIS
• Técnico em Instrumentação e Controle peloCOLTEC/UFMG
• Engenheiro Agrícola pela UFV
• MBA em Gestão de Projetos pela FGV
• Programalista desde sempre
O PROJETO
• Repositor de cascos de cerveja em uma linha de processamento de caixas
• Esteira transportadora
• Sensores de ultrassom
• Magazine de reposição
DADOS BRUTOS COLETADOS
0
500
1000
1500
2000
2500
3000
3500
4000
4500
1
16
31
46
61
76
91
106
121
136
151
166
181
196
211
226
241
256
271
Series1
Series2
Series3
Series4
TORTURA 1: CORTANDOEXTREMIDADES
0
200
400
600
800
1000
1200
1400
1600
1 5 9
13
17
21
25
29
33
37
41
45
49
53
57
61
65
69
73
77
81
85
89
93
97
101
105
109
113
117
121
125
129
133
137
141
TORTURA DOIS: MÉDIAS MÓVEIS
0
200
400
600
800
1000
1200
1400
16001 4 7
101316192225283134374043464952555861646770737679828588919497
100
103
106
109
112
115
118
121
TORTURA 3: LIMIAR
0
0.2
0.4
0.6
0.8
1
1.2
1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93 97 101105109113117121
http://playground.arduino.cc/Main/DigitalSmoothint digitalSmooth(int rawIn, int *sensSmoothArray){int j, k, temp, top, bottom;long total;static int i;
static int sorted[filterSamples];boolean done;
i = (i + 1) % filterSamples; sensSmoothArray[i] = rawIn;
for (j=0; j<filterSamples; j++){ // transfer data array into anther array for sorting and // averaging
sorted[j] = sensSmoothArray[j];}
done = 0; // flag to know when we're done sorting while(done != 1){ // simple swap sort, sorts numbers from lowest to highestdone = 1;for (j = 0; j < (filterSamples - 1); j++){
if (sorted[j] > sorted[j + 1]){ // numbers are out of order - swaptemp = sorted[j + 1];sorted [j+1] = sorted[j] ;sorted [j] = temp;done = 0;
}}
}
// throw out top and bottom 15% of samples - limit to throw out at least one from top and bottom
bottom = max(((filterSamples * 15) / 100), 1);
top = min((((filterSamples * 85) / 100) + 1 ), (filterSamples - 1));
k = 0;
total = 0;
for ( j = bottom; j< top; j++){
total += sorted[j]; // total remaining indices
k++;
}
return total / k; // divide by number of samples
}
Esteira