-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Corrigido a versão de firmware do ESP32;
- Criado função para cálculo do RMS - Função para avaliar se o buffer de leitura está cheio; - Organização da chamada das funções - Organização do salvamento no buffer; - Adicionado max e min no buffer, para facilitar o cálculo de offset DC que deve ser subtraido do sinal; - Criado estrutura para armzenamento das variáveis principais do Smart Meter; - Criado buffer do tipo ring, para salvar os dados de 'time series' do Smart MEter; - Criado função para inserir no vetor de Smart Meter time series, os dados atuais que foram calculados; - Alteração da lib de wifi; - Melhorias gerais do código
- Loading branch information
1 parent
f884ea5
commit ffeef87
Showing
14 changed files
with
416 additions
and
366 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Inclusion guard, to prevent multiple includes of the same header | ||
#ifndef BUFFER_H | ||
#define BUFFER_H | ||
|
||
#include <stdint.h> // C standard library | ||
#define BUFFER_SIZE 2048 // Define buffer size for current and voltage | ||
#define SM_TIMESERIE_SIZE 32 // Define smart meter main measures timeseires size | ||
|
||
// # Buffer struct | ||
typedef struct { | ||
int16_t data[BUFFER_SIZE]; // Array to store values | ||
uint16_t size; // Store array size | ||
uint16_t max; // Store max value in array | ||
uint16_t min; // Store min value in array | ||
} Buffer; | ||
|
||
// # Smart Meter main data block struct | ||
typedef struct { | ||
float v_rms; | ||
float i_rms; | ||
float aparrent_power; | ||
float active_power; | ||
float reactive_power; | ||
float frequency; | ||
float fp; | ||
float THD_V; | ||
float THD_I; | ||
uint32_t timestamp; | ||
} SmartMeter; | ||
|
||
// # Smart Meter timeseries block | ||
typedef struct { | ||
SmartMeter data[SM_TIMESERIE_SIZE]; | ||
uint16_t pointer; | ||
} TimeSerieSM; | ||
|
||
// # Buffer functions | ||
int buffer_push (Buffer *buf, int16_t value); | ||
int is_buffer_full(Buffer *buf); | ||
void buffer_clean (Buffer *buf); | ||
|
||
// # Timeseries functions | ||
int sm_push (SmartMeter *buf); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Inclusion guard, to prevent multiple includes of the same header | ||
#ifndef SMARTMETER_H | ||
#define SMARTMETER_H | ||
|
||
#include <stdint.h> // C standard library | ||
|
||
#endif |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.