uc: use a formula to calculate METERCONST: METERCONST=0.479*Vrms*Imax (nWh) for 1-phase and METERCONST=0.477*Vrms*Imax (nWh)

This commit is contained in:
Bart Van Der Meerssche 2010-04-09 17:23:41 +00:00
parent 933654eb9c
commit cbd4283d18
2 changed files with 9 additions and 113 deletions

View File

@ -56,7 +56,7 @@ SENSOR1 = 0123456789abcdef0123456789abcde1
SENSOR2 = 0123456789abcdef0123456789abcde2 SENSOR2 = 0123456789abcdef0123456789abcde2
SENSOR3 = 0123456789abcdef0123456789abcde3 SENSOR3 = 0123456789abcdef0123456789abcde3
# #
CEXTRA = -D DBG=$(DBG) -D TYPE=$(TYPE) -D METERCONST=$(METERCONST) -D 'SENSOR0="$(SENSOR0)"' -D 'SENSOR1="$(SENSOR1)"' -D 'SENSOR2="$(SENSOR2)"' -D 'SENSOR3="$(SENSOR3)"' CEXTRA = -D DBG=$(DBG) -D METERCONST=$(METERCONST) -D 'SENSOR0="$(SENSOR0)"' -D 'SENSOR1="$(SENSOR1)"' -D 'SENSOR2="$(SENSOR2)"' -D 'SENSOR3="$(SENSOR3)"'
############################################################################### ###############################################################################
@ -259,7 +259,7 @@ bin/core.a: $(OBJ)
# Target: clean project. # Target: clean project.
clean: clean:
$(REMOVE) bin/$(TARGET).hex bin/$(TARGET).eep bin/$(TARGET).cof bin/$(TARGET).elf \ @$(REMOVE) bin/$(TARGET).hex bin/$(TARGET).eep bin/$(TARGET).cof bin/$(TARGET).elf \
bin/$(TARGET).map bin/$(TARGET).sym bin/$(TARGET).lss bin/$(TARGET).c bin/core.a \ bin/$(TARGET).map bin/$(TARGET).sym bin/$(TARGET).lss bin/$(TARGET).c bin/core.a \
$(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) $(CXXSRC:.cpp=.s) $(CXXSRC:.cpp=.d) $(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) $(CXXSRC:.cpp=.s) $(CXXSRC:.cpp=.d)

116
uc/main.h
View File

@ -27,129 +27,25 @@
# define SECOND 624 // 625Hz - 1 # define SECOND 624 // 625Hz - 1
#ifndef SENSOR0 #ifndef SENSOR0
#define SENSOR0 "0123456789abcdef0123456789abcde0" #error "SENSOR0 not defined"
#endif #endif
#ifndef SENSOR1 #ifndef SENSOR1
#define SENSOR1 "0123456789abcdef0123456789abcde1" #error "SENSOR1 not defined"
#endif #endif
#ifndef SENSOR2 #ifndef SENSOR2
#define SENSOR2 "0123456789abcdef0123456789abcde2" #error "SENSOR2 not defined"
#endif #endif
#ifndef SENSOR3 #ifndef SENSOR3
#define SENSOR3 "0123456789abcdef0123456789abcde3" #error "SENSOR3 not defined"
#endif #endif
#ifndef TYPE #ifndef METERCONST
#define TYPE 2300501 #error "METERCONST not defined"
#endif #endif
#ifndef METERCONST // @ 625Hz sampling rate
#if TYPE == 2200501
#define METERCONST 5299
#warning "220V - 50A - 1-phase selected. METERCONST set to 5299"
#elif TYPE == 2200503
#define METERCONST 5251
#warning "220V - 50A - 3-phase selected. METERCONST set to 5251"
#elif TYPE == 2300501
#define METERCONST 5540
#warning "230V - 50A - 1-phase selected. METERCONST set to 5540"
#elif TYPE == 2300503
#define METERCONST 5489
#warning "230V - 50A - 3-phase selected. METERCONST set to 5489"
#elif TYPE == 2400501
#define METERCONST 5780
#warning "240V - 50A - 1-phase selected. METERCONST set to 5780"
#elif TYPE == 2400503
#define METERCONST 5727
#warning "240V - 50A - 3-phase selected. METERCONST set to 5727"
#elif TYPE == 2201001
#define METERCONST 10598
#warning "220V - 100A - 1-phase selected. METERCONST set to 10598"
#elif TYPE == 2201003
#define METERCONST 10502
#warning "220V - 100A - 3-phase selected. METERCONST set to 10502"
#elif TYPE == 2301001
#define METERCONST 11080
#warning "230V - 100A - 1-phase selected. METERCONST set to 11080"
#elif TYPE == 2301003
#define METERCONST 10978
#warning "230V - 100A - 3-phase selected. METERCONST set to 10978"
#elif TYPE == 2401001
#define METERCONST 11560
#warning "240V - 100A - 1-phase selected. METERCONST set to 11560"
#elif TYPE == 2401003
#define METERCONST 11454
#warning "240V - 100A - 3-phase selected. METERCONST set to 11454"
#elif TYPE == 2202501
#define METERCONST 26495
#warning "220V - 250A - 1-phase selected. METERCONST set to 26495"
#elif TYPE == 2202503
#define METERCONST 26255
#warning "220V - 250A - 3-phase selected. METERCONST set to 26255"
#elif TYPE == 2302501
#define METERCONST 27700
#warning "230V - 250A - 1-phase selected. METERCONST set to 27700"
#elif TYPE == 2302503
#define METERCONST 27445
#warning "230V - 250A - 3-phase selected. METERCONST set to 27445"
#elif TYPE == 2402501
#define METERCONST 28900
#warning "240V - 250A - 1-phase selected. METERCONST set to 28900"
#elif TYPE == 2402503
#define METERCONST 28635
#warning "240V - 250A - 3-phase selected. METERCONST set to 28635"
#elif TYPE == 2205001
#define METERCONST 52990
#warning "220V - 500A - 1-phase selected. METERCONST set to 52990"
#elif TYPE == 2205003
#define METERCONST 52510
#warning "220V - 500A - 3-phase selected. METERCONST set to 52510"
#elif TYPE == 2305001
#define METERCONST 55400
#warning "230V - 500A - 1-phase selected. METERCONST set to 55400"
#elif TYPE == 2305003
#define METERCONST 54890
#warning "230V - 500A - 3-phase selected. METERCONST set to 54890"
#elif TYPE == 2405001
#define METERCONST 57800
#warning "240V - 500A - 1-phase selected. METERCONST set to 57800"
#elif TYPE == 2405003
#define METERCONST 57270
#warning "240V - 500A - 3-phase selected. METERCONST set to 57270"
#endif
#endif
//#define POWERCONST (METERCONST*1758)/1000 // in mW
#define START 0 #define START 0
#define END3 0xffffffff #define END3 0xffffffff
#define END2 0xeeeeeeee #define END2 0xeeeeeeee