00001 // $Id: meter.h,v 1.13 2008/01/24 17:21:42 d3g637 Exp $ 00002 00003 #ifndef _METER_H 00004 #define _METER_H 00005 00006 #include "powerflow.h" 00007 #include "node.h" 00008 00010 #define LINE1_GROUND 0 //< line 1 to ground index 00011 #define LINE2_GROUND 1 //< line 2 to ground index 00012 #define LINE3_GROUND 2 //< line 3 to ground index 00013 #define LINE1_LINE2 3 //< line 1 to line 2 index 00014 #define LINE2_LINE3 4 //< line 2 to line 3 index 00015 #define LINE3_LINE1 5 //< line 3 to line 1 index 00016 00017 class meter : public node 00018 { 00019 protected: 00020 TIMESTAMP last_t; 00021 00022 public: 00023 enum {UNKNOWN=0, SINGLEPHASE=1, POLYPHASE=2} type; //< meter type 00024 enum {NOMINAL, UNDERVOLT, OVERVOLT} status; 00025 double nominal_voltage; //< nominal voltage (usually 240V) 00026 double energy; //< metered energy 00027 double power; //< metered power 00028 double demand; //< metered demand (peak of power) 00029 complex phaseAtoB_V; 00030 complex phaseBtoC_V; 00031 complex phaseCtoA_V; 00032 complex phaseA_I; // current 00033 complex phaseB_I; 00034 complex phaseC_I; 00035 00036 public: 00037 static CLASS *oclass; 00038 static meter *defaults; 00039 static CLASS *pclass; 00040 public: 00041 meter(MODULE *mod); 00042 int create(void); 00043 int init(OBJECT *parent); 00044 TIMESTAMP presync(TIMESTAMP t0, TIMESTAMP t1); 00045 TIMESTAMP sync(TIMESTAMP t0); 00046 TIMESTAMP postsync(TIMESTAMP t0); 00047 int isa(char *classname); 00048 }; 00049 00050 #endif // _METER_H 00051