network/node.h

00001 // node.h
00002 
00003 #ifndef _NODE_H
00004 #define _NODE_H
00005 
00006 typedef enum {PQ=0, PQV=1, PV=2, SWING=3} BUSTYPE;
00007 class node {
00008 public:
00009     complex V; /* voltage */
00010     complex S; /* power injection */
00011     double G; /* shunt conductance */
00012     double B; /* shunt susceptance */
00013     double Qmax_MVAR; /* maximum MVAR limit */
00014     double Qmin_MVAR; /* minimum MVAR limit */
00015     BUSTYPE type; /* 1=PQ, 2=PV, 3=SWING */
00016     int16 bus_id; /* IEEE CDF bus id */
00017     char32 name; /* bus Name */
00018     int16 flow_area_num; /* load flow area */
00019     int16 loss_zone_num; /* loss zone number */
00020     double base_kV; /* base kV */
00021     double desired_kV; /* desired kV of remote bus */
00022     OBJECT *remote_bus_id; /* remote bus */
00023 
00024     /* these values are used by state estimation */
00025     complex Vobs;   /* observed voltage */
00026     double Vstdev;  /* observed voltage standard deviation; 0 means no observation */
00027 
00028 protected:
00029     complex Ys; /* self admittance (on-diagonal)*/
00030     complex YVs; /* load/gen partials (off-diagonals x remote V) */
00031     double r2; /* sum of R^2 of observations residuals */
00032     unsigned short n_obs; /* number of observations made */
00033     double Sr2; /* power residuals */
00034     unsigned short n_inj;
00035 public:
00036     static CLASS *oclass;
00037     static node *defaults;
00038     static CLASS *pclass;
00039 public:
00040     node(MODULE *mod);
00041     ~node();
00042     int create();
00043     int init(OBJECT *parent);
00044 
00045     void add_obs_residual(node *pNode);
00046     void del_obs_residual(node *pNode);
00047     double get_obs_residual(void) const;
00048     double get_obs_probability(void) const;
00049 
00050     void add_inj_residual(node *pNode);
00051     void del_inj_residual(node *pNode);
00052     double get_inj_residual(void) const;
00053     double get_inj_probability(void) const;
00054 
00055     TIMESTAMP sync(TIMESTAMP t0);
00056     friend class link;
00057 };
00058 
00059 GLOBAL CLASS *node_class INIT(NULL);
00060 GLOBAL OBJECT *last_node INIT(NULL);
00061 
00062 #endif

GridLAB-DTM Version 1.0
An open-source project initiated by the US Department of Energy