<html><head></head><body><div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div>Boa tarde listeiros,</div><div><br></div><div>Estou executando a seguinte rotina para obter os parâmetros de weibull num dado intervalo de velocidades de vento.</div><div>Fiz um servidor linux numa placa raspberry pi3 e estou usando MySQL, R, PHP e hospedando um site onde retorno os valores calculados. </div><div>A questão é que demora demais para calcular, quase um minuto e meio.</div><div>No computador é menos de 10s. Entendo que existe questões de memória e processamento.</div><div>Hoje o intervalo de busca no banco de dados é fixo, futuramente vai ser variável, logo, a cada busca demorará 1:30 min para ter a resposta.</div><div><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">A questão é, existe forma de agilizar esse cálculo?</span><br></div><div><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">Pensei até em criar um server exclusivo para R, mas não encontrei muito material a respeito.</span></div><div><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;"><br></span></div><div><br></div><div><br></div><div><div>library(DBI, quietly = TRUE)</div><div>library(fitdistrplus, quietly = TRUE)</div><div>library(RMySQL, quietly = TRUE)</div><div><br></div><div>mydb = dbConnect(MySQL(), user=.........., password=......., dbname=......., host=...................)</div><div>rs = dbSendQuery(mydb, "SELECT vento_12m FROM weibull_points WHERE vento_12m >=0 AND vento_12m < 15.75 ORDER BY datetime DESC")</div><div>data = fetch(rs, n=-1)</div><div><br></div><div>fw = fitdistr(as.numeric(data$vento_12m), densfun = "weibull", lower = 0)</div><div>forma= fw$estimate[1]</div><div>escala = fw$estimate[2]</div><div><br></div><div>query <- paste0("INSERT INTO weibull_curva_12m (fator_forma_k, fator_escala_c) VALUES ('",fw$estimate[1],"','", fw$estimate[2],"')")</div><div>grava = dbSendQuery(mydb, query)</div><div>dev.off()</div><div><br></div><div><br></div></div><div class="ydp78290003signature"><div></div><div><font class="ydp78290003Apple-style-span" size="2" face="tahoma, 'new york', times, serif" color="#737373"><br></font></div><div><div id="ydp78290003yui_3_16_0_1_1441712734407_5261" style="font-family:HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;background-color:rgb(255, 255, 255);"><font class="ydp78290003Apple-style-span" size="2" face="tahoma, 'new york', times, serif" color="#737373" id="ydp78290003yui_3_16_0_1_1441712734407_5711">--</font></div><div id="ydp78290003yui_3_16_0_1_1441712734407_5157" style="font-family:HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;background-color:rgb(255, 255, 255);"><div id="ydp78290003yui_3_16_0_1_1441712734407_5262" style="font-family:tahoma, 'new york', times, serif;"><span class="ydp78290003yui_3_7_2_47_1381080856391_85" id="ydp78290003yui_3_16_0_1_1441712734407_5507" style="font-size:small;font-weight:bold;"><font class="ydp78290003Apple-style-span" color="#737373" id="ydp78290003yui_3_16_0_1_1441712734407_5506">Leonardo de Oliveira Ferrão</font></span></div><div id="ydp78290003yui_3_16_0_1_1441712734407_5510" style="font-family:tahoma, 'new york', times, serif;"><span class="ydp78290003yui_3_7_2_47_1381080856391_85" id="ydp78290003yui_3_16_0_1_1441712734407_5509" style="font-size:small;"><font class="ydp78290003Apple-style-span" color="#737373" id="ydp78290003yui_3_16_0_1_1441712734407_5508">Eletrotécnico - CREA/RS 198702</font></span></div><div id="ydp78290003yui_3_16_0_1_1441712734407_5512" dir="ltr" style="font-family:tahoma, 'new york', times, serif;"><span id="ydp78290003yui_3_16_0_1_1441712734407_5511" style="color:rgb(115, 115, 115);font-size:small;">Administrador - CRA/RS 049456<br>Engenheiro de Controle e Automação</span></div><div id="ydp78290003yui_3_16_0_1_1441712734407_5515" style="font-family:tahoma, 'new york', times, serif;"><font color="#737373" face="tahoma, 'new york', times, serif" id="ydp78290003yui_3_16_0_1_1441712734407_5514"><div id="ydp78290003yui_3_16_0_1_1441712734407_5513" style="font-size:small;">Universidade Federal de Santa Maria - UFSM </div></font></div><div id="ydp78290003yui_3_16_0_1_1441712734407_5156" style="font-family:tahoma, 'new york', times, serif;"><font class="ydp78290003Apple-style-span" size="2" face="tahoma, 'new york', times, serif" color="#737373" id="ydp78290003yui_3_16_0_1_1441712734407_5516">Skype: leonardo.ferrao</font></div><div id="ydp78290003yui_3_16_0_1_1441712734407_5519" style="font-family:tahoma, 'new york', times, serif;"><span id="ydp78290003yui_3_16_0_1_1441712734407_5518" style="font-size:small;"><font class="ydp78290003Apple-style-span" face="tahoma, 'new york', times, serif" color="#737373" id="ydp78290003yui_3_16_0_1_1441712734407_5517">Celular (55) 9</font><span class="ydp78290003yui_3_7_2_47_1381080856391_94" id="ydp78290003yui_3_16_0_1_1441712734407_5528" style="color:rgb(115, 115, 115);">9715-0343</span></span></div><div id="ydp78290003yui_3_16_0_1_1441712734407_5521" style="font-family:tahoma, 'new york', times, serif;"><font class="ydp78290003Apple-style-span" size="2" face="tahoma, 'new york', times, serif" color="#737373" id="ydp78290003yui_3_16_0_1_1441712734407_5520">Residencial (55) 3221-6743</font></div></div></div></div></div></body></html>