00001 // $Id: node.h,v 1.18 2008/02/05 17:26:22 natet Exp $ 00002 00003 #ifndef _NODE_H 00004 #define _NODE_H 00005 00006 #include "powerflow.h" 00007 00008 #define I_INJ(V, S, Z, I) (I_S(S, V) + ((Z.IsFinite()) ? I_Z(Z, V) : complex(0.0)) + I_I(I)) 00009 #define I_S(S, V) (~((S) / (V))) // Current injection - constant power load 00010 #define I_Z(Z, V) ((V) / (Z)) // Current injection - constant impedance load 00011 #define I_I(I) (I) // Current injection - constant current load 00012 00013 class node : public powerflow_object 00014 { 00015 protected: 00016 complex phaseA_I_in; // current injection 00017 complex phaseB_I_in; 00018 complex phaseC_I_in; 00019 complex lastA_V, lastB_V, lastC_V; 00020 00021 public: 00022 double sync_V_limit; // convergence voltage limit 00023 complex phaseA_V; // voltage - order is important 00024 complex phaseB_V; 00025 complex phaseC_V; 00026 00027 complex get_phaseA_I_in(){return phaseA_I_in;} // convenience method to get at the injection current for testing 00028 complex get_phaseB_I_in(){return phaseB_I_in;} // convenience method to get at the injection current for testing 00029 complex get_phaseC_I_in(){return phaseC_I_in;} // convenience method to get at the injection current for testing 00030 00031 public: 00032 static CLASS *oclass; 00033 static node *defaults; 00034 static CLASS *pclass; 00035 public: 00036 node(MODULE *mod); 00037 int create(void); 00038 int init(OBJECT *parent=NULL); 00039 TIMESTAMP presync(TIMESTAMP t0); 00040 TIMESTAMP sync(TIMESTAMP t0); 00041 TIMESTAMP postsync(TIMESTAMP t0); 00042 int isa(char *classname); 00043 00044 friend class link; 00045 }; 00046 00047 #include "load.h" 00048 #include "triplex_node.h" 00049 00050 #endif // _NODE_H 00051