00001
00010 #ifndef _POWERFLOW_H
00011 #define _POWERFLOW_H
00012
00013 #include "gridlabd.h"
00014 #include "solver_nr.h"
00015
00016 #ifdef _POWERFLOW_CPP
00017 #define GLOBAL
00018 #define INIT(A) = (A)
00019 #else
00020 #define GLOBAL extern
00021 #define INIT(A)
00022 #endif
00023
00024 #ifdef _DEBUG
00025 void print_matrix(complex mat[3][3]);
00026 #endif
00027
00028 #define GETOBJECT(obj) ((OBJECT *) obj - 1)
00029 #define IMPORT_CLASS(name) extern CLASS *name##_class
00030
00031 typedef enum {SM_FBS=0, SM_GS=1, SM_NR=2} SOLVERMETHOD;
00032 GLOBAL SOLVERMETHOD solver_method INIT(SM_FBS);
00033 GLOBAL bool GS_all_converged INIT(false);
00034 GLOBAL unsigned int NR_bus_count INIT(0);
00035 GLOBAL unsigned int NR_branch_count INIT(0);
00036 GLOBAL BUSDATA *NR_busdata INIT(NULL);
00037 GLOBAL BRANCHDATA *NR_branchdata INIT(NULL);
00038 GLOBAL int NR_curr_bus INIT(-1);
00039 GLOBAL int NR_curr_branch INIT(-1);
00040 GLOBAL unsigned int NR_iteration_limit INIT(500);
00041 GLOBAL bool NR_cycle INIT(true);
00042 GLOBAL bool NR_admit_change INIT(true);
00043 GLOBAL int NR_superLU_procs INIT(1);
00044 GLOBAL TIMESTAMP NR_retval INIT(TS_NEVER);
00045 GLOBAL OBJECT *NR_swing_bus INIT(NULL);
00046 GLOBAL double acceleration_factor INIT(1.4);
00047 GLOBAL bool show_matrix_values INIT(false);
00048 GLOBAL double primary_voltage_ratio INIT(60.0);
00049 GLOBAL double nominal_frequency INIT(60.0);
00050 GLOBAL double warning_underfrequency INIT(55.0);
00051 GLOBAL double warning_overfrequency INIT(65.0);
00052 GLOBAL double nominal_voltage INIT(240.0);
00053 GLOBAL double warning_undervoltage INIT(0.8);
00054 GLOBAL double warning_overvoltage INIT(1.2);
00055 GLOBAL double warning_voltageangle INIT(2.0);
00056 GLOBAL bool require_voltage_control INIT(false);
00057 GLOBAL double geographic_degree INIT(0.0);
00058 GLOBAL complex fault_Z INIT(complex(1e-6,0));
00059 GLOBAL double default_maximum_voltage_error INIT(1e-6);
00060 GLOBAL OBJECT *restoration_object INIT(NULL);
00062
00063 #define UNKNOWN 0
00064 #define ROUNDOFF 1e-6 // numerical accuracy for zero in float comparisons
00065
00066
00067 #include "powerflow_object.h"
00068
00069 #endif // _POWERFLOW_H
00070