powerflow/link.h

00001 // $Id: link.h,v 1.10 2008/02/04 23:08:12 natet Exp $
00002 
00003 #ifndef _LINK_H
00004 #define _LINK_H
00005 
00006 #include "powerflow.h"
00007 
00008 EXPORT int isa_link(OBJECT *obj, char *classname);
00009 
00010 class link : public powerflow_object
00011 {
00012 public:
00013     complex i_abc_in[3];   // i_abc_in - 3x1 matrix, 3-ph current from 'from node'
00014     complex i_n_in[3];     // i_n_in   - 3x1 matrix, neutral current from 'from node'
00015     complex i_abc_out[3];  // i_abc_out - 3x1 matrix, 3-ph current into 'to node'
00016     complex i_n_out[3];    // i_n_out   - 3x1 matrix, neutral current into 'to node'
00017     complex a_mat[3][3];   // a_mat - 3x3 matrix, 'a' matrix
00018     complex b_mat[3][3];   // b_mat - 3x3 matrix, 'b' matrix
00019     complex c_mat[3][3];   // c_mat - 3x3 matrix, 'c' matrix
00020     complex d_mat[3][3];   // d_mat - 3x3 matrix, 'd' matrix
00021     complex A_mat[3][3];   // A_mat - 3x3 matrix, 'A' matrix
00022     complex B_mat[3][3];   // B_mat - 3x3 matrix, 'B' matrix
00023 
00024 public:
00025     OBJECT *from;          // from_node - source node
00026     OBJECT *to;            // to_node - load node
00027 
00028     int create(void);
00029     int init(void);
00030     TIMESTAMP sync(TIMESTAMP t0);
00031     TIMESTAMP postsync(TIMESTAMP t0);
00032     link(MODULE *mod);
00033     static CLASS *oclass;
00034     static CLASS *pclass;
00035     static link *defaults;
00036     int isa(char *classname);
00037 public:
00038     /* status values */
00039     set affected_phases;                /* use this to determine which phases are affected by status change */
00040     #define IMPEDANCE_CHANGED       1   /* use this status to indicate an impedance change (e.g., line contact) */
00041     double resistance;                  /* use this resistance when status=IMPEDANCE_CHANGED */
00042     #define LINE_CONTACT            2   /* use this to indicate line contact */
00043     set line_contacted;                 /* use this to indicate which line was contacted (N means ground) */
00044     #define CONTROL_FAILED          4   /* use this status to indicate a controller failure (e.g., PLC failure) */
00045 };
00046 
00047 void inverse(complex in[3][3], complex out[3][3]);
00048 void multiply(double a, complex b[3][3], complex c[3][3]);
00049 void multiply(complex a[3][3], complex b[3][3], complex c[3][3]);
00050 void subtract(complex a[3][3], complex b[3][3], complex c[3][3]);
00051 #endif // _LINK_H
00052 

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