![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Versão do protegemed que calcula o tempo em ms da fuga, calcula o numero de onverflow (valores muito baixo) e underflow (valores muito altos). Além disso, calcula um valor médio a partir dos valores capturados e não apenas pela fft.
Dependencies: EthernetInterface mbed-rtos mbed
Diff: Codes/EventDetector.cpp
- Revision:
- 1:917ca6b5d9d9
- Parent:
- 0:c64e1194230b
- Child:
- 2:86c3cb25577b
diff -r c64e1194230b -r 917ca6b5d9d9 Codes/EventDetector.cpp --- a/Codes/EventDetector.cpp Wed Jul 09 21:16:23 2014 +0000 +++ b/Codes/EventDetector.cpp Fri Jul 18 20:24:45 2014 +0000 @@ -88,7 +88,17 @@ Thread::wait(2); } - else{ + else{ + /* + unsigned short int buf[NUMBER_OF_SAMPLES]; + Capture::CopyBuffer(m_Channel,buf); + if ( (rmsvalue > 200) && (m_Channel == 0) ){ + for(int y=0; y< 256; y++) + printf("%d*",buf + [y]); + printf("\n"); + } + */ if(rmsvalue > Settings::get_Limit(m_Channel)) { if(!m_OutletTriggered) @@ -200,6 +210,7 @@ //void EventDetector::SendMessage(int ext,float rmsvalue) void EventDetector::SendMessage(int ext, float rmsvalue, float mv2, int under, int over, int duration) { + //printf("Chegou SendMessage\n"); //Here we must alloc a CaptureEvent object from mailbox pool, CaptureEvent* event = GetMailbox().alloc(); //printf("Capturou evento\n"); @@ -219,10 +230,22 @@ int type=0,outlet_number=0, aux=0; aux = Settings::get_OutletNumber(m_Channel); outlet_number = Settings::get_Outlet(aux); - //Temporario + + //Temporario - Sem leitor de RFID char rfid[9] = "1234560"; rfid[7] = (char)outlet_number + '0'; + // Com leitor de RFID + /* + //send hitag request + //capture hitag response + //printf("OUTLET=%d\n",outlet_index+1); + + if(m_OutletTriggered) + Capture::ReadRFID(outlet_index+1,m_RFID); + */ + + if(Settings::get_Purpose(m_Channel) == 'p') // phase channel { if(ext!=0) @@ -248,6 +271,7 @@ } } + printf("Passou algum troço\n"); if (type == 1 || type == 2 || type == 4) // Calula FFT s nos eventos de fuga, acompanhamento de fuga (diferencial) e liga SignalProcessor::CalculateFFT(buf,seno,coss,&mv,1, m_Channel); /* @@ -259,11 +283,12 @@ seno[i] = coss[i] = 0; //event->Setup(rfid,type,outlet_number,mv,rmsvalue,Settings::get_Gain(m_Channel),Settings::get_Offset(m_Channel),seno,coss); - + + printf("Passou FFT\n"); event->Setup(rfid,type,outlet_number,mv,mv2, rmsvalue,under, over, Settings::get_Gain(m_Channel),Settings::get_Offset(m_Channel),duration, seno,coss); //printf("\n\nDuration: %d\n\n", duration); - //ShowValues(event); + ShowValues(event); //and finally place the object in the mailbox queue. GetMailbox().put(event);